void BadKeyWindow::Create() { InterfaceWindow::Create(); InvertedBox *box = new InvertedBox(); box->SetProperties( "invert", 10, 30, m_w-20, m_h-70, " ", " ", false, false ); RegisterButton( box ); #if !defined(RETAIL_DEMO) if( m_offerDemo ) { PlayDemoButton *demo = new PlayDemoButton(); demo->SetProperties( "Play Demo", m_w - 330, m_h - 30, 100, 20, "dialog_play_demo", " ", true, false ); demo->m_forceVisible = true; RegisterButton( demo ); } #endif #if !defined(RETAIL) // BuyNowButton *buyNow = new BuyNowButton(); // buyNow->SetProperties( "Buy Now", m_w - 220, m_h - 30, 100, 20, "dialog_buy_now", " ", true, false ); // buyNow->m_closeOnClick = false; // RegisterButton( buyNow ); #endif CloseButton *close = new CloseButton(); close->SetProperties( "Close", m_w - 110, m_h - 30, 100, 20, "dialog_close", " ", true, false ); RegisterButton( close ); }
void VotingWindow::Create() { InterfaceWindow::Create(); InvertedBox *box = new InvertedBox(); box->SetProperties( "invert", 20, 80, m_w-40, 100, " ", " ", false, false ); RegisterButton( box ); VoteButton *voteYes = new VoteButton(); voteYes->SetProperties( "yes", 40, 90, 30, 20, " ", "tooltip_vote_yes", false, true ); voteYes->m_vote = Vote::VoteYes; voteYes->m_voteId = m_voteId; RegisterButton( voteYes ); VoteButton *voteNo = new VoteButton(); voteNo->SetProperties( "no", 40, 120, 30, 20, " ", "tooltip_vote_no", false, true ); voteNo->m_vote = Vote::VoteNo; voteNo->m_voteId = m_voteId; RegisterButton( voteNo ); VoteButton *voteAbstain = new VoteButton(); voteAbstain->SetProperties( "abstain", 40, 150, 30, 20, " ", "tooltip_vote_abstain", false, true ); voteAbstain->m_vote = Vote::VoteAbstain; voteAbstain->m_voteId = m_voteId; RegisterButton( voteAbstain ); CloseButton *close = new CloseButton(); close->SetProperties( "Close", m_w/2 - 50, m_h - 25, 100, 20, "dialog_close", " ", true, false ); RegisterButton( close ); }
void TabBar::hideCloseButton(int index) { CloseButton* button = (CloseButton*)tabButton(index, QTabBar::RightSide); if (!button) { return; } button->hide(); }
void WorkflowTabView::sl_workflowStateChanged(bool isRunning) { QWidget *db = dynamic_cast<QWidget*>(sender()); SAFE_POINT(NULL != db, "NULL dashboard", ); int idx = indexOf(db); CHECK(-1 != idx, ); CloseButton* closeButton = dynamic_cast<CloseButton*>(tabBar()->tabButton(idx, QTabBar::RightSide)); SAFE_POINT(NULL != db, "NULL close button", ); closeButton->setEnabled(!isRunning); }
void CeaseFireWindow::Create() { ConfirmCeaseFireButton *yes = new ConfirmCeaseFireButton(); yes->SetProperties( "CeaseFireYes", 20, m_h-30, 80, 20, "dialog_yes", "", true, false ); RegisterButton( yes ); CloseButton *no = new CloseButton(); no->SetProperties( "CeaseFireNo", m_w-100, m_h-30, 80, 20, "dialog_no", "", true, false ); RegisterButton( no ); }
void ShareRadarWindow::Create() { ConfirmShareRadarButton *yes = new ConfirmShareRadarButton(); yes->SetProperties( "ShareRadarWindowYes", 20, m_h-30, 80, 20, "dialog_yes", "", true, false ); RegisterButton( yes ); CloseButton *no = new CloseButton(); no->SetProperties( "ShareRadarWindowNo", m_w-100, m_h-30, 80, 20, "dialog_no", "", true, false ); RegisterButton( no ); }
void TabBar::hideCloseButton(int index) { if (!validIndex(index) || tabsClosable()) { return; } CloseButton* button = qobject_cast<CloseButton*>(tabButton(index, closeButtonPosition())); if (!button) { return; } setTabButton(index, closeButtonPosition(), 0); button->deleteLater(); }
void TabBar::showCloseButton(int index) { WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index)); if (webTab && webTab->isPinned()) { return; } CloseButton* button = (CloseButton*)tabButton(index, QTabBar::RightSide); if (!button) { return; } button->show(); }
void AuthKeyWindow::Create() { InterfaceWindow::Create(); InvertedBox *invert = new InvertedBox(); invert->SetProperties( "invert", 10, 30, m_w-20, m_h - 70, " ", " ", false, false ); RegisterButton( invert ); AuthInputField *input = new AuthInputField(); input->SetProperties( "Key", 40, 50, 620, 30, " ", " ", false, false ); input->RegisterString( m_key ); RegisterButton( input ); // Only show the paste button on platforms with a paste implementation #if defined(TARGET_MSVC) || defined(TARGET_OS_MACOSX) PasteKeyButton *paste = new PasteKeyButton(); paste->SetProperties( "Paste", 10, m_h-30, 100, 20, "dialog_paste", "dialog_paste_tooltip", true, true ); RegisterButton( paste ); #endif ApplyKeyButton *apply = new ApplyKeyButton(); apply->SetProperties( "Apply", m_w-220, m_h-30, 100, 20, "dialog_apply", " ", true, false ); RegisterButton( apply ); PlayDemoButton *demo = new PlayDemoButton(); demo->SetProperties( "Play Demo", m_w/2-50, m_h-30, 100, 20, "dialog_play_demo", " ", true, false ); demo->m_forceVisible = false; RegisterButton( demo ); CloseButton *close = new CloseButton(); close->SetProperties( "Close", m_w-110, m_h-30, 100, 20, "dialog_close", " ", true, false ); RegisterButton(close); // // Auto-select the chat box if the key is empty char authKey[256]; Authentication_GetKey( authKey ); if( stricmp(authKey, "authkey not found") == 0 || strlen(authKey) < 3 ) { input->MouseUp(); } }
int WorkflowTabView::addDashboard(Dashboard *db) { if (db->getName().isEmpty()) { db->setName(generateName()); } int idx = addTab(db, db->getName()); CloseButton *closeButton = new CloseButton(db); tabBar()->setTabButton(idx, QTabBar::RightSide, closeButton); if (db->isWorkflowInProgress()) { closeButton->setEnabled(false); connect(db, SIGNAL(si_workflowStateChanged(bool)), SLOT(sl_workflowStateChanged(bool))); } connect(closeButton, SIGNAL(clicked()), SLOT(sl_closeTab())); connect(db, SIGNAL(si_loadSchema(const QString &)), parent, SLOT(sl_loadScene(const QString &))); connect(db, SIGNAL(si_hideLoadBtnHint()), this, SIGNAL(si_hideLoadBtnHint())); connect(this, SIGNAL(si_hideLoadBtnHint()), db, SLOT(sl_hideLoadBtnHint())); emit si_countChanged(); return idx; }
Gobby::ClosableFrame::ClosableFrame(const Glib::ustring& title, const Glib::ustring& icon_name, Preferences::Option<bool>& option): m_option(option), m_allow_visible(true) { CloseButton* button = Gtk::manage(new CloseButton); button->set_hexpand(true); button->set_halign(Gtk::ALIGN_END); button->signal_clicked().connect( sigc::mem_fun(*this, &ClosableFrame::on_clicked)); m_option.signal_changed().connect( sigc::mem_fun(*this, &ClosableFrame::on_option)); button->show(); Gtk::Image* image = Gtk::manage( new Gtk::Image); image->set_from_icon_name(icon_name, Gtk::ICON_SIZE_MENU); image->show(); Gtk::Label* label_title = Gtk::manage( new Gtk::Label(title, Gtk::ALIGN_START)); label_title->show(); m_grid.set_border_width(6); m_grid.set_column_spacing(6); m_grid.set_row_spacing(6); m_grid.attach(*image, 0, 0, 1, 1); m_grid.attach(*label_title, 1, 0, 1, 1); m_grid.attach(*button, 2, 0, 1, 1); m_grid.show(); add(m_grid); on_option(); }
void AlliancesWindow::Create() { InterfaceWindow::Create(); float xPos = 20; float yPos = 60; float width = m_w - 270; float height = 30; float gap = 7; int permitDefection = g_app->GetGame()->GetOptionValue( "PermitDefection" ); int sharingRadar = g_app->GetGame()->GetOptionValue("RadarSharing"); // // Invert box InvertedBox *box = new InvertedBox(); box->SetProperties( "box", xPos-10, yPos-10, width+20, (height+gap) * g_app->GetWorld()->m_teams.Size() + 15, " ", " ", false, false ); RegisterButton( box ); // // Buttons for each team for( int i = 0; i < g_app->GetWorld()->m_teams.Size(); ++i ) { char name[256]; sprintf( name, "Team %d", i ); AllianceTeamButton *team = new AllianceTeamButton(); team->SetProperties( name, xPos, yPos, width, height, " ", " ", false, false ); team->m_teamIndex = i; RegisterButton( team ); if( permitDefection ) { sprintf( name, "ceasfire %d", i ); RequestCeasefireButton *ceasefire = new RequestCeasefireButton(); ceasefire->SetProperties( name, xPos + 295, yPos+5, 18, 18, " ", " ", false, false ); ceasefire->m_teamIndex = i; RegisterButton( ceasefire ); } if( sharingRadar == 2 ) { sprintf( name, "shareradar %d", i ); RequestShareRadarButton *shareRadar = new RequestShareRadarButton(); shareRadar->SetProperties( name, xPos + 235, yPos+5, 18, 18, " ", " ", false, false ); shareRadar->m_teamIndex = i; RegisterButton( shareRadar ); } yPos += height; yPos += gap; } yPos += gap * 2; // // Join / Leave / Kick button if( permitDefection ) { JoinLeaveButton *joinLeave = new JoinLeaveButton(); joinLeave->SetProperties( "JoinLeave", xPos+width/2 - 120, yPos, 240, 23, " ", " ", false, false ); RegisterButton( joinLeave ); } yPos += 25; yPos += gap; height = 40; // // Close button CloseButton *close = new CloseButton(); close->SetProperties( "Close", m_w - 110, m_y - 25, 100, 18, "dialog_close", " ", true, false ); RegisterButton( close ); // // Once button for each vote for( int i = 0; i < MAX_TEAMS; ++i ) { char name[256]; sprintf( name, "Vote %d", i ); AllianceVoteButton *vote = new AllianceVoteButton(); vote->SetProperties( name, xPos, yPos, width, height, " ", " ", false, false ); vote->m_voteIndex = i; RegisterButton( vote ); yPos += height; yPos += gap; } }
void InterfaceWindow::Create() { CloseButton *cb = new CloseButton(); cb->SetProperties( "Close", m_w - 17, 4, 13, 13, " ", "tooltip_close_window", false, true ); RegisterButton( cb ); }
void PrefsKeybindingsWindow::Create() { DarwiniaWindow::Create(); int fontSize = GetMenuSize(11); int y = GetClientRectY1(); int border = GetClientRectX1() + GetMenuSize(5); int x = m_w * 2 / 3; int buttonH = GetMenuSize(20); int buttonW = m_w - border * 2 - x; int h = buttonH + border; if ( 0 == m_controlMethod ) s_indices = s_gesture_controls; else s_indices = s_icon_controls; ControlMethodDropDownMenu *controlMethod = new ControlMethodDropDownMenu(); controlMethod->SetShortProperties( LANGUAGEPHRASE("newcontrols_prefsoption"), x, y+=border, buttonW, buttonH ); controlMethod->AddOption( LANGUAGEPHRASE("newcontrols_prefs_gestures"), 0 ); controlMethod->AddOption( LANGUAGEPHRASE("newcontrols_prefs_icons"), 1 ); controlMethod->RegisterInt( &m_controlMethod ); controlMethod->m_fontSize = GetMenuSize(11); RegisterButton( controlMethod ); m_buttonOrder.PutData( controlMethod ); InvertedBox *box = new InvertedBox(); unsigned num_controls = 0; while ( s_indices[num_controls] >= 0 ) { num_controls++; } box->SetShortProperties( "invert", 10, y+h, m_w - 20, (num_controls * h) + border); RegisterButton( box ); y += border; for (unsigned j = 0; j < num_controls; ++j) { int i = s_indices[ j ]; ChangeKeybindingButton *but = new ChangeKeybindingButton( i, s_controls[i].instant ); char const *eventName = LANGUAGEPHRASE( s_controls[i].name ); but->SetShortProperties(eventName, x, y+=h, buttonW, buttonH); but->m_fontSize = GetMenuSize(15); but->m_centered = true; char const *keyName = m_bindings[i]->noun.c_str(); strcpy(but->m_caption, keyName); RegisterButton(but); m_buttonOrder.PutData( but ); } #ifdef TARGET_OS_MACOSX DropDownMenu *numMouseButtons = new DropDownMenu(); numMouseButtons->SetShortProperties( " ", x, y+=h, buttonW, buttonH ); numMouseButtons->AddOption( "1", 1 ); numMouseButtons->AddOption( "3", 3 ); numMouseButtons->RegisterInt( &m_numMouseButtons ); RegisterButton( numMouseButtons ); m_buttonOrder.PutData( numMouseButtons ); #endif y = m_h - (h+5); RestoreDefaultsButton *restore = new RestoreDefaultsButton(); restore->SetShortProperties(LANGUAGEPHRASE("dialog_restoredefaults"), border, y - h, m_w - border*2, buttonH); restore->m_fontSize = fontSize; restore->m_centered = true; RegisterButton(restore); m_buttonOrder.PutData( restore ); int buttonW2 = m_w / 2 - border * 2; CloseButton *cancel = new CloseButton(); cancel->SetShortProperties( LANGUAGEPHRASE("dialog_close"), border, y, buttonW2, buttonH ); cancel->m_fontSize = fontSize; cancel->m_centered = true; RegisterButton( cancel ); m_buttonOrder.PutData( cancel ); ApplyKeybindingsButton *apply = new ApplyKeybindingsButton(); apply->SetShortProperties( LANGUAGEPHRASE("dialog_apply"), m_w - buttonW2 - border, y, buttonW2, buttonH ); apply->m_fontSize = fontSize; apply->m_centered = true; RegisterButton( apply ); m_buttonOrder.PutData( apply ); }