]> git.saurik.com Git - wxWidgets.git/commitdiff
added OnSize() to wxNotebook which forwards size events to the pages: fixes
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 23 Jun 1998 16:28:49 +0000 (16:28 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 23 Jun 1998 16:28:49 +0000 (16:28 +0000)
the layout problem

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@140 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/notebook.h
include/wx/gtk1/notebook.h
src/gtk/notebook.cpp
src/gtk1/notebook.cpp

index eebf0ba9ecc2af9178a0d5cba78089f4be2dbdbc..f63813d76a734fbf77548b7b6ea7db0387a485c3 100644 (file)
@@ -70,12 +70,12 @@ class wxNotebook: public wxControl
     bool DeletePage( const int page );
     bool AddPage(wxWindow* win, const wxString& text, const int imageId = -1, void* data = NULL );
     wxWindow *GetPageWindow( const int page ) const;
-    
-    // overriden to do nothing
     virtual void AddChild( wxWindow *win );
-    
+
   protected:
-  
+    // wxWin callbacks
+    void OnSize(wxSizeEvent& event);
+
     wxImageList*    m_imageList;
     wxList          m_pages;
 
index eebf0ba9ecc2af9178a0d5cba78089f4be2dbdbc..f63813d76a734fbf77548b7b6ea7db0387a485c3 100644 (file)
@@ -70,12 +70,12 @@ class wxNotebook: public wxControl
     bool DeletePage( const int page );
     bool AddPage(wxWindow* win, const wxString& text, const int imageId = -1, void* data = NULL );
     wxWindow *GetPageWindow( const int page ) const;
-    
-    // overriden to do nothing
     virtual void AddChild( wxWindow *win );
-    
+
   protected:
-  
+    // wxWin callbacks
+    void OnSize(wxSizeEvent& event);
+
     wxImageList*    m_imageList;
     wxList          m_pages;
 
index 73fa4b76ec50ccc33ab179e92463dc579e135bed..1629c14c343e00c6e6c5502905f59057d45d6a3d 100644 (file)
@@ -52,6 +52,7 @@ class wxNotebookPage: public wxObject
 //-----------------------------------------------------------------------------
 
 BEGIN_EVENT_TABLE(wxNotebook, wxControl)
+  EVT_SIZE(wxNotebook::OnSize)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl)
@@ -327,6 +328,10 @@ wxWindow *wxNotebook::GetPageWindow( const int page ) const
 
 void wxNotebook::AddChild( wxWindow *win )
 {
+  // @@@ normally done in wxWindow::AddChild but for some reason wxNotebook
+  // case is speicla there (Robert?)
+  m_children.Append(win);
+
   wxNotebookPage *page = new wxNotebookPage();
 
   page->m_id = GetPageCount();
@@ -350,6 +355,19 @@ void wxNotebook::AddChild( wxWindow *win )
   m_pages.Append( page );
 };
 
+void wxNotebook::OnSize(wxSizeEvent& event)
+{
+  // forward this event to all pages
+  wxNode *node = m_pages.First();
+  while (node)
+  {
+    wxNotebookPage *page = (wxNotebookPage*)node->Data();
+    page->m_clientPanel->ProcessEvent(event);
+
+    node = node->Next();
+  };
+}
+
 //-----------------------------------------------------------------------------
 // wxTabEvent
 //-----------------------------------------------------------------------------
index 73fa4b76ec50ccc33ab179e92463dc579e135bed..1629c14c343e00c6e6c5502905f59057d45d6a3d 100644 (file)
@@ -52,6 +52,7 @@ class wxNotebookPage: public wxObject
 //-----------------------------------------------------------------------------
 
 BEGIN_EVENT_TABLE(wxNotebook, wxControl)
+  EVT_SIZE(wxNotebook::OnSize)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl)
@@ -327,6 +328,10 @@ wxWindow *wxNotebook::GetPageWindow( const int page ) const
 
 void wxNotebook::AddChild( wxWindow *win )
 {
+  // @@@ normally done in wxWindow::AddChild but for some reason wxNotebook
+  // case is speicla there (Robert?)
+  m_children.Append(win);
+
   wxNotebookPage *page = new wxNotebookPage();
 
   page->m_id = GetPageCount();
@@ -350,6 +355,19 @@ void wxNotebook::AddChild( wxWindow *win )
   m_pages.Append( page );
 };
 
+void wxNotebook::OnSize(wxSizeEvent& event)
+{
+  // forward this event to all pages
+  wxNode *node = m_pages.First();
+  while (node)
+  {
+    wxNotebookPage *page = (wxNotebookPage*)node->Data();
+    page->m_clientPanel->ProcessEvent(event);
+
+    node = node->Next();
+  };
+}
+
 //-----------------------------------------------------------------------------
 // wxTabEvent
 //-----------------------------------------------------------------------------