1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     Contrib. demo 
   4 // Author:      Aleksandras Gluchovas 
   5 // Modified by: Sebastian Haase (June 21, 2001) 
   8 // Copyright:   (c) Aleksandras Gluchovas 
   9 // Licence:     wxWindows license 
  10 ///////////////////////////////////////////////////////////////////////////// 
  13 #pragma implementation "fl_demo2.h" 
  16 // For compilers that support precompilation, includes "wx/wx.h". 
  17 #include "wx/wxprec.h" 
  28 #include "wx/treectrl.h" 
  29 #include "wx/imaglist.h" 
  30 #include "wx/notebook.h" 
  33 #include "wx/fl/controlbar.h" 
  34 #include "wx/fl/rowlayoutpl.h" 
  35 #include "wx/fl/antiflickpl.h" 
  36 #include "wx/fl/bardragpl.h" 
  37 #include "wx/fl/cbcustom.h" 
  38 #include "wx/fl/rowdragpl.h" 
  40 // some extra fl plugins. 
  41 #include "wx/fl/barhintspl.h" 
  42 #include "wx/fl/hintanimpl.h" 
  44 #include "wx/fl/dyntbar.h" 
  45 #include "wx/fl/dyntbarhnd.h"  // fl-dimension-handler for dynamic toolbar 
  49 /***** Implementation for class MyApp *****/ 
  51 // Create a new application object 
  54 // `Main program' equivalent, creating windows and returning main app frame 
  55 bool MyApp::OnInit(void) 
  57     // Create the main frame window 
  58     MyFrame 
*frame 
= new MyFrame(NULL
, _("wxWidgets 2.0 wxFrameLayout demo"), 50, 50, 650, 540); 
  62     frame
->SetIcon(wxIcon(wxT("mondrian"))); 
  65     frame
->SetIcon(wxIcon(wxT("aiai.xbm"))); 
  69     wxMenu 
*file_menu 
= new wxMenu
; 
  70     wxMenu 
*active_menu 
= new wxMenu
; 
  72     file_menu
->Append( ID_LOAD
,  _("&Load layouts")  ); 
  73     file_menu
->Append( ID_STORE
, _("&Store layouts") ); 
  74     file_menu
->AppendSeparator(); 
  76     file_menu
->Append( ID_AUTOSAVE
, _("&Auto Save Layouts"), _("save layouts on exit"), wxITEM_CHECK 
); 
  77     file_menu
->AppendSeparator(); 
  79     file_menu
->Append(MINIMAL_ABOUT
, _("A&bout !")); 
  80     file_menu
->Append(MINIMAL_QUIT
, _("E&xit\tTab")); 
  82     //active_menu->Append( ID_SETTINGS, _("&Settings...\tCtrl") ); 
  83     //active_menu->AppendSeparator(); 
  85     active_menu
->Append( ID_REMOVE
,    _("&Remove Active") ); 
  86     active_menu
->Append( ID_REMOVEALL
, _("Remove &All") ); 
  87     active_menu
->Append( ID_RECREATE
,  _("Re&create") ); 
  88     active_menu
->AppendSeparator(); 
  90     active_menu
->Append( ID_FIRST
,  _("Activate f&irst layout \tF1"), _("activate it"), wxITEM_CHECK 
); 
  91     active_menu
->Append( ID_SECOND
, _("Activate &second layout\tF2"), _("activate it"),  wxITEM_CHECK 
); 
  92     active_menu
->Append( ID_THIRD
,  _("Activate &third layout\tF3"), _("activate it"),   wxITEM_CHECK 
); 
  94     wxMenuBar 
*menu_bar 
= new wxMenuBar
; 
  96     menu_bar
->Append(file_menu
,   _("&File")); 
  97     menu_bar
->Append(active_menu
, _("Active &Layout")); 
  99     frame
->CreateStatusBar(3); 
 101     frame
->SetMenuBar(menu_bar
); 
 103     frame
->SyncMenuBarItems(); 
 115     // frame-layouts is not a windows (objects), thus should 
 116     // be cleaned up manually 
 118     for( int i 
= 0; i 
!= MAX_LAYOUTS
; ++i 
) 
 124     if ( mpNestedLayout   
) 
 125         delete mpNestedLayout
; 
 126     if ( mpAboutBoxLayout 
) 
 127         delete mpAboutBoxLayout
