コード例 #1
0
ファイル: StripCanvas.cpp プロジェクト: kevindqc/Helium
void StripCanvas::Realize( Inspect::Canvas* canvas )
{
    HELIUM_ASSERT( canvas == this || canvas == NULL );

    StrongPtr< StripCanvasWidget > widget = new StripCanvasWidget( this, m_Orientation );
    widget->SetPanel( m_Panel );
    SetWidget( widget );

    int spacing = GetBorder();

    wxSizer* sizer = new wxBoxSizer( m_Orientation );
    m_Panel->SetSizer( sizer );
    sizer->AddSpacer( spacing );

    Inspect::V_Control::const_iterator itr = m_Children.begin();
    Inspect::V_Control::const_iterator end = m_Children.end();
    for( ; itr != end; ++itr )
    {
        Inspect::Control* c = *itr;
        c->Realize( this );
        sizer->Add( Reflect::AssertCast< Widget >( c->GetWidget() )->GetWindow(), 0, wxALIGN_CENTER );
        sizer->AddSpacer( spacing );
    }

    m_Panel->Freeze();
    {
        Populate();
        Read();
        m_Panel->Layout();
    }
    m_Panel->Thaw();
}
コード例 #2
0
ファイル: TreeCanvas.cpp プロジェクト: euler0/Helium
void TreeCanvas::Realize( Inspect::Canvas* canvas )
{
    HELIUM_ASSERT( canvas == this || canvas == NULL );

    StrongPtr< TreeCanvasWidget > widget = new TreeCanvasWidget( this );
    widget->SetTreeWndCtrl( m_TreeWndCtrl );
    widget->SetId( m_RootId );
    SetWidget( widget );

    Inspect::V_Control::const_iterator itr = m_Children.begin();
    Inspect::V_Control::const_iterator end = m_Children.end();
    for( ; itr != end; ++itr )
    {
        Inspect::Control* c = *itr;
        c->Realize( this );
    }

    m_TreeWndCtrl->Freeze();
    {
        m_TreeWndCtrl->Scroll( 0, 0 );
        m_TreeWndCtrl->Layout();
        Populate();
        Read();
    }    
    m_TreeWndCtrl->Thaw();
}
コード例 #3
0
void StripCanvasWidget::CreateWindow( wxWindow* parent )
{
    SetWindow( m_ContainerWindow = new wxPanel( parent, wxID_ANY ) );

    int spacing = m_ContainerControl->GetCanvas()->GetBorder();
    wxSizer* sizer = NULL;
    if ( !m_ContainerControl->a_Name.Get().empty() )
    {
        sizer = new wxStaticBoxSizer( m_Orientation, m_ContainerWindow, m_ContainerControl->a_Name.Get() );
    }
    else
    {
        sizer = new wxBoxSizer( m_Orientation );
        m_StaticText = new wxStaticText( m_ContainerWindow, wxID_ANY, m_ContainerControl->a_Name.Get() );
        sizer->Add( m_StaticText, 0, wxALIGN_CENTER, 0);
        sizer->AddSpacer( spacing );
    }

    // Add all of the child controls to the container
    m_ContainerWindow->SetSizer( sizer );
    m_ContainerWindow->Freeze();

    std::vector< Inspect::ControlPtr >::const_iterator itr = m_ContainerControl->GetChildren().begin();
    std::vector< Inspect::ControlPtr >::const_iterator end = m_ContainerControl->GetChildren().end();
    for( ; itr != end; ++itr )
    {
        Inspect::Control* control = *itr;

        Inspect::Label* label = Reflect::SafeCast< Inspect::Label >( control );
        if ( label )
        {
            label->a_Ellipsize.Set( false );
        }

        control->Realize( m_ContainerControl->GetCanvas() );
        sizer->Add( Reflect::AssertCast< Widget >( control->GetWidget() )->GetWindow(), 0, wxALIGN_CENTER );
        sizer->AddSpacer( spacing );
    }

    m_ContainerControl->a_Name.Changed().AddMethod( this, &StripCanvasWidget::NameChanged );
    m_ContainerControl->a_Icon.Changed().AddMethod( this, &StripCanvasWidget::IconChanged );

    m_ContainerWindow->SetHelpText( m_ContainerControl->a_HelpText.Get() );

    m_ContainerWindow->Thaw();

    m_ContainerWindow->Layout();
}