void MyFrame::DropInSomeBars( int layoutNo ) { /* create once... and forget! */ // setup dimension infos for various bar shapes int cbWidth = 90; int cbHeight = 30; if ( layoutNo == SECOND_LAYOUT ) cbHeight = 60; wxFrameLayout& layout = *mLayouts[layoutNo]; cbDimInfo sizes( cbWidth,cbHeight, // when docked horizontally cbWidth,cbHeight, // when docked vertically cbWidth,cbHeight, // when floated true // true - bar is fixed-size ); cbWidth = 120; cbDimInfo sizes1( cbWidth,cbHeight, cbWidth,cbHeight, cbWidth,cbHeight, false ); // false - bar is "flexible" cbWidth = 120; cbHeight = 40; cbDimInfo sizes3( cbWidth,cbHeight, cbWidth,cbHeight, cbWidth,cbHeight, true ); // -/- cbWidth = 200; cbHeight = 150; cbDimInfo sizes4( cbWidth,cbHeight, cbWidth,cbHeight, cbWidth,cbHeight, false ); // -/- cbWidth = 63; cbHeight = 31; cbDimInfo sizes5( cbWidth,cbHeight, cbHeight,cbWidth, cbWidth,cbHeight, true, 3, // vertical gap (bar border) 3 // horizontal gap (bar border) ); // -/- if ( layoutNo == FIRST_LAYOUT ) { // add 4 fixed-size bars (`sizes' dim-info) and one "flexible" (with `sizes1' dim-info) wxWindow* pGreenOne = new MyTestPanel(mpInternalFrm); pGreenOne->SetBackgroundColour( wxColour(128,255,128) ); layout.AddBar( pGreenOne, sizes, FL_ALIGN_TOP, 0, 50, wxT("Bar1"), true ); layout.AddBar( new MyTestPanel(mpInternalFrm), sizes, FL_ALIGN_TOP, 2, 50, wxT("Bar2"), true ); layout.AddBar( new MyTestPanel(mpInternalFrm), sizes, FL_ALIGN_BOTTOM, 2, 50, wxT("Bar3"), true ); layout.AddBar( new MyTestPanel(mpInternalFrm), sizes, FL_ALIGN_LEFT, 2, 50, wxT("Bar4"), true ); layout.AddBar( new MyTestPanel(mpInternalFrm), sizes1, wxCBAR_HIDDEN, 2, 50, wxT("Super-Bar"), true ); } else { if ( layoutNo == SECOND_LAYOUT ) { // show off various wx-controls in the second layout layout.AddBar( CreateTxtCtrl(), sizes, FL_ALIGN_TOP, 0, 50, wxT("Fixed text Area&0") ); layout.AddBar( CreateButton(wxT("OK")), sizes, FL_ALIGN_TOP, 0, 100, wxT("First Button") ); layout.AddBar( CreateTxtCtrl(), sizes1, FL_ALIGN_BOTTOM, 0, 50, wxT("First Tree") ); layout.AddBar( CreateTreeCtrl(wxT("Root")), sizes1, FL_ALIGN_LEFT, 0, 0, wxT("TreeCtrl Window") ); layout.AddBar( CreateChoice(wxT("Choice 1")), sizes3, FL_ALIGN_TOP, 0, 0, wxT("Choice 1 (buggy)"), false, wxCBAR_HIDDEN ); layout.AddBar( CreateChoice(wxT("Choice 2")), sizes3, FL_ALIGN_TOP, 0, 0, wxT("Choice 2 (buggy)"), false, wxCBAR_HIDDEN ); layout.AddBar( CreateTreeCtrl(wxT("X-Files")), sizes1, FL_ALIGN_RIGHT, 0, 100, wxT("X-Files") ); layout.AddBar( CreateTxtCtrl(wxT("smaller1")), sizes3, FL_ALIGN_TOP, 0, 50, wxT("smaller Area1") ); layout.AddBar( CreateTxtCtrl(wxT("smaller2")), sizes3, FL_ALIGN_TOP, 0, 50, wxT("sm&ller Area2") ); } else { if ( layoutNo == THIRD_LAYOUT ) { #if defined(__WXGTK__) || defined(__WXX11__) cbCommonPaneProperties props; layout.GetPaneProperties( props ); props.mRealTimeUpdatesOn = false; // real-time OFF for gtk!!! layout.SetPaneProperties( props, wxALL_PANES ); #endif layout.AddBar( CreateTxtCtrl(wxT("Tool1")), sizes3, FL_ALIGN_TOP, 0, 50, wxT("Fixed text Area1") ); layout.AddBar( CreateTxtCtrl(wxT("Tool2")), sizes3, FL_ALIGN_TOP, 0, 50, wxT("Fixed text Area2") ); layout.AddBar( CreateTxtCtrl(wxT("Tool3")), sizes3, FL_ALIGN_TOP, 0, 50, wxT("Fixed text Area3") ); layout.AddBar( CreateTxtCtrl(wxT("Tool4")), sizes3, FL_ALIGN_TOP, 1, 50, wxT("Fixed text Area4") ); layout.AddBar( CreateTxtCtrl(wxT("Tool5")), sizes3, FL_ALIGN_TOP, 1, 50, wxT("Fixed text Area5") ); layout.AddBar( CreateTxtCtrl(wxT("Tool6")), sizes3, FL_ALIGN_TOP, 1, 50, wxT("Fixed text Area6") ); layout.AddBar( CreateTxtCtrl(wxT("Tool7")), sizes3, FL_ALIGN_TOP, 2,250, wxT("Fixed text Area7") ); cbDimInfo sizes10( 175,35, // when docked horizontally 175,38, // when docked vertically 170,35, // when floated true, // the bar is not fixed-size 4, // vertical gap (bar border) 4, // horizontal gap (bar border) new cbDynToolBarDimHandler() ); wxDynamicToolBar* pToolBar = new wxDynamicToolBar(); pToolBar->Create( mpInternalFrm, wxID_ANY ); // 1001-1006 ids of command events fired by added tool-buttons pToolBar->AddTool( 1001, wxString(wxT(BMP_DIR)) + wxT("new.bmp") ); pToolBar->AddTool( 1002, wxString(wxT(BMP_DIR)) + wxT("open.bmp") ); pToolBar->AddTool( 1003, wxString(wxT(BMP_DIR)) + wxT("save.bmp") ); pToolBar->AddTool( 1004, wxString(wxT(BMP_DIR)) + wxT("cut.bmp") ); pToolBar->AddTool( 1005, wxString(wxT(BMP_DIR)) + wxT("copy.bmp") ); pToolBar->AddTool( 1006, wxString(wxT(BMP_DIR)) + wxT("paste.bmp") ); layout.AddBar( pToolBar, // bar window (can be NULL) sizes10, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc) 0, // insert into 0th row (vert. position) 0, // offset from the start of row (in pixels) wxT("Real-Toolbar"), // name to refere in customization pop-ups false ); // create first "developement" layout AddSearchToolbars( layout, mpInternalFrm); wxWindow* pSheet3 = CreateDevLayout( layout, mpInternalFrm); // create another ***secreat developement*** layout inside // the third sheet of the outter one's output bar mpNestedLayout = new wxFrameLayout( pSheet3, CreateTxtCtrl(wxT("\"Mobils in Mobile\" --C.Nemo"),pSheet3), false ); CreateDevLayout( *mpNestedLayout, pSheet3 ); mpNestedLayout->Activate(); } } } }
MyFrame::MyFrame(wxFrame *frame) : wxFrame( frame, wxID_ANY, _("wxWidgets 2.0 wxFrameLayout Test Application"), wxDefaultPosition, wxSize( 700, 500 ), wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION, wxT("freimas") ) { mpClientWnd = CreateTextCtrl( _("Client window") ); mpLayout = new wxFrameLayout( this, mpClientWnd ); #if defined(__WXGTK__) || defined(__WXX11__) cbCommonPaneProperties props; mpLayout->GetPaneProperties( props ); props.mRealTimeUpdatesOn = false; // real-time OFF!!! mpLayout->SetPaneProperties( props, wxALL_PANES ); #endif mpLayout->SetUpdatesManager( new cbGCUpdatesMgr() ); // this is now default... //mpLayout->SetMargins( 1,1,1,1 ); // gaps for vertical/horizontal/right/left panes // setup plugins for testing mpLayout->PushDefaultPlugins(); mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // fancy "X"es and bevel for bars mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) ); mpLayout->AddPlugin( CLASSINFO( cbRowDragPlugin ) ); mpLayout->AddPlugin( CLASSINFO( cbAntiflickerPlugin ) ); mpLayout->AddPlugin( CLASSINFO( cbSimpleCustomizationPlugin ) ); // drop in some bars cbDimInfo sizes0( 200,45, // when docked horizontally 200,85, // when docked vertically 175,35, // when floated false, // the bar is not fixed-size 4, // vertical gap (bar border) 4 // horizontal gap (bar border) ); cbDimInfo sizes1( 150,35, // when docked horizontally 150,85, // when docked vertically 175,35, // when floated true, // the bar is not fixed-size 4, // vertical gap (bar border) 4 // horizontal gap (bar border) ); cbDimInfo sizes2( 195,35, // when docked horizontally 185,37, // when docked vertically 195,35, // when floated true, // the bar is not fixed-size 4, // vertical gap (bar border) 4, // horizontal gap (bar border) new cbDynToolBarDimHandler() ); mpLayout->AddBar( CreateTextCtrl(_("Hello")), // bar window sizes0, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc) 0, // insert into 0th row (vert. position) 0, // offset from the start of row (in pixels) _("InfoViewer1"), // name to refer in customization pop-ups true ); mpLayout->AddBar( CreateTextCtrl(_("Bye")), // bar window sizes0, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc) 1, // insert into 0th row (vert. position) 0, // offset from the start of row (in pixels) _("InfoViewer2"), // name to refer in customization pop-ups true ); mpLayout->AddBar( CreateTextCtrl(_("Fixed0")), // bar window sizes1, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc) 0, // insert into 0th row (vert. position) 0, // offset from the start of row (in pixels) _("ToolBar1"), // name to refer in customization pop-ups true ); wxDynamicToolBar* pToolBar = new wxDynamicToolBar(); pToolBar->Create( this, wxID_ANY ); // 1001-1006 ids of command events fired by added tool-buttons pToolBar->AddTool( 1001, wxString(wxT(BMP_DIR)) + wxT("new.bmp") ); pToolBar->AddSeparator(); pToolBar->AddTool( 1002, wxString(wxT(BMP_DIR)) + wxT("open.bmp") ); pToolBar->AddTool( 1003, wxString(wxT(BMP_DIR)) + wxT("save.bmp") ); #if wxUSE_STATLINE pToolBar->AddSeparator(new wxMySeparatorLine(pToolBar, wxID_ANY)); #endif // wxUSE_STATLINE pToolBar->AddTool( 1004, wxString(wxT(BMP_DIR)) + wxT("cut.bmp") ); pToolBar->AddTool( 1005, wxString(wxT(BMP_DIR)) + wxT("copy.bmp") ); pToolBar->AddTool( 1006, wxString(wxT(BMP_DIR)) + wxT("paste.bmp") ); mpLayout->AddBar( pToolBar, // bar window (can be NULL) sizes2, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc) 0, // insert into 0th row (vert. position) 0, // offset from the start of row (in pixels) wxT("ToolBar2"), // name to refer in customization pop-ups false ); mpLayout->EnableFloating( true ); // off, thinking about wxGtk... }