]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/aui/auidemo.cpp
copy tif_config.h.vc to tif_config.h, this file will be used for all builds not using...
[wxWidgets.git] / samples / aui / auidemo.cpp
index c9036eea9dc9c6edb3755f60f026408f2c7e677b..0e5dc39501c67ec966c05b49c3fe5310c5b8645b 100644 (file)
@@ -269,14 +269,15 @@ class SettingsPanel : public wxPanel
 public:
 
     SettingsPanel(wxWindow* parent, MyFrame* frame)
-            : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
+            : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize),
+              m_frame(frame)
     {
         //wxBoxSizer* vert = new wxBoxSizer(wxVERTICAL);
 
         //vert->Add(1, 1, 1, wxEXPAND);
 
         wxBoxSizer* s1 = new wxBoxSizer(wxHORIZONTAL);
-        m_border_size = new wxSpinCtrl(this, ID_PaneBorderSize, wxEmptyString, wxDefaultPosition, wxSize(50,20));
+        m_border_size = new wxSpinCtrl(this, ID_PaneBorderSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE)), wxDefaultPosition, wxSize(50,20), wxSP_ARROW_KEYS, 0, 100, frame->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE));
         s1->Add(1, 1, 1, wxEXPAND);
         s1->Add(new wxStaticText(this, wxID_ANY, wxT("Pane Border Size:")));
         s1->Add(m_border_size);
@@ -285,7 +286,7 @@ public:
         //vert->Add(s1, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
 
         wxBoxSizer* s2 = new wxBoxSizer(wxHORIZONTAL);
-        m_sash_size = new wxSpinCtrl(this, ID_SashSize, wxEmptyString, wxDefaultPosition, wxSize(50,20));
+        m_sash_size = new wxSpinCtrl(this, ID_SashSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE)), wxDefaultPosition, wxSize(50,20), wxSP_ARROW_KEYS, 0, 100, frame->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE));
         s2->Add(1, 1, 1, wxEXPAND);
         s2->Add(new wxStaticText(this, wxID_ANY, wxT("Sash Size:")));
         s2->Add(m_sash_size);
@@ -294,7 +295,7 @@ public:
         //vert->Add(s2, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
 
         wxBoxSizer* s3 = new wxBoxSizer(wxHORIZONTAL);
-        m_caption_size = new wxSpinCtrl(this, ID_CaptionSize, wxEmptyString, wxDefaultPosition, wxSize(50,20));
+        m_caption_size = new wxSpinCtrl(this, ID_CaptionSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE)), wxDefaultPosition, wxSize(50,20), wxSP_ARROW_KEYS, 0, 100, frame->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE));
         s3->Add(1, 1, 1, wxEXPAND);
         s3->Add(new wxStaticText(this, wxID_ANY, wxT("Caption Size:")));
         s3->Add(m_caption_size);
@@ -402,10 +403,9 @@ public:
         SetSizer(cont_sizer);
         GetSizer()->SetSizeHints(this);
 
-        m_frame = frame;
-        m_border_size->SetValue(frame->GetDockArt()->GetMetric(wxAUI_ART_PANE_BORDER_SIZE));
-        m_sash_size->SetValue(frame->GetDockArt()->GetMetric(wxAUI_ART_SASH_SIZE));
-        m_caption_size->SetValue(frame->GetDockArt()->GetMetric(wxAUI_ART_CAPTION_SIZE));
+        m_border_size->SetValue(frame->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE));
+        m_sash_size->SetValue(frame->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE));
+        m_caption_size->SetValue(frame->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE));
 
         UpdateColors();
     }
@@ -429,54 +429,54 @@ private:
 
     void UpdateColors()
     {
-        wxColour bk = m_frame->GetDockArt()->GetColor(wxAUI_ART_BACKGROUND_COLOUR);
+        wxColour bk = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_BACKGROUND_COLOUR);
         m_background_color->SetBitmapLabel(CreateColorBitmap(bk));
 
-        wxColour cap = m_frame->GetDockArt()->GetColor(wxAUI_ART_INACTIVE_CAPTION_COLOUR);
+        wxColour cap = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR);
         m_inactive_caption_color->SetBitmapLabel(CreateColorBitmap(cap));
 
-        wxColour capgrad = m_frame->GetDockArt()->GetColor(wxAUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR);
+        wxColour capgrad = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR);
         m_inactive_caption_gradient_color->SetBitmapLabel(CreateColorBitmap(capgrad));
 
-        wxColour captxt = m_frame->GetDockArt()->GetColor(wxAUI_ART_INACTIVE_CAPTION_TEXT_COLOUR);
+        wxColour captxt = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR);
         m_inactive_caption_text_color->SetBitmapLabel(CreateColorBitmap(captxt));
 
