Overrode wxMDIChildFrame's DoSetSize to not misplace

the window when it was using wxFrame's method.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15727 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2002-06-02 14:24:29 +00:00
parent 2dde25b981
commit ac0c857aaa
4 changed files with 30 additions and 22 deletions

View File

@ -184,6 +184,11 @@ public:
bool m_justInserted; bool m_justInserted;
protected: protected:
// override wxFrame methods to not do anything
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
virtual void DoSetClientSize(int width, int height);
virtual void DoGetClientSize( int *width, int *height ) const; virtual void DoGetClientSize( int *width, int *height ) const;
private: private:

View File

@ -184,6 +184,11 @@ public:
bool m_justInserted; bool m_justInserted;
protected: protected:
// override wxFrame methods to not do anything
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
virtual void DoSetClientSize(int width, int height);
virtual void DoGetClientSize( int *width, int *height ) const; virtual void DoGetClientSize( int *width, int *height ) const;
private: private:

View File

@ -237,11 +237,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget); GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
if (!notebook) return (wxMDIChildFrame*) NULL; if (!notebook) return (wxMDIChildFrame*) NULL;
#if (GTK_MINOR_VERSION > 0)
gint i = gtk_notebook_get_current_page( notebook ); gint i = gtk_notebook_get_current_page( notebook );
#else
gint i = gtk_notebook_current_page( notebook );
#endif
if (i < 0) return (wxMDIChildFrame*) NULL; if (i < 0) return (wxMDIChildFrame*) NULL;
GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data); GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
@ -325,6 +321,16 @@ bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name ); return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name );
} }
void wxMDIChildFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
wxWindow::DoSetSize( x, y, width, height, sizeFlags );
}
void wxMDIChildFrame::DoSetClientSize(int width, int height)
{
wxWindow::DoSetClientSize( width, height );
}
void wxMDIChildFrame::DoGetClientSize( int *width, int *height ) const void wxMDIChildFrame::DoGetClientSize( int *width, int *height ) const
{ {
wxWindow::DoGetClientSize( width, height ); wxWindow::DoGetClientSize( width, height );
@ -361,17 +367,10 @@ wxMenuBar *wxMDIChildFrame::GetMenuBar() const
void wxMDIChildFrame::Activate() void wxMDIChildFrame::Activate()
{ {
#if defined(__WXGTK20__) || (GTK_MINOR_VERSION > 0)
wxMDIParentFrame* parent = (wxMDIParentFrame*) GetParent(); wxMDIParentFrame* parent = (wxMDIParentFrame*) GetParent();
GtkNotebook* notebook = GTK_NOTEBOOK(parent->m_widget); GtkNotebook* notebook = GTK_NOTEBOOK(parent->m_widget);
gint pageno = gtk_notebook_page_num( notebook, m_widget ); gint pageno = gtk_notebook_page_num( notebook, m_widget );
gtk_notebook_set_page( notebook, pageno ); gtk_notebook_set_page( notebook, pageno );
#else // GTK+ 1.0
// the only way I can see to do this under gtk+ 1.0.X would
// be to keep track of page numbers, start at first and
// do "next" enough times to get to this page number - messy
// - J. Russell Smyth
#endif
} }
void wxMDIChildFrame::OnActivate( wxActivateEvent& WXUNUSED(event) ) void wxMDIChildFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )

View File

@ -237,11 +237,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget); GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
if (!notebook) return (wxMDIChildFrame*) NULL; if (!notebook) return (wxMDIChildFrame*) NULL;
#if (GTK_MINOR_VERSION > 0)
gint i = gtk_notebook_get_current_page( notebook ); gint i = gtk_notebook_get_current_page( notebook );
#else
gint i = gtk_notebook_current_page( notebook );
#endif
if (i < 0) return (wxMDIChildFrame*) NULL; if (i < 0) return (wxMDIChildFrame*) NULL;
GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data); GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
@ -325,6 +321,16 @@ bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name ); return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name );
} }
void wxMDIChildFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
wxWindow::DoSetSize( x, y, width, height, sizeFlags );
}
void wxMDIChildFrame::DoSetClientSize(int width, int height)
{
wxWindow::DoSetClientSize( width, height );
}
void wxMDIChildFrame::DoGetClientSize( int *width, int *height ) const void wxMDIChildFrame::DoGetClientSize( int *width, int *height ) const
{ {
wxWindow::DoGetClientSize( width, height ); wxWindow::DoGetClientSize( width, height );
@ -361,17 +367,10 @@ wxMenuBar *wxMDIChildFrame::GetMenuBar() const
void wxMDIChildFrame::Activate() void wxMDIChildFrame::Activate()
{ {
#if defined(__WXGTK20__) || (GTK_MINOR_VERSION > 0)
wxMDIParentFrame* parent = (wxMDIParentFrame*) GetParent(); wxMDIParentFrame* parent = (wxMDIParentFrame*) GetParent();
GtkNotebook* notebook = GTK_NOTEBOOK(parent->m_widget); GtkNotebook* notebook = GTK_NOTEBOOK(parent->m_widget);
gint pageno = gtk_notebook_page_num( notebook, m_widget ); gint pageno = gtk_notebook_page_num( notebook, m_widget );
gtk_notebook_set_page( notebook, pageno ); gtk_notebook_set_page( notebook, pageno );
#else // GTK+ 1.0
// the only way I can see to do this under gtk+ 1.0.X would
// be to keep track of page numbers, start at first and
// do "next" enough times to get to this page number - messy
// - J. Russell Smyth
#endif
} }
void wxMDIChildFrame::OnActivate( wxActivateEvent& WXUNUSED(event) ) void wxMDIChildFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )