From e8375af8ff97a3649361b988a40b991a8cdaab09 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 23 Apr 2007 15:16:06 +0000 Subject: [PATCH] remove wxWindow::m_needParent and use GTKNeedsParent() which can be overridden in just wxMenuBar (and not set in each and every wxGTK control) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/menu.h | 4 ++++ include/wx/gtk/window.h | 6 +++++- src/gtk/animate.cpp | 2 -- src/gtk/bmpbuttn.cpp | 2 -- src/gtk/button.cpp | 13 ++++++++----- src/gtk/checkbox.cpp | 1 - src/gtk/choice.cpp | 2 -- src/gtk/clrpicker.cpp | 2 -- src/gtk/collpane.cpp | 1 - src/gtk/combobox.cpp | 1 - src/gtk/control.cpp | 1 - src/gtk/dataview.cpp | 22 ++++++++++------------ src/gtk/dirdlg.cpp | 1 - src/gtk/filedlg.cpp | 2 -- src/gtk/filepicker.cpp | 4 ---- src/gtk/fontdlg.cpp | 2 -- src/gtk/fontpicker.cpp | 2 -- src/gtk/gauge.cpp | 2 -- src/gtk/hyperlink.cpp | 2 -- src/gtk/listbox.cpp | 1 - src/gtk/mdi.cpp | 4 +--- src/gtk/menu.cpp | 8 +++----- src/gtk/notebook.cpp | 1 - src/gtk/popupwin.cpp | 2 -- src/gtk/radiobox.cpp | 2 -- src/gtk/radiobut.cpp | 6 ++---- src/gtk/scrolbar.cpp | 2 -- src/gtk/slider.cpp | 16 ++++++++++------ src/gtk/spinbutt.cpp | 2 -- src/gtk/spinctrl.cpp | 2 -- src/gtk/statbmp.cpp | 2 -- src/gtk/statbox.cpp | 4 +--- src/gtk/statline.cpp | 2 -- src/gtk/stattext.cpp | 4 +--- src/gtk/tbargtk.cpp | 1 - src/gtk/textctrl.cpp | 2 -- src/gtk/tglbtn.cpp | 4 ---- src/gtk/toplevel.cpp | 2 -- src/gtk/window.cpp | 6 ++++-- 39 files changed, 49 insertions(+), 96 deletions(-) diff --git a/include/wx/gtk/menu.h b/include/wx/gtk/menu.h index cc00c2fd7c..ba4c245a9d 100644 --- a/include/wx/gtk/menu.h +++ b/include/wx/gtk/menu.h @@ -40,6 +40,10 @@ public: void SetLayoutDirection(wxLayoutDirection dir); wxLayoutDirection GetLayoutDirection() const; + // wxMenuBar is not a top level window but it still doesn't need a parent + // window + virtual bool GTKNeedsParent() const { return false; } + void Attach(wxFrame *frame); // implementation only from now on diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index 2646c5c4bf..762dd643e2 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -181,6 +181,11 @@ public: static wxLayoutDirection GTKGetLayout(GtkWidget *widget); static void GTKSetLayout(GtkWidget *widget, wxLayoutDirection dir); + // return true if this window must have a non-NULL parent, false if it can + // be created without parent (normally only top level windows but in wxGTK + // there is also the exception of wxMenuBar) + virtual bool GTKNeedsParent() const { return !IsTopLevel(); } + protected: // Override GTKWidgetNeedsMnemonic and return true if your // needs to set its mnemonic widget, such as for a @@ -292,7 +297,6 @@ public: // extra (wxGTK-specific) flags - bool m_needParent:1; // ! wxFrame, wxDialog, wxNotebookPage ? bool m_noExpose:1; // wxGLCanvas has its own redrawing bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size" bool m_hasScrolling:1; diff --git a/src/gtk/animate.cpp b/src/gtk/animate.cpp index 3d236e57ee..820536a564 100644 --- a/src/gtk/animate.cpp +++ b/src/gtk/animate.cpp @@ -199,8 +199,6 @@ bool wxAnimationCtrl::Create( wxWindow *parent, wxWindowID id, long style, const wxString& name) { - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !base_type::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK, wxDefaultValidator, name)) diff --git a/src/gtk/bmpbuttn.cpp b/src/gtk/bmpbuttn.cpp index 8a36503dbc..eda28f6680 100644 --- a/src/gtk/bmpbuttn.cpp +++ b/src/gtk/bmpbuttn.cpp @@ -121,8 +121,6 @@ bool wxBitmapButton::Create( wxWindow *parent, const wxValidator& validator, const wxString &name ) { - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index ce4f0ab373..e9b395f835 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -97,12 +97,15 @@ wxButton::~wxButton() { } -bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, - const wxPoint &pos, const wxSize &size, - long style, const wxValidator& validator, const wxString &name ) +bool wxButton::Create(wxWindow *parent, + wxWindowID id, + const wxString &label, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) { - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index 29dce10f19..1e25d81b9d 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -107,7 +107,6 @@ bool wxCheckBox::Create(wxWindow *parent, const wxValidator& validator, const wxString &name ) { - m_needParent = true; m_blockEvent = false; if (!PreCreation( parent, pos, size ) || diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index 86c9a17191..ef4a9e61d1 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -94,8 +94,6 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, int n, const wxString choices[], long style, const wxValidator& validator, const wxString &name ) { - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { diff --git a/src/gtk/clrpicker.cpp b/src/gtk/clrpicker.cpp index e90fb97c5b..9184ed7025 100644 --- a/src/gtk/clrpicker.cpp +++ b/src/gtk/clrpicker.cpp @@ -61,8 +61,6 @@ bool wxColourButton::Create( wxWindow *parent, wxWindowID id, { if (!gtk_check_version(2,4,0)) { - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !wxControl::CreateBase(parent, id, pos, size, style, validator, name)) { diff --git a/src/gtk/collpane.cpp b/src/gtk/collpane.cpp index 277601c171..9dab861247 100644 --- a/src/gtk/collpane.cpp +++ b/src/gtk/collpane.cpp @@ -198,7 +198,6 @@ bool wxCollapsiblePane::Create(wxWindow *parent, return wxGenericCollapsiblePane::Create(parent, id, label, pos, size, style, val, name); - m_needParent = true; m_bIgnoreNextChange = false; if ( !PreCreation( parent, pos, size ) || diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 807fdf895b..10f20fbd1a 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -242,7 +242,6 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, const wxString& name ) { m_ignoreNextUpdate = false; - m_needParent = true; m_prevSelection = 0; if (!PreCreation( parent, pos, size ) || diff --git a/src/gtk/control.cpp b/src/gtk/control.cpp index 9c81bcea8f..f839ce7e45 100644 --- a/src/gtk/control.cpp +++ b/src/gtk/control.cpp @@ -37,7 +37,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxControl, wxWindow) wxControl::wxControl() { - m_needParent = true; } bool wxControl::Create( wxWindow *parent, diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index b784bad68e..d560119725 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -488,7 +488,7 @@ static GtkCellEditable *gtk_wx_cell_renderer_start_editing( GdkRectangle *background_area, GdkRectangle *cell_area, GtkCellRendererState flags ); - + static GObjectClass *cell_parent_class = NULL; @@ -572,7 +572,7 @@ static GtkCellEditable *gtk_wx_cell_renderer_start_editing( wxDataViewCustomRenderer *cell = wxrenderer->cell; if (!cell->HasEditorCtrl()) return NULL; - + GdkRectangle rect; gtk_wx_cell_renderer_get_size (renderer, widget, cell_area, &rect.x, @@ -733,11 +733,11 @@ gtk_wx_cell_renderer_activate( if (!event) { bool ret = false; - + // activated by if (cell->Activate( renderrect, model, model_col, model_row )) ret = true; - + return ret; } else if (event->type == GDK_BUTTON_PRESS) @@ -1933,7 +1933,7 @@ static void wxInsertChildInDataViewCtrl( wxWindowGTK* parent, wxWindowGTK* child // Insert widget in GtkTreeView if (GTK_WIDGET_REALIZED(treeview)) - gtk_widget_set_parent_window( child->m_widget, + gtk_widget_set_parent_window( child->m_widget, gtk_tree_view_get_bin_window( GTK_TREE_VIEW(treeview) ) ); gtk_widget_set_parent( child->m_widget, treeview ); } @@ -1943,22 +1943,22 @@ void gtk_dataviewctrl_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation *alloc, wxDataViewCtrl *win ) { - + wxWindowList::Node *node = win->GetChildren().GetFirst(); while (node) { wxWindow *child = node->GetData(); - + GtkRequisition req; gtk_widget_size_request( child->m_widget, &req ); - + GtkAllocation alloc; alloc.x = child->m_x; alloc.y = child->m_y; alloc.width = child->m_width; alloc.height = child->m_height; gtk_widget_size_allocate( child->m_widget, &alloc ); - + node = node->GetNext(); } } @@ -1988,8 +1988,6 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, { Init(); - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator )) { @@ -2005,7 +2003,7 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, m_treeview = gtk_tree_view_new(); gtk_container_add (GTK_CONTAINER (m_widget), m_treeview); - + g_signal_connect (m_treeview, "size_allocate", G_CALLBACK (gtk_dataviewctrl_size_callback), this); diff --git a/src/gtk/dirdlg.cpp b/src/gtk/dirdlg.cpp index f555dcdf17..742961c994 100644 --- a/src/gtk/dirdlg.cpp +++ b/src/gtk/dirdlg.cpp @@ -97,7 +97,6 @@ wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title, if (!gtk_check_version(2,4,0)) { m_message = title; - m_needParent = false; parent = GetParentForModalDialog(parent); diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 60fc46cdb8..1e6fef80a3 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -152,8 +152,6 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, return; } - m_needParent = false; - parent = GetParentForModalDialog(parent); if (!PreCreation(parent, pos, wxDefaultSize) || diff --git a/src/gtk/filepicker.cpp b/src/gtk/filepicker.cpp index 01702dd37c..8ce087ed5c 100644 --- a/src/gtk/filepicker.cpp +++ b/src/gtk/filepicker.cpp @@ -46,8 +46,6 @@ bool wxFileButton::Create( wxWindow *parent, wxWindowID id, // VERY IMPORTANT: this code is identic to relative code in wxDirButton; // if you find a problem here, fix it also in wxDirButton ! - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !wxControl::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK, validator, name)) @@ -195,8 +193,6 @@ bool wxDirButton::Create( wxWindow *parent, wxWindowID id, // VERY IMPORTANT: this code is identic to relative code in wxFileButton; // if you find a problem here, fix it also in wxFileButton ! - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !wxControl::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK, validator, name)) diff --git a/src/gtk/fontdlg.cpp b/src/gtk/fontdlg.cpp index c20b8b55ab..cb99b9c398 100644 --- a/src/gtk/fontdlg.cpp +++ b/src/gtk/fontdlg.cpp @@ -86,8 +86,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) bool wxFontDialog::DoCreate(wxWindow *parent) { - m_needParent = false; - parent = GetParentForModalDialog(parent); if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) || diff --git a/src/gtk/fontpicker.cpp b/src/gtk/fontpicker.cpp index 325280de30..6719a53aa9 100644 --- a/src/gtk/fontpicker.cpp +++ b/src/gtk/fontpicker.cpp @@ -60,8 +60,6 @@ bool wxFontButton::Create( wxWindow *parent, wxWindowID id, { if (!gtk_check_version(2,4,0)) { - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !wxControl::CreateBase(parent, id, pos, size, style, validator, name)) { diff --git a/src/gtk/gauge.cpp b/src/gtk/gauge.cpp index 7fb1828e14..aaa124506c 100644 --- a/src/gtk/gauge.cpp +++ b/src/gtk/gauge.cpp @@ -31,8 +31,6 @@ bool wxGauge::Create( wxWindow *parent, const wxValidator& validator, const wxString& name ) { - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { diff --git a/src/gtk/hyperlink.cpp b/src/gtk/hyperlink.cpp index 701aeb934d..8d120d9c13 100644 --- a/src/gtk/hyperlink.cpp +++ b/src/gtk/hyperlink.cpp @@ -76,8 +76,6 @@ bool wxHyperlinkCtrl::Create(wxWindow *parent, wxWindowID id, // do validation checks: CheckParams(label, url, style); - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 1a53e99167..c244394fcd 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -303,7 +303,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, long style, const wxValidator& validator, const wxString &name ) { - m_needParent = true; m_blockEvent = false; if (!PreCreation( parent, pos, size ) || diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp index 8caf06b92a..1335dd02bb 100644 --- a/src/gtk/mdi.cpp +++ b/src/gtk/mdi.cpp @@ -496,8 +496,6 @@ wxMDIClientWindow::~wxMDIClientWindow() bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style ) { - m_needParent = true; - m_insertCallback = (wxInsertChildFunction)wxInsertChildInMDI; if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) || @@ -523,4 +521,4 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style ) return true; } -#endif +#endif // wxUSE_MDI diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 65006103ee..533aa55cf6 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -140,13 +140,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow) void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long style) { - // the parent window is known after wxFrame::SetMenu() - m_needParent = false; m_style = style; - m_invokingWindow = (wxWindow*) NULL; + m_invokingWindow = NULL; - if (!PreCreation( (wxWindow*) NULL, wxDefaultPosition, wxDefaultSize ) || - !CreateBase( (wxWindow*) NULL, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("menubar") )) + if (!PreCreation( NULL, wxDefaultPosition, wxDefaultSize ) || + !CreateBase( NULL, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("menubar") )) { wxFAIL_MSG( wxT("wxMenuBar creation failed") ); return; diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 4c9ef39535..41659072dc 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -217,7 +217,6 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) { - m_needParent = true; m_insertCallback = (wxInsertChildFunction)wxInsertChildInNotebook; if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) diff --git a/src/gtk/popupwin.cpp b/src/gtk/popupwin.cpp index c3a890bd71..6ed9c1a9ad 100644 --- a/src/gtk/popupwin.cpp +++ b/src/gtk/popupwin.cpp @@ -143,8 +143,6 @@ wxPopupWindow::~wxPopupWindow() bool wxPopupWindow::Create( wxWindow *parent, int style ) { - m_needParent = false; - if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) || !CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("popup") )) { diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index dba9c91702..027b8d05ee 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -212,8 +212,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl) void wxRadioBox::Init() { - m_needParent = true; - m_hasFocus = m_lostFocus = false; } diff --git a/src/gtk/radiobut.cpp b/src/gtk/radiobut.cpp index 47b18d8560..a1a5e23c29 100644 --- a/src/gtk/radiobut.cpp +++ b/src/gtk/radiobut.cpp @@ -60,15 +60,13 @@ bool wxRadioButton::Create( wxWindow *parent, const wxValidator& validator, const wxString& name ) { - m_needParent = TRUE; - - m_blockEvent = FALSE; + m_blockEvent = false; if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { wxFAIL_MSG( wxT("wxRadioButton creation failed") ); - return FALSE; + return false; } GSList* radioButtonGroup = NULL; diff --git a/src/gtk/scrolbar.cpp b/src/gtk/scrolbar.cpp index f13b47a756..fcf9edc55e 100644 --- a/src/gtk/scrolbar.cpp +++ b/src/gtk/scrolbar.cpp @@ -129,8 +129,6 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name ) { - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { diff --git a/src/gtk/slider.cpp b/src/gtk/slider.cpp index 14e4c38659..13e84b7974 100644 --- a/src/gtk/slider.cpp +++ b/src/gtk/slider.cpp @@ -281,13 +281,17 @@ wxSlider::wxSlider() m_needThumbRelease = false; } -bool wxSlider::Create(wxWindow *parent, wxWindowID id, - int value, int minValue, int maxValue, - const wxPoint& pos, const wxSize& size, - long style, const wxValidator& validator, const wxString& name ) +bool wxSlider::Create(wxWindow *parent, + wxWindowID id, + int value, + int minValue, + int maxValue, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) { - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { diff --git a/src/gtk/spinbutt.cpp b/src/gtk/spinbutt.cpp index 86f7f8f5bf..46bdce9690 100644 --- a/src/gtk/spinbutt.cpp +++ b/src/gtk/spinbutt.cpp @@ -91,8 +91,6 @@ bool wxSpinButton::Create(wxWindow *parent, long style, const wxString& name) { - m_needParent = true; - wxSize new_size = size, sizeBest = DoGetBestSize(); new_size.x = sizeBest.x; // override width always diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index f45bd0cc4a..e7918a61df 100644 --- a/src/gtk/spinctrl.cpp +++ b/src/gtk/spinctrl.cpp @@ -97,8 +97,6 @@ bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id, int min, int max, int initial, const wxString& name) { - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { diff --git a/src/gtk/statbmp.cpp b/src/gtk/statbmp.cpp index 7bc4035a18..6d6f82649c 100644 --- a/src/gtk/statbmp.cpp +++ b/src/gtk/statbmp.cpp @@ -38,8 +38,6 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { - m_needParent = TRUE; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { diff --git a/src/gtk/statbox.cpp b/src/gtk/statbox.cpp index a5314ce4df..783d1315fa 100644 --- a/src/gtk/statbox.cpp +++ b/src/gtk/statbox.cpp @@ -90,13 +90,11 @@ bool wxStaticBox::Create( wxWindow *parent, long style, const wxString& name ) { - m_needParent = TRUE; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { wxFAIL_MSG( wxT("wxStaticBox creation failed") ); - return FALSE; + return false; } m_widget = GTKCreateFrame(label); diff --git a/src/gtk/statline.cpp b/src/gtk/statline.cpp index 0e05c9e758..97bfa70cfa 100644 --- a/src/gtk/statline.cpp +++ b/src/gtk/statline.cpp @@ -38,8 +38,6 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { - m_needParent = TRUE; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { diff --git a/src/gtk/stattext.cpp b/src/gtk/stattext.cpp index c60fcf3f11..a10e98f85b 100644 --- a/src/gtk/stattext.cpp +++ b/src/gtk/stattext.cpp @@ -52,13 +52,11 @@ bool wxStaticText::Create(wxWindow *parent, long style, const wxString &name ) { - m_needParent = TRUE; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { wxFAIL_MSG( wxT("wxStaticText creation failed") ); - return FALSE; + return false; } m_widget = gtk_label_new(NULL); diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 1b9034647c..4fb659d824 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -293,7 +293,6 @@ bool wxToolBar::Create( wxWindow *parent, long style, const wxString& name ) { - m_needParent = true; m_insertCallback = (wxInsertChildFunction)wxInsertChildInToolBar; if ( !PreCreation( parent, pos, size ) || diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index e2f24552c1..c1533fb24e 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -685,8 +685,6 @@ bool wxTextCtrl::Create( wxWindow *parent, const wxValidator& validator, const wxString &name ) { - m_needParent = true; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { diff --git a/src/gtk/tglbtn.cpp b/src/gtk/tglbtn.cpp index 176f8d5806..734b351d26 100644 --- a/src/gtk/tglbtn.cpp +++ b/src/gtk/tglbtn.cpp @@ -55,8 +55,6 @@ bool wxToggleBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString &name) { - m_needParent = true; - m_blockEvent = false; if (!PreCreation(parent, pos, size) || @@ -197,8 +195,6 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString &name) { - m_needParent = true; - m_blockEvent = false; if (!PreCreation(parent, pos, size) || diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index aaa598b8ea..99da69d61c 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -458,8 +458,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, wxTopLevelWindows.Append( this ); - m_needParent = false; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 5546f6cca7..bb6ec9e921 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2229,7 +2229,6 @@ void wxWindowGTK::Init() m_sizeSet = false; m_hasVMT = false; - m_needParent = true; m_isBeingDeleted = false; m_showOnIdle= false; @@ -2452,7 +2451,10 @@ wxWindowGTK::~wxWindowGTK() bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size ) { - wxCHECK_MSG( !m_needParent || parent, false, wxT("Need complete parent.") ); + if ( GTKNeedsParent() ) + { + wxCHECK_MSG( parent, false, wxT("Must have non-NULL parent") ); + } // Use either the given size, or the default if -1 is given. // See wxWindowBase for these functions. -- 2.45.2