diff --git a/include/wx/mac/carbon/combobox.h b/include/wx/mac/carbon/combobox.h index 45b4f96b4e..6c7d4a5c85 100644 --- a/include/wx/mac/carbon/combobox.h +++ b/include/wx/mac/carbon/combobox.h @@ -28,7 +28,6 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase DECLARE_DYNAMIC_CLASS(wxComboBox) public: - wxComboBox() ; virtual ~wxComboBox(); // forward these functions to all subcontrols @@ -39,7 +38,9 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase virtual void DelegateTextChanged( const wxString& value ); virtual void DelegateChoice( const wxString& value ); - inline wxComboBox(wxWindow *parent, wxWindowID id, + wxComboBox() { Init(); } + + wxComboBox(wxWindow *parent, wxWindowID id, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -48,9 +49,11 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr) { - Create(parent, id, value, pos, size, n, choices, style, validator, name); + Init(); + Create(parent, id, value, pos, size, n, choices, style, validator, name); } - inline wxComboBox(wxWindow *parent, wxWindowID id, + + wxComboBox(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, @@ -59,7 +62,8 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr) { - Create(parent, id, value, pos, size, choices, style, validator, name); + Init(); + Create(parent, id, value, pos, size, choices, style, validator, name); } bool Create(wxWindow *parent, wxWindowID id, @@ -70,6 +74,7 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, @@ -131,6 +136,9 @@ protected: virtual wxSize DoGetBestSize() const; virtual void DoMoveWindow(int x, int y, int width, int height); + // common part of all ctors + void Init(); + virtual int DoAppend(const wxString& item) ; virtual int DoInsert(const wxString& item, int pos) ; diff --git a/src/mac/carbon/combobox.cpp b/src/mac/carbon/combobox.cpp index a1fbf3c01f..56238d61d6 100644 --- a/src/mac/carbon/combobox.cpp +++ b/src/mac/carbon/combobox.cpp @@ -226,11 +226,6 @@ BEGIN_EVENT_TABLE(wxComboBoxChoice, wxChoice) EVT_CHOICE(-1, wxComboBoxChoice::OnChoice) END_EVENT_TABLE() -wxComboBox::wxComboBox() -{ - m_container.SetContainerWindow(this); -} - wxComboBox::~wxComboBox() { // delete client objects @@ -335,6 +330,11 @@ void wxComboBox::DelegateChoice( const wxString& value ) SetStringSelection( value ); } +void wxComboBox::Init() +{ + m_container.SetContainerWindow(this); +} + bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,