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 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 ConnectingWindow::Create() { InterfaceWindow::Create(); InvertedBox *box = new InvertedBox(); box->SetProperties( "invert", 10, 30, m_w-20, m_h-70, " ", " ", false, false ); RegisterButton( box ); AbortButton *abort = new AbortButton(); abort->SetProperties( "Abort", m_w/2-50, m_h-30, 100, 20, "dialog_abort", "dialog_abort_current_connection", true, true ); RegisterButton( abort ); }
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(); } }
void NetworkWindow::Create() { InterfaceWindow::Create(); if( g_app->GetServer() ) { int maxClients = g_app->GetGame()->GetOptionValue("MaxTeams") + g_app->GetGame()->GetOptionValue("MaxSpectators"); int boxH = maxClients * 20 + 15; SetSize( m_w, 170 + boxH ); InvertedBox *box = new InvertedBox(); box->SetProperties( "invert", 10, 110, m_w-20, boxH, " ", " ", false, false ); RegisterButton( box ); } }
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 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 ); }