-        wxColour acap = m_frame->GetDockArt()->GetColor(wxAUI_ART_ACTIVE_CAPTION_COLOUR);
+        wxColour acap = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR);
         m_active_caption_color->SetBitmapLabel(CreateColorBitmap(acap));
 
-        wxColour acapgrad = m_frame->GetDockArt()->GetColor(wxAUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR);
+        wxColour acapgrad = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR);
         m_active_caption_gradient_color->SetBitmapLabel(CreateColorBitmap(acapgrad));
 
-        wxColour acaptxt = m_frame->GetDockArt()->GetColor(wxAUI_ART_ACTIVE_CAPTION_TEXT_COLOUR);
+        wxColour acaptxt = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR);
         m_active_caption_text_color->SetBitmapLabel(CreateColorBitmap(acaptxt));
 
-        wxColour sash = m_frame->GetDockArt()->GetColor(wxAUI_ART_SASH_COLOUR);
+        wxColour sash = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_SASH_COLOUR);
         m_sash_color->SetBitmapLabel(CreateColorBitmap(sash));
 
-        wxColour border = m_frame->GetDockArt()->GetColor(wxAUI_ART_BORDER_COLOUR);
+        wxColour border = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_BORDER_COLOUR);
         m_border_color->SetBitmapLabel(CreateColorBitmap(border));
 
-        wxColour gripper = m_frame->GetDockArt()->GetColor(wxAUI_ART_GRIPPER_COLOUR);
+        wxColour gripper = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_GRIPPER_COLOUR);
         m_gripper_color->SetBitmapLabel(CreateColorBitmap(gripper));
     }
 
     void OnPaneBorderSize(wxSpinEvent& event)
     {
-        m_frame->GetDockArt()->SetMetric(wxAUI_ART_PANE_BORDER_SIZE,
+        m_frame->GetDockArt()->SetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE,
                                          event.GetPosition());
         m_frame->DoUpdate();
     }
 
     void OnSashSize(wxSpinEvent& event)
     {
-        m_frame->GetDockArt()->SetMetric(wxAUI_ART_SASH_SIZE,
+        m_frame->GetDockArt()->SetMetric(wxAUI_DOCKART_SASH_SIZE,
                                          event.GetPosition());
         m_frame->DoUpdate();
     }
 
     void OnCaptionSize(wxSpinEvent& event)
     {
-        m_frame->GetDockArt()->SetMetric(wxAUI_ART_CAPTION_SIZE,
+        m_frame->GetDockArt()->SetMetric(wxAUI_DOCKART_CAPTION_SIZE,
                                          event.GetPosition());
         m_frame->DoUpdate();
     }
@@ -491,16 +491,16 @@ private:
         int var = 0;
         switch (event.GetId())
         {
-            case ID_BackgroundColor:              var = wxAUI_ART_BACKGROUND_COLOUR; break;
-            case ID_SashColor:                    var = wxAUI_ART_SASH_COLOUR; break;
-            case ID_InactiveCaptionColor:         var = wxAUI_ART_INACTIVE_CAPTION_COLOUR; break;
-            case ID_InactiveCaptionGradientColor: var = wxAUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR; break;
-            case ID_InactiveCaptionTextColor:     var = wxAUI_ART_INACTIVE_CAPTION_TEXT_COLOUR; break;
-            case ID_ActiveCaptionColor:           var = wxAUI_ART_ACTIVE_CAPTION_COLOUR; break;
-            case ID_ActiveCaptionGradientColor:   var = wxAUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR; break;
-            case ID_ActiveCaptionTextColor:       var = wxAUI_ART_ACTIVE_CAPTION_TEXT_COLOUR; break;
-            case ID_BorderColor:                  var = wxAUI_ART_BORDER_COLOUR; break;
-            case ID_GripperColor:                 var = wxAUI_ART_GRIPPER_COLOUR; break;
+            case ID_BackgroundColor:              var = wxAUI_DOCKART_BACKGROUND_COLOUR; break;
+            case ID_SashColor:                    var = wxAUI_DOCKART_SASH_COLOUR; break;
+            case ID_InactiveCaptionColor:         var = wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR; break;
+            case ID_InactiveCaptionGradientColor: var = wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR; break;
+            case ID_InactiveCaptionTextColor:     var = wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR; break;
+            case ID_ActiveCaptionColor:           var = wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR; break;
+            case ID_ActiveCaptionGradientColor:   var = wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR; break;
+            case ID_ActiveCaptionTextColor:       var = wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR; break;
+            case ID_BorderColor:                  var = wxAUI_DOCKART_BORDER_COLOUR; break;
+            case ID_GripperColor:                 var = wxAUI_DOCKART_GRIPPER_COLOUR; break;
             default: return;
         }
 
@@ -548,6 +548,9 @@ END_EVENT_TABLE()
 
 bool MyApp::OnInit()
 {
+    if ( !wxApp::OnInit() )
+        return false;
+
     wxFrame* frame = new MyFrame(NULL,
                                  wxID_ANY,
                                  wxT("wxAUI Sample Application"),
@@ -626,7 +629,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
     EVT_UPDATE_UI(ID_HorizontalGradient, MyFrame::OnUpdateUI)
     EVT_MENU_RANGE(MyFrame::ID_FirstPerspective, MyFrame::ID_FirstPerspective+1000,
                    MyFrame::OnRestorePerspective)
-    EVT_AUI_PANECLOSE(MyFrame::OnPaneClose)
+    EVT_AUI_PANE_CLOSE(MyFrame::OnPaneClose)
     EVT_AUINOTEBOOK_ALLOW_DND(wxID_ANY, MyFrame::OnAllowNotebookDnD)
     EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, MyFrame::OnNotebookPageClose)
 END_EVENT_TABLE()
@@ -668,7 +671,7 @@ MyFrame::MyFrame(wxWindow* parent,
     view_menu->Append(ID_TextContent, _("Use a Text Control for the Content Pane"));
     view_menu->Append(ID_HTMLContent, _("Use an HTML Control for the Content Pane"));
     view_menu->Append(ID_TreeContent, _("Use a Tree Control for the Content Pane"));
-    view_menu->Append(ID_NotebookContent, _("Use a AUI wxMultiNotebook control for the Content Pane"));
+    view_menu->Append(ID_NotebookContent, _("Use a wxAuiNotebook control for the Content Pane"));
     view_menu->Append(ID_SizeReportContent, _("Use a Size Reporter for the Content Pane"));
 
     wxMenu* options_menu = new wxMenu;
@@ -880,7 +883,7 @@ MyFrame::MyFrame(wxWindow* parent,
                   CenterPane().Hide());
 
     m_mgr.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo().Name(wxT("html_content")).
-                  CenterPane());
+                  CenterPane().Hide());
 
     m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo().Name(wxT("notebook_content")).
                   CenterPane().PaneBorder(false));
@@ -987,7 +990,7 @@ void MyFrame::OnGradient(wxCommandEvent& event)
         case ID_HorizontalGradient: gradient = wxAUI_GRADIENT_HORIZONTAL; break;
     }
 