; 
 130 /***** Implementation for class MyFrame *****/ 
 132 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
) 
 133     EVT_MENU( MINIMAL_QUIT
,  MyFrame::OnQuit  
) 
 134     EVT_MENU( MINIMAL_ABOUT
, MyFrame::OnAbout 
) 
 136     EVT_MENU( ID_LOAD
,      MyFrame::OnLoad      
) 
 137     EVT_MENU( ID_STORE
,     MyFrame::OnStore     
) 
 138     EVT_MENU( ID_AUTOSAVE
,  MyFrame::OnAutoSave  
) 
 139     //EVT_MENU( ID_SETTINGS,  MyFrame::OnSettings  ) 
 140     EVT_MENU( ID_REMOVE
,    MyFrame::OnRemove    
) 
 141     EVT_MENU( ID_REMOVEALL
, MyFrame::OnRemoveAll 
) 
 142     EVT_MENU( ID_RECREATE
,  MyFrame::OnRecreate  
) 
 143     EVT_MENU( ID_FIRST
,     MyFrame::OnFirst     
) 
 144     EVT_MENU( ID_SECOND
,    MyFrame::OnSecond    
) 
 145     EVT_MENU( ID_THIRD
,     MyFrame::OnThird     
) 
 147     EVT_BUTTON( ID_SAY_ITSOK
, MyFrame::OnSayItsOk 
) 
 148     EVT_BUTTON( ID_BTN_YES
,   MyFrame::OnBtnYes 
) 
 149     EVT_BUTTON( ID_BTN_NO
,    MyFrame::OnBtnNo 
) 
 150     EVT_BUTTON( ID_BTN_ESC
,   MyFrame::OnBtnEsc 
) 
 152     EVT_CHAR_HOOK( MyFrame::OnChar 
) 
 155 // My frame constructor 
 157 MyFrame::MyFrame(wxFrame 
*frame
, const wxChar 
*title
, int x
, int y
, int w
, int h
) 
 158     : wxFrame(frame
, wxID_ANY
, title
, wxPoint(x
, y
), wxSize(w
, h
)), 
 159     mpNestedLayout( NULL 
), 
 160     mpAboutBoxLayout( NULL 
), 
 162     mActiveLayoutNo( FIRST_LAYOUT 
), 
 164     mSavedAlready( false ), 
 165     mpClntWindow( NULL 
), 
 167     mImageList( 16,16, false, 2 ) 
 171     mpInternalFrm 
= (wxPanel
*)this; 
 173     mAboutBox
.Create( this, wxID_ANY
,  _T("About box in wxWidgets style..."), 
 176                       wxDEFAULT_DIALOG_STYLE 
| wxTAB_TRAVERSAL 
); 
 178     for( i 
= 0; i 
!= MAX_LAYOUTS
; ++i 
) 
 181     // image-list is one of the few objects which 
 182     // currently cannot be serialized, create it first 
 183     // and use it as initial reference (IR) 
 187     if ( wxFileExists( wxString(wxT(BMP_DIR
)) + wxT("folder_icon.bmp") ) ) 
 188         bmp1
.LoadFile( wxString(wxT(BMP_DIR
)) + wxT("folder_icon.bmp"), wxBITMAP_TYPE_BMP 
); 
 190     if ( wxFileExists( wxString(wxT(BMP_DIR
)) + wxT("class_icon1.bmp") ) ) 
 191         bmp2
.LoadFile( wxString(wxT(BMP_DIR
)) + wxT("class_icon1.bmp"), wxBITMAP_TYPE_BMP 
); 
 193     mImageList
.Add( bmp1 
); 
 194     mImageList
.Add( bmp2 
); 
 198     // create multiple layouts 
 202     mpClntWindow 
= CreateTxtCtrl(wxT("client window")); 
 204     // Create all layouts 
 205     for( i 
= 0; i 
!= MAX_LAYOUTS
; ++i 
) 
 210     for( i 
= SECOND_LAYOUT
; i 
!= MAX_LAYOUTS
; ++i 
) 
 212         mLayouts
[i
]->HideBarWindows(); 
 215     // activate first one 
 216     mLayouts
[FIRST_LAYOUT
]->Activate(); 
 217     mActiveLayoutNo 
= FIRST_LAYOUT
; 
 220 /*** event handlers ***/ 
 222 bool MyFrame::OnClose(void) 
 224     //  USEFUL TRICK:: avoids flickering of application's frame 
 225     //                 when closing NN windows on exit: 
 229     if ( (mAutoSave 
&& mSavedAlready
) || !mAutoSave 
) 
 244 void MyFrame::OnLoad( wxCommandEvent
& WXUNUSED(event
) ) 
 246     wxMessageBox(_("Hey - you found a BIG question-mark !!")); 
 249 void MyFrame::OnStore( wxCommandEvent
& WXUNUSED(event
) ) 
 251     wxMessageBox(_("Hey - you found another BIG question-mark !!")); 
 254 void MyFrame::OnAutoSave( wxCommandEvent
& WXUNUSED(event
) ) 
 256     mAutoSave 
= !mAutoSave
; 
 264 void MyFrame::OnRemove( wxCommandEvent
& WXUNUSED(event
) ) 
 266     RemoveLayout( mActiveLayoutNo 
); 
 271 void MyFrame::OnRemoveAll( wxCommandEvent
& WXUNUSED(event
) ) 
 273     for( int i 
= 0; i 
!= MAX_LAYOUTS
; ++i 
) 
 282 void MyFrame::OnRecreate( wxCommandEvent
& event 
) 
 284     OnRemove( event 
); // first destroy active layout 
 286     CreateLayout( mActiveLayoutNo 
); 
 288     mLayouts
