本文整理汇总了C++中Panel::ApplySettings方法的典型用法代码示例。如果您正苦于以下问题:C++ Panel::ApplySettings方法的具体用法?C++ Panel::ApplySettings怎么用?C++ Panel::ApplySettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Panel
的用法示例。
在下文中一共展示了Panel::ApplySettings方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ApplySettings
//-----------------------------------------------------------------------------
// Purpose: serializes settings from a resource data container
//-----------------------------------------------------------------------------
void BuildGroup::ApplySettings( KeyValues *resourceData )
{
// loop through all the keys, applying them wherever
for (KeyValues *controlKeys = resourceData->GetFirstSubKey(); controlKeys != NULL; controlKeys = controlKeys->GetNextKey())
{
bool bFound = false;
// Skip keys that are atomic..
if (controlKeys->GetDataType() != KeyValues::TYPE_NONE)
continue;
char const *keyName = controlKeys->GetName();
// check to see if any buildgroup panels have this name
for ( int i = 0; i < _panelDar.Count(); i++ )
{
Panel *panel = _panelDar[i].Get();
if (!panel) // this can happen if we had two of the same handle in the list
{
_panelDar.Remove(i);
--i;
continue;
}
Assert (panel);
// make the control name match CASE INSENSITIVE!
char const *panelName = panel->GetName();
if (!Q_stricmp(panelName, keyName))
{
// apply the settings
panel->ApplySettings(controlKeys);
bFound = true;
break;
}
}
if ( !bFound )
{
// the key was not found in the registered list, check to see if we should create it
if ( keyName /*controlKeys->GetInt("AlwaysCreate", false)*/ )
{
// create the control even though it wasn't registered
NewControl( controlKeys );
}
}
}
}
示例2: DoPaste
//-----------------------------------------------------------------------------
// Purpose: Create a new Panel with the _copySettings applied
//-----------------------------------------------------------------------------
void BuildModeDialog::DoPaste()
{
// Make a new control located where you had the mouse
int x, y;
input()->GetCursorPos(x, y);
m_pBuildGroup->GetContextPanel()->ScreenToLocal(x,y);
Panel *newPanel = OnNewControl(_copyClassName, x, y);
if (newPanel)
{
newPanel->ApplySettings(_copySettings);
newPanel->SetPos(x, y);
char name[255];
m_pBuildGroup->GetNewFieldName(name, sizeof(name), newPanel);
newPanel->SetName(name);
}
}
示例3: KeyValues
//-----------------------------------------------------------------------------
// Purpose: Create a new control in the context panel
// Input: controlKeys: keyvalues of settings for the panel only works when applying initial settings.
// Output: Panel *newPanel, NULL if failed to create new control.
//-----------------------------------------------------------------------------
Panel *BuildGroup::NewControl( KeyValues *controlKeys, int x, int y)
{
Assert (controlKeys);
Panel *newPanel = nullptr;
if (controlKeys)
{
// Warning( "Creating new control \"%s\" of type \"%s\"\n", controlKeys->GetString( "fieldName" ), controlKeys->GetString( "ControlName" ) );
KeyValues *keyVal = new KeyValues("ControlFactory", "ControlName", controlKeys->GetString("ControlName"));
m_pBuildContext->RequestInfo(keyVal);
// returns NULL on failure
newPanel = (Panel *)keyVal->GetPtr("PanelPtr");
keyVal->deleteThis();
}
else
{
return nullptr;
}
if (newPanel)
{
// panel successfully created
newPanel->SetParent(m_pParentPanel);
newPanel->SetBuildGroup(this);
newPanel->SetPos(x, y);
newPanel->SetName(controlKeys->GetName()); // name before applysettings :)
newPanel->ApplySettings(controlKeys);
newPanel->AddActionSignalTarget(m_pParentPanel);
newPanel->SetBuildModeEditable(true);
newPanel->SetBuildModeDeletable(true);
// make sure it gets freed
newPanel->SetAutoDelete(true);
}
return newPanel;
}