本文整理汇总了C++中vgui::DHANDLE::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ DHANDLE::Get方法的具体用法?C++ DHANDLE::Get怎么用?C++ DHANDLE::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vgui::DHANDLE
的用法示例。
在下文中一共展示了DHANDLE::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetProgressLevelName
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CGameUI::SetProgressLevelName( const char *levelName )
{
MEM_ALLOC_CREDIT();
if ( g_hLoadingBackgroundDialog )
{
KeyValues *pKV = new KeyValues( "ProgressLevelName" );
pKV->SetString( "levelName", levelName );
vgui::ivgui()->PostMessage( g_hLoadingBackgroundDialog, pKV, NULL );
}
if ( g_hLoadingDialog.Get() )
{
// TODO: g_hLoadingDialog->SetLevelName( levelName );
}
}
示例2: SetProgressBarStatusText
//-----------------------------------------------------------------------------
// Purpose: sets loading info text
//-----------------------------------------------------------------------------
bool CGameUI::SetProgressBarStatusText(const char *statusText)
{
if (!g_hLoadingDialog.Get())
return false;
if (!statusText)
return false;
if (!stricmp(statusText, m_szPreviousStatusText))
return false;
g_hLoadingDialog->SetStatusText(statusText);
Q_strncpy(m_szPreviousStatusText, statusText, sizeof(m_szPreviousStatusText));
return true;
}
示例3: ShowInGameBriefing
void ShowInGameBriefing()
{
using namespace vgui;
C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer();
if (!pPlayer)
return;
if (engine->IsLevelMainMenuBackground()) // don't show player list on main menu
{
return;
}
vgui::Panel *pContainer = GetClientMode()->GetViewport()->FindChildByName("InGameBriefingContainer", true);
if (pContainer)
{
pContainer->SetVisible(false);
pContainer->MarkForDeletion();
pContainer = NULL;
return;
}
if (g_hBriefingFrame.Get() || GetClientModeASW()->m_hCampaignFrame.Get() || GetClientModeASW()->m_hMissionCompleteFrame.Get())
{
return;
}
vgui::Frame* pFrame = new InGameMissionPanelFrame( GetClientMode()->GetViewport(), "InGameBriefingContainer" );
HScheme scheme = vgui::scheme()->LoadSchemeFromFile("resource/SwarmSchemeNew.res", "SwarmSchemeNew");
pFrame->SetScheme(scheme);
// the panel to show the info
CNB_Mission_Panel *missionpanel = new CNB_Mission_Panel( pFrame, "MissionPanel" );
missionpanel->SetVisible( true );
if (!pFrame)
{
Msg("Error: ingame briefing frame was closed immediately on opening\n");
}
else
{
pFrame->RequestFocus();
pFrame->SetVisible(true);
pFrame->SetEnabled(true);
pFrame->SetKeyBoardInputEnabled(false);
pFrame->SetZPos(200);
GetClientModeASW()->m_hInGameBriefingFrame = pFrame;
}
}
示例4: ShowTooltip
//-----------------------------------------------------------------------------
// 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();
}
示例5: SizeTextWindow
//-----------------------------------------------------------------------------
// Purpose: Size the text window so all the text fits inside it.
//-----------------------------------------------------------------------------
void Tooltip::SizeTextWindow()
{
if ( !s_TooltipWindow.Get() )
return;
if (_displayOnOneLine)
{
// We want the tool tip to be one line
s_TooltipWindow->SetMultiline(false);
s_TooltipWindow->SetToFullWidth();
}
else
{
// We want the tool tip to be one line
s_TooltipWindow->SetMultiline(false);
s_TooltipWindow->SetToFullWidth();
int wide, tall;
s_TooltipWindow->GetSize( wide, tall );
double newWide = sqrt( (2.0/1) * wide * tall );
double newTall = (1/2) * newWide;
s_TooltipWindow->SetMultiline(true);
s_TooltipWindow->SetSize((int)newWide, (int)newTall );
s_TooltipWindow->SetToFullHeight();
s_TooltipWindow->GetSize( wide, tall );
if (( wide < 100 ) && ( s_TooltipWindow->GetNumLines() == 2) )
{
s_TooltipWindow->SetMultiline(false);
s_TooltipWindow->SetToFullWidth();
}
else
{
while ( (float)wide/(float)tall < 2 )
{
s_TooltipWindow->SetSize( wide + 1, tall );
s_TooltipWindow->SetToFullHeight();
s_TooltipWindow->GetSize( wide, tall );
}
}
s_TooltipWindow->GetSize( wide, tall );
// ivgui()->DPrintf("End Ratio: %f\n", (float)wide/(float)tall);
}
}
示例6: StopProgressBar
//-----------------------------------------------------------------------------
// Purpose: stops progress bar, displays error if necessary
//-----------------------------------------------------------------------------
void CGameUI::StopProgressBar(bool bError, const char *failureReason, const char *extendedReason)
{
if (!g_hLoadingDialog.Get())
return;
if ( !IsX360() && bError )
{
// turn the dialog to error display mode
g_hLoadingDialog->DisplayGenericError(failureReason, extendedReason);
}
else
{
// close loading dialog
g_hLoadingDialog->Close();
g_hLoadingDialog = NULL;
}
// should update the background to be in a transition here
}
示例7: SetMainPanel
//-----------------------------------------------------------------------------
// 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 );
}
示例8: OnCommand
void CBaseActionPlaySoundStartDialog::OnCommand( char const *command )
{
if ( !Q_strcasecmp( command, "choosesound" ) )
{
if ( !m_hFileOpenDialog.Get() )
{
m_hFileOpenDialog = new vgui::FileOpenDialog( this, "Choose .wav file", true );
}
if ( m_hFileOpenDialog )
{
char startPath[ MAX_PATH ];
Q_strncpy( startPath, com_gamedir, sizeof( startPath ) );
COM_FixSlashes( startPath );
m_hFileOpenDialog->SetStartDirectory( va( "%s/sound", startPath ) );
m_hFileOpenDialog->DoModal( false );
}
return;
}
BaseClass::OnCommand( command );
}
示例9:
CASW_VGUI_Info_Message::~CASW_VGUI_Info_Message()
{
if (GetControllerFocus())
{
GetControllerFocus()->RemoveFromFocusList(m_pOkayButton);
if (m_pLogButton)
GetControllerFocus()->RemoveFromFocusList(m_pLogButton);
}
g_asw_iGUIWindowsOpen--;
if (g_hCurrentInfoPanel.Get() == this)
g_hCurrentInfoPanel = NULL;
NotifyServerOfClose();
if ( !asw_info_sound_continue.GetBool() )
{
StopInfoMessageSound();
}
ASWInput()->SetCameraFixed( false );
}
示例10: PerformLayout
//-----------------------------------------------------------------------------
// Purpose: Display the tooltip
//-----------------------------------------------------------------------------
void TextTooltip::PerformLayout()
{
if ( !ShouldLayout() )
return;
// we're ready, just make us visible
if ( !s_TooltipWindow.Get() )
return;
_isDirty = false;
s_TooltipWindow->SetVisible(true);
s_TooltipWindow->MakePopup( false, true );
s_TooltipWindow->SetKeyBoardInputEnabled( false );
s_TooltipWindow->SetMouseInputEnabled( false );
// relayout the textwindow immediately so that we know it's size
//m_pTextEntry->InvalidateLayout(true);
SizeTextWindow();
PositionWindow( s_TooltipWindow );
}
示例11: StartProgressBar
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CGameUI::StartProgressBar(const char *progressType, int progressSteps)
{
// TRACE_FUNCTION("CGameUI::StartProgressBar");
if (!g_hLoadingDialog.Get())
{
g_hLoadingDialog = new CLoadingDialog(staticPanel);
}
// close the start menu
staticPanel->SetBackgroundRenderState(CBasePanel::BACKGROUND_LOADING);
m_pszCurrentProgressType = progressType;
if (m_flProgressStartTime < 0.001f)
{
m_flProgressStartTime = (float)vgui::system()->GetCurrentTime();
}
// open a loading dialog
g_hLoadingDialog->SetProgressRange(0 , progressSteps);
g_hLoadingDialog->SetProgressPoint(0);
g_hLoadingDialog->DisplayProgressBar(progressType, "invalid");
}
示例12: ShowTooltip
//-----------------------------------------------------------------------------
// 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 );
}
示例13: SetText
//-----------------------------------------------------------------------------
// Purpose: Set the tooltip text
//-----------------------------------------------------------------------------
void Tooltip::SetText(const char *text)
{
if (!text)
{
text = "";
}
if (m_Text.Size() > 0)
{
m_Text.RemoveAll();
}
for (unsigned int i = 0; i < strlen(text); i++)
{
m_Text.AddToTail(text[i]);
}
m_Text.AddToTail('\0');
if (s_TooltipWindow.Get())
{
s_TooltipWindow->SetText(m_Text.Base());
}
}
示例14: TextEntry
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
Tooltip::Tooltip(Panel *parent, const char *text)
{
if (!s_TooltipWindow.Get())
{
s_TooltipWindow = new TextEntry(NULL, "tooltip");
}
s_iTooltipWindowCount++;
// this line prevents the main window from losing focus
// when a tooltip pops up
s_TooltipWindow->MakePopup(false, true);
SetText(text);
s_TooltipWindow->SetText(m_Text.Base());
s_TooltipWindow->SetEditable(false);
s_TooltipWindow->SetMultiline(true);
s_TooltipWindow->SetVisible(false);
_displayOnOneLine = false;
_makeVisible = false;
_tooltipDelay = 500; // default delay for opening tooltips
_delay = 0;
}
示例15: ShowPlayerList
void ShowPlayerList()
{
if ( gpGlobals->maxClients <= 1 )
return;
using namespace vgui;
C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer();
if (!pPlayer)
return;
if (engine->IsLevelMainMenuBackground()) // don't show player list on main menu
{
return;
}
vgui::Panel *pContainer = GetClientMode()->GetViewport()->FindChildByName("g_PlayerListFrame", true);
if (pContainer)
{
pContainer->SetVisible(false);
pContainer->MarkForDeletion();
pContainer = NULL;
return;
}
vgui::Frame* pFrame = NULL;
if (g_hBriefingFrame.Get())
pContainer = new PlayerListContainer( g_hBriefingFrame.Get(), "g_PlayerListFrame" );
else
{
if (GetClientModeASW()->m_hCampaignFrame.Get())
{
pContainer = new PlayerListContainer( GetClientModeASW()->m_hCampaignFrame.Get(), "g_PlayerListFrame" );
}
else
{
if (GetClientModeASW()->m_hMissionCompleteFrame.Get())
{
pContainer = new PlayerListContainer( GetClientModeASW()->m_hMissionCompleteFrame.Get(), "g_PlayerListFrame" );
}
else
{
pFrame = new PlayerListContainerFrame( GetClientMode()->GetViewport(), "g_PlayerListFrame" );
pContainer = pFrame;
}
}
}
HScheme scheme = vgui::scheme()->LoadSchemeFromFile("resource/SwarmSchemeNew.res", "SwarmSchemeNew");
pContainer->SetScheme(scheme);
// the panel to show the info
PlayerListPanel *playerlistpanel = new PlayerListPanel( pContainer, "PlayerListPanel" );
playerlistpanel->SetVisible( true );
if (!pContainer)
{
Msg("Error: Player list pContainer frame was closed immediately on opening\n");
}
else
{
pContainer->RequestFocus();
pContainer->SetVisible(true);
pContainer->SetEnabled(true);
pContainer->SetKeyBoardInputEnabled(false);
pContainer->SetZPos(200);
}
}