]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/notebook/test.cpp
GetItem() doesn't ignore column number any more
[wxWidgets.git] / samples / notebook / test.cpp
index e9867c144cc8ae407563592c1344cb476b650814..4f3b57893fec2303253d4c59551f13de6de84a9d 100644 (file)
@@ -20,7 +20,6 @@
 #include "wx/wx.h"
 #endif
 
-#include "wx/tab.h"
 #include "test.h"
 
 // If 1, use a dialog. Otherwise use a frame.
@@ -44,6 +43,14 @@ bool MyApp::OnInit(void)
 #else
   frame = new MyFrame((wxFrame*) NULL, -1, (char *) "Notebook", wxPoint(-1, -1), wxSize(365, 390), wxDEFAULT_FRAME_STYLE);
 
+  // Problem with generic wxNotebook implementation whereby it doesn't size properly unless
+  // you set the size again
+#if defined(__WIN16__)
+  int width, height;
+  frame->GetSize(& width, & height);
+  frame->SetSize(-1, -1, width, height);
+#endif
+
   return TRUE;
 #endif
 }
@@ -52,7 +59,7 @@ void MyApp::InitTabView(wxNotebook* notebook, wxWindow* window)
 {
   m_okButton = new wxButton(window, wxID_OK, "Close", wxPoint(-1, -1), wxSize(80, 25));
   m_cancelButton = new wxButton(window, wxID_CANCEL, "Cancel", wxPoint(-1, -1), wxSize(80, 25));
-  m_helpButton = new wxButton(window, wxID_HELP, "Help", wxPoint(-1, -1), wxSize(80, 25));
+  m_addPageButton = new wxButton(window, ID_ADD_PAGE, "Add page", wxPoint(-1, -1), wxSize(80, 25));
   m_okButton->SetDefault();
 
   wxLayoutConstraints* c = new wxLayoutConstraints;
@@ -60,10 +67,10 @@ void MyApp::InitTabView(wxNotebook* notebook, wxWindow* window)
   c->bottom.SameAs(window, wxBottom, 4);
   c->height.AsIs();
   c->width.AsIs();
-  m_helpButton->SetConstraints(c);
+  m_addPageButton->SetConstraints(c);
 
   c = new wxLayoutConstraints;
-  c->right.SameAs(m_helpButton, wxLeft, 4);
+  c->right.SameAs(m_addPageButton, wxLeft, 4);
   c->bottom.SameAs(window, wxBottom, 4);
   c->height.AsIs();
   c->width.AsIs();
@@ -82,7 +89,7 @@ void MyApp::InitTabView(wxNotebook* notebook, wxWindow* window)
   (void)new wxButton(panel1, -1, "Press me", wxPoint(10, 10));
   (void)new wxTextCtrl(panel1, -1, "1234", wxPoint(10, 40), wxSize(120, 150));
   
-  notebook->AddPage(panel1, "Cat");
+  notebook->AddPage(panel1, "Cat", TRUE);
 
   wxPanel *panel2 = new wxPanel(notebook, -1);
   panel2->SetBackgroundColour(wxColour("BLUE"));
@@ -94,7 +101,6 @@ void MyApp::InitTabView(wxNotebook* notebook, wxWindow* window)
     wxTE_MULTILINE);
 
   notebook->AddPage(panel2, "Dog");
-
   wxPanel *panel3 = new wxPanel(notebook, -1);
   panel3->SetBackgroundColour(wxColour("WHITE"));
   notebook->AddPage(panel3, "Goat");
@@ -149,6 +155,7 @@ void MyDialog::Init(void)
 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
     EVT_BUTTON(wxID_OK, MyFrame::OnOK)
     EVT_BUTTON(wxID_CANCEL, MyFrame::OnOK)
+    EVT_BUTTON(ID_ADD_PAGE, MyFrame::OnAddPage)
     EVT_SIZE(MyFrame::OnSize)
 END_EVENT_TABLE()
 
@@ -161,6 +168,14 @@ MyFrame::MyFrame(wxFrame* parent, const wxWindowID id, const wxString& title,
     Init();
 }
 
+void MyFrame::OnAddPage(wxCommandEvent& WXUNUSED(event))
+{
+  wxPanel *panel = new wxPanel( m_notebook, -1 );
+  (void)new wxButton( panel, -1, "Button", wxPoint( 10,10 ), wxSize(-1,-1) );
+  m_notebook->AddPage( panel, "Added" );
+  m_notebook->SetSelection( m_notebook->GetPageCount()-1 );
+}
+
 void MyFrame::OnOK(wxCommandEvent& WXUNUSED(event) )
 {
     this->Destroy();