From 8dc6614e60709a87d13615c050f743fa1c17ec9d Mon Sep 17 00:00:00 2001 From: Kevin Hock Date: Tue, 14 Feb 2006 04:00:39 +0000 Subject: [PATCH] Fix wxComboBox constructors after keyboard access commit, not all constructors were setting the parent container pointer. Added Init method and put all the constructors together in the header (rather than being split between h and cpp) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37572 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mac/carbon/combobox.h | 18 +++++++++++++----- src/mac/carbon/combobox.cpp | 10 +++++----- 2 files changed, 18 insertions(+), 10 deletions(-) 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, -- 2.45.2