-    m_mgr.GetArtProvider()->SetMetric(wxAUI_ART_GRADIENT_TYPE, gradient);
+    m_mgr.GetArtProvider()->SetMetric(wxAUI_DOCKART_GRADIENT_TYPE, gradient);
     m_mgr.Update();
 }
 
@@ -1125,13 +1128,13 @@ void MyFrame::OnUpdateUI(wxUpdateUIEvent& event)
     switch (event.GetId())
     {
         case ID_NoGradient:
-            event.Check(m_mgr.GetArtProvider()->GetMetric(wxAUI_ART_GRADIENT_TYPE) == wxAUI_GRADIENT_NONE);
+            event.Check(m_mgr.GetArtProvider()->GetMetric(wxAUI_DOCKART_GRADIENT_TYPE) == wxAUI_GRADIENT_NONE);
             break;
         case ID_VerticalGradient:
-            event.Check(m_mgr.GetArtProvider()->GetMetric(wxAUI_ART_GRADIENT_TYPE) == wxAUI_GRADIENT_VERTICAL);
+            event.Check(m_mgr.GetArtProvider()->GetMetric(wxAUI_DOCKART_GRADIENT_TYPE) == wxAUI_GRADIENT_VERTICAL);
             break;
         case ID_HorizontalGradient:
-            event.Check(m_mgr.GetArtProvider()->GetMetric(wxAUI_ART_GRADIENT_TYPE) == wxAUI_GRADIENT_HORIZONTAL);
+            event.Check(m_mgr.GetArtProvider()->GetMetric(wxAUI_DOCKART_GRADIENT_TYPE) == wxAUI_GRADIENT_HORIZONTAL);
             break;
         case ID_AllowFloating:
             event.Check((flags & wxAUI_MGR_ALLOW_FLOATING) != 0);
@@ -1281,7 +1284,7 @@ wxPoint MyFrame::GetStartPosition()
 void MyFrame::OnCreateTree(wxCommandEvent& WXUNUSED(event))
 {
     m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().
-                  Name(wxT("Test")).Caption(wxT("Tree Control")).
+                  Caption(wxT("Tree Control")).
                   Float().FloatingPosition(GetStartPosition()).
                   FloatingSize(wxSize(150,300)));
     m_mgr.Update();
@@ -1290,7 +1293,7 @@ void MyFrame::OnCreateTree(wxCommandEvent& WXUNUSED(event))
 void MyFrame::OnCreateGrid(wxCommandEvent& WXUNUSED(event))
 {
     m_mgr.AddPane(CreateGrid(), wxAuiPaneInfo().
-                  Name(wxT("Test")).Caption(wxT("Grid")).
+                  Caption(wxT("Grid")).
                   Float().FloatingPosition(GetStartPosition()).
                   FloatingSize(wxSize(300,200)));
     m_mgr.Update();
@@ -1299,7 +1302,7 @@ void MyFrame::OnCreateGrid(wxCommandEvent& WXUNUSED(event))
 void MyFrame::OnCreateHTML(wxCommandEvent& WXUNUSED(event))
 {
     m_mgr.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo().
-                  Name(wxT("Test")).Caption(wxT("HTML Control")).
+                  Caption(wxT("HTML Control")).
                   Float().FloatingPosition(GetStartPosition()).
                   FloatingSize(wxSize(300,200)));
     m_mgr.Update();
@@ -1308,7 +1311,7 @@ void MyFrame::OnCreateHTML(wxCommandEvent& WXUNUSED(event))
 void MyFrame::OnCreateNotebook(wxCommandEvent& WXUNUSED(event))
 {
     m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo().
-                  Name(wxT("Test")).Caption(wxT("Notebook")).
+                  Caption(wxT("Notebook")).
                   Float().FloatingPosition(GetStartPosition()).
                   //FloatingSize(300,200).
                   CloseButton(true).MaximizeButton(true));
@@ -1318,7 +1321,7 @@ void MyFrame::OnCreateNotebook(wxCommandEvent& WXUNUSED(event))
 void MyFrame::OnCreateText(wxCommandEvent& WXUNUSED(event))
 {
     m_mgr.AddPane(CreateTextCtrl(), wxAuiPaneInfo().
-                  Name(wxT("Test")).Caption(wxT("Text Control")).
+                  Caption(wxT("Text Control")).
                   Float().FloatingPosition(GetStartPosition()));
     m_mgr.Update();
 }
@@ -1326,7 +1329,7 @@ void MyFrame::OnCreateText(wxCommandEvent& WXUNUSED(event))
 void MyFrame::OnCreateSizeReport(wxCommandEvent& WXUNUSED(event))
 {
     m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
-                  Name(wxT("Test")).Caption(wxT("Client Size Reporter")).
+                  Caption(wxT("Client Size Reporter")).
                   Float().FloatingPosition(GetStartPosition()).
                   CloseButton(true).MaximizeButton(true));
     m_mgr.Update();
@@ -1448,8 +1451,10 @@ wxAuiNotebook* MyFrame::CreateNotebook()
                                     wxPoint(client_size.x, client_size.y),
                                     wxSize(430,200),
                                     m_notebook_style);
+   
+   wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
                                     
-   ctrl->AddPage(CreateHTMLCtrl(ctrl), wxT("Welcome to wxAUI"));
+   ctrl->AddPage(CreateHTMLCtrl(ctrl), wxT("Welcome to wxAUI") , false, page_bmp);
                                     
    wxPanel *panel = new wxPanel( ctrl, wxID_ANY );
    wxFlexGridSizer *flex = new wxFlexGridSizer( 2 );
@@ -1465,10 +1470,11 @@ wxAuiNotebook* MyFrame::CreateNotebook()
                 wxSP_ARROW_KEYS, 5, 50, 5 ), 0, wxALL|wxALIGN_CENTRE, 5 );
    flex->Add( 5,5 );   flex->Add( 5,5 );
    panel->SetSizer( flex );
