本文整理汇总了C++中KeyValues::GetPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyValues::GetPtr方法的具体用法?C++ KeyValues::GetPtr怎么用?C++ KeyValues::GetPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyValues
的用法示例。
在下文中一共展示了KeyValues::GetPtr方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMouseReleased
//-----------------------------------------------------------------------------
// Purpose:
// Input : code -
//-----------------------------------------------------------------------------
void CBuddyButton::OnMouseReleased(vgui::MouseCode code)
{
if (m_bDragging)
{
// make sure we're over a valid panel
VPanel *imouseOver = input()->GetMouseOver();
if (imouseOver)
{
Panel *mouseOver = ipanel()->Client(imouseOver)->GetPanel();
KeyValues *keyVal = new KeyValues("DragDrop", "type", "TrackerFriend");
keyVal->SetInt("friendID", m_iBuddyID);
if (mouseOver->RequestInfo(keyVal))
{
Panel *acceptPanel = (Panel *)keyVal->GetPtr("AcceptPanel");
if (acceptPanel)
{
PostMessage(acceptPanel, keyVal);
keyVal = NULL;
}
}
if (keyVal)
{
keyVal->deleteThis();
}
}
input()->SetMouseCapture(NULL);
}
m_bDragging = false;
BaseClass::OnMouseReleased(code);
}
示例2: InsertKeyValues
//-----------------------------------------------------------------------------
// VMT parser
//-----------------------------------------------------------------------------
static void InsertKeyValues( KeyValues &dst, KeyValues& src, bool bCheckForExistence )
{
KeyValues *pSrcVar = src.GetFirstSubKey();
while( pSrcVar )
{
if ( !bCheckForExistence || dst.FindKey( pSrcVar->GetName() ) )
{
switch( pSrcVar->GetDataType() )
{
case KeyValues::TYPE_STRING:
dst.SetString( pSrcVar->GetName(), pSrcVar->GetString() );
break;
case KeyValues::TYPE_INT:
dst.SetInt( pSrcVar->GetName(), pSrcVar->GetInt() );
break;
case KeyValues::TYPE_FLOAT:
dst.SetFloat( pSrcVar->GetName(), pSrcVar->GetFloat() );
break;
case KeyValues::TYPE_PTR:
dst.SetPtr( pSrcVar->GetName(), pSrcVar->GetPtr() );
break;
}
}
pSrcVar = pSrcVar->GetNextKey();
}
}
示例3: OnDragFailed
virtual void OnDragFailed( CUtlVector< KeyValues * >& msglist )
{
PropertySheet *sheet = IsDroppingSheet( msglist );
if ( !sheet )
return;
// Create a new property sheet
if ( m_pParent->IsDraggableTab() )
{
if ( msglist.Count() == 1 )
{
KeyValues *data = msglist[ 0 ];
int screenx = data->GetInt( "screenx" );
int screeny = data->GetInt( "screeny" );
// m_pParent->ScreenToLocal( screenx, screeny );
if ( !m_pParent->IsWithin( screenx, screeny ) )
{
Panel *page = reinterpret_cast< Panel * >( data->GetPtr( "propertypage" ) );
PropertySheet *sheet = reinterpret_cast< PropertySheet * >( data->GetPtr( "propertysheet" ) );
char const *title = data->GetString( "tabname", "" );
if ( !page || !sheet )
return;
// Can only create if sheet was part of a ToolWindow derived object
ToolWindow *tw = dynamic_cast< ToolWindow * >( sheet->GetParent() );
if ( tw )
{
IToolWindowFactory *factory = tw->GetToolWindowFactory();
if ( factory )
{
bool hasContextMenu = sheet->PageHasContextMenu( page );
sheet->RemovePage( page );
factory->InstanceToolWindow( tw->GetParent(), sheet->ShouldShowContextButtons(), page, title, hasContextMenu );
if ( sheet->GetNumPages() == 0 )
{
tw->MarkForDeletion();
}
}
}
}
}
}
}
示例4:
//-----------------------------------------------------------------------------
// Purpose: Helper for drag drop
// Input : msglist -
// Output : static PropertySheet
//-----------------------------------------------------------------------------
static PropertySheet *IsDroppingSheet( CUtlVector< KeyValues * >& msglist )
{
if ( msglist.Count() == 0 )
return NULL;
KeyValues *data = msglist[ 0 ];
PropertySheet *sheet = reinterpret_cast< PropertySheet * >( data->GetPtr( "propertysheet" ) );
if ( sheet )
return sheet;
return NULL;
}
示例5: IsDroppable
bool CAttributeTextEntry::IsDroppable( CUtlVector< KeyValues * >& msglist )
{
if ( !IsEnabled() )
return false;
if ( msglist.Count() != 1 )
return false;
KeyValues *msg = msglist[ 0 ];
Panel *draggedPanel = ( Panel * )msg->GetPtr( "panel", NULL );
if ( draggedPanel == GetParent() )
return false;
CAttributeTextPanel *pPanel = GetParentAttributePanel();
if ( !pPanel )
return false;
// If a specific text type is specified, then filter if it doesn't match
const char *pTextType = pPanel->GetTextType();
if ( pTextType[0] )
{
const char *pMsgTextType = msg->GetString( "texttype" );
if ( Q_stricmp( pTextType, pMsgTextType ) )
return false;
}
DmAttributeType_t t = pPanel->GetAttributeType();
switch ( t )
{
default:
break;
case AT_ELEMENT:
{
CDmElement *ptr = reinterpret_cast< CDmElement * >( g_pDataModel->GetElement( DmElementHandle_t( msg->GetInt( "root" ) ) ) );
if ( ptr )
{
return true;
}
return false;
}
break;
case AT_ELEMENT_ARRAY:
return false;
}
return true;
}
示例6: KeyValues
//-----------------------------------------------------------------------------
// Purpose: Searches for a BuildModeDialog in the hierarchy
//-----------------------------------------------------------------------------
Panel *BuildGroup::CreateBuildDialog( void )
{
// request the panel
Panel *buildDialog = NULL;
KeyValues *data = new KeyValues("BuildDialog");
data->SetPtr("BuildGroupPtr", this);
if (m_pBuildContext->RequestInfo(data))
{
buildDialog = (Panel *)data->GetPtr("PanelPtr");
}
// initialize the build dialog if found
if ( buildDialog )
{
input()->ReleaseAppModalSurface();
}
return buildDialog;
}
示例7: OnPanelDropped
void PropertySheet::OnPanelDropped( CUtlVector< KeyValues * >& msglist )
{
if ( msglist.Count() != 1 )
{
return;
}
PropertySheet *sheet = IsDroppingSheet( msglist );
if ( !sheet )
{
// Defer to active page
if ( _activePage && _activePage->IsDropEnabled() )
{
return _activePage->OnPanelDropped( msglist );
}
return;
}
KeyValues *data = msglist[ 0 ];
Panel *page = reinterpret_cast< Panel * >( data->GetPtr( "propertypage" ) );
char const *title = data->GetString( "tabname", "" );
if ( !page || !sheet )
return;
// Can only create if sheet was part of a ToolWindow derived object
ToolWindow *tw = dynamic_cast< ToolWindow * >( sheet->GetParent() );
if ( tw )
{
IToolWindowFactory *factory = tw->GetToolWindowFactory();
if ( factory )
{
bool showContext = sheet->PageHasContextMenu( page );
sheet->RemovePage( page );
if ( sheet->GetNumPages() == 0 )
{
tw->MarkForDeletion();
}
AddPage( page, title, NULL, showContext );
}
}
}
示例8: OnTextChanged
//-----------------------------------------------------------------------------
// Purpose: Checks to see if any text has changed
//-----------------------------------------------------------------------------
void BuildModeDialog::OnTextChanged( Panel *panel )
{
if (panel == m_pFileSelectionCombo)
{
// reload file if it's changed
char newFile[512];
m_pFileSelectionCombo->GetText(newFile, sizeof(newFile));
if (stricmp(newFile, m_pBuildGroup->GetResourceName()) != 0)
{
// file has changed, reload
SetActiveControl(NULL);
m_pBuildGroup->ChangeControlSettingsFile(newFile);
}
return;
}
if (panel == m_pAddNewControlCombo)
{
char buf[40];
m_pAddNewControlCombo->GetText(buf, 40);
if (stricmp(buf, "None") != 0)
{
OnNewControl(buf);
// reset box back to None
m_pAddNewControlCombo->ActivateItemByRow( 0 );
}
}
if ( panel == m_pEditableChildren )
{
KeyValues *kv = m_pEditableChildren->GetActiveItemUserData();
if ( kv )
{
EditablePanel *ep = reinterpret_cast< EditablePanel * >( kv->GetPtr( "ptr" ) );
if ( ep )
{
ep->ActivateBuildMode();
}
}
}
if ( panel == m_pEditableParents )
{
KeyValues *kv = m_pEditableParents->GetActiveItemUserData();
if ( kv )
{
EditablePanel *ep = reinterpret_cast< EditablePanel * >( kv->GetPtr( "ptr" ) );
if ( ep )
{
ep->ActivateBuildMode();
}
}
}
if (m_pCurrentPanel && m_pCurrentPanel->IsBuildModeEditable())
{
m_pApplyButton->SetEnabled(true);
}
if (_autoUpdate)
{
ApplyDataToControls();
}
}
示例9: OnPanelDropped
void CAttributeTextEntry::OnPanelDropped( CUtlVector< KeyValues * >& msglist )
{
if ( msglist.Count() != 1 )
return;
KeyValues *data = msglist[ 0 ];
Panel *draggedPanel = ( Panel * )data->GetPtr( "panel", NULL );
if ( draggedPanel == GetParent() )
return;
CAttributeTextPanel *pPanel = GetParentAttributePanel();
if ( !pPanel )
return;
// If a specific text type is specified, then filter if it doesn't match
const char *pTextType = pPanel->GetTextType();
if ( pTextType[0] )
{
const char *pMsgTextType = data->GetString( "texttype" );
if ( Q_stricmp( pTextType, pMsgTextType ) )
return;
}
const char *cmd = data->GetString( "command" );
if ( !Q_stricmp( cmd, "droptext" ) || !Q_stricmp( cmd, "default" ) )
{
DmAttributeType_t t = pPanel->GetAttributeType();
switch ( t )
{
default:
{
pPanel->SetDirty( true );
SetText( data->GetString( "text" ) );
if ( pPanel->IsAutoApply() )
{
pPanel->Apply();
}
}
break;
case AT_ELEMENT:
{
CDmElement *ptr = reinterpret_cast< CDmElement * >( g_pDataModel->GetElement( DmElementHandle_t( data->GetInt( "root" ) ) ) );
if ( !ptr )
{
break;
}
pPanel->SetDirty( true );
SetText( data->GetString( "text" ) );
if ( pPanel->IsAutoApply() )
{
pPanel->Apply();
}
}
break;
case AT_ELEMENT_ARRAY:
Assert( 0 );
break;
}
}
StoreInitialValue( true );
}