//--------------------------------------------------------------------- // Purpose: Center the dialog on the screen //--------------------------------------------------------------------- void CSessionBrowserDialog::PerformLayout() { BaseClass::PerformLayout(); MoveToCenterOfScreen(); UpdateScenarioDisplay(); }
CDialog_RendertargetList::CDialog_RendertargetList( Panel *parent ) : CBaseDiag( parent, NULL, "_rt_list" ) { SetSizeable( false ); SetVisible( true ); SetMouseInputEnabled( true ); SetKeyBoardInputEnabled( true ); Activate(); m_pList_RT = new PanelListPanel( this, "rtlist" ); m_pList_RT->SetNumColumns( 2 ); m_pList_RT->SetFirstColumnWidth( 200 ); FillList(); LoadControlSettings( "shadereditorui/vgui/dialog_rendertarget_list.res" ); SetTitle( "Rendertarget manager", true ); DoModal(); SetDeleteSelfOnClose( true ); MoveToCenterOfScreen(); }
void CDialog_NewCanvas::PerformLayout() { BaseClass::PerformLayout(); SetSize( 400, 400 ); MoveToCenterOfScreen(); }
void CDialog_GeneralConfig::PerformLayout() { BaseClass::PerformLayout(); SetCloseButtonVisible( false ); SetSize( 400, 300 ); MoveToCenterOfScreen(); }
CASW_VGUI_Edit_Emitter_SaveDialog::CASW_VGUI_Edit_Emitter_SaveDialog( vgui::Panel *pParent, const char *pElementName, CASW_VGUI_Edit_Emitter* pEditFrame ) : vgui::Frame( pParent, pElementName ) { m_pEditFrame = pEditFrame; SetTitle("Save Template", true); SetSizeable(false); SetMoveable(false); SetTall(140); SetWide(320); SetCloseButtonVisible(false); MoveToCenterOfScreen(); vgui::Label* pPleaseLabel = new vgui::Label(this, "SaveDLabel", "Please enter a name to save this template as:"); pPleaseLabel->SetPos(20,25); pPleaseLabel->SetWide(290); pPleaseLabel->SetTall(20); //vgui::Label* pLabel = new vgui::Label(this, "SaveDLabel", "Template Name:"); //pLabel->SetPos(20,45); //pLabel->SetWide(220); //pLabel->SetTall(20); m_pSaveText = new vgui::TextEntry(this, "SaveDText"); m_pSaveText->SetPos(20,45); m_pSaveText->SetWide(220); m_pSaveText->SetTall(20); char buf[MAX_PATH]; m_pEditFrame->m_pTemplateCombo->GetText(buf, MAX_PATH); m_pSaveText->SetText(buf); m_pSaveButton = new vgui::Button(this, "SaveDButton", "Save"); m_pSaveButton->SetCommand(new KeyValues("SaveDButton")); m_pSaveButton->SetWide(60); m_pSaveButton->SetTall(20); m_pSaveButton->SetPos(190, 115); m_pSaveButton->AddActionSignalTarget(this); m_pCancelButton = new vgui::Button(this, "CancelDButton", "Cancel"); m_pCancelButton->SetCommand(new KeyValues("CancelDButton")); m_pCancelButton->SetWide(60); m_pCancelButton->SetTall(20); m_pCancelButton->SetPos(255, 115); m_pCancelButton->AddActionSignalTarget(this); m_pExistsLabel = new vgui::Label(this, "ExistsLabel", " "); m_pExistsLabel->SetPos(20,70); m_pExistsLabel->SetWide(300); m_pExistsLabel->SetTall(40); TextEntryChanged(m_pSaveText); }
//--------------------------------------------------------------------- // Purpose: Center the dialog on the screen //--------------------------------------------------------------------- void CSessionOptionsDialog::PerformLayout( void ) { BaseClass::PerformLayout(); UpdateScenarioDisplay(); MoveToCenterOfScreen(); if ( m_pRecommendedLabel ) { bool bHosting = ( Q_stristr( m_szGametype, "Host" ) ); m_pRecommendedLabel->SetVisible( bHosting ); } }
CNodePropertySheet::CNodePropertySheet( CBaseNode *pNode, CNodeView *parent, const char *panelName ) : BaseClass( parent, panelName ) { n = pNode; pNodeView = parent; SetSize( 480, 400 ); MoveToCenterOfScreen(); SetApplyButtonVisible( false ); //DoModal(); SetTitle( "Properties", false ); pKV_NodeSettings = GetNode()->AllocateKeyValues(0); pKV_NodeSettings_Original = pKV_NodeSettings->MakeCopy(); }
CDialog_RendertargetSettings::CDialog_RendertargetSettings( Panel *parent ) : CBaseDiag( parent, NULL, "rtsettings" ) //BaseClass( parent, "rtsettings" ) { m_pRTTarget = NULL; SetMouseInputEnabled( true ); SetKeyBoardInputEnabled( true ); m_pText_RTName = new TextEntry( this, "rt_name" ); m_pText_SizeX = new TextEntry( this, "rt_size_x" ); m_pText_SizeY = new TextEntry( this, "rt_size_y" ); m_pList_Flags = new PanelListPanel( this, "rtlist" ); m_pList_Flags->SetNumColumns( 1 ); m_pList_Flags->SetFirstColumnWidth( 0 ); m_pList_Flags->SetVerticalBufferPixels( 0 ); for ( int i = 0; i < iNumVTFFlags; i++ ) { CheckButton *pCBut = new CheckButton( m_pList_Flags, "", pszVTFFlags[i] ); m_pList_Flags->AddItem( NULL, pCBut ); m_hFlag_Buttons.AddToTail( pCBut ); } m_pCBox_ImgFormat = new ComboBox( this, "cbox_format", 20, false ); for ( int i = 0; i < iNumImgFormatNames; i++ ) m_pCBox_ImgFormat->AddItem( pszImgFormatNames[i], NULL ); m_pCBox_SizeMode = new ComboBox( this, "cbox_sizemode", 20, false ); for ( int i = 0; i < iNumRTSizeModes; i++ ) m_pCBox_SizeMode->AddItem( pszRTSizeModes[i], NULL ); m_pCBox_DepthMode = new ComboBox( this, "cbox_depthmode", 20, false ); for ( int i = 0; i < iNumRTDepthModes; i++ ) m_pCBox_DepthMode->AddItem( pszRTDepthModes[i], NULL ); LoadControlSettings( "shadereditorui/vgui/dialog_rendertarget_settings.res" ); SetSizeable( false ); SetTitle( "Rendertarget properties", true ); SetCloseButtonVisible( false ); DoModal(); MoveToCenterOfScreen(); }
void CIOSUpdatePanel::ApplySchemeSettings( IScheme *pScheme ) { m_pScheme = pScheme; BaseClass::ApplySchemeSettings( pScheme ); SetTitle("IOS Updater", false); SetProportional(false); SetSizeable(false); SetBounds(0, 0, PANEL_WIDTH, PANEL_HEIGHT); //SetBgColor(Color(0, 0, 0, 255)); SetPaintBackgroundEnabled(true); SetCloseButtonVisible(false); MoveToCenterOfScreen(); m_pContent->SetBounds(PADDING, PADDING + TOP_PADDING, GetWide() - 2 * PADDING, GetTall() - 2 * PADDING - TOP_PADDING); m_pUpdateButton->SetBounds(m_pContent->GetWide() / 2 - UPDATE_BUTTON_WIDTH / 2, m_pContent->GetTall() - UPDATE_BUTTON_HEIGHT - BUTTON_MARGIN - BUTTON_HEIGHT, UPDATE_BUTTON_WIDTH, UPDATE_BUTTON_HEIGHT); m_pUpdateButton->SetContentAlignment(Label::a_center); m_pCloseButton->SetBounds(m_pContent->GetWide() / 2 - BUTTON_WIDTH / 2, m_pContent->GetTall() - BUTTON_HEIGHT, BUTTON_WIDTH, BUTTON_HEIGHT); m_pCloseButton->SetContentAlignment(Label::a_center); m_pInfoText->SetBounds(PADDING, 3 * PADDING, m_pContent->GetWide() - 2 * PADDING, INFO_HEIGHT); m_pInfoText->SetFont(pScheme->GetFont("DefaultBig")); m_pInfoText->SetContentAlignment(Label::a_center); m_pInfoText->SetFgColor(Color(255, 255, 255, 255)); m_pExtraInfoText->SetBounds(PADDING, 3 * PADDING + INFO_HEIGHT + PADDING, m_pContent->GetWide() - 2 * PADDING, INFO_HEIGHT); m_pExtraInfoText->SetFont(pScheme->GetFont("DefaultBig")); m_pExtraInfoText->SetContentAlignment(Label::a_center); m_pExtraInfoText->SetFgColor(Color(255, 255, 255, 255)); m_pExtraInfoText2->SetBounds(PADDING, 3 * PADDING + 2 * (INFO_HEIGHT + PADDING), m_pContent->GetWide() - 2 * PADDING, INFO_HEIGHT); m_pExtraInfoText2->SetFont(pScheme->GetFont("DefaultBig")); m_pExtraInfoText2->SetContentAlignment(Label::a_center); m_pExtraInfoText2->SetFgColor(Color(255, 255, 255, 255)); m_pProgressBar->SetBounds(m_pContent->GetWide() / 2 - PROGRESSBAR_WIDTH / 2, 3 * PADDING + 3 * (INFO_HEIGHT + PADDING), PROGRESSBAR_WIDTH, PROGRESSBAR_HEIGHT); m_pChangelog->SetBounds(m_pContent->GetWide() / 2 - CHANGELOG_WIDTH / 2, 4 * PADDING + 3 * (INFO_HEIGHT + PADDING) + PROGRESSBAR_HEIGHT, CHANGELOG_WIDTH, CHANGELOG_HEIGHT); }
CDialog_PPEPrecache::CDialog_PPEPrecache( Panel *parent ) : BaseClass( parent, NULL, "dialog_precache_ppeffect" ) { SetSizeable( false ); SetVisible( true ); SetMouseInputEnabled( true ); SetKeyBoardInputEnabled( true ); Activate(); m_pList_Effects = new PanelListPanel( this, "effect_list" ); m_pList_Effects->SetNumColumns( 4 ); m_pList_Effects->SetFirstColumnWidth( 200 ); FillList(); LoadControlSettings( "shadereditorui/vgui/dialog_ppe_precache_list.res" ); SetTitle( "Post processing precache", true ); DoModal(); SetDeleteSelfOnClose( true ); MoveToCenterOfScreen(); }
//----------------------------------------------------------------------------- // Purpose: Create and arrange the panel button labels according to the dialog type //----------------------------------------------------------------------------- void CMessageDialog::ApplySchemeSettings( vgui::IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); LoadControlSettings( "resource/ui/MessageDialog.res", "GAME", m_pControlSettings ); m_hButtonFont = pScheme->GetFont( "GameUIButtons" ); m_hTextFont = pScheme->GetFont( "MenuLarge" ); if ( m_nType & MD_OK ) { CreateButtonLabel( &m_Buttons[BTN_A], "#GameUI_Icons_A_BUTTON", "#GameUI_OK" ); } else if ( m_nType & MD_CANCEL ) { CreateButtonLabel( &m_Buttons[BTN_B], "#GameUI_Icons_B_BUTTON", "#GameUI_Cancel" ); } else if ( m_nType & MD_OKCANCEL ) { CreateButtonLabel( &m_Buttons[BTN_A], "#GameUI_Icons_A_BUTTON", "#GameUI_OK" ); CreateButtonLabel( &m_Buttons[BTN_B], "#GameUI_Icons_B_BUTTON", "#GameUI_Cancel" ); } else if ( m_nType & MD_YESNO ) { CreateButtonLabel( &m_Buttons[BTN_A], "#GameUI_Icons_A_BUTTON", "#GameUI_Yes" ); CreateButtonLabel( &m_Buttons[BTN_B], "#GameUI_Icons_B_BUTTON", "#GameUI_No" ); } // count the buttons and add up their widths int cButtons = 0; int nTotalWide = 0; for ( int i = 0; i < MAX_BUTTONS; ++i ) { if ( m_Buttons[i].bCreated ) { ++cButtons; nTotalWide += m_Buttons[i].nWide; } } // make sure text and icons are center-aligned vertically with each other int nButtonTall = vgui::surface()->GetFontTall( m_hButtonFont ); int nTextTall = vgui::surface()->GetFontTall( m_hTextFont ); int nVerticalAdjust = ( nButtonTall - nTextTall ) / 2; // position the buttons with even horizontal spacing int xpos = 0; int ypos = GetTall() - max( nButtonTall, nTextTall ) - m_ButtonMargin; int nSpacing = ( GetWide() - nTotalWide ) / ( cButtons + 1 ); for ( int i = 0; i < MAX_BUTTONS; ++i ) { if ( m_Buttons[i].bCreated ) { xpos += nSpacing; m_Buttons[i].pIcon->SetPos( xpos, ypos ); xpos += m_Buttons[i].pIcon->GetWide() + m_ButtonIconLabelSpace; m_Buttons[i].pText->SetPos( xpos, ypos + nVerticalAdjust ); xpos += m_Buttons[i].pText->GetWide(); } } m_clrNotSimpleBG = pScheme->GetColor( "MessageDialog.MatchmakingBG", Color( 200, 184, 151, 255 ) ); m_clrNotSimpleBGBlack = pScheme->GetColor( "MessageDialog.MatchmakingBGBlack", Color( 52, 48, 55, 255 ) ); if ( !m_bShowActivity ) { if ( m_pAnimatingPanel ) { if ( m_pAnimatingPanel->IsVisible() ) { m_pAnimatingPanel->SetVisible( false ); } m_pAnimatingPanel->StopAnimation(); } } else { if ( m_pAnimatingPanel ) { if ( !m_pAnimatingPanel->IsVisible() ) { m_pAnimatingPanel->SetVisible( true ); } m_pAnimatingPanel->StartAnimation(); } } MoveToCenterOfScreen(); if ( m_bShowActivity && m_ActivityIndent ) { // If we're animating, we push our text label in, and reduce its width int iX,iY,iW,iH; m_pMsg->GetBounds( iX, iY, iW, iH ); m_pMsg->SetBounds( iX + m_ActivityIndent, iY, max(0,iW-m_ActivityIndent), iH ); } // Invalidate the scheme on our message label so that it recalculates // its line breaks in case it was resized when we loaded our .res file. m_pMsg->InvalidateLayout( false, true ); }
//--------------------------------------------------------------------- // Purpose: Center the dialog on the screen //--------------------------------------------------------------------- void CSessionLobbyDialog::PerformLayout() { BaseClass::PerformLayout(); if ( !m_pDialogKeys ) return; // Set the label strings according to the keyvalues passed in SetTextFromKeyvalues( m_pScenarioInfo->m_pTitle ); SetTextFromKeyvalues( m_pScenarioInfo->m_pDescOne ); SetTextFromKeyvalues( m_pScenarioInfo->m_pDescTwo ); SetTextFromKeyvalues( m_pScenarioInfo->m_pDescThree ); SetTextFromKeyvalues( m_pScenarioInfo->m_pValueTwo ); SetTextFromKeyvalues( m_pScenarioInfo->m_pValueThree ); const char *pDiskName = "unknown"; KeyValues *pName = m_pDialogKeys->FindKey( "MapDiskNames" ); if ( pName ) { KeyValues *pScenario = m_pDialogKeys->FindKey( "CONTEXT_SCENARIO" ); if ( pScenario ) { pDiskName = pName->GetString( pScenario->GetString( "displaystring" ), "unknown" ); } } // find the scenario type KeyValues *pType = m_pDialogKeys->FindKey( "ScenarioTypes" ); if ( pType ) { const char *pString = pType->GetString( pDiskName, NULL ); if ( pString ) { m_pScenarioInfo->m_pSubtitle->SetText( pString ); } } // Set the team goals KeyValues *pGoals = m_pDialogKeys->FindKey( "TeamGoals" ); if ( pGoals ) { KeyValues *pTeam = pGoals->FindKey( "Blue" ); if ( pTeam ) { m_pTeamInfos[BLUE_TEAM_LOBBY]->m_pDescOne->SetText( pTeam->GetString( pDiskName, "" ) ); } pTeam = pGoals->FindKey( "Red" ); if ( pTeam ) { m_pTeamInfos[RED_TEAM_LOBBY]->m_pDescOne->SetText( pTeam->GetString( pDiskName, "" ) ); } } for ( int i = 0; i < TOTAL_LOBBY_TEAMS; ++i ) { UpdatePlayerCountDisplay( i ); } if ( m_bCenterOnScreen ) { MoveToCenterOfScreen(); } // Don't allow player reviews in system link games CMatchmakingBasePanel *pBase = dynamic_cast< CMatchmakingBasePanel* >( m_pParent ); if ( pBase ) { pBase->SetFooterButtonVisible( "#GameUI_PlayerReview", pBase->GetGameType() != GAMETYPE_SYSTEMLINK_MATCH ); // hide the settings changing if we're in a ranked game if ( m_pHostOptionsPanel ) { bool bVisible = pBase->GetGameType() != GAMETYPE_RANKED_MATCH; vgui::Label *pSettingsLabel = (vgui::Label *)m_pHostOptionsPanel->FindChildByName("ChangeSettingsButton",true); if ( pSettingsLabel ) { pSettingsLabel->SetVisible( bVisible ); } pSettingsLabel = (vgui::Label *)m_pHostOptionsPanel->FindChildByName("ChangeSettingsText",true); if ( pSettingsLabel ) { pSettingsLabel->SetVisible( bVisible ); } } } }
CCode_Editor::CCode_Editor( CSheet_Base *parent, const char *pName, CSmartText::CodeEditMode_t mode ) : BaseClass( parent, pName ) { m_iMode = mode; Activate(); SetVisible( true ); SetPaintBackgroundEnabled(true); SetPaintEnabled(true); SetSizeable(true); SetMoveable(true); SetMinimumSize( 500, 400 ); SetDeleteSelfOnClose( true ); m_iLastAppliedCodeIndex = 0; m_pCodeWindow = new CSmartText( this, "codewindow", mode ); m_pCodeWindow->AddActionSignalTarget( this ); /* TextEntry *pT = new TextEntry( this, "codewindow" ); pT->SetMultiline( true ); pT->SetEditable( true ); pT->SetCatchEnterKey( true ); pT->SetVerticalScrollbar( true ); */ LoadControlSettings( "shadereditorui/vgui/code_editor_Window.res" ); UpdateButtonEnabled( true, true ); SetCloseButtonVisible(false); int w,t; surface()->GetScreenSize( w, t ); w *= 0.75f; t *= 0.75f; SetSize( max( w, 500 ), max( t, 400 ) ); //SetKeyBoardInputEnabled( false ); //SetMouseInputEnabled( true ); //SetTitle( "Editor", true ); SetTitle( "", false ); Panel *pButton = FindChildByName( "button_save" ); if ( pButton ) pButton->SetKeyBoardInputEnabled( false ); pButton = FindChildByName( "button_apply" ); if ( pButton ) pButton->SetKeyBoardInputEnabled( false ); pButton = FindChildByName( "button_cancel" ); if ( pButton ) pButton->SetKeyBoardInputEnabled( false ); DoModal(); int rx, ry, rsx, rsy; if ( pEditorRoot->GetCodeEditorBounds( rx, ry, rsx, rsy ) ) SetBounds( rx, ry, rsx, rsy ); else MoveToCenterOfScreen(); }
void CIOSUpdatePanel::PerformLayout() { BaseClass::PerformLayout(); MoveToCenterOfScreen(); }