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
This commit is contained in:
Kevin Hock 2006-02-14 04:00:39 +00:00
parent e6b1317b79
commit 8dc6614e60
2 changed files with 18 additions and 10 deletions

View File

@ -28,7 +28,6 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
DECLARE_DYNAMIC_CLASS(wxComboBox) DECLARE_DYNAMIC_CLASS(wxComboBox)
public: public:
wxComboBox() ;
virtual ~wxComboBox(); virtual ~wxComboBox();
// forward these functions to all subcontrols // 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 DelegateTextChanged( const wxString& value );
virtual void DelegateChoice( 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 wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
@ -48,9 +49,11 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr) 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 wxString& value,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
@ -59,7 +62,8 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr) 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, bool Create(wxWindow *parent, wxWindowID id,
@ -70,6 +74,7 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
long style = 0, long style = 0,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr); const wxString& name = wxComboBoxNameStr);
bool Create(wxWindow *parent, wxWindowID id, bool Create(wxWindow *parent, wxWindowID id,
const wxString& value, const wxString& value,
const wxPoint& pos, const wxPoint& pos,
@ -131,6 +136,9 @@ protected:
virtual wxSize DoGetBestSize() const; virtual wxSize DoGetBestSize() const;
virtual void DoMoveWindow(int x, int y, int width, int height); 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 DoAppend(const wxString& item) ;
virtual int DoInsert(const wxString& item, int pos) ; virtual int DoInsert(const wxString& item, int pos) ;

View File

@ -226,11 +226,6 @@ BEGIN_EVENT_TABLE(wxComboBoxChoice, wxChoice)
EVT_CHOICE(-1, wxComboBoxChoice::OnChoice) EVT_CHOICE(-1, wxComboBoxChoice::OnChoice)
END_EVENT_TABLE() END_EVENT_TABLE()
wxComboBox::wxComboBox()
{
m_container.SetContainerWindow(this);
}
wxComboBox::~wxComboBox() wxComboBox::~wxComboBox()
{ {
// delete client objects // delete client objects
@ -335,6 +330,11 @@ void wxComboBox::DelegateChoice( const wxString& value )
SetStringSelection( value ); SetStringSelection( value );
} }
void wxComboBox::Init()
{
m_container.SetContainerWindow(this);
}
bool wxComboBox::Create(wxWindow *parent, bool wxComboBox::Create(wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxString& value, const wxString& value,