//----------------------------------------------------------------------------- // Purpose: Display the tooltip //----------------------------------------------------------------------------- void Tooltip::ShowTooltip(Panel *currentPanel) { if ( s_TooltipWindow.Get() ) { s_TooltipWindow->SetText(m_Text.Base()); s_TooltipWindow->SetParent(currentPanel); } _makeVisible = true; PerformLayout(); }
//----------------------------------------------------------------------------- // Purpose: Display the tooltip //----------------------------------------------------------------------------- void Tooltip::ShowTooltip(Panel *currentPanel) { if ( s_TooltipWindow.Get() ) { int nLen = s_TooltipWindow->GetTextLength(); char *pBuf = (char*)_alloca( nLen+1 ); s_TooltipWindow->GetText( pBuf, nLen+1 ); Panel *pCurrentParent = s_TooltipWindow->GetParent(); _isDirty = _isDirty || ( pCurrentParent != currentPanel ); s_TooltipWindow->SetText( m_Text.Base() ); s_TooltipWindow->SetParent(currentPanel); } _makeVisible = true; PerformLayout(); }
//----------------------------------------------------------------------------- // Sets a panel to be the main panel //----------------------------------------------------------------------------- void CVsVGuiWindow::SetMainPanel( vgui::EditablePanel * pPanel ) { Assert( m_hMainPanel.Get() == NULL ); Assert( m_hVGuiContext == vgui::DEFAULT_VGUI_CONTEXT ); m_hMainPanel = pPanel; m_hMainPanel->SetParent( vgui::surface()->GetEmbeddedPanel() ); m_hMainPanel->SetVisible( true ); m_hMainPanel->SetCursor( vgui::dc_arrow ); m_hVGuiContext = vgui::ivgui()->CreateContext(); vgui::ivgui()->AssociatePanelWithContext( m_hVGuiContext, m_hMainPanel->GetVPanel() ); pPanel->InvalidateLayout(); EnableWindow( m_hWnd, true ); SetFocus( m_hWnd ); }
//----------------------------------------------------------------------------- // Purpose: Display the tooltip //----------------------------------------------------------------------------- void TextTooltip::ShowTooltip(Panel *currentPanel) { if ( s_TooltipWindow.Get() ) { int nLen = s_TooltipWindow->GetTextLength(); if ( nLen <= 0 ) { // Empty tool tip, no need to show it _makeVisible = false; return; } char *pBuf = (char*)_alloca( nLen+1 ); s_TooltipWindow->GetText( pBuf, nLen+1 ); Panel *pCurrentParent = s_TooltipWindow->GetParent(); _isDirty = _isDirty || ( pCurrentParent != currentPanel ); s_TooltipWindow->SetText( m_Text.Base() ); s_TooltipWindow->SetParent(currentPanel); } BaseTooltip::ShowTooltip( currentPanel ); }