本文整理汇总了C++中TextEntry::SetEditable方法的典型用法代码示例。如果您正苦于以下问题:C++ TextEntry::SetEditable方法的具体用法?C++ TextEntry::SetEditable怎么用?C++ TextEntry::SetEditable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextEntry
的用法示例。
在下文中一共展示了TextEntry::SetEditable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PopulateShaderParameters
//-----------------------------------------------------------------------------
// Sets up the shader param editbox
//-----------------------------------------------------------------------------
void CMaterialEditorPanel::PopulateShaderParameters()
{
Assert( m_nShaderIndex >= 0 );
m_pEditorPanel->RemoveAll();
int nCount = g_pMaterialSystem->GetNumShaderParams(m_nShaderIndex);
for (int i = 0; i < nCount; ++i)
{
const char *pParamName = g_pMaterialSystem->GetShaderParamName(m_nShaderIndex, i);
char tempBuf[512];
Q_strncpy( tempBuf, pParamName, 512 );
Q_strnlwr( tempBuf, 512 );
// build a control & label (strip off '$' prefix)
Label *pLabel = new Label( this, NULL, tempBuf + 1 );
pLabel->SetSize(128, 24);
// Set up the tooltip for this puppy...
pLabel->SetTooltipText( g_pMaterialSystem->GetShaderParamHelp(m_nShaderIndex, i) );
// Get at the material var
bool bFound;
IMaterialVar *pMaterialVar = m_pMaterial->FindVar( pParamName, &bFound );
Assert( bFound );
Panel *pEditPanel;
switch( g_pMaterialSystem->GetShaderParamType(m_nShaderIndex, i) )
{
case SHADER_PARAM_TYPE_TEXTURE:
pEditPanel = new Label( this, NULL, "texture" );
break;
case SHADER_PARAM_TYPE_INTEGER:
{
TextEntry *pTextEntry = new TextEntry(this, "Shader Param Integer");
Q_snprintf( tempBuf, 512, "%d", pMaterialVar->GetIntValue() );
pTextEntry->SetText( tempBuf );
pTextEntry->SetEditable( true );
pEditPanel = pTextEntry;
}
break;
case SHADER_PARAM_TYPE_COLOR:
pEditPanel = new Label( this, NULL, "color" );
break;
case SHADER_PARAM_TYPE_VEC2:
pEditPanel = new Label( this, NULL, "vec2" );
break;
case SHADER_PARAM_TYPE_VEC3:
pEditPanel = new Label( this, NULL, "vec3" );
break;
case SHADER_PARAM_TYPE_FLOAT:
{
TextEntry *pTextEntry = new TextEntry(this, "Shader Param Float");
Q_snprintf( tempBuf, 512, "%f", pMaterialVar->GetIntValue() );
pTextEntry->SetText( tempBuf );
pTextEntry->SetEditable( true );
pEditPanel = pTextEntry;
}
break;
default:
pEditPanel = new Label( this, NULL, "other" );
break;
}
pEditPanel->SetSize(128, 24);
// pEditPanel->SetContentAlignment( Label::a_east );
m_pEditorPanel->AddItem( pLabel, pEditPanel );
}
}