From b45ed7a273799b1b360482496a706a211eca6435 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 18 Aug 2003 23:57:34 +0000 Subject: [PATCH] use wxWindowBase::Create() instead of duplicating its code in MacPreControlCreate() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23005 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/bmpbuttn.cpp | 13 ++++++------- src/mac/button.cpp | 3 +++ src/mac/carbon/bmpbuttn.cpp | 13 ++++++------- src/mac/carbon/button.cpp | 3 +++ src/mac/carbon/checkbox.cpp | 3 +++ src/mac/carbon/checklst.cpp | 4 ++++ src/mac/carbon/choice.cpp | 3 +++ src/mac/carbon/control.cpp | 17 +---------------- src/mac/carbon/gauge.cpp | 3 +++ src/mac/carbon/listbox.cpp | 3 +++ src/mac/carbon/notebmac.cpp | 3 +++ src/mac/carbon/radiobox.cpp | 14 ++++++++++++-- src/mac/carbon/radiobut.cpp | 3 +++ src/mac/carbon/scrolbar.cpp | 17 +++++++++-------- src/mac/carbon/slider.cpp | 3 +++ src/mac/carbon/spinbutt.cpp | 4 ++++ src/mac/carbon/statbox.cpp | 4 ++++ src/mac/carbon/statlmac.cpp | 4 ++++ src/mac/carbon/stattext.cpp | 19 +++++++------------ src/mac/carbon/tabctrl.cpp | 4 ++++ src/mac/checkbox.cpp | 3 +++ src/mac/checklst.cpp | 4 ++++ src/mac/choice.cpp | 3 +++ src/mac/control.cpp | 17 +---------------- src/mac/gauge.cpp | 3 +++ src/mac/listbox.cpp | 3 +++ src/mac/notebmac.cpp | 3 +++ src/mac/radiobox.cpp | 14 ++++++++++++-- src/mac/radiobut.cpp | 3 +++ src/mac/scrolbar.cpp | 17 +++++++++-------- src/mac/slider.cpp | 3 +++ src/mac/spinbutt.cpp | 4 ++++ src/mac/statbox.cpp | 4 ++++ src/mac/statlmac.cpp | 4 ++++ src/mac/stattext.cpp | 19 +++++++------------ src/mac/tabctrl.cpp | 4 ++++ 36 files changed, 158 insertions(+), 90 deletions(-) diff --git a/src/mac/bmpbuttn.cpp b/src/mac/bmpbuttn.cpp index 046d548058..f296776652 100644 --- a/src/mac/bmpbuttn.cpp +++ b/src/mac/bmpbuttn.cpp @@ -29,6 +29,10 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit const wxValidator& validator, const wxString& name) { + if ( !wxBitmapButtonBase::Create(parent, id, _T(""), pos, size, + style, validator, name) ) + return false; + m_bmpNormal = bitmap; m_marginX = 0; @@ -39,16 +43,11 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit int width = size.x; int height = size.y; - if (id == -1) - m_windowId = NewControlId(); - else - m_windowId = id; - if ( width == -1 && bitmap.Ok()) - width = bitmap.GetWidth() + 2*m_marginX; + width = bitmap.GetWidth() + 2*m_marginX; if ( height == -1 && bitmap.Ok()) - height = bitmap.GetHeight() + 2*m_marginY; + height = bitmap.GetHeight() + 2*m_marginY; Rect bounds ; Str255 title ; diff --git a/src/mac/button.cpp b/src/mac/button.cpp index aaf91f644e..253671b6fe 100644 --- a/src/mac/button.cpp +++ b/src/mac/button.cpp @@ -34,6 +34,9 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxValidator& validator, const wxString& name) { + if ( !wxButtonBase::Create(parent, id, pos, size, style, validator, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/carbon/bmpbuttn.cpp b/src/mac/carbon/bmpbuttn.cpp index 046d548058..f296776652 100644 --- a/src/mac/carbon/bmpbuttn.cpp +++ b/src/mac/carbon/bmpbuttn.cpp @@ -29,6 +29,10 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit const wxValidator& validator, const wxString& name) { + if ( !wxBitmapButtonBase::Create(parent, id, _T(""), pos, size, + style, validator, name) ) + return false; + m_bmpNormal = bitmap; m_marginX = 0; @@ -39,16 +43,11 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit int width = size.x; int height = size.y; - if (id == -1) - m_windowId = NewControlId(); - else - m_windowId = id; - if ( width == -1 && bitmap.Ok()) - width = bitmap.GetWidth() + 2*m_marginX; + width = bitmap.GetWidth() + 2*m_marginX; if ( height == -1 && bitmap.Ok()) - height = bitmap.GetHeight() + 2*m_marginY; + height = bitmap.GetHeight() + 2*m_marginY; Rect bounds ; Str255 title ; diff --git a/src/mac/carbon/button.cpp b/src/mac/carbon/button.cpp index aaf91f644e..253671b6fe 100644 --- a/src/mac/carbon/button.cpp +++ b/src/mac/carbon/button.cpp @@ -34,6 +34,9 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxValidator& validator, const wxString& name) { + if ( !wxButtonBase::Create(parent, id, pos, size, style, validator, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/carbon/checkbox.cpp b/src/mac/carbon/checkbox.cpp index cb43f117af..3df5c00d9e 100644 --- a/src/mac/carbon/checkbox.cpp +++ b/src/mac/carbon/checkbox.cpp @@ -31,6 +31,9 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxValidator& validator, const wxString& name) { + if ( !wxCheckBoxBase::Create(parent, id, pos, size, style, validator, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/carbon/checklst.cpp b/src/mac/carbon/checklst.cpp index d987d94994..ee04357b8f 100644 --- a/src/mac/carbon/checklst.cpp +++ b/src/mac/carbon/checklst.cpp @@ -183,6 +183,10 @@ bool wxCheckListBox::Create(wxWindow *parent, const wxValidator& validator, const wxString &name) { + if ( !wxCheckListBoxBase::Create(parent, id, pos, size, + n, choices, style, validator, name) ) + return false; + m_noItems = 0 ; // this will be increased by our append command m_selected = 0; diff --git a/src/mac/carbon/choice.cpp b/src/mac/carbon/choice.cpp index c187d9ecc7..2275ce10c0 100644 --- a/src/mac/carbon/choice.cpp +++ b/src/mac/carbon/choice.cpp @@ -46,6 +46,9 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + if ( !wxChoiceBase::Create(parent, id, pos, size, style, validator, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/carbon/control.cpp b/src/mac/carbon/control.cpp index b4cd648a48..84e0822c54 100644 --- a/src/mac/carbon/control.cpp +++ b/src/mac/carbon/control.cpp @@ -300,23 +300,8 @@ void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString l const wxString& name , WXRECTPTR outBounds , unsigned char* maclabel ) { m_label = label ; - SetName(name); - if ( &validator ) - SetValidator(validator); - - m_windowStyle = style; - parent->AddChild(this); - - m_backgroundColour = parent->GetBackgroundColour() ; - m_foregroundColour = parent->GetForegroundColour() ; - - if (id == -1) - m_windowId = NewControlId(); - else - m_windowId = id; - - // These sizes will be adjusted in MacPostControlCreate + // These sizes will be adjusted in MacPostControlCreate m_width = size.x ; m_height = size.y ; m_x = pos.x ; diff --git a/src/mac/carbon/gauge.cpp b/src/mac/carbon/gauge.cpp index de7dd8c90c..01a557e17c 100644 --- a/src/mac/carbon/gauge.cpp +++ b/src/mac/carbon/gauge.cpp @@ -29,6 +29,9 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + if ( !wxGaugeBase::Create(parent, id, range, pos, s, style, validator, name) ) + return false; + wxSize size = s ; Rect bounds ; Str255 title ; diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index 9daaf275e8..5240ef76be 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -202,6 +202,9 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + if ( !wxListBoxBase::Create(parent, id, pos, size, style, validator, name) ) + return false; + m_noItems = 0 ; // this will be increased by our append command m_selected = 0; diff --git a/src/mac/carbon/notebmac.cpp b/src/mac/carbon/notebmac.cpp index 4e8a87a9b4..5ed215b7ab 100644 --- a/src/mac/carbon/notebmac.cpp +++ b/src/mac/carbon/notebmac.cpp @@ -175,6 +175,9 @@ bool wxNotebook::Create(wxWindow *parent, long style, const wxString& name) { + if ( !wxNotebookBase::Create(parent, id, pos, size, style, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/carbon/radiobox.cpp b/src/mac/carbon/radiobox.cpp index f7874dd099..bfc9b87637 100644 --- a/src/mac/carbon/radiobox.cpp +++ b/src/mac/carbon/radiobox.cpp @@ -102,6 +102,9 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, int majorDim, long style, const wxValidator& val, const wxString& name) { + if ( !wxControl::Create(parent, id, pos, size, style, val, name) ) + return false; + int i; m_noItems = n; @@ -124,8 +127,15 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, for (i = 0; i < n; i++) { - wxRadioButton *radBtn = new wxRadioButton(this, NewControlId(), wxStripMenuCodes(choices[i]),wxPoint(5,20*i+10), - wxDefaultSize , i == 0 ? wxRB_GROUP : 0 ) ; + wxRadioButton *radBtn = new wxRadioButton + ( + this, + wxID_ANY, + wxStripMenuCodes(choices[i]), + wxPoint(5,20*i+10), + wxDefaultSize, + i == 0 ? wxRB_GROUP : 0 + ); if ( i == 0 ) m_radioButtonCycle = radBtn ; // m_radioButtonCycle=radBtn->AddInCycle(m_radioButtonCycle); diff --git a/src/mac/carbon/radiobut.cpp b/src/mac/carbon/radiobut.cpp index 45c734c58b..991c8be68f 100644 --- a/src/mac/carbon/radiobut.cpp +++ b/src/mac/carbon/radiobut.cpp @@ -30,6 +30,9 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/carbon/scrolbar.cpp b/src/mac/carbon/scrolbar.cpp index eef2a84c54..5ddda761a0 100644 --- a/src/mac/carbon/scrolbar.cpp +++ b/src/mac/carbon/scrolbar.cpp @@ -40,24 +40,25 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { - if (!parent) - return FALSE; - + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) + return FALSE; + Rect bounds ; Str255 title ; - + MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ; - m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , true , 0 , 0 , 100, - kControlScrollBarLiveProc , (long) this ) ; - + m_macControl = ::NewControl(MAC_WXHWND(parent->MacGetRootWindow()) , + &bounds , title , true , 0 , 0 , 100, + kControlScrollBarLiveProc , (long) this) ; + wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ; ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ; MacPostControlCreate() ; - return TRUE; + return TRUE; } wxScrollBar::~wxScrollBar() diff --git a/src/mac/carbon/slider.cpp b/src/mac/carbon/slider.cpp index 96fdf5102c..4bd4bab532 100644 --- a/src/mac/carbon/slider.cpp +++ b/src/mac/carbon/slider.cpp @@ -57,6 +57,9 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) + return false; + Rect bounds ; Str255 title ; SInt16 procID; diff --git a/src/mac/carbon/spinbutt.cpp b/src/mac/carbon/spinbutt.cpp index 57a2a4a0d7..f8dcca8bd9 100644 --- a/src/mac/carbon/spinbutt.cpp +++ b/src/mac/carbon/spinbutt.cpp @@ -38,6 +38,10 @@ wxSpinButton::wxSpinButton() bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { + if ( !wxSpinButtonBase::Create(parent, id, pos, size, + style, wxDefaultValidator, name) ) + return false; + m_min = 0; m_max = 100; diff --git a/src/mac/carbon/statbox.cpp b/src/mac/carbon/statbox.cpp index e494e9e709..13c7daf669 100644 --- a/src/mac/carbon/statbox.cpp +++ b/src/mac/carbon/statbox.cpp @@ -38,6 +38,10 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { + if ( !wxControl::Create(parent, id, pos, size, + style, wxDefaultValidator, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/carbon/statlmac.cpp b/src/mac/carbon/statlmac.cpp index 30305cc1cf..a7a116ba57 100644 --- a/src/mac/carbon/statlmac.cpp +++ b/src/mac/carbon/statlmac.cpp @@ -49,6 +49,10 @@ bool wxStaticLine::Create( wxWindow *parent, long style, const wxString &name) { + if ( !wxStaticLineBase::Create(parent, id, pos, size, + style, wxDefaultValidator, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index b2a7d103da..2d81d33b16 100644 --- a/src/mac/carbon/stattext.cpp +++ b/src/mac/carbon/stattext.cpp @@ -41,22 +41,17 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { - SetName(name); - m_backgroundColour = parent->GetBackgroundColour() ; - m_foregroundColour = parent->GetForegroundColour() ; - - if ( id == -1 ) - m_windowId = (int)NewControlId(); - else - m_windowId = id; - - m_windowStyle = style; m_label = wxStripMenuCodes(label) ; - bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name ); + if ( !wxControl::Create( parent, id, pos, size, style, + wxDefaultValidator , name ) ) + { + return false; + } + SetBestSize( size ) ; - return ret; + return true; } const wxString punct = wxT(" ,.-;:!?"); diff --git a/src/mac/carbon/tabctrl.cpp b/src/mac/carbon/tabctrl.cpp index 4fcf069286..f879b78447 100644 --- a/src/mac/carbon/tabctrl.cpp +++ b/src/mac/carbon/tabctrl.cpp @@ -34,6 +34,10 @@ wxTabCtrl::wxTabCtrl() bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { + if ( !wxControl::Create(parent, id, pos, size, + style, wxDefaultValidator, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/checkbox.cpp b/src/mac/checkbox.cpp index cb43f117af..3df5c00d9e 100644 --- a/src/mac/checkbox.cpp +++ b/src/mac/checkbox.cpp @@ -31,6 +31,9 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxValidator& validator, const wxString& name) { + if ( !wxCheckBoxBase::Create(parent, id, pos, size, style, validator, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/checklst.cpp b/src/mac/checklst.cpp index d987d94994..ee04357b8f 100644 --- a/src/mac/checklst.cpp +++ b/src/mac/checklst.cpp @@ -183,6 +183,10 @@ bool wxCheckListBox::Create(wxWindow *parent, const wxValidator& validator, const wxString &name) { + if ( !wxCheckListBoxBase::Create(parent, id, pos, size, + n, choices, style, validator, name) ) + return false; + m_noItems = 0 ; // this will be increased by our append command m_selected = 0; diff --git a/src/mac/choice.cpp b/src/mac/choice.cpp index c187d9ecc7..2275ce10c0 100644 --- a/src/mac/choice.cpp +++ b/src/mac/choice.cpp @@ -46,6 +46,9 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + if ( !wxChoiceBase::Create(parent, id, pos, size, style, validator, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/control.cpp b/src/mac/control.cpp index b4cd648a48..84e0822c54 100644 --- a/src/mac/control.cpp +++ b/src/mac/control.cpp @@ -300,23 +300,8 @@ void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString l const wxString& name , WXRECTPTR outBounds , unsigned char* maclabel ) { m_label = label ; - SetName(name); - if ( &validator ) - SetValidator(validator); - - m_windowStyle = style; - parent->AddChild(this); - - m_backgroundColour = parent->GetBackgroundColour() ; - m_foregroundColour = parent->GetForegroundColour() ; - - if (id == -1) - m_windowId = NewControlId(); - else - m_windowId = id; - - // These sizes will be adjusted in MacPostControlCreate + // These sizes will be adjusted in MacPostControlCreate m_width = size.x ; m_height = size.y ; m_x = pos.x ; diff --git a/src/mac/gauge.cpp b/src/mac/gauge.cpp index de7dd8c90c..01a557e17c 100644 --- a/src/mac/gauge.cpp +++ b/src/mac/gauge.cpp @@ -29,6 +29,9 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + if ( !wxGaugeBase::Create(parent, id, range, pos, s, style, validator, name) ) + return false; + wxSize size = s ; Rect bounds ; Str255 title ; diff --git a/src/mac/listbox.cpp b/src/mac/listbox.cpp index 9daaf275e8..5240ef76be 100644 --- a/src/mac/listbox.cpp +++ b/src/mac/listbox.cpp @@ -202,6 +202,9 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + if ( !wxListBoxBase::Create(parent, id, pos, size, style, validator, name) ) + return false; + m_noItems = 0 ; // this will be increased by our append command m_selected = 0; diff --git a/src/mac/notebmac.cpp b/src/mac/notebmac.cpp index 4e8a87a9b4..5ed215b7ab 100644 --- a/src/mac/notebmac.cpp +++ b/src/mac/notebmac.cpp @@ -175,6 +175,9 @@ bool wxNotebook::Create(wxWindow *parent, long style, const wxString& name) { + if ( !wxNotebookBase::Create(parent, id, pos, size, style, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/radiobox.cpp b/src/mac/radiobox.cpp index f7874dd099..bfc9b87637 100644 --- a/src/mac/radiobox.cpp +++ b/src/mac/radiobox.cpp @@ -102,6 +102,9 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, int majorDim, long style, const wxValidator& val, const wxString& name) { + if ( !wxControl::Create(parent, id, pos, size, style, val, name) ) + return false; + int i; m_noItems = n; @@ -124,8 +127,15 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, for (i = 0; i < n; i++) { - wxRadioButton *radBtn = new wxRadioButton(this, NewControlId(), wxStripMenuCodes(choices[i]),wxPoint(5,20*i+10), - wxDefaultSize , i == 0 ? wxRB_GROUP : 0 ) ; + wxRadioButton *radBtn = new wxRadioButton + ( + this, + wxID_ANY, + wxStripMenuCodes(choices[i]), + wxPoint(5,20*i+10), + wxDefaultSize, + i == 0 ? wxRB_GROUP : 0 + ); if ( i == 0 ) m_radioButtonCycle = radBtn ; // m_radioButtonCycle=radBtn->AddInCycle(m_radioButtonCycle); diff --git a/src/mac/radiobut.cpp b/src/mac/radiobut.cpp index 45c734c58b..991c8be68f 100644 --- a/src/mac/radiobut.cpp +++ b/src/mac/radiobut.cpp @@ -30,6 +30,9 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/scrolbar.cpp b/src/mac/scrolbar.cpp index eef2a84c54..5ddda761a0 100644 --- a/src/mac/scrolbar.cpp +++ b/src/mac/scrolbar.cpp @@ -40,24 +40,25 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { - if (!parent) - return FALSE; - + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) + return FALSE; + Rect bounds ; Str255 title ; - + MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ; - m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , true , 0 , 0 , 100, - kControlScrollBarLiveProc , (long) this ) ; - + m_macControl = ::NewControl(MAC_WXHWND(parent->MacGetRootWindow()) , + &bounds , title , true , 0 , 0 , 100, + kControlScrollBarLiveProc , (long) this) ; + wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ; ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ; MacPostControlCreate() ; - return TRUE; + return TRUE; } wxScrollBar::~wxScrollBar() diff --git a/src/mac/slider.cpp b/src/mac/slider.cpp index 96fdf5102c..4bd4bab532 100644 --- a/src/mac/slider.cpp +++ b/src/mac/slider.cpp @@ -57,6 +57,9 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) + return false; + Rect bounds ; Str255 title ; SInt16 procID; diff --git a/src/mac/spinbutt.cpp b/src/mac/spinbutt.cpp index 57a2a4a0d7..f8dcca8bd9 100644 --- a/src/mac/spinbutt.cpp +++ b/src/mac/spinbutt.cpp @@ -38,6 +38,10 @@ wxSpinButton::wxSpinButton() bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { + if ( !wxSpinButtonBase::Create(parent, id, pos, size, + style, wxDefaultValidator, name) ) + return false; + m_min = 0; m_max = 100; diff --git a/src/mac/statbox.cpp b/src/mac/statbox.cpp index e494e9e709..13c7daf669 100644 --- a/src/mac/statbox.cpp +++ b/src/mac/statbox.cpp @@ -38,6 +38,10 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { + if ( !wxControl::Create(parent, id, pos, size, + style, wxDefaultValidator, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/statlmac.cpp b/src/mac/statlmac.cpp index 30305cc1cf..a7a116ba57 100644 --- a/src/mac/statlmac.cpp +++ b/src/mac/statlmac.cpp @@ -49,6 +49,10 @@ bool wxStaticLine::Create( wxWindow *parent, long style, const wxString &name) { + if ( !wxStaticLineBase::Create(parent, id, pos, size, + style, wxDefaultValidator, name) ) + return false; + Rect bounds ; Str255 title ; diff --git a/src/mac/stattext.cpp b/src/mac/stattext.cpp index b2a7d103da..2d81d33b16 100644 --- a/src/mac/stattext.cpp +++ b/src/mac/stattext.cpp @@ -41,22 +41,17 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { - SetName(name); - m_backgroundColour = parent->GetBackgroundColour() ; - m_foregroundColour = parent->GetForegroundColour() ; - - if ( id == -1 ) - m_windowId = (int)NewControlId(); - else - m_windowId = id; - - m_windowStyle = style; m_label = wxStripMenuCodes(label) ; - bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name ); + if ( !wxControl::Create( parent, id, pos, size, style, + wxDefaultValidator , name ) ) + { + return false; + } + SetBestSize( size ) ; - return ret; + return true; } const wxString punct = wxT(" ,.-;:!?"); diff --git a/src/mac/tabctrl.cpp b/src/mac/tabctrl.cpp index 4fcf069286..f879b78447 100644 --- a/src/mac/tabctrl.cpp +++ b/src/mac/tabctrl.cpp @@ -34,6 +34,10 @@ wxTabCtrl::wxTabCtrl() bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { + if ( !wxControl::Create(parent, id, pos, size, + style, wxDefaultValidator, name) ) + return false; + Rect bounds ; Str255 title ; -- 2.45.2