Пример #1
0
void VisualEditor::SetupSizer( PObjectBase obj, wxSizer* sizer )
{
	wxSize minsize = obj->GetPropertyAsSize( wxT("minimum_size") );
	if ( minsize != wxDefaultSize )
	{
		sizer->SetMinSize( minsize );
		sizer->Layout();
	}
}
Пример #2
0
void VisualEditor::SetupWindow( PObjectBase obj, wxWindow* window )
{
	// All of the properties of the wxWindow object are applied in this function

	// Position
	/* Position does nothing in wxFB - this is pointless
	wxPoint pos;
	PProperty ppos = obj->GetProperty( wxT("pos") );
	if ( ppos )
	{
		pos = TypeConv::StringToPoint( ppos->GetValue() );
	}
	*/

	// Size
	wxSize size = obj->GetPropertyAsSize( wxT("size") );
	if ( size != wxDefaultSize )
	{
		window->SetSize( size );
	}

	// Minimum size
	wxSize minsize = obj->GetPropertyAsSize( wxT("minimum_size") );
	if ( minsize != wxDefaultSize )
	{
		window->SetMinSize( minsize );
	}

	// Maximum size
	wxSize maxsize = obj->GetPropertyAsSize( wxT("maximum_size") );
	if ( maxsize != wxDefaultSize )
	{
		window->SetMaxSize( maxsize );
	}

	// Font
	PProperty pfont = obj->GetProperty( wxT("font") );
	if ( pfont && !pfont->GetValue().empty() )
	{
		window->SetFont( TypeConv::StringToFont( pfont->GetValue() ) );
	}

	// Foreground
	PProperty pfg_colour = obj->GetProperty( wxT("fg") );
	if ( pfg_colour && !pfg_colour->GetValue().empty() )
	{
		window->SetForegroundColour( TypeConv::StringToColour( pfg_colour->GetValue() ) );
	}

	// Background
	PProperty pbg_colour = obj->GetProperty( wxT("bg") );
	if ( pbg_colour && !pbg_colour->GetValue().empty() )
	{
		window->SetBackgroundColour( TypeConv::StringToColour( pbg_colour->GetValue() ) );
	}

	// Extra Style
	PProperty pextra_style = obj->GetProperty( wxT("window_extra_style") );
	if ( pextra_style )
	{
		window->SetExtraStyle( TypeConv::StringToInt( pextra_style->GetValue() ) );
	}

	// Enabled
	PProperty penabled = obj->GetProperty( wxT("enabled") );
	if ( penabled )
	{
		window->Enable( ( penabled->GetValueAsInteger() !=0 ) );
	}

	// Hidden
	PProperty phidden = obj->GetProperty( wxT("hidden") );
	if ( phidden )
	{
		window->Show( !phidden->GetValueAsInteger() );
	}

	// Tooltip
	PProperty ptooltip = obj->GetProperty( wxT("tooltip") );
	if ( ptooltip )
	{
		window->SetToolTip( ptooltip->GetValueAsString() );
	}
}
Пример #3
0
void VisualEditor::SetupAui( PObjectBase obj, wxWindow* window )
{
    wxAuiPaneInfo info;

    // check whether the object contains AUI info...
    if( !obj->GetProperty( wxT("aui_name") ) ) return;

    wxString name = obj->GetPropertyAsString( wxT("aui_name") );
    if( name != wxT("") ) info.Name( name );

    if( obj->GetPropertyAsInteger( wxT("center_pane") )) info.CenterPane();
    if( obj->GetPropertyAsInteger( wxT("default_pane") )) info.DefaultPane();

    if( !obj->IsNull(wxT("caption"))) info.Caption(obj->GetPropertyAsString(wxT("caption")));
    info.CaptionVisible( obj->GetPropertyAsInteger( wxT("caption_visible") ) );
    info.CloseButton( obj->GetPropertyAsInteger( wxT("close_button") ) );
    info.MaximizeButton( obj->GetPropertyAsInteger( wxT("maximize_button") ) );
    info.MinimizeButton( obj->GetPropertyAsInteger( wxT("minimize_button") ) );
    info.PinButton( obj->GetPropertyAsInteger( wxT("pin_button") ) );
    info.PaneBorder( obj->GetPropertyAsInteger( wxT("pane_border") ) );
    info.Gripper(obj->GetPropertyAsInteger( wxT("gripper") ));

    info.BottomDockable( obj->GetPropertyAsInteger( wxT("BottomDockable") ) );
    info.TopDockable( obj->GetPropertyAsInteger( wxT("TopDockable") ) );
    info.LeftDockable( obj->GetPropertyAsInteger( wxT("LeftDockable") ) );
    info.RightDockable( obj->GetPropertyAsInteger( wxT("RightDockable") ) );

    if( !obj->IsNull(wxT("dock")) )
    {
        if( obj->GetPropertyAsString( wxT("dock") ) == wxT("Dock"))
        {
            info.Dock();
            if( !obj->IsNull(wxT("docking")) )
            {
                if( obj->GetPropertyAsString(wxT("docking")) == wxT("Bottom") ) info.Bottom();
                else if( obj->GetPropertyAsString(wxT("docking")) == wxT("Top") ) info.Top();
                else if( obj->GetPropertyAsString(wxT("docking")) == wxT("Center") ) info.Center();
                else if( obj->GetPropertyAsString(wxT("docking")) == wxT("Right") ) info.Right();
            }
        }
        else
        {
            info.Float();
            info.FloatingPosition( obj->GetPropertyAsPoint( wxT("pane_position") ) );
        }
    }

    if( !obj->IsNull(wxT("resize")) )
    {
        if( obj->GetPropertyAsString( wxT("resize") ) == wxT("Resizable")) info.Resizable();
        else info.Fixed();
    }

    info.DockFixed( obj->GetPropertyAsInteger( wxT("dock_fixed") ) );
    info.Movable( obj->GetPropertyAsInteger( wxT("moveable") ));
    info.Floatable(obj->GetPropertyAsInteger( wxT("floatable") ));

    if( !obj->GetProperty( wxT("pane_size" ) )->IsNull() ) info.FloatingSize( obj->GetPropertyAsSize( wxT("pane_size") ));
    if( !obj->GetProperty( wxT("best_size" ) )->IsNull() ) info.BestSize( obj->GetPropertyAsSize( wxT("best_size") ) );
    if( !obj->GetProperty( wxT("min_size" ) )->IsNull() ) info.MinSize( obj->GetPropertyAsSize( wxT("min_size") ) );
    if( !obj->GetProperty( wxT("max_size" ) )->IsNull() ) info.MaxSize( obj->GetPropertyAsSize( wxT("max_size") ) );

    if( obj->GetPropertyAsInteger( wxT("toolbar_pane") ) ) info.ToolbarPane();
    if( !obj->IsNull( wxT("aui_position") ) ) info.Position( obj->GetPropertyAsInteger( wxT("aui_position") ));
    if( !obj->IsNull( wxT("aui_row") ) ) info.Row( obj->GetPropertyAsInteger( wxT("aui_row") ));
    if( !obj->IsNull( wxT("aui_layer") ) ) info.Layer( obj->GetPropertyAsInteger( wxT("aui_layer") ));
    if( !obj->GetPropertyAsInteger( wxT("show") ) ) info.Hide();

    m_auimgr->AddPane( window, info );
}
Пример #4
0
void VisualEditor::SetupWindow( PObjectBase obj, wxWindow* window )
{
    // All of the properties of the wxWindow object are applied in this function

    // Position
    /* Position does nothing in wxFB - this is pointless
    wxPoint pos;
    PProperty ppos = obj->GetProperty( wxT("pos") );
    if ( ppos )
    {
    	pos = TypeConv::StringToPoint( ppos->GetValue() );
    }
    */

    // Size
    wxSize size = obj->GetPropertyAsSize( wxT("size") );
    if ( size != wxDefaultSize )
    {
        window->SetSize( size );
    }

    // Minimum size
    wxSize minsize = obj->GetPropertyAsSize( wxT("minimum_size") );
    if ( minsize != wxDefaultSize )
    {
        window->SetMinSize( minsize );
    }

    // Maximum size
    wxSize maxsize = obj->GetPropertyAsSize( wxT("maximum_size") );
    if ( maxsize != wxDefaultSize )
    {
        window->SetMaxSize( maxsize );
    }

    // Font
    PProperty pfont = obj->GetProperty( wxT("font") );
    if ( pfont && !pfont->GetValue().empty() )
    {
        window->SetFont( TypeConv::StringToFont( pfont->GetValue() ) );
    }

    // Foreground
    PProperty pfg_colour = obj->GetProperty( wxT("fg") );
    if ( pfg_colour && !pfg_colour->GetValue().empty() )
    {
        window->SetForegroundColour( TypeConv::StringToColour( pfg_colour->GetValue() ) );
    }

    // Background
    PProperty pbg_colour = obj->GetProperty( wxT("bg") );
    if ( pbg_colour && !pbg_colour->GetValue().empty() )
    {
        window->SetBackgroundColour( TypeConv::StringToColour( pbg_colour->GetValue() ) );
    }

    // Extra Style
    PProperty pextra_style = obj->GetProperty( wxT("window_extra_style") );
    if ( pextra_style )
    {
        window->SetExtraStyle( TypeConv::StringToInt( pextra_style->GetValue() ) );
    }

    // Enabled
    PProperty penabled = obj->GetProperty( wxT("enabled") );
    if ( penabled )
    {
        window->Enable( ( penabled->GetValueAsInteger() !=0 ) );
    }

    // Hidden
    PProperty phidden = obj->GetProperty( wxT("hidden") );
    if ( phidden )
    {
        window->Show( !phidden->GetValueAsInteger() );
    }

    // Tooltip
    PProperty ptooltip = obj->GetProperty( wxT("tooltip") );
    if ( ptooltip )
    {
        window->SetToolTip( ptooltip->GetValueAsString() );
    }

    //AUI
    wxString tname = obj->GetObjectInfo()->GetObjectType()->GetName();
    if( m_auimgr && ( tname == wxT("widget") ||
                      tname == wxT("expanded_widget") ||
                      tname == wxT("container") ||
                      tname == wxT("notebook") ||
                      tname == wxT("auinotebook") ||
                      tname == wxT("choicebook") ||
                      tname == wxT("treelistctrl") ||
                      tname == wxT("splitter") ) )
    {
        if( obj->GetParent()->GetObjectTypeName() == wxT("form") )
        {
            SetupAui(obj, window);
        }
    }
    // Wizard
    else if ( obj->GetParent()->GetObjectTypeName() == wxT("wizard") )
    {
        SetupWizard( obj, window, true );
    }
}