Example #1
0
void MyFrame::AddSearchToolbars( wxFrameLayout& layout, wxWindow* WXUNUSED(pParent) )
{
    cbDimInfo sizes2( 275,38,   // when docked horizontally
                      45,275,   // when docked vertically
                      80,30,    // when floated
                      true,     // the bar is fixed-size
                      4,        // vertical gap (bar border)
                      4,        // horizontal gap (bar border)
                      new cbDynToolBarDimHandler()
                    );

    cbDimInfo sizes3( 275,55,   // when docked horizontally
                      275,60,   // when docked vertically
                      45,130,   // when floated
                      true,     // the bar is fixed-size
                      4,        // vertical gap (bar border)
                      4,        // horizontal gap (bar border)
                      new cbDynToolBarDimHandler()
                    );

    cbDimInfo sizes4( 430,35,   // when docked horizontally
                      44,375,   // when docked vertically
                      80,100,   // when floated
                      true,     // the bar is fixed-size
                      4,        // vertical gap (bar border)
                      4,        // horizontal gap (bar border)
                      new cbDynToolBarDimHandler()
                    );

    wxDynamicToolBar* pTBar2 = new wxDynamicToolBar( mpInternalFrm, wxID_ANY );

    wxChoice* pChoice = new wxChoice( pTBar2, wxID_ANY, wxDefaultPosition, wxSize( 140,25 ) );

    pTBar2->AddTool( 1, pChoice );
    pTBar2->AddTool( 2, wxString(wxT(BMP_DIR)) + wxT("search.bmp") );
    //pTBar2->AddSeparator();
    pTBar2->AddTool( 3, wxString(wxT(BMP_DIR)) + wxT("bookmarks.bmp") );
    pTBar2->AddTool( 4, wxString(wxT(BMP_DIR)) + wxT("nextmark.bmp") );
    pTBar2->AddTool( 5, wxString(wxT(BMP_DIR)) + wxT("prevmark.bmp") );

    wxDynamicToolBar* pTBar3 = new wxDynamicToolBar( mpInternalFrm, wxID_ANY );

    pTBar3->AddTool( 1, wxString(wxT(BMP_DIR)) + wxT("open.bmp"), wxBITMAP_TYPE_BMP, wxString(_(" Open ")) );
    pTBar3->AddTool( 2, wxString(wxT(BMP_DIR)) + wxT("save.bmp"), wxBITMAP_TYPE_BMP, wxString(_(" Save ")) );
    pTBar3->AddTool( 3, wxString(wxT(BMP_DIR)) + wxT("saveall.bmp"), wxBITMAP_TYPE_BMP, wxString(_(" Save All ")) );
    //pTBar3->AddSeparator();
    pTBar3->AddTool( 4, wxString(wxT(BMP_DIR)) + wxT("cut.bmp"),   wxBITMAP_TYPE_BMP, wxString(_(" Open ")) );
    pTBar3->AddTool( 5, wxString(wxT(BMP_DIR)) + wxT("copy.bmp"),  wxBITMAP_TYPE_BMP, wxString(_(" Copy ")) );
    pTBar3->AddTool( 6, wxString(wxT(BMP_DIR)) + wxT("paste.bmp"), wxBITMAP_TYPE_BMP, wxString(_(" Paste ")) );

#ifdef __WXMSW__
    pTBar3->EnableTool( 2, false );
#endif

    wxDynamicToolBar* pTBar4 = new wxDynamicToolBar( mpInternalFrm, wxID_ANY );

    pTBar4->AddTool( 1, wxString(wxT(BMP_DIR)) + wxT("bookmarks.bmp"), wxBITMAP_TYPE_BMP, wxString(_("Bookmarks ")), true );
    pTBar4->AddTool( 2, wxString(wxT(BMP_DIR)) + wxT("nextmark.bmp"),  wxBITMAP_TYPE_BMP, wxString(_("Next bookmark ")), true );
    pTBar4->AddTool( 3, wxString(wxT(BMP_DIR)) + wxT("prevmark.bmp"),  wxBITMAP_TYPE_BMP, wxString(_("Prev bookmark ")), true );
    //pTBar4->AddSeparator();
    pTBar4->AddTool( 4, wxString(wxT(BMP_DIR)) + wxT("search.bmp"), wxBITMAP_TYPE_BMP, wxString(_("Search ")), true );

#ifdef __WXMSW__
    pTBar4->EnableTool( 4, false );
#endif

    layout.AddBar( pTBar2,
                   sizes2, FL_ALIGN_TOP,
                   0,
                   0,
                   wxT("Search"),
                   true
                 );

    layout.AddBar( pTBar3,
                   sizes3, FL_ALIGN_BOTTOM,
                   0,
                   0,
                   wxT("Titled"),
                   true
                 );

    layout.AddBar( pTBar4,
                   sizes4, FL_ALIGN_BOTTOM,
                   1,
                   0,
                   wxT("Bookmarks"),
                   true
                 );
}
Example #2
0
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...
}