[mActiveLayoutNo
]->Activate(); 
 291 void MyFrame::OnFirst( wxCommandEvent
& WXUNUSED(event
) ) 
 293     ActivateLayout( FIRST_LAYOUT 
); 
 296 void MyFrame::OnSecond( wxCommandEvent
& WXUNUSED(event
) ) 
 298     ActivateLayout( SECOND_LAYOUT 
); 
 301 void MyFrame::OnThird( wxCommandEvent
& WXUNUSED(event
) ) 
 303     ActivateLayout( THIRD_LAYOUT 
); 
 306 void MyFrame::OnQuit( wxCommandEvent
& WXUNUSED(event
) ) 
 308     //  USEFUL TRICK:: avoids flickering of application's frame 
 309     //                 when closing NN windows on exit: 
 313     if ( (mAutoSave 
&& mSavedAlready
) || !mAutoSave 
) 
 325 void MyFrame::OnAbout( wxCommandEvent
& WXUNUSED(event
) ) 
 329     font
.SetFaceName(wxT("MS Sans Serif")); 
 331     font
.SetFamily( wxSWISS 
); 
 334     font
.SetStyle( wxSLANT 
); 
 335     font
.SetWeight( wxNORMAL 
); 
 336     font
.SetPointSize( 8 ); 
 339     font
.RealizeResource(); 
 342     mAboutBox
.Center( wxBOTH 
); 
 343     mAboutBox
.Show(true); 
 347 void MyFrame::OnChar( wxKeyEvent
& event 
) 
 351     if ( event
.m_keyCode 
== WXK_F1 
) 
 357         if ( event
.m_keyCode 
== WXK_F2 
) 
 363             if ( event
.m_keyCode 
== WXK_F3 
) 
 367             if ( event
.m_keyCode 
== WXK_F4 
&& !event
.AltDown() ) 
 370                 wxMessageBox(_("There are only 3 layouts in this demo :-(")); 
 374                 if ( event
.m_keyCode 
== WXK_TAB 
) 
 376                     //  USEFUL TRICK:: avoids flickering of application's frame 
 377                     //                 when closing NN windows on exit: 
 381                     if ( (mAutoSave 
&& mSavedAlready
) || !mAutoSave 
) 
 401 void MyFrame::OnSayItsOk( wxCommandEvent
& WXUNUSED(event
) ) 
 403     wxMessageBox(_("It's OK  :-)\n\n now click on the border around the button\n and try dragging it!") ); 
 406 void MyFrame::OnBtnYes( wxCommandEvent
& WXUNUSED(event
) ) 
 408     mAboutBox
.Show(false); 
 411 void MyFrame::OnBtnNo( wxCommandEvent
& WXUNUSED(event
) ) 
 413     mAboutBox
.Show(false); 
 416 void MyFrame::OnBtnEsc( wxCommandEvent
& WXUNUSED(event
) ) 
 418     mAboutBox
.Show(false); 
 421 /*** helper methods ***/ 
 423 void MyFrame::InitAboutBox() 
 425     wxPanel
* pArea 
= new wxPanel(); 
 427     pArea
