SideBar::SideBar(QWidget *parent) :StylableWidget(parent) { QVBoxLayout* layout = new QVBoxLayout( this ); layout->setContentsMargins( 0, 0, 0, 0 ); layout->setSpacing( 0 ); layout->addWidget( ui.nowPlaying = newButton( tr( "Now Playing" ), this ), Qt::AlignHCenter ); ui.nowPlaying->setObjectName( "nowPlaying" ); ui.nowPlaying->setChecked( true ); // the nowPlaying tab is always seleted at startUp layout->addWidget( ui.scrobbles = newButton( tr( "Scrobbles" ), this ), Qt::AlignHCenter); ui.scrobbles->setObjectName( "scrobbles" ); layout->addWidget( ui.profile = newButton( tr( "Profile" ), this ), Qt::AlignHCenter); ui.profile->setObjectName( "profile" ); layout->addWidget( ui.friends = newButton( tr( "Friends" ), this ), Qt::AlignHCenter); ui.friends->setObjectName( "friends" ); layout->addWidget( ui.radio = newButton( tr( "Radio" ), this ), Qt::AlignHCenter); ui.radio->setObjectName( "radio" ); layout->addStretch( 1 ); layout->addWidget( ui.sash = new QPushButton( tr( "Sash" ), this ), Qt::AlignLeft | Qt::AlignBottom ); ui.sash->setObjectName( "sash" ); connect( ui.nowPlaying, SIGNAL(clicked()), SLOT(onButtonClicked())); connect( ui.scrobbles, SIGNAL(clicked()), SLOT(onButtonClicked())); connect( ui.profile, SIGNAL(clicked()), SLOT(onButtonClicked())); connect( ui.friends, SIGNAL(clicked()), SLOT(onButtonClicked())); connect( ui.radio, SIGNAL(clicked()), SLOT(onButtonClicked())); connect( ui.sash, SIGNAL(clicked()), aApp, SLOT(onBetaTriggered())); }
SideBar::SideBar(QWidget *parent) :QFrame(parent), m_lastButton( 0 ) { QVBoxLayout* layout = new QVBoxLayout( this ); layout->setContentsMargins( 0, 0, 0, 0 ); layout->setSpacing( 0 ); m_buttonGroup = new QButtonGroup( this ); m_buttonGroup->setExclusive( true ); layout->addWidget( ui.nowPlaying = newButton( tr( "Now Playing" ), m_buttonGroup, this ), Qt::AlignHCenter ); ui.nowPlaying->setObjectName( "nowPlaying" ); layout->addWidget( ui.scrobbles = newButton( tr( "Scrobbles" ), m_buttonGroup, this ), Qt::AlignHCenter); ui.scrobbles->setObjectName( "scrobbles" ); layout->addWidget( ui.profile = newButton( tr( "Profile" ), m_buttonGroup, this ), Qt::AlignHCenter); ui.profile->setObjectName( "profile" ); layout->addWidget( ui.friends = newButton( tr( "Friends" ), m_buttonGroup, this ), Qt::AlignHCenter); ui.friends->setObjectName( "friends" ); layout->addWidget( ui.radio = newButton( tr( "Radio" ), m_buttonGroup, this ), Qt::AlignHCenter); ui.radio->setObjectName( "radio" ); layout->addStretch( 1 ); connect( m_buttonGroup, SIGNAL(buttonClicked(QAbstractButton*)), SLOT(onButtonClicked(QAbstractButton*))); ui.nowPlaying->click(); connect( aApp, SIGNAL(sessionChanged(unicorn::Session)), SLOT(onSessionChanged(unicorn::Session)) ); onSessionChanged( aApp->currentSession() ); }
void Picnic2::createMenu() { btnBack = newButton("back", getX(100), getY(600), this, menu_selector(Picnic2::onBack), false, RATIO_X); btnNext = newButton("next", G_SWIDTH - getX(100), getY(600), this, menu_selector(Picnic2::onNext), false, RATIO_X); CCMenuItemImage *btnHome = newButton("home", getX(100), getY(70), this, menu_selector(Picnic2::onHome), false, RATIO_X); // btnHome->setOpacity(120); menu = CCMenu::create(btnNext,btnBack, btnHome, NULL); menu->setPosition(ccp(0, 0)); this->addChild(menu, 0); }
void main(int pointy, char **arguments) { Obj *a, *c; Obj *t, *chain; chain = ObjChain(a = newButton(1,"A",0,0), newButton(2,"B",0,0)); chain = ObjChain(chain, c = newCheck(0,0,"C",0,0,0,0)); chain = ObjChain(chain, newCheck(0,4,"D",0,0,0,0)); t = ObjChain(chain, chain); if (t == (Obj*)0) perror("duplicate insert"); else puts("ERROR! duplicate inserts work"); puts("BACKWARD"); printPrevObjChain(chain); puts("FORWARD"); printNextObjChain(chain); t = copyObj(a); setObjTitle(t, "AA"); chain = extractFromObjChain(chain, a); if (chain) { puts("FORWARD AFTER EXTRACT"); printNextObjChain(chain); ObjChain(c, a); ObjChain(c, t); puts("FORWARD AFTER REINSERT"); printNextObjChain(chain); chain = sortObjChain(chain); if (chain) { puts("FORWARD AFTER SORT"); printNextObjChain(chain); } else perror("sortObjChain"); } else perror("extractFromObjChain"); deleteObjChain(chain); adump(); }
void game_init() { disable_irq(MOUSE_IRQ); disable_irq(KBD_IRQ); // loading screen char **mapsBG[] = {LOADING_BOARD}; Sprite *loadingBG = newSprite(0, 0, mapsBG, sizeof(mapsBG)/sizeof(char*)); drawSpriteBG(loadingBG, base); srand(time(NULL)); mapsBG[0] = BG; spriteBG = newSprite(0, 0, mapsBG, sizeof(mapsBG)/sizeof(char*)); mapsBG[0] = HELP_BOARD; helpBoard = newSprite(0, 0, mapsBG, sizeof(mapsBG)/sizeof(char*)); mapsBG[0] = SCORE_BOARD; scoreBoard = newSprite(0, 0, mapsBG, sizeof(mapsBG)/sizeof(char*)); helpButton = newButton(0, 160, HELP_OVER); exitButton = newButton(196, 40, EXIT_OVER); hammer = newHammer(); numPCs = NUM_PCS; cscreens = malloc(NUM_PCS * sizeof(CScreen)); cscreens[0] = newCScreen(241, 367, 0); cscreens[1] = newCScreen(435, 363, 0); cscreens[2] = newCScreen(626, 363, 0); cscreens[3] = newCScreen(388, 224, 1); cscreens[4] = newCScreen(532, 216, 1); cscreens[5] = newCScreen(672, 209, 1); score = newScore(); highScores = readHighScores(); state = PLAYING; enable_irq(KBD_IRQ); enable_irq(MOUSE_IRQ); }
// // addButton - add a button // // Creates a new button given all the paramerters for it // (this is for a public slot) // void MsgDialog::addButton(const QString &name, const QString &filter, const QColor &color, bool bAct) { #ifdef DEBUGMSG qDebug("addButton() '%s', '%s', '%s' %s", name.ascii(), filter.ascii(), color.name().ascii(), bAct?"Active":"InActive"); #endif newButton(name, filter, color, bAct); } // end addButton()
void StoreLayer::createBg(){ newSprite("setting_bg", G_SWIDTH/2, G_SHEIGHT/2, this, 0, RATIO_XY); newLabel("Store", "Arial MT", 50, G_SWIDTH/2, getY(220), this, 0, RATIO_XY); lbEnglish = newLabel("English", "Arial MT", 30, G_SWIDTH/2 - getX(180), getY(320), this, 0, RATIO_XY); lbSpanish = newLabel("Spanish", "Arial MT", 30, G_SWIDTH/2 - getX(180), getY(400), this, 0, RATIO_XY); lbEnglish->setAnchorPoint(ccp(0, 0.5f)); lbSpanish->setAnchorPoint(ccp(0, 0.5f)); btnEnglish = newButton("select", G_SWIDTH/2 + getX(120), getY(320), this, menu_selector(StoreLayer::onClose), true, RATIO_XY); btnEnglish->setScale(0.8*G_SCALEX); btnSpanish = newButton("buy", G_SWIDTH/2 + getX(120), getY(400), this, menu_selector(StoreLayer::onClose), true, RATIO_XY); btnSpanish->setScale(0.8*G_SCALEX); btnClose = newButton("close", getX(800), getY(180), this, menu_selector(StoreLayer::onClose), true, RATIO_XY); CCMenu *menu = CCMenu::create(btnClose,btnEnglish,btnSpanish, NULL); menu->setPosition(ccp(0, 0)); this->addChild(menu, 0); }
void SidePanel::draw(sf::RenderWindow* window,sf::Font* font) { sf::RectangleShape bg(sf::Vector2f(290,600)); bg.setFillColor(sf::Color(200,200,115)); bg.setPosition(710,0); window->draw(bg); std::string dateString = Calendar::months[dateShown->tm_mon]; dateString += " "; dateString += std::to_string(dateShown->tm_mday); dateString += ", "; dateString += std::to_string(dateShown->tm_year + 1900); sf::Text dateText(dateString,*font,20); dateText.setPosition(716,-2); dateText.setColor(sf::Color(0,0,0)); window->draw(dateText); DisplayShift::draw(window,font); sf::RectangleShape bottomline(sf::Vector2f(290,5)); bottomline.setFillColor(sf::Color(100,100,55)); bottomline.setPosition(710,560); window->draw(bottomline); sf::RectangleShape newButton(sf::Vector2f(82,20)); newButton.setPosition(720,570); newButton.setFillColor(sf::Color(255,255,80)); window->draw(newButton); sf::RectangleShape editButton(newButton); editButton.move(94,0); window->draw(editButton); sf::RectangleShape deleteButton(editButton); deleteButton.move(94,0); window->draw(deleteButton); sf::Text newText("New", *font, 20); newText.setPosition(726,568); newText.setColor(sf::Color()); window->draw(newText); sf::Text editText(newText); editText.setString("Edit"); editText.move(94,0); window->draw(editText); sf::Text deleteText(editText); deleteText.setString("Delete"); deleteText.move(94,0); window->draw(deleteText); }
// // addButton - add a button // // Creates a new button and Pops up a modal CButDlg widget to edit it. // After the button has been edited it added to the active filters // if it is selected // (this is for a slot) // void MsgDialog::addButton(void) { #ifdef DEBUGMSG qDebug("addButton()"); #endif MyButton* but = newButton("Name", "Filter", QColor("black"), FALSE); QString oldfilter(but->filter()); // hold copy of old filter CButDlg butdlg(parentWidget(), "ButtonDlg", but); butdlg.exec(); // apply the filter if we are active if (but->isChecked()) addFilter(but->filter()); } // end addButton()
void VrmlNodeTextureSample::setField(const char *fieldName, const VrmlField &fieldValue) { if TRY_FIELD(sampleNum, SFInt) else if TRY_FIELD(repeatS, SFBool) else if TRY_FIELD(repeatT, SFBool) else if TRY_FIELD(environment, SFBool) else if TRY_FIELD(blendMode, SFInt) else if TRY_FIELD(filterMode, SFInt) else if TRY_FIELD(anisotropy, SFInt) else VrmlNodeTexture::setField(fieldName, fieldValue); newButton(d_sampleNum.get()); }
void ListWidgetButtonContainer::setButtons(const RecordItNow::CollectionListWidget::ButtonCodes &buttons) { m_buttons.clear(); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->setContentsMargins(-1, -1, -1, 0); mainLayout->setSizeConstraint(QVBoxLayout::SetMinimumSize); KSeparator *mainSeparator = new KSeparator(this); mainSeparator->setFrameShape(KSeparator::HLine); QHBoxLayout *layout = new QHBoxLayout; layout->setContentsMargins(0, 0, 0, 0); layout->setSizeConstraint(QLayout::SetMinimumSize); mainLayout->addLayout(layout); mainLayout->addWidget(mainSeparator); QToolButton *button = 0; if (buttons & CollectionListWidget::PlayButton) { button = newButton(this); button->setIcon(KIcon("media-playback-start")); button->setToolTip(i18n("Play")); connect(button, SIGNAL(clicked()), this, SIGNAL(playClicked())); layout->addWidget(button); m_buttons.insert(CollectionListWidget::PlayButton, button); } /* if (button) { KSeparator *separator = new KSeparator(this); separator->setFrameShape(QFrame::VLine); layout->addWidget(separator); } */ if (buttons & CollectionListWidget::UploadButton) { button = newButton(this); button->setIcon(KIcon("recorditnow-upload-media")); button->setToolTip(i18n("Upload")); connect(button, SIGNAL(clicked()), this, SIGNAL(uploadClicked())); layout->addWidget(button); m_buttons.insert(CollectionListWidget::UploadButton, button); } if (buttons & CollectionListWidget::AddButton) { button = newButton(this); button->setIcon(KIcon("list-add")); button->setToolTip(i18n("Add")); connect(button, SIGNAL(clicked()), this, SIGNAL(addClicked())); layout->addWidget(button); m_buttons.insert(CollectionListWidget::AddButton, button); } if (buttons & CollectionListWidget::EditButton) { button = newButton(this); button->setIcon(KIcon("document-edit")); button->setToolTip(i18n("Edit")); connect(button, SIGNAL(clicked()), this, SIGNAL(editClicked())); layout->addWidget(button); m_buttons.insert(CollectionListWidget::EditButton, button); } if (buttons & CollectionListWidget::DeleteButton) { button = newButton(this); button->setIcon(KIcon("edit-delete")); button->setToolTip(i18n("Delete")); connect(button, SIGNAL(clicked()), this, SIGNAL(deleteClicked())); layout->addWidget(button); m_buttons.insert(CollectionListWidget::DeleteButton, button); } QWidget *spacer = new QWidget(this); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); layout->addWidget(spacer); setLayout(mainLayout); }
void VrmlNodeTextureSample::addSample(VrmlNodeTextureSample *node) { textureSamples.push_front(node); newButton(node->d_sampleNum.get()); }
void LaunchPad::buttonContextMenu(const QPoint& /*pos*/) { QAbstractButton* btn = static_cast<QAbstractButton*>(sender()); int id = mButtons.id(btn); QDialog dialog; QGridLayout layout(&dialog); QLabel* label; int row = 0; // Count layout rows label = new QLabel(tr("Name")); label->setAlignment(Qt::AlignRight); layout.addWidget(label, row, 0); QLineEdit name(btn->text()); name.setToolTip(tr("Button caption")); layout.addWidget(&name, row++, 1); layout.setColumnStretch(1, 1); label = new QLabel(tr("Tip")); label->setAlignment(Qt::AlignRight); layout.addWidget(label, row, 0); QLineEdit tip(btn->toolTip()); tip.setToolTip(tr("Button tool tip")); tip.setCursorPosition(0); layout.addWidget(&tip, row++, 1, 1, 2); layout.setColumnStretch(2, 3); label = new QLabel(tr("Command")); label->setAlignment(Qt::AlignRight); layout.addWidget(label, row, 0); QLineEdit command(mCommands.at(id)); //QTextEdit command(mCommands.at(id)); command.setCursorPosition(0); command.setToolTip(tr("Available Tags are: %1").arg("[Provider] [Symbol] [Market] " "[FiId] [MarketId]")); layout.addWidget(&command, row++, 1, 1, 2); // Spawn over two colums... // layout.setColumnStretch(2, 2); // ...and take more space label = new QLabel(tr("Symbol Type")); label->setAlignment(Qt::AlignRight); layout.addWidget(label, row, 0); // QLineEdit symbolType(mSymbolTypes.at(id)); QComboBox symbolType; symbolType.setToolTip(tr("Witch type has to be [Symbol]. When empty is called once with any symbol\n" "(You should not use [Symbol] in this case at the command)")); SymbolTypeTuple* st = mFilu->getSymbolTypes(Filu::eAllTypes); if(st) { while(st->next()) symbolType.addItem(st->caption()); } symbolType.addItem(""); symbolType.setCurrentIndex(symbolType.findText(mSymbolTypes.at(id))); layout.addWidget(&symbolType, row, 1); QCheckBox allMarkets(tr("All Markets")); allMarkets.setToolTip(tr("Call multiple times with all markets by 'Symbol Type'")); allMarkets.setChecked(mMultis.at(id)); layout.addWidget(&allMarkets, row++, 2); // Add an empty row to take unused space layout.addWidget(new QWidget, row, 1); layout.setRowStretch(row++, 2); // Build the button line QDialogButtonBox dlgBtns(QDialogButtonBox::Save | QDialogButtonBox::Discard); QPushButton* db = dlgBtns.button(QDialogButtonBox::Discard); dlgBtns.addButton(db, QDialogButtonBox::RejectRole); connect(&dlgBtns, SIGNAL(accepted()), &dialog, SLOT(accept())); connect(&dlgBtns, SIGNAL(rejected()), &dialog, SLOT(reject())); DialogButton* remove = new DialogButton(tr("&Remove"), -1); remove->setToolTip(tr("Remove button")); dlgBtns.addButton(remove, QDialogButtonBox::ActionRole); connect(remove, SIGNAL(clicked(int)), &dialog, SLOT(done(int))); DialogButton* add = new DialogButton(tr("&Add"), 2); add->setToolTip(tr("Copy to new button")); dlgBtns.addButton(add, QDialogButtonBox::ActionRole); connect(add, SIGNAL(clicked(int)), &dialog, SLOT(done(int))); layout.addWidget(&dlgBtns, row, 1, 1, 2); dialog.setWindowTitle(tr("LaunchPad - Edit button '%1'").arg(btn->text())); dialog.setMinimumWidth(350); switch (dialog.exec()) { case 0: // Discard return; break; case -1: // Remove { int ret = QMessageBox::warning(&dialog , tr("LaunchPad - Last chance to keep your data") , tr("Are you sure to delete button <b>'%1'</b> with all your work<b>?</b>") .arg(btn->text()) , QMessageBox::Yes | QMessageBox::No , QMessageBox::No); if(ret == QMessageBox::No) return; deleteButton(btn); mCommands.removeAt(id); mSymbolTypes.removeAt(id); mMultis.removeAt(id); break; } case 1: // Save setButtonName(btn, name.text()); btn->setToolTip(tip.text()); mCommands[id] = command.text(); //mCommands[id] = command.toPlainText(); // mSymbolTypes[id] = symbolType.text(); mSymbolTypes[id] = symbolType.currentText(); mMultis[id] = allMarkets.isChecked(); break; case 2: // Add btn = newButton(name.text()); btn->setToolTip(tip.text()); mCommands.append(command.text()); //mCommands.append(command.toPlainText()); // mSymbolTypes.append(symbolType.text()); mSymbolTypes.append(symbolType.currentText()); mMultis.append(allMarkets.isChecked()); mButtons.setId(btn, mCommands.size() - 1); break; } saveSettings(); }
// // Constructor // MsgDialog::MsgDialog(QWidget *parent, const char *name, QStringList &list) // : QDialog(parent, name) : QWidget(parent, name) { #ifdef DEBUGMSG qDebug("MsgDialog() '%s' List passed by ref with %d elements", name, list.count()); #endif m_bScrollLock = FALSE; m_nButtons = 0; m_nIndent = 5; // num of spaces to indent wrapped lines m_nLockIndex = 0; m_nIndex = 0; m_bUseIndexing = FALSE; m_bShowType = TRUE; m_nShown = 0; m_nEditItem = -1; m_bAdditiveFilter = FALSE; #if 0 m_pMsgTypeCheckBox = 0; m_pButtonsPanel = 0; m_pEdit = 0; m_pStatusBar = 0; m_pStatusBarLock = 0; m_pStatusBarMsgcount = 0; m_pStatusBarTotMsgcount = 0; m_pStatusBarFilter = 0; m_pButtonsLayout = 0; m_pMenu = 0; m_pStringList = 0; #endif // Anyone want to explain to me why ShowEQ segfaults upon exit when I // uncomment out the following line. This baffles me.... it acts like // it causes something to get destroyed when it's not supposed to be // - Maerlyn // m_pButtonOver = 0; // use the shared list given to us m_pStringList = &list; // set Title setCaption(QString(name)); // install event filter to catch right clicks to add buttons installEventFilter(this); // top-level layout; a vertical box to contain all widgets and sublayouts QBoxLayout *topLayout = new QVBoxLayout(this); // Make an hbox that will hold the textbox and the row of filterbuttons QBoxLayout *middleLayout = new QHBoxLayout(topLayout); // add the edit // m_pEdit = new QMultiLineEdit(this, "edit"); m_pEdit = new MyEdit(this, "edit"); m_pEdit->setFrameStyle(QFrame::Panel | QFrame::Sunken); m_pEdit->setReadOnly(TRUE); m_pEdit->setFont(QFont("Helvetica", 10)); middleLayout->addWidget(m_pEdit); // add a vertical box to hold the button layout and the stretch QBoxLayout *rightLayout = new QVBoxLayout(middleLayout); // add a vertical box to hold the filter buttons m_pButtonsPanel = new QWidget(this, "buttonPanel"); rightLayout->addWidget(m_pButtonsPanel); m_pButtonsLayout = new QVBoxLayout(m_pButtonsPanel); // Make an hbox that will hold the tools QBoxLayout *tools = new QHBoxLayout(m_pButtonsLayout); // Make an bbox that will hold the right tools QBoxLayout *righttools = new QVBoxLayout(tools); // Add an 'additive' vs 'subtractive checkbox m_pAdditiveCheckBox = new QCheckBox("Additive", m_pButtonsPanel); m_pAdditiveCheckBox->setChecked(isAdditive()); connect(m_pAdditiveCheckBox, SIGNAL (toggled(bool)), this, SLOT (setAdditive(bool))); righttools->addWidget(m_pAdditiveCheckBox); // Add a 'scroll-lock' checkbox QCheckBox *pScrollLockCheckBox= new QCheckBox("Lock", m_pButtonsPanel); pScrollLockCheckBox->setChecked(FALSE); connect(pScrollLockCheckBox, SIGNAL (toggled(bool)), this, SLOT (scrollLock(bool))); righttools->addWidget(pScrollLockCheckBox); // Add a 'msg type' checkbox m_pMsgTypeCheckBox = new QCheckBox("Msg Type", m_pButtonsPanel); m_pMsgTypeCheckBox->setChecked(m_bShowType); connect(m_pMsgTypeCheckBox, SIGNAL (toggled(bool)), this, SLOT (showMsgType(bool))); righttools->addWidget(m_pMsgTypeCheckBox); // Add a decrorative frame seperator QFrame *frame = new QFrame(m_pButtonsPanel, "seperator"); frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); frame->setFixedHeight(2); m_pButtonsLayout->addWidget(frame); // // Status Bar // // create a label to look like a status bar QBoxLayout *statusLayout = new QHBoxLayout(topLayout); m_pStatusBarFilter = new QLabel(this); m_pStatusBarFilter->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarFilter, 4); m_pStatusBarMsgcount = new QLabel(this); m_pStatusBarMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarMsgcount, 1); m_pStatusBarTotMsgcount = new QLabel(this); m_pStatusBarTotMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarTotMsgcount, 1); m_pStatusBarLock = new QLabel(this); m_pStatusBarLock->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarLock, 1); #if 0 // Add some default filter buttons MyButton *but; for (int i = 0; i < 5; i++) { char temp[15]; sprintf(temp, "Empty%d", i); QString name(temp); QString filter(temp); QString color("Black"); newButton(name, filter, color, FALSE); } #endif // Add an empty widget to fill the space and stretch when resized rightLayout->addStretch(10); // Add popup menu m_pMenu = new QPopupMenu(this, "popup"); m_pMenu->insertItem("&Add Button", this, SLOT(addButton())); m_pMenu->insertSeparator(); m_pMenu->insertItem("&Toggle Controls", this, SLOT(toggleControls())); connect(m_pMenu, SIGNAL (aboutToShow(void)), this, SLOT (menuAboutToShow(void))); // refresh the messages refresh(); } // end constructor