//----------------------------------------------------------------------------- // Purpose: Applies scheme settings //----------------------------------------------------------------------------- void CTFFreezePanelCallout::ApplySchemeSettings( vgui::IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); LoadControlSettings( "resource/UI/FreezePanelCallout.res" ); m_pGibLabel = dynamic_cast<Label *>( FindChildByName("CalloutLabel") ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CCommentaryModelViewer::ApplySchemeSettings( vgui::IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); LoadControlSettings( "Resource/UI/CommentaryModelViewer.res" ); m_pModelPanel = dynamic_cast<CCommentaryModelPanel*>( FindChildByName( "modelpanel" ) ); }
//----------------------------------------------------------------------------- // Initialization //----------------------------------------------------------------------------- bool CTeleportCountdownScreen::Init( KeyValues* pKeyValues, VGuiScreenInitData_t* pInitData ) { // Load all of the controls in if ( !BaseClass::Init(pKeyValues, pInitData) ) return false; // Make sure we get ticked... vgui::ivgui()->AddTickSignal( GetVPanel() ); // Grab ahold of certain well-known controls // NOTE: it is valid for these controls to not exist! m_pTimeRemainingTitleLabel = dynamic_cast<vgui::Label*>(FindChildByName( "TimeRemainingTitle" )); m_pTimeRemainingLabel = dynamic_cast<vgui::Label*>(FindChildByName( "TimeRemaining" )); m_pMalfunctionLabel = dynamic_cast<vgui::Label*>( FindChildByName( "MalfunctionLabel" ) ); return true; }
void CNewSkinDlg::OnGradationDir() { BOOL bVertical=FindChildByName(L"chk_gradation_dir")->IsChecked(); CSkinView_Gradation *pImgView=FindChildByName2<CSkinView_Gradation>(L"imgview_gradation"); pImgView->GetGradationSkin()->SetVertical(bVertical); pImgView->Invalidate(); }
BOOL SSpinButtonCtrl::CreateChildren(pugi::xml_node xmlNode) { if(!__super::CreateChildren(xmlNode)) return FALSE; m_btnUp = FindChildByName(KBTN_UP); m_btnDown = FindChildByName(KBTN_DOWN); SASSERT(m_btnUp &&m_btnDown); if(!m_btnDown || !m_btnUp) return FALSE; m_btnUp->SetAttribute(L"focusable",L"0"); m_btnDown->SetAttribute(L"focusable",L"0"); m_btnUp->GetEventSet()->subscribeEvent(EventCmd::EventID,Subscriber(&SSpinButtonCtrl::OnUpDownClick,this)); m_btnDown->GetEventSet()->subscribeEvent(EventCmd::EventID,Subscriber(&SSpinButtonCtrl::OnUpDownClick,this)); OnValueChanged(); return TRUE; }
void CNewSkinDlg::UpdateimglistPreview() { SRichEdit *pEdit=FindChildByName2<SRichEdit>(L"edit_imglist_src_name"); SStringT strSrcName=pEdit->GetWindowText(); SStringT strSrcFile=m_pMainDlg->GetImageSrcFile(strSrcName); if(!strSrcFile.IsEmpty()) { CSkinView_ImgList *pImgView=FindChildByName2<CSkinView_ImgList>(L"imgview_imglist"); pImgView->SetImageFile(strSrcFile); SStringT strStates=FindChildByName2<SRichEdit>(L"edit_imglist_states")->GetWindowText(); int nStates=_ttoi(strStates); if(nStates<=0) nStates=1; pImgView->SetStates(nStates); pImgView->SetTile(FindChildByName(L"chk_imglist_tile")->IsChecked()); pImgView->SetVertical(FindChildByName(L"chk_imglist_vert")->IsChecked()); pImgView->Invalidate(); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CControlPointIcon::ApplySchemeSettings( IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); if ( !m_pCapHighlightImage ) { m_pCapHighlightImage = new CControlPointIconSwoop( this, "CapHighlightImage" ); m_pCapHighlightImage->SetParent( g_pClientMode->GetViewport() ); m_pCapHighlightImage->SetZPos( 10 ); m_pCapHighlightImage->SetShouldScaleImage( true ); } if ( !m_pCapPulseImage ) { m_pCapPulseImage = new CControlPointIconCapturePulse( this, "CapPulse" ); m_pCapPulseImage->SetParent( g_pClientMode->GetViewport() ); m_pCapPulseImage->SetZPos( -1 ); m_pCapPulseImage->SetVisible( false ); m_pCapPulseImage->SetShouldScaleImage( true ); } if ( !m_pBaseImage ) { m_pBaseImage = new CControlPointIconPulseable( this, "BaseImage", m_iCPIndex ); m_pBaseImage->SetShouldScaleImage( true ); } if ( !m_pCapImage ) { m_pCapImage = new CControlPointIconCapArrow( this, this, "CapImage" ); m_pCapImage->SetZPos( 2 ); m_pCapImage->SetVisible( false ); } LoadControlSettings( "resource/UI/ControlPointIcon.res" ); m_pCapPlayerImage = dynamic_cast<vgui::ImagePanel *>( FindChildByName("CapPlayerImage") ); m_pCapNumPlayers = dynamic_cast<vgui::Label *>( FindChildByName("CapNumPlayers") ); m_pOverlayImage = dynamic_cast<vgui::ImagePanel *>( FindChildByName("OverlayImage") ); UpdateImage(); UpdateCapImage(); }
void CMainDlg::OnSize(UINT nType, CSize size) { SetMsgHandled(FALSE); SWindow *pBtnMax = FindChildByName(L"btn_max"); SWindow *pBtnRestore = FindChildByName(L"btn_restore"); if(!pBtnMax || !pBtnRestore) return; if (nType == SIZE_MAXIMIZED) { pBtnRestore->SetVisible(TRUE); pBtnMax->SetVisible(FALSE); } else if (nType == SIZE_RESTORED) { pBtnRestore->SetVisible(FALSE); pBtnMax->SetVisible(TRUE); } }
ProtectedMethod void CWebWindow::ApplySchemeSettings( vgui::IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); SetFgColor( pScheme->GetColor("Modfg", GetFgColor()) ); SetBgColor( Color(0, 0, 0, 0) ); SetBorder( pScheme->GetBorder( "FrameBorder" ) ); m_pHTMLMessage = dynamic_cast< vgui::HTML * > ( FindChildByName("HTMLMessage") ); AssertMsg( m_pHTMLMessage, "HTML Widget" ); }
//--------------------------------------------------------------------- // Purpose: Set up colors and other such stuff //--------------------------------------------------------------------- void CSessionOptionsDialog::ApplySchemeSettings( vgui::IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); for ( int i = 0; i < m_pScenarioInfos.Count(); ++i ) { m_pScenarioInfos[i]->SetBgColor( pScheme->GetColor( "TanDark", Color( 0, 0, 0, 255 ) ) ); } m_pRecommendedLabel = dynamic_cast<vgui::Label *>(FindChildByName( "RecommendedLabel" )); }
void CMainWnd::OnBtnBox() //打开暴风盒子 { //m_winBox.ShowWindow(SW_SHOWNORMAL); SWindow *pBtn = FindChildByName(L"mainWnd"); CRect rc_temp; if(pBtn) { pBtn->GetClientRect(&rc_temp); ClientToScreen(&rc_temp); m_winBox.SetWindowPos(HWND_TOP, rc_temp.right -5, rc_temp.top -3, 250, rc_temp.Height() +10, NULL); m_winBox.ShowWindow(SW_SHOWNORMAL); } pBtn = FindChildByName(L"btn_boxed"); if(pBtn) pBtn->SetVisible(TRUE,TRUE); pBtn = FindChildByName(L"btn_box"); if(pBtn) pBtn->SetVisible(FALSE,TRUE); }
void CEditorRoot::SortButtons() { //m_bNeedsButtonPush = false; Panel *pViewReset = FindChildByName( "button_viewreset" ); if ( pViewReset ) { pViewReset->MoveToFront(); pViewReset->SetBgColor( Color( 127,127,127,127) ); } }
// ------------------------------------------------------------------------------------------------ void ColladaModelFactory::ProcessImage(Model3dBuilder * builder, xml_node* node) { const char * imageId = GetAttributeText(node, "id", true); if (!imageId) { return; } xml_node* source = FindChildByName(node, "init_from"); if(source) { const char * filepath = (const char*)source->first_node()->value(); builder->m_material.image2file[imageId] = filepath; } }
//----------------------------------------------------------------------------- // Initialization //----------------------------------------------------------------------------- bool CManhackScreen::Init( KeyValues* pKeyValues, VGuiScreenInitData_t* pInitData ) { s_ManhackScreen = this; // Load all of the controls in if ( !BaseClass::Init(pKeyValues, pInitData) ) return false; // Make sure we get ticked... vgui::ivgui()->AddTickSignal( GetVPanel() ); // Ask: Here we find a pointer to our AmmoCountReadout Label and store it in m_pAmmoCount m_pManhackCount = dynamic_cast<vgui::Label*>(FindChildByName( "ManhackCountReadout" )); m_pManhackDistance = dynamic_cast<vgui::Label*>(FindChildByName( "ManhackDistanceReadout" )); m_pManhackOnline = dynamic_cast<vgui::Label*>(FindChildByName( "ManhacksOnlineLabel" )); m_iManhackDistance = 100; SetVisible( false ); return true; }
void CMainWnd::OnBtnBgOpenMenu() //播放区域打开文件按钮的弹出菜单 { CRect rc_menu; SWindow * pBtn = FindChildByName(L"btn_bg_open"); if(pBtn) { pBtn->GetClientRect(&rc_menu); ClientToScreen(&rc_menu); menu_PlayArea.TrackPopupMenu(0, rc_menu.left, rc_menu.bottom, m_hWnd); } }
void CMainWnd::OnBtnSkins()//打开皮肤管理 { CRect rc_temp; SWindow * pBtn = FindChildByName(L"btn_skins"); if(pBtn) { pBtn->GetClientRect(&rc_temp); ClientToScreen(&rc_temp); m_dlgSkinMgr.SetWindowPos(HWND_TOP, rc_temp.left, rc_temp.bottom, 360, 350, NULL); m_dlgSkinMgr.ShowWindow(SW_SHOWNORMAL); } }
// ------------------------------------------------------------------------------------------------ void ColladaModelFactory::ProcessChildNodes(Model3dBuilder * builder, xml_node* xmlParent, Node * parent, ControllerToGeo * controllerToGeo) { for(xml_node* node = FindChildByName(xmlParent, "node"); node != NULL; node=FindNextByName(node, "node")) { Node * modelNode = ProcessSceneNode(builder, node, parent, controllerToGeo); // register with parent and model parent->children.push_back(modelNode); // process child nodes ProcessChildNodes(builder, node, modelNode, controllerToGeo); } }
/****************************** 播放列表tab页1 **************************************************/ void CMainWnd::OnBtnPage1SortordMenu() //播放列表排序方式 { CRect rc_menu; SWindow * pBtn = FindChildByName(L"btn_sortord_menu"); if(pBtn) { pBtn->GetClientRect(&rc_menu); ClientToScreen(&rc_menu); menu_sortord.TrackPopupMenu(0, rc_menu.left - 50, rc_menu.bottom, m_hWnd); } }
void CMainWnd::OnBtnIcon() // 左上角icon按钮 { CRect rc_menu; SWindow * pBtn = FindChildByName(L"btn_icon"); if(pBtn) { pBtn->GetClientRect(&rc_menu); ClientToScreen(&rc_menu); menu_icon.TrackPopupMenu(0, rc_menu.left, rc_menu.bottom, m_hWnd); } }
// ------------------------------------------------------------------------------------------------ void ColladaModelFactory::ProcessMaterial(Model3dBuilder * builder, xml_node* node) { const char * matId = GetAttributeText(node, "id", true); if (!matId) { return; } xml_node* effect = FindChildByName(node, "instance_effect"); if (effect) { const char * effectId = GetAttributeText(effect, "url", true); if (!effectId) { return; } effectId++; // strip off the # builder->m_material.material2effect[matId] = effectId; } }
// ------------------------------------------------------------------------------------------------ void ColladaModelFactory::ProcessSources(std::vector<Source> * sources, Model3dBuilder * /*builder*/, xml_node* mesh) { // first setup our 'sources' for(xml_node* xmlSource = FindChildByName(mesh, "source"); xmlSource != NULL; xmlSource=FindNextByName(xmlSource, "source")) { // get and validate id const char * id = GetAttributeText(xmlSource, "id", true); if (!id) { continue; } // get and validate stride std::vector<xml_node*> accessors; FindAllByName(xmlSource, "accessor", true, &accessors); if (accessors.size() != 1) { ParseError("'%s' source should have only one 'accessor' descendant\n", id); continue; } const char * stride = GetAttributeText(accessors[0], "stride", true); if (!stride) { continue; } sources->resize(sources->size() + 1); Source & source = sources->back(); source.id = id; source.stride = atoi(stride); // get values xml_node * float_array = FindChildByName(xmlSource, "float_array"); if (!float_array) { ParseError("'%s' source has no 'float_array' child\n", id); continue; } ParseFloatArray(float_array, &source.float_array); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFStatPanel::ApplySchemeSettings( vgui::IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); LoadControlSettings( "resource/UI/StatPanel_Base.res" ); vgui::Panel *pStatBox = FindChildByName("StatBox"); if ( pStatBox ) { // Dirty hack: Make the statbox update now, and then change its bgColor. // When it then gets ApplySchemeSetting called shortly after this, it doesn't // reapply the scheme because its dirty-scheme flag has been removed. pStatBox->ApplySchemeSettings( pScheme ); pStatBox->SetBgColor( GetSchemeColor("TransparentLightBlack", pScheme) ); } }
const char* QuickXMLNode::FindChildDataByName( const char *pName ) { if( m_pImplementation == 0 ) return 0; QuickXMLNode *pNode = FindChildByName( pName ); if( pNode == 0 ) return 0; pNode = pNode->m_pImplementation->m_pFirstChild; while( pNode != 0 ) { if( !pNode->m_pImplementation->m_bLink ) return pNode->m_pImplementation->m_NameOrData; pNode = pNode->m_pImplementation->m_pNext; } return 0; }
// ------------------------------------------------------------------------------------------------ void ColladaModelFactory::ParseEffectColor(xml_node* node, const char* name, float4* out) { if(node) { // get 'color' descendant xml_node* parentNode = FindFirstByName(node, name); xml_node* colorNode = FindChildByName(parentNode, "color"); if (colorNode) { // get 4 floats if (!ParseVector4(colorNode, out)) { ParseError("'%s' 'color' element has fewer than required 4 floats\n", name); } } } }
// ------------------------------------------------------------------------------------------------ void ColladaModelFactory::ProcessController(xml_node * xmlController, ColladaModelFactory::ControllerToGeo * controllerToGeo) { const char * id = GetAttributeText(xmlController, "id", true); if (!id) { return; } xml_node* skin = FindChildByName(xmlController, "skin"); if (skin) { const char * skinSource = GetAttributeText(skin, "source", true); if (!skinSource) { return; } // skip # ++skinSource; (*controllerToGeo)[id] = skinSource; } }
//--------------------------------------------------------------------- // Purpose: Set up colors and other such stuff //--------------------------------------------------------------------- void CSessionLobbyDialog::ApplySchemeSettings( vgui::IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); Color cLabelColor = pScheme->GetColor( "MatchmakingDialogTitleColor", Color( 0, 0, 0, 255 ) ); m_pLobbyStateLabel->SetFgColor( cLabelColor ); m_pHostLabel->SetFgColor( cLabelColor ); m_pLobbyStateBg->SetBgColor( pScheme->GetColor( "TanDarker", Color( 0, 0, 0, 255 ) ) ); m_pLobbyStateBg->SetPaintBackgroundType( 2 ); m_pHostOptionsPanel->SetBgColor( pScheme->GetColor( "TanDarker", Color( 0, 0, 0, 255 ) ) ); m_pHostOptionsPanel->SetPaintBackgroundType( 2 ); m_pScenarioInfo->SetBgColor( pScheme->GetColor( "TanDarker", Color( 0, 0, 0, 255 ) ) ); m_pTeamInfos[BLUE_TEAM_LOBBY]->SetBgColor( pScheme->GetColor( "HudBlueTeam", Color( 0, 0, 0, 255 ) ) ); m_pTeamInfos[RED_TEAM_LOBBY]->SetBgColor( pScheme->GetColor( "HudRedTeam", Color( 0, 0, 0, 255 ) ) ); // Cache of these heights so we never go below them when resizing m_nMinInfoHeight[BLUE_TEAM_LOBBY] = m_pTeamInfos[BLUE_TEAM_LOBBY]->GetTall(); m_nMinInfoHeight[RED_TEAM_LOBBY] = m_pTeamInfos[RED_TEAM_LOBBY]->GetTall(); //Lets set all the labels this panel owns to be the right fgcolor. hooray vgui! int iChildren = m_pHostOptionsPanel->GetChildCount(); for ( int i=0;i<iChildren;i++ ) { vgui::Label *pLabel = dynamic_cast< vgui::Label * >( m_pHostOptionsPanel->GetChild(i) ); if ( pLabel ) { SETUP_PANEL( pLabel ); pLabel->SetFgColor( cLabelColor ); } } vgui::Label *pPlayerReviewLabel = (vgui::Label *)FindChildByName("PlayerReviewLabel" ); if ( pPlayerReviewLabel ) { SETUP_PANEL( pPlayerReviewLabel ); pPlayerReviewLabel->SetFgColor( cLabelColor ); } SetLobbyReadyState( m_nLastPlayersNeeded ); }
void CMainDlg::OnHideOrShowLeftWndClick() { if(m_bLayoutInited) { SImageButton *pBtn = FindChildByName2<SImageButton>(L"btn_navi_left_wnd"); SWindow *pLeftWnd = FindChildByName(L"wnd_left_file_type"); m_LeftWndShow = !m_LeftWndShow; pLeftWnd->SetVisible(m_LeftWndShow); if(m_LeftWndShow) { pBtn->SetAttribute(L"skin", L"skin_navi_left_wnd"); } else { pBtn->SetAttribute(L"skin", L"skin_navi_left_wnd_hide"); } } }
BOOL CMainDlg::OnInitDialog(HWND hWnd, LPARAM lParam) { m_bLayoutInited = TRUE; shellNotifyIcon.Create(m_hWnd,GETRESPROVIDER->LoadIcon(_T("ICON_LOGO"),16)); shellNotifyIcon.Show(); //InitListCtrl(); //拖拽功能 SWindow *pListBox = FindChildByName(L"music_lbe"); if(pListBox) { HRESULT hr=::RegisterDragDrop(m_hWnd,GetDropTarget()); CTestDropTarget1 *pDrop=new CTestDropTarget1(pListBox); RegisterDragDrop(pListBox->GetSwnd(),pDrop); pDrop->GetDragData(GetAudioAllPath,this); } //初始化音频操作类 m_pMuOPreat=new CMusicOpreat(m_hWnd); m_pMuOPreat->InitDatas(); //找到列表控件 SScrollLrc *pTreeBox=FindChildByName2<SScrollLrc>(L"music_lrc"); if(pTreeBox) { SStringW m_sTemp; STreeItem *pItem; HSTREEITEM rootItem; for (int i=0;i<20;i++) { m_sTemp.Format(L"<item><text pos=\"10,0,-5,-0\" name=\"数据_%d\" valign=\"middle\" align=\"left\" colorText=\"#ff0000\" align=\"center\" font=\"face:微软雅黑,adding:5\">%s</text></item>",i,szLrc[i]); //m_sTemp=_T(,strTemp); pItem=pTreeBox->InsertItem((LPCWSTR )m_sTemp,(DWORD)rootItem,STVI_ROOT,STVI_LAST,FALSE); m_TreItemInfo.insert(std::make_pair(i,pItem)); } pTreeBox->GetSetLrcFun(SetLrcStyle,this); pTreeBox->StarsRollLrc(); } return 0; }
void CReplayListPanel::ApplySchemeSettings( vgui::IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); LoadControlSettings( "resource/ui/replaybrowser/replaylistpanel.res", "GAME" ); #if !defined( TF_CLIENT_DLL ) SetPaintBorderEnabled( false ); #endif MoveScrollBarToTop(); vgui::ScrollBar *pScrollBar = dynamic_cast< vgui::ScrollBar * >( FindChildByName( "PanelListPanelVScroll" ) ); pScrollBar->SetScrollbarButtonsVisible( false ); Color clrButtonColor = GetSchemeColor( "Yellow", Color( 255, 255, 255, 255 ), pScheme ); Color clrBgColor = GetSchemeColor( "TanDark", Color( 255, 255, 255, 255 ), pScheme ); const int nWidth = XRES( 5 ); pScrollBar->SetSize( nWidth, GetTall() ); pScrollBar->GetSlider()->SetSize( nWidth, GetTall() ); }
//============================================================================= void ControllerOptionsButtons::RecalculateBindingLabels( void ) { // Populate the bindings labels with the currently bound keys EditablePanel *pContainer = dynamic_cast<EditablePanel *>( FindChildByName( "LabelContainer" ) ); if ( !pContainer ) return; // for every button on the controller for ( int i=0;i<sizeof(sControllerBindings) / sizeof( ControllerBindingMap );i++ ) { // what is it bound to? vgui::KeyCode code = sControllerBindings[i].m_keyCode; //int nJoystick = m_iActiveUserSlot; code = ButtonCodeToJoystickButtonCode( code, m_iActiveUserSlot ); const char *pBinding = engine->Key_BindingForKey( code ); if ( !pBinding ) { // key is not bound to anything pContainer->SetControlString( sControllerBindings[i].m_pszLabelName, L"<Not Bound>" ); continue; } // find the localized string for this binding and set the label text for( int j=0;j<sizeof( sBindingToDisplay ) / sizeof( BindingDisplayMap );j++ ) { const BindingDisplayMap *entry = &( sBindingToDisplay[ j ] ); if ( Q_strstr( pBinding, entry->pszBinding ) ) { Label *pLabel = dynamic_cast< Label * >( pContainer->FindChildByName( sControllerBindings[i].m_pszLabelName ) ); if ( pLabel ) { pLabel->SetText( entry->pszDisplay ); } } } } }