->Create( &mAboutBox
, wxID_ANY 
); 
 429     new wxStaticText(pArea
, wxID_ANY
, _("This is wxFrameLayout contribution demo."), 
 432     new wxStaticText(pArea
, wxID_ANY
, _("Aleksandras Gluchovas (c) 1998"), 
 435     new wxStaticText(pArea
, wxID_ANY
, _("<mailto:alex@soften.ktu.lt>"), 
 438     mpAboutBoxLayout 
= new wxFrameLayout( &mAboutBox
, pArea
, true ); 
 440     wxFrameLayout
& layout 
= *mpAboutBoxLayout
; 
 442     cbDimInfo 
sizes( 90,40,     // when docked horizontally 
 443                      45,55,     // when docked vertically 
 444                      90,40,     // when floated 
 445                      true, 4, 4 // true - bar is fixed-size 
 449     wxButton
* pYes 
= CreateButton(_("&Yes"),   &mAboutBox
, ID_SAY_ITSOK 
); 
 450     wxButton
* pNo  
= CreateButton(_("&No"),    &mAboutBox
, ID_BTN_NO 
); 
 451     wxButton
* pEsc 
= CreateButton(_("Cancel"), &mAboutBox
, ID_BTN_ESC 
); 
 453     layout
.AddBar( pEsc
, sizes
,  FL_ALIGN_BOTTOM
, 0, 20, _("cancel button")); 
 454     layout
.AddBar( pNo
,  sizes
,  FL_ALIGN_BOTTOM
, 0, 20, _("no button")); 
 455     layout
.AddBar( pYes
, sizes
,  FL_ALIGN_BOTTOM
, 0, 20, _("yes button")); 
 457     layout
.mBorderPen
.SetColour( 192, 192, 192 ); 
 458     layout
.SetMargins( 15, 15, 15, 15, wxALL_PANES 
); 
 460     cbCommonPaneProperties props
; 
 462     layout
.GetPaneProperties( props
, FL_ALIGN_TOP 
); 
 464     props
.mShow3DPaneBorderOn 
= false; 
 466     layout
.SetPaneProperties( props
, wxALL_PANES 
); 
 474 wxTextCtrl
* MyFrame::CreateTxtCtrl( const wxString
& txt
, wxWindow
* parent 
) 
 476     return new wxTextCtrl( (parent 
!= NULL 
) ? parent 
: mpInternalFrm
, 
 477                             wxID_ANY
, txt
, wxDefaultPosition
, wxDefaultSize
, 
 481 wxButton
* MyFrame::CreateButton( const wxString
& label
, 
 482                                 wxWindow
* pParent
, long id 
) 
 484     return new wxButton( (pParent
)?pParent 
: mpInternalFrm
, id
, 
 485                             label
, wxPoint( 0,0 ), wxSize( 0,0 ) ); 
 488 wxTreeCtrl
* MyFrame::CreateTreeCtrl( const wxString
& label 
) 
 490     wxTreeCtrl
* pTree 
= new wxTreeCtrl( mpInternalFrm
, wxID_ANY 
); 
 492     const wxTreeItemId rootid 
= pTree
->AppendItem( (long)0, label
, 0); 
 494     if ( label
[0] != 'X' ) 
 496         pTree
->AppendItem(rootid
, _("Leaf1"), 0); 
 497         pTree
->AppendItem(rootid
, _("Leaf2"), 0); 
 501         pTree
->AppendItem(rootid
, _("Scully"), 0); 
 502         pTree
->AppendItem(rootid
, _("Mulder"), 0); 
 508 wxChoice
* MyFrame::CreateChoice( const wxString
& txt 
) 
 510     wxString choice_strings
[5]; 
 512     choice_strings
[0] = txt
; 
 513     choice_strings
[1] = _("Julian"); 
 514     choice_strings
[2] = _("Hattie"); 
 515     choice_strings
[3] = _("Ken"); 
 516     choice_strings
[4] = _("Dick"); 
 518     wxChoice 
*choice 
= new wxChoice( mpInternalFrm
, 301, wxDefaultPosition
, 
 519                                         wxDefaultSize
, 5, choice_strings
); 
 521     choice
->SetSelection(0); 
 528 void MyFrame::AddSearchToolbars( wxFrameLayout
& layout
, wxWindow
* WXUNUSED(pParent
) ) 
 530     cbDimInfo 
sizes2( 275,38,   // when docked horizontally 
 531                       45,275,   // when docked vertically 
 532                       80,30,    // when floated 
 533                       true,     // the bar is fixed-size 
 534                       4,        // vertical gap (bar border) 
 535                       4,        // horizontal gap (bar border) 
 536                       new cbDynToolBarDimHandler() 
 539     cbDimInfo 
sizes3( 275,55,   // when docked horizontally 
 540                       275,60,   // when docked vertically 
 541                       45,130,   // when floated 
 542                       true,     // the bar is fixed-size 
 543                       4,        // vertical gap (bar border) 
 544                       4,        // horizontal gap (bar border) 
 545                       new cbDynToolBarDimHandler() 
 548     cbDimInfo 
sizes4( 430,35,   // when docked horizontally 
 549                       44,375,   // when docked vertically 
 550                       80,100,   // when floated 
 551                       true,     // the bar is fixed-size 
 552                       4,        // vertical gap (bar border) 
 553                       4,        // horizontal gap (bar border) 
 554                       new cbDynToolBarDimHandler() 
 557     wxDynamicToolBar
* pTBar2 
= new wxDynamicToolBar( mpInternalFrm
, wxID_ANY 
); 
 559     wxChoice
* pChoice 
= new wxChoice( pTBar2
, wxID_ANY
, wxDefaultPosition
, wxSize( 140,25 ) ); 
 561     pTBar2
->AddTool( 1, pChoice 
); 
 562     pTBar2
->AddTool( 2, wxString(wxT(BMP_DIR
)) + wxT("search.bmp") ); 
 563     //pTBar2->AddSeparator(); 
 564     pTBar2
->AddTool( 3, wxString(wxT(BMP_DIR
)) + wxT("bookmarks.bmp") ); 
 565     pTBar2
->AddTool( 4, wxString(wxT(BMP_DIR
)) + wxT("nextmark.bmp") ); 
 566     pTBar2
->AddTool( 5, wxString(wxT(BMP_DIR
)) + wxT("prevmark.bmp") ); 
 568     wxDynamicToolBar
* pTBar3 
= new wxDynamicToolBar( mpInternalFrm
, wxID_ANY 
); 
 570     pTBar3
->AddTool( 1, wxString(wxT(BMP_DIR
)) + wxT("open.bmp"), wxBITMAP_TYPE_BMP
, wxString(_(" Open ")) ); 
 571     pTBar3
->AddTool( 2, wxString(wxT(BMP_DIR
)) + wxT("save.bmp"), wxBITMAP_TYPE_BMP
, wxString(_(" Save ")) ); 
 572     pTBar3
->AddTool( 3, wxString(wxT(BMP_DIR
)) + wxT("saveall.bmp"), wxBITMAP_TYPE_BMP
, wxString(_(" Save All ")) ); 
 573     //pTBar3->AddSeparator(); 
 574     pTBar3
->AddTool( 4, wxString(wxT(BMP_DIR
)) + wxT("cut.bmp"),   wxBITMAP_TYPE_BMP
, wxString(_(" Open ")) ); 
 575     pTBar3
->AddTool( 5, wxString(wxT(BMP_DIR
)) + wxT("copy.bmp"),  wxBITMAP_TYPE_BMP
, wxString(_(" Copy ")) ); 
 576     pTBar3
->AddTool( 6, wxString(wxT(BMP_DIR
)) + wxT("paste.bmp"), wxBITMAP_TYPE_BMP
, wxString(_(" Paste ")) ); 
 579     pTBar3
->EnableTool( 2, false ); 
 582     wxDynamicToolBar
* pTBar4 
= new wxDynamicToolBar( mpInternalFrm
, wxID_ANY 
); 
 584     pTBar4
->AddTool( 1, wxString(wxT(BMP_DIR
)) + wxT("bookmarks.bmp"), wxBITMAP_TYPE_BMP
, wxString(_("Bookmarks ")), true ); 
 585     pTBar4
->AddTool( 2, wxString(wxT(BMP_DIR
)) + wxT("nextmark.bmp"),  wxBITMAP_TYPE_BMP
, wxString(_("Next bookmark ")), true ); 
 586     pTBar4
->AddTool( 3, wxString(wxT(BMP_DIR
)) + wxT("prevmark.bmp"),  wxBITMAP_TYPE_BMP
, wxString(_("Prev bookmark ")), true ); 
 587     //pTBar4->AddSeparator(); 
 588     pTBar4
->AddTool( 4, wxString(wxT(BMP_DIR
)) + wxT("search.bmp"), wxBITMAP_TYPE_BMP
, wxString(_("Search ")), true ); 
 591     pTBar4
->EnableTool( 4, false ); 
 594     layout
.AddBar( pTBar2
, 
 595                    sizes2
, FL_ALIGN_TOP
, 
 602     layout
.AddBar( pTBar3
, 
 603                    sizes3
, FL_ALIGN_BOTTOM
, 
 610     layout
.AddBar( pTBar4
, 
 611                    sizes4
, FL_ALIGN_BOTTOM
, 
 619 wxWindow
* MyFrame::CreateDevLayout( wxFrameLayout
& layout
, wxWindow
* pParent 
) 
 621     bool isNested 
= (pParent 
!= mpInternalFrm
); 
 623     // check if we're craeting nested layout 
 626         layout
.mBorderPen
.SetColour( 128,255,128 ); 
 628         // if so, than make border smaller 
 629         for( int i 
= 0; i 
!= MAX_PANES
; ++i  
) 
 631             cbDockPane
& pane 
= *layout
.GetPane( i 
); 
 634             pane
.mBottomMargin 
= 5; 
 635             pane
.mLeftMargin   
= 5; 
 636             pane
.mRightMargin  
= 5; 
 641     int cbHeight 
= ( isNested 
) ? 50 : 150; 
 643     cbDimInfo 
sizes4( cbWidth
,cbHeight
, 
 645                       cbWidth
,cbHeight
, false ); 
 650     cbDimInfo 
sizes5( cbWidth
,cbHeight
, 
 652                       cbWidth
,cbHeight
, true, 
 653                       3,                       // vertical gap (bar border) 
 654                       3                        // horizontal gap (bar border) 
 657     // create "workplace" window in the third layout 
 658     // SEB: originally here was a wxpp (wxWorkshop) class demotrated 
 659     //    wxTabbedWindow* pMiniTabArea = new wxTabbedWindow(); 
 660     //    pMiniTabArea->Create( pParent, wxID_ANY ); 
 663     wxTreeCtrl
* pClassView 
= new wxTreeCtrl( pParent
, wxID_ANY
, 
 664                 wxDefaultPosition
, wxDefaultSize
, wxTR_HAS_BUTTONS 
| wxTR_EDIT_LABELS 
); 
 666     pClassView
->SetImageList( &mImageList 
); 
 668     wxTreeItemId rootId 
= pClassView
->AddRoot( wxT("wxWidgets 2.0 classes"), 0 ); 
 670     pClassView
->AppendItem( rootId
, _("wxWin Dynamic classes (grabbed at run-time)"), 0 ); 
 671     pClassView
->AppendItem( rootId
, _("serializer-classes (grabbed at run-time)"),    0 ); 
 673     // now create "output" window 
 674     wxNotebook
* pTabbedArea 
= new wxNotebook(pParent
, wxID_ANY
); 
 675     // SEB: originally here was a wxpp (wxWorkshop) class used 
 676     //    wxPaggedWindow* pTabbedArea = new wxPaggedWindow(); 
 677     //    pTabbedArea->Create( pParent, wxID_ANY ); 
 679     wxPanel
* pSheet3 
= new wxPanel(); 
 680     pSheet3
->Create( pTabbedArea
, wxID_ANY 
); 
 681     pSheet3
->Show(false); 
 683     pTabbedArea
->AddPage( CreateTxtCtrl(wxT("build"), pTabbedArea
), wxT("Build")); 
 684     pTabbedArea
->AddPage( CreateTxtCtrl(wxT("debug"), pTabbedArea
), wxT("Debug")); 
 685     pTabbedArea
->AddPage( pSheet3
, wxT("is THIS recursive - or what !?")); 
 686     pTabbedArea
->AddPage( CreateTxtCtrl(wxT("profile"), pTabbedArea
), wxT("Profile")); 
 688     layout
.AddBar( new StartButton95(pParent
), sizes5
, FL_ALIGN_TOP
, 0, 0, wxT("Start...") ); 
 689     layout
.AddBar( pClassView
, sizes4
, FL_ALIGN_LEFT
, 0, 0, wxT("Project Workplace") ); 
 690     layout
.AddBar( pTabbedArea
, sizes4
, FL_ALIGN_BOTTOM
, 0, 50, wxT("Output") ); 
 695 void MyFrame::DropInSomeBars( int layoutNo 
) 
 697     /* create once... and forget! */ 
 699     // setup dimension infos for various bar shapes 
 704     if ( layoutNo 
== SECOND_LAYOUT 
) 
 707     wxFrameLayout
& layout 
= *mLayouts
[layoutNo
]; 
 709     cbDimInfo 
sizes( cbWidth
,cbHeight
, // when docked horizontally 
 710                      cbWidth
,cbHeight
, // when docked vertically 
 711                      cbWidth
,cbHeight
, // when floated 
 712                      true              // true - bar is fixed-size 
 717     cbDimInfo 
sizes1( cbWidth
,cbHeight
, 
 719                       cbWidth
,cbHeight
, false ); // false - bar is "flexible" 
 724     cbDimInfo 
sizes3( cbWidth
,cbHeight
, 
 726                       cbWidth
,cbHeight
, true ); // -/- 
 731     cbDimInfo 
sizes4( cbWidth
,cbHeight
, 
 733                       cbWidth
,cbHeight
, false ); // -/- 
 738     cbDimInfo 
sizes5( cbWidth
,cbHeight
, 
 740                       cbWidth
,cbHeight
, true, 
 741                       3,                        // vertical gap (bar border) 
 742                       3                         // horizontal gap (bar border) 
 746     if ( layoutNo 
== FIRST_LAYOUT 
) 
 748         // add 4 fixed-size bars (`sizes' dim-info) and one "flexible" (with `sizes1' dim-info) 
 750         wxWindow
* pGreenOne    
= new MyTestPanel(mpInternalFrm
); 
 752         pGreenOne
->SetBackgroundColour( wxColour(128,255,128) ); 
 754         layout
.AddBar( pGreenOne
,                      sizes
,  FL_ALIGN_TOP
,         0, 50, wxT("Bar1"), true ); 
 755         layout
.AddBar( new MyTestPanel(mpInternalFrm
), sizes
,  FL_ALIGN_TOP
,         2, 50, wxT("Bar2"), true ); 
 756         layout
.AddBar( new MyTestPanel(mpInternalFrm
), sizes
,  FL_ALIGN_BOTTOM
,      2, 50, wxT("Bar3"), true ); 
 757         layout
.AddBar( new MyTestPanel(mpInternalFrm
), sizes
,  FL_ALIGN_LEFT
,        2, 50, wxT("Bar4"), true ); 
 758         layout
.AddBar( new MyTestPanel(mpInternalFrm
), sizes1
, wxCBAR_HIDDEN
, 2, 50, wxT("Super-Bar"), true ); 
 762         if ( layoutNo 
== SECOND_LAYOUT 
) 
 764             // show off various wx-controls in the second layout 
 766             layout
.AddBar( CreateTxtCtrl(),                sizes
,  FL_ALIGN_TOP
,    0, 50,  wxT("Fixed text Area&0")     ); 
 767             layout
.AddBar( CreateButton(wxT("OK")),        sizes
,  FL_ALIGN_TOP
,    0, 100, wxT("First Button")    ); 
 768             layout
.AddBar( CreateTxtCtrl(),                sizes1
, FL_ALIGN_BOTTOM
, 0, 50,  wxT("First Tree")  ); 
 769             layout
.AddBar( CreateTreeCtrl(wxT("Root")),    sizes1
, FL_ALIGN_LEFT
,   0, 0,   wxT("TreeCtrl Window") ); 
 770             layout
.AddBar( CreateChoice(wxT("Choice 1")),  sizes3
, FL_ALIGN_TOP
,    0, 0,   wxT("Choice 1 (buggy)"), false, wxCBAR_HIDDEN 
); 
 771             layout
.AddBar( CreateChoice(wxT("Choice 2")),  sizes3
, FL_ALIGN_TOP
,    0, 0,   wxT("Choice 2 (buggy)"), false, wxCBAR_HIDDEN 
); 
 772             layout
.AddBar( CreateTreeCtrl(wxT("X-Files")), sizes1
, FL_ALIGN_RIGHT
,  0, 100, wxT("X-Files") ); 
 773             layout
.AddBar( CreateTxtCtrl(wxT("smaller1")), sizes3
, FL_ALIGN_TOP
,    0, 50,  wxT("smaller Area1")     ); 
 774             layout
.AddBar( CreateTxtCtrl(wxT("smaller2")), sizes3
, FL_ALIGN_TOP
,    0, 50,  wxT("sm&ller Area2")     ); 
 778             if ( layoutNo 
== THIRD_LAYOUT  
) 
 780 #if defined(__WXGTK__) || defined(__WXX11__) 
 781                 cbCommonPaneProperties props
; 
 782                 layout
.GetPaneProperties( props 
); 
 783                 props
.mRealTimeUpdatesOn 
= false; // real-time OFF for gtk!!! 
 784                 layout
.SetPaneProperties( props
, wxALL_PANES 
); 
 787                 layout
.AddBar( CreateTxtCtrl(wxT("Tool1")), sizes3
,  FL_ALIGN_TOP
,  0, 50,  wxT("Fixed text Area1") ); 
 788                 layout
.AddBar( CreateTxtCtrl(wxT("Tool2")), sizes3
,  FL_ALIGN_TOP
,  0, 50,  wxT("Fixed text Area2") ); 
 789                 layout
.AddBar( CreateTxtCtrl(wxT("Tool3")), sizes3
,  FL_ALIGN_TOP
,  0, 50,  wxT("Fixed text Area3") ); 
 790                 layout
.AddBar( CreateTxtCtrl(wxT("Tool4")), sizes3
,  FL_ALIGN_TOP
,  1, 50,  wxT("Fixed text Area4") ); 
 791                 layout
.AddBar( CreateTxtCtrl(wxT("Tool5")), sizes3
,  FL_ALIGN_TOP
,  1, 50,  wxT("Fixed text Area5") ); 
 792                 layout
.AddBar( CreateTxtCtrl(wxT("Tool6")), sizes3
,  FL_ALIGN_TOP
,  1, 50,  wxT("Fixed text Area6") ); 
 793                 layout
.AddBar( CreateTxtCtrl(wxT("Tool7")), sizes3
,  FL_ALIGN_TOP
,  2,250,  wxT("Fixed text Area7") ); 
 795                 cbDimInfo 
sizes10( 175,35, // when docked horizontally 
 796                                    175,38, // when docked vertically 
 797                                    170,35, // when floated 
 798                                    true,   // the bar is not fixed-size 
 799                                    4,      // vertical gap (bar border) 
 800                                    4,      // horizontal gap (bar border) 
 801                                    new cbDynToolBarDimHandler() 
 804                 wxDynamicToolBar
* pToolBar 
= new wxDynamicToolBar(); 
 806                 pToolBar
->Create( mpInternalFrm
, wxID_ANY 
); 
 808                 // 1001-1006 ids of command events fired by added tool-buttons 
 810                 pToolBar
->AddTool( 1001, wxString(wxT(BMP_DIR
)) + wxT("new.bmp") ); 
 811                 pToolBar
->AddTool( 1002, wxString(wxT(BMP_DIR
)) + wxT("open.bmp") ); 
 812                 pToolBar
->AddTool( 1003, wxString(wxT(BMP_DIR
)) + wxT("save.bmp") ); 
 814                 pToolBar
->AddTool( 1004, wxString(wxT(BMP_DIR
)) + wxT("cut.bmp") ); 
 815                 pToolBar
->AddTool( 1005, wxString(wxT(BMP_DIR
)) + wxT("copy.bmp") ); 
 816                 pToolBar
->AddTool( 1006, wxString(wxT(BMP_DIR
)) + wxT("paste.bmp") ); 
 818                 layout
.AddBar( pToolBar
,              // bar window (can be NULL) 
 819                                sizes10
, FL_ALIGN_TOP
, // alignment ( 0-top,1-bottom, etc) 
 820                                0,                     // insert into 0th row (vert. position) 
 821                                0,                     // offset from the start of row (in pixels) 
 822                                wxT("Real-Toolbar"),        // name to refere in customization pop-ups 
 826                 // create first "developement" layout 
 827                 AddSearchToolbars( layout
, mpInternalFrm
); 
 829                 wxWindow
* pSheet3 
= CreateDevLayout( layout
, mpInternalFrm
); 
 831                 // create another ***secreat developement*** layout inside 
 832                 // the third sheet of the outter one's output bar 
 834                 mpNestedLayout 
= new wxFrameLayout( pSheet3
, 
 835                     CreateTxtCtrl(wxT("\"Mobils in Mobile\" --C.Nemo"),pSheet3
), false ); 
 837                 CreateDevLayout( *mpNestedLayout
, pSheet3 
); 
 839                 mpNestedLayout
->Activate(); 
 845 void MyFrame::CreateLayout( int layoutNo 
) 
 847     wxFrameLayout
* pLayout 
= new wxFrameLayout( mpInternalFrm
, mpClntWindow
, false ); 
 849     if ( layoutNo 
== THIRD_LAYOUT 
) 
 851         pLayout
->PushDefaultPlugins(); 
 852         pLayout
->AddPlugin( CLASSINFO( cbBarHintsPlugin 
) ); // facny "X"es and beveal for bars 
 853 #if defined(__WXGTK__) || defined(__WXX11__) 
 854         pLayout
->AddPlugin( CLASSINFO( cbHintAnimationPlugin 
) ); 
 856         pLayout
->AddPlugin( CLASSINFO( cbRowDragPlugin 
) ); 
 859     mLayouts
[layoutNo
] = pLayout
; 
 861     DropInSomeBars( layoutNo 
); 
 864 void MyFrame::RemoveLayout( int layoutNo 
) 
 866     wxFrameLayout
* pLayout 
= mLayouts
[layoutNo
]; 
 871     pLayout
->HideBarWindows(); 
 873     // destroy nested layout first 
 875     if ( layoutNo 
== THIRD_LAYOUT 
) 
 877         if ( mpNestedLayout 
) 
 878             delete mpNestedLayout
; 
 879         mpNestedLayout 
= NULL
; 
 882     // NOTE:: bar windows are NOT destroyed automatically by frame-layout 
 884     pLayout
->DestroyBarWindows(); 
 888     mLayouts
[layoutNo
] = NULL
; 
 893 void MyFrame::SyncMenuBarItems() 
 895     for( int i 
= 0; i 
!= MAX_LAYOUTS
; ++i 
) 
 897         GetMenuBar()->Check( ID_FIRST
+i
,  mActiveLayoutNo 
== FIRST_LAYOUT
+i 
); 
 900     GetMenuBar()->Check( ID_AUTOSAVE
,  mAutoSave  
); 
 903 void MyFrame::ActivateLayout( int layoutNo 
) 
 905     if ( layoutNo 
== mActiveLayoutNo 
) 
 908     if ( mLayouts
[mActiveLayoutNo
] ) 
 909         mLayouts
[mActiveLayoutNo
]->Deactivate(); 
 911     mActiveLayoutNo 
= layoutNo
; 
 913     if ( mLayouts
[mActiveLayoutNo
] ) 
 914         mLayouts
[mActiveLayoutNo
]->Activate(); 
 921 /***** Implementation for class StartButton95 (just for fun) *****/ 
 923 IMPLEMENT_DYNAMIC_CLASS( StartButton95
, wxPanel 
) 
 925 BEGIN_EVENT_TABLE( StartButton95
, wxPanel 
) 
 926     EVT_LEFT_DOWN( StartButton95::OnMouseDown 
) 
 927     EVT_LEFT_UP  ( StartButton95::OnMouseUp   
) 
 928     EVT_PAINT    ( StartButton95::OnPaint     
) 
 931 void StartButton95::OnMouseDown( wxMouseEvent
& WXUNUSED(event
) ) 
 938 void StartButton95::OnMouseUp( wxMouseEvent
& WXUNUSED(event
) ) 
 940     // "this is not a bug" 
 942     SetCursor( wxCURSOR_WAIT 
); 
 943     GetParent()->SetCursor( wxCURSOR_WAIT 
); 
 944     ::wxSetCursor( wxCURSOR_WAIT 
); 
 947     for( int i 
= 1; i 
!= 6; ++i 
) 
 949         m_bPressed 
= (i 
% 2) != 0; 
 953     GetParent()->Close(); 
 954     //*((char*)(i)-3) = 'X'; // Aleks what's the meaning of this??? 
 957 void StartButton95::OnPaint( wxPaintEvent
& WXUNUSED(event
) ) 
 963         if ( !m_PBmp
.Ok() && wxFileExists( wxString(wxT(BMP_DIR
)) + wxT("start95_pr.bmp") ) ) 
 965             m_PBmp
.LoadFile( wxString(wxT(BMP_DIR
)) + wxT("start95_pr.bmp"), wxBITMAP_TYPE_BMP 
); 
 971         if ( !m_DBmp
.Ok() && wxFileExists( wxString(wxT(BMP_DIR
)) + wxT("start95_dp.bmp") ) ) 
 973             m_DBmp
.LoadFile( wxString(wxT(BMP_DIR
)) + wxT("start95_dp.bmp"), wxBITMAP_TYPE_BMP 
); 
 981     mdc
.SelectObject( *pBmp 
); 
 983     dc
.Blit( 0,0, pBmp
->GetWidth(), pBmp
->GetHeight(), &mdc
, 0,0, wxCOPY 
); 
 985     mdc
.SelectObject( wxNullBitmap 
);