-   ctrl->AddPage( panel, wxT("wxPanel") );
+   ctrl->AddPage( panel, wxT("wxPanel"), false, page_bmp );
+   
    
    ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some text"),
-                wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 1") );
+                wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 1"), false, page_bmp );
                 
    ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
                 wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 2") );
@@ -1512,6 +1518,17 @@ wxString MyFrame::GetIntroText()
         "<li>Customizable floating/docking behavior</li>"
         "<li>Completely customizable look-and-feel</li>"
         "<li>Optional transparent window effects (while dragging or docking)</li>"
+        "<li>Splittable notebook control</li>"
+        "</ul>"
+        "<p><b>What's new in 0.9.3?</b></p>"
+        "<p>wxAUI 0.9.3, which is now bundled with wxWidgets, adds the following features:"
+        "<ul>"
+        "<li>New wxAuiNotebook class, a dynamic splittable notebook control</li>"
+        "<li>New wxAuiMDI* classes, a tab-based MDI and drop-in replacement for classic MDI</li>"
+        "<li>Maximize/Restore buttons implemented</li>"
+        "<li>Better hinting with wxGTK</li>"
+        "<li>Class rename.  'wxAui' is now the standard class prefix for all wxAUI classes</li>"
+        "<li>Lots of bug fixes</li>"
         "</ul>"
         "<p><b>What's new in 0.9.2?</b></p>"
         "<p>The following features/fixes have been added since the last version of wxAUI:</p>"