From: Vadim Zeitlin Date: Wed, 24 Feb 1999 13:15:42 +0000 (+0000) Subject: wxGTK fixes for the yesterday's addition of m_isWindow flag X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/68995f26e8cb57350ee1acde913106723e0b39c4 wxGTK fixes for the yesterday's addition of m_isWindow flag git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1777 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/gtk/dialog.h b/include/wx/gtk/dialog.h index 002c3e1bed..62bd45a4cd 100644 --- a/include/wx/gtk/dialog.h +++ b/include/wx/gtk/dialog.h @@ -40,7 +40,7 @@ class wxDialog: public wxPanel DECLARE_DYNAMIC_CLASS(wxDialog) public: - wxDialog(); + wxDialog() { Init(); } wxDialog( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos = wxDefaultPosition, @@ -97,6 +97,9 @@ public: wxIcon m_icon; protected: + // common part of all ctors + void Init(); + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index 8e0eeacfe7..fb1b13938b 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -532,6 +532,9 @@ public: virtual void GetPositionConstraint(int *x, int *y) const ; protected: + // common part of all ctors + void Init(); + // this is the virtual function to be overriden in any derived class which // wants to change how SetSize() or Move() works - it is called by all // versions of these functions in the base class diff --git a/include/wx/gtk1/dialog.h b/include/wx/gtk1/dialog.h index 002c3e1bed..62bd45a4cd 100644 --- a/include/wx/gtk1/dialog.h +++ b/include/wx/gtk1/dialog.h @@ -40,7 +40,7 @@ class wxDialog: public wxPanel DECLARE_DYNAMIC_CLASS(wxDialog) public: - wxDialog(); + wxDialog() { Init(); } wxDialog( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos = wxDefaultPosition, @@ -97,6 +97,9 @@ public: wxIcon m_icon; protected: + // common part of all ctors + void Init(); + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); diff --git a/include/wx/gtk1/window.h b/include/wx/gtk1/window.h index 8e0eeacfe7..fb1b13938b 100644 --- a/include/wx/gtk1/window.h +++ b/include/wx/gtk1/window.h @@ -532,6 +532,9 @@ public: virtual void GetPositionConstraint(int *x, int *y) const ; protected: + // common part of all ctors + void Init(); + // this is the virtual function to be overriden in any derived class which // wants to change how SetSize() or Move() works - it is called by all // versions of these functions in the base class diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index 5b4719e6fc..a2c3a2bf3e 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -96,9 +96,8 @@ END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxDialog,wxPanel) -wxDialog::wxDialog() +void wxDialog::Init() { - m_title = ""; m_sizeSet = FALSE; m_modalShowing = FALSE; } @@ -108,8 +107,8 @@ wxDialog::wxDialog( wxWindow *parent, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { - m_modalShowing = FALSE; - m_sizeSet = FALSE; + Init(); + Create( parent, id, title, pos, size, style, name ); } diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 91c07fb36d..39a203d804 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1309,8 +1309,10 @@ BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler) EVT_KEY_DOWN(wxWindow::OnKeyDown) END_EVENT_TABLE() -wxWindow::wxWindow() +void wxWindow::Init() { + m_isWindow = TRUE; + m_widget = (GtkWidget *) NULL; m_wxwindow = (GtkWidget *) NULL; m_parent = (wxWindow *) NULL; @@ -1377,11 +1379,17 @@ wxWindow::wxWindow() #endif // wxUSE_TOOLTIPS } +wxWindow::wxWindow() +{ + Init(); +} + wxWindow::wxWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { - m_insertCallback = wxInsertChildInWindow; + Init(); + Create( parent, id, pos, size, style, name ); } @@ -1389,9 +1397,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { - m_isShown = FALSE; - m_isEnabled = TRUE; - m_needParent = TRUE; + wxASSERT_MSG( m_isWindow, "Init() must have been called before!" ); PreCreation( parent, id, pos, size, style, name ); diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index 5b4719e6fc..a2c3a2bf3e 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -96,9 +96,8 @@ END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxDialog,wxPanel) -wxDialog::wxDialog() +void wxDialog::Init() { - m_title = ""; m_sizeSet = FALSE; m_modalShowing = FALSE; } @@ -108,8 +107,8 @@ wxDialog::wxDialog( wxWindow *parent, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { - m_modalShowing = FALSE; - m_sizeSet = FALSE; + Init(); + Create( parent, id, title, pos, size, style, name ); } diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 91c07fb36d..39a203d804 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -1309,8 +1309,10 @@ BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler) EVT_KEY_DOWN(wxWindow::OnKeyDown) END_EVENT_TABLE() -wxWindow::wxWindow() +void wxWindow::Init() { + m_isWindow = TRUE; + m_widget = (GtkWidget *) NULL; m_wxwindow = (GtkWidget *) NULL; m_parent = (wxWindow *) NULL; @@ -1377,11 +1379,17 @@ wxWindow::wxWindow() #endif // wxUSE_TOOLTIPS } +wxWindow::wxWindow() +{ + Init(); +} + wxWindow::wxWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { - m_insertCallback = wxInsertChildInWindow; + Init(); + Create( parent, id, pos, size, style, name ); } @@ -1389,9 +1397,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { - m_isShown = FALSE; - m_isEnabled = TRUE; - m_needParent = TRUE; + wxASSERT_MSG( m_isWindow, "Init() must have been called before!" ); PreCreation( parent, id, pos, size, style, name );