X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/22756322824e8f377b792897209d052ca9281534..64ea838d8f4d1853b7d850db93ee565e901d099a:/src/osx/combobox_osx.cpp diff --git a/src/osx/combobox_osx.cpp b/src/osx/combobox_osx.cpp index 1d4529bbbc..00a8e571fe 100644 --- a/src/osx/combobox_osx.cpp +++ b/src/osx/combobox_osx.cpp @@ -25,10 +25,6 @@ wxComboBox::~wxComboBox() { } -void wxComboBox::Init() -{ -} - bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, @@ -53,11 +49,11 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + DontCreatePeer(); + m_text = NULL; m_choice = NULL; - - m_macIsUserPane = false; - + if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) ) return false; @@ -135,11 +131,13 @@ unsigned int wxComboBox::GetCount() const void wxComboBox::DoDeleteOneItem(unsigned int n) { + m_datas.RemoveAt(n); GetComboPeer()->RemoveItem(n); } void wxComboBox::DoClear() { + m_datas.Clear(); GetComboPeer()->Clear(); } @@ -193,8 +191,11 @@ wxString wxComboBox::GetStringSelection() const void wxComboBox::SetString(unsigned int n, const wxString& s) { - Delete(n); - Insert(s, n); + // Notice that we shouldn't delete and insert the item in this control + // itself as this would also affect the client data which we need to + // preserve here. + GetComboPeer()->RemoveItem(n); + GetComboPeer()->InsertItem(n, s); SetValue(s); // changing the item in the list won't update the display item } @@ -219,4 +220,14 @@ wxComboWidgetImpl* wxComboBox::GetComboPeer() const return dynamic_cast (GetPeer()); } +void wxComboBox::Popup() +{ + GetComboPeer()->Popup(); +} + +void wxComboBox::Dismiss() +{ + GetComboPeer()->Dismiss(); +} + #endif // wxUSE_COMBOBOX && wxOSX_USE_COCOA