diff --git a/include/wx/gtk/notebook.h b/include/wx/gtk/notebook.h index eebf0ba9ec..f63813d76a 100644 --- a/include/wx/gtk/notebook.h +++ b/include/wx/gtk/notebook.h @@ -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; diff --git a/include/wx/gtk1/notebook.h b/include/wx/gtk1/notebook.h index eebf0ba9ec..f63813d76a 100644 --- a/include/wx/gtk1/notebook.h +++ b/include/wx/gtk1/notebook.h @@ -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; diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 73fa4b76ec..1629c14c34 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -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 //----------------------------------------------------------------------------- diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index 73fa4b76ec..1629c14c34 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -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 //-----------------------------------------------------------------------------