From 4e6322e0e538b98cb68100df788eb14bbf31dcd5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Jun 1998 16:28:49 +0000 Subject: [PATCH] added OnSize() to wxNotebook which forwards size events to the pages: fixes 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 | 8 ++++---- include/wx/gtk1/notebook.h | 8 ++++---- src/gtk/notebook.cpp | 18 ++++++++++++++++++ src/gtk1/notebook.cpp | 18 ++++++++++++++++++ 4 files changed, 44 insertions(+), 8 deletions(-) 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 //----------------------------------------------------------------------------- -- 2.47.2