当前位置: 首页>>代码示例>>C++>>正文


C++ LabelPtr::SetText方法代码示例

本文整理汇总了C++中LabelPtr::SetText方法的典型用法代码示例。如果您正苦于以下问题:C++ LabelPtr::SetText方法的具体用法?C++ LabelPtr::SetText怎么用?C++ LabelPtr::SetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LabelPtr的用法示例。


在下文中一共展示了LabelPtr::SetText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: InterpretField

void ReflectBitfieldInterpreter::InterpretField(const Field* field, const std::vector<Reflect::Element*>& instances, Container* parent)
{
  // If you hit this, you are misusing this interpreter
  HELIUM_ASSERT( field->m_SerializerID == Reflect::GetType<Reflect::BitfieldSerializer>() );

  if ( field->m_SerializerID != Reflect::GetType<Reflect::BitfieldSerializer>() )
  {
    return;
  }

  if ( field->m_Flags & FieldFlags::Hide )
  {
    return;
  }

  const EnumerationField* enumField = static_cast< const EnumerationField* >( field );

  // create the panel
  PanelPtr panel = m_Container->GetCanvas()->Create<Panel>(this);
  
  tstring temp;
  bool converted = Helium::ConvertString( field->m_UIName, temp );
  panel->SetText( temp );

  panel->SetExpanded( true );
  parent->AddControl(panel);

  // build the child gui elements
  bool readOnly = ( field->m_Flags & FieldFlags::ReadOnly ) == FieldFlags::ReadOnly;
  M_StrEnumerationElement::const_iterator enumItr = enumField->m_Enumeration->m_ElementsByLabel.begin();
  M_StrEnumerationElement::const_iterator enumEnd = enumField->m_Enumeration->m_ElementsByLabel.end();
  for ( ; enumItr != enumEnd; ++enumItr )
  {
    ContainerPtr row = m_Container->GetCanvas()->Create<Container>( this );
    panel->AddControl( row );

    LabelPtr label = m_Container->GetCanvas()->Create<Label>( this );
    row->AddControl( label );

    tstring temp;
    bool converted = Helium::ConvertString( enumItr->first, temp );
    HELIUM_ASSERT( converted );
    label->SetText( temp );

    BitfieldCheckBoxPtr checkbox = m_Container->GetCanvas()->Create<ReflectBitfieldCheckBox>( this );
    row->AddControl( checkbox );

    converted = Helium::ConvertString( enumItr->first, temp );
    HELIUM_ASSERT( converted );
    checkbox->SetBitfieldString( temp );
    checkbox->SetReadOnly( readOnly );
  }

  // create the serializers
  std::vector<Reflect::Element*>::const_iterator itr = instances.begin();
  std::vector<Reflect::Element*>::const_iterator end = instances.end();
  for ( ; itr != end; ++itr )
  {
    SerializerPtr s = field->CreateSerializer();
    s->ConnectField(*itr, field);
    m_Serializers.push_back(s);
  }

  // bind the ui to the serializers
  panel->Bind( new MultiStringFormatter<Serializer>( (std::vector<Reflect::Serializer*>&)m_Serializers ) );

  // setup the default value
  if (field->m_Default != NULL)
  {
    tstringstream outStream;
    *field->m_Default >> outStream;
    panel->SetDefault( outStream.str() );
  }
开发者ID:pthiben,项目名称:Helium,代码行数:73,代码来源:ReflectBitfieldInterpreter.cpp


注:本文中的LabelPtr::SetText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。