]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/notebook/notebook.cpp
build a tarball when building the new docs
[wxWidgets.git] / samples / notebook / notebook.cpp
index 71caa697f22351aad714a2b05eeb070893349ddd..f5ed8758e1a20eb77d8ac54a5b7a5f9e149ce4ae 100644 (file)
@@ -5,7 +5,7 @@
 // Modified by: Dimitri Schoolwerth
 // Created:     26/10/98
 // RCS-ID:      $Id$
-// Copyright:   (c) 1998-2002 wxWindows team
+// Copyright:   (c) 1998-2002 wxWidgets team
 // License:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
@@ -36,7 +36,7 @@ bool MyApp::OnInit()
 #if defined(__WXMOTIF__)
     int width, height;
     frame->GetSize(& width, & height);
-    frame->SetSize(wxDefaultPosition.x, wxDefaultPosition.y, width, height);
+    frame->SetSize(wxDefaultCoord, wxDefaultCoord, width, height);
 #endif
 
     frame->Show();
@@ -137,8 +137,7 @@ wxPanel *MyNotebook::CreateBigButtonPage()
 {
     wxPanel *panel = new wxPanel(this);
 
-    wxButton *buttonBig = new wxButton( panel, wxID_ANY, wxT("Maximized button"),
-        wxPoint(0, 0), wxSize(480, 360) );
+    wxButton *buttonBig = new wxButton(panel, wxID_ANY, wxT("Maximized button"));
 
     wxBoxSizer *sizerPanel = new wxBoxSizer(wxVERTICAL);
     sizerPanel->Add(buttonBig, 1, wxEXPAND);
@@ -276,10 +275,12 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
     m_btnExit = new wxButton( m_panel, wxID_OK, wxT("&Exit") );
     m_btnExit->SetDefault();
 
+#if wxUSE_LOG
     m_text = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString,
         wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY);
 
     m_logTargetOld = wxLog::SetActiveTarget( new wxLogTextCtrl(m_text) );
+#endif // wxUSE_LOG
 
     // Set sizers
     m_sizerFrame = new wxBoxSizer(wxVERTICAL);
@@ -309,16 +310,17 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
 
 
     m_sizerFrame->Add(m_sizerTop, 1, wxEXPAND);
+#if wxUSE_LOG
     m_sizerFrame->Add(m_text, 0, wxEXPAND);
+#endif // wxUSE_LOG
 
     ReInitNotebook();
     m_notebook->CreateInitialPages();
 
     m_panel->SetSizer(m_sizerFrame);
 
-    m_panel->SetAutoLayout(true);
-
     m_sizerFrame->Fit(this);
+    m_sizerFrame->SetSizeHints(this);
 
     Centre(wxBOTH);
 
@@ -326,7 +328,9 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
 
 MyFrame::~MyFrame()
 {
+#if wxUSE_LOG
     delete wxLog::SetActiveTarget(m_logTargetOld);
+#endif // wxUSE_LOG
 
     if (m_imageList)
     {
@@ -392,11 +396,8 @@ void MyFrame::ReInitNotebook()
             m_notebook->AddPage(page, str, false, m_notebook->GetIconIndex() );
         }
 
-        if (m_sizerNotebook)
-        {
-            m_sizerTop->Remove(m_sizerNotebook);
-        }
-
+        m_sizerTop->Detach(notebook);
+        
         delete notebook;
 
         // restore selection
@@ -408,8 +409,7 @@ void MyFrame::ReInitNotebook()
     }
 
 
-    m_sizerNotebook = new wxBookCtrlSizer(m_notebook);
-    m_sizerTop->Add(m_sizerNotebook, 1, wxEXPAND | wxALL, 4);
+    m_sizerTop->Add(m_notebook, 1, wxEXPAND | wxALL, 4);
     m_sizerTop->Layout();
 }
 
@@ -536,7 +536,9 @@ void MyFrame::OnNotebook(wxNotebookEvent& event)
     wxLogMessage(wxT("Notebook event #%d: %s (%d)"),
         s_numNotebookEvents++, str.c_str(), eventType);
 
+#if wxUSE_LOG
     m_text->SetInsertionPointEnd();
+#endif // wxUSE_LOG
 
     event.Skip();
 }