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() );
  }
void ReflectVectorInterpreter::InterpretField(const Field* field, const std::vector<Reflect::Element*>& instances, Container* parent)
{
    if ( field->m_Flags & FieldFlags::Hide )
    {
        return;
    }

    // create the container
    ContainerPtr container = CreateControl< Container >();
    parent->AddChild( container );

    // create the label
    LabelPtr label = CreateControl< Label >();
    container->AddChild( label );
    label->a_HelpText.Set( field->GetProperty( TXT( "HelpText" ) ) );

    tstring temp;
    bool converted = Helium::ConvertString( field->m_UIName, temp );
    HELIUM_ASSERT( converted );

    label->BindText( temp );

    // compute dimensions
    int dimensions = 2;
    if ( field->m_SerializerID == Reflect::GetType<Vector3Serializer>() )
    {
        dimensions += 1;
    }
    if ( field->m_SerializerID == Reflect::GetType<Vector4Serializer>() )
    {
        dimensions += 2;
    }

    // create the dimension ui
    for ( int offset = 0; offset < dimensions*4; offset += 4 )
    {
        // create the serializers
        std::vector<Reflect::Serializer*> data;
        std::vector<Reflect::Element*>::const_iterator itr = instances.begin();
        std::vector<Reflect::Element*>::const_iterator end = instances.end();
        for ( ; itr != end; ++itr )
        {
            SerializerPtr s = new F32Serializer ();

            s->ConnectField(*itr, field, offset); 

            m_Serializers.push_back(s);

            data.push_back(s);
        }

        // create the text box
        ValuePtr value = CreateControl< Value >();
        container->AddChild( value );
        value->a_IsReadOnly.Set( ( field->m_Flags & FieldFlags::ReadOnly ) == FieldFlags::ReadOnly );
        value->a_HelpText.Set( field->GetProperty( TXT( "HelpText" ) ) );

        // bind the ui to the serializers
        value->Bind( new MultiStringFormatter<Serializer>( data ) );
    }
}
void ReflectArrayInterpreter::InterpretField(const Field* field, const std::vector<Reflect::Element*>& instances, Container* parent)
{
    if (field->m_Flags & FieldFlags::Hide)
    {
        return;
    }

    // create the label
    ContainerPtr labelContainer = CreateControl<Container>();
    parent->AddChild( labelContainer );
    LabelPtr label = CreateControl< Label >();
    label->a_HelpText.Set( field->GetProperty( TXT( "HelpText" ) ) );

    labelContainer->AddChild( label );
    tstring temp;
    bool converted = Helium::ConvertString( field->m_UIName, temp );
    HELIUM_ASSERT( converted );
    label->BindText( temp );

    // create the list view
    ContainerPtr listContainer = CreateControl<Container>();
    parent->AddChild( listContainer );
    ListPtr list = CreateControl<List>();
    list->a_HelpText.Set( field->GetProperty( TXT( "HelpText" ) ) );
    listContainer->AddChild( list );

    // create the buttons
    ButtonPtr addButton;
    ButtonPtr removeButton;
    ButtonPtr upButton;
    ButtonPtr downButton;
    if ( !(field->m_Flags & FieldFlags::ReadOnly) )
    {
        addButton = AddAddButton( list );
        removeButton = AddRemoveButton( list );
        upButton = AddMoveUpButton( list );
        downButton = AddMoveDownButton( list );
    }

    // add the buttons to the container
    ContainerPtr buttonContainer = CreateControl<Container>();
    parent->AddChild( buttonContainer );
    if ( addButton )
    {
        buttonContainer->AddChild( addButton );
    }
    if ( removeButton )
    {
        buttonContainer->AddChild( removeButton );
    }
    if ( upButton )
    {
        buttonContainer->AddChild( upButton );
    }
    if ( downButton )
    {
        buttonContainer->AddChild( downButton );
    }

    // 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();

        OnCreateFieldSerializer( s );

        s->ConnectField(*itr, field);

        m_Serializers.push_back(s);
    }

    // bind the ui to the serializers
    Helium::SmartPtr< MultiStringFormatter<Serializer> > data = new MultiStringFormatter<Reflect::Serializer>( (std::vector<Reflect::Serializer*>&)m_Serializers );
    list->Bind( data );

    // setup the default value
    if (field->m_Default != NULL)
    {
        tstringstream outStream;
        *field->m_Default >> outStream;
        list->a_Default.Set( outStream.str() );
    }