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
This commit is contained in:
Vadim Zeitlin 1998-06-23 16:28:49 +00:00
parent 46851318fe
commit 4e6322e0e5
4 changed files with 44 additions and 8 deletions

View File

@ -70,11 +70,11 @@ class wxNotebook: public wxControl
bool DeletePage( const int page ); bool DeletePage( const int page );
bool AddPage(wxWindow* win, const wxString& text, const int imageId = -1, void* data = NULL ); bool AddPage(wxWindow* win, const wxString& text, const int imageId = -1, void* data = NULL );
wxWindow *GetPageWindow( const int page ) const; wxWindow *GetPageWindow( const int page ) const;
// overriden to do nothing
virtual void AddChild( wxWindow *win ); virtual void AddChild( wxWindow *win );
protected: protected:
// wxWin callbacks
void OnSize(wxSizeEvent& event);
wxImageList* m_imageList; wxImageList* m_imageList;
wxList m_pages; wxList m_pages;

View File

@ -70,11 +70,11 @@ class wxNotebook: public wxControl
bool DeletePage( const int page ); bool DeletePage( const int page );
bool AddPage(wxWindow* win, const wxString& text, const int imageId = -1, void* data = NULL ); bool AddPage(wxWindow* win, const wxString& text, const int imageId = -1, void* data = NULL );
wxWindow *GetPageWindow( const int page ) const; wxWindow *GetPageWindow( const int page ) const;
// overriden to do nothing
virtual void AddChild( wxWindow *win ); virtual void AddChild( wxWindow *win );
protected: protected:
// wxWin callbacks
void OnSize(wxSizeEvent& event);
wxImageList* m_imageList; wxImageList* m_imageList;
wxList m_pages; wxList m_pages;

View File

@ -52,6 +52,7 @@ class wxNotebookPage: public wxObject
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxNotebook, wxControl) BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_SIZE(wxNotebook::OnSize)
END_EVENT_TABLE() END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl)
@ -327,6 +328,10 @@ wxWindow *wxNotebook::GetPageWindow( const int page ) const
void wxNotebook::AddChild( wxWindow *win ) 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(); wxNotebookPage *page = new wxNotebookPage();
page->m_id = GetPageCount(); page->m_id = GetPageCount();
@ -350,6 +355,19 @@ void wxNotebook::AddChild( wxWindow *win )
m_pages.Append( page ); 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 // wxTabEvent
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -52,6 +52,7 @@ class wxNotebookPage: public wxObject
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxNotebook, wxControl) BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_SIZE(wxNotebook::OnSize)
END_EVENT_TABLE() END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl)
@ -327,6 +328,10 @@ wxWindow *wxNotebook::GetPageWindow( const int page ) const
void wxNotebook::AddChild( wxWindow *win ) 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(); wxNotebookPage *page = new wxNotebookPage();
page->m_id = GetPageCount(); page->m_id = GetPageCount();
@ -350,6 +355,19 @@ void wxNotebook::AddChild( wxWindow *win )
m_pages.Append( page ); 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 // wxTabEvent
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------