X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/94e0018723919fe2ca2f5b5f0a42804c16dbf3a1..7c60222510bc5e197b12f153c4bf05db66cb0f4a:/src/osx/combobox_osx.cpp diff --git a/src/osx/combobox_osx.cpp b/src/osx/combobox_osx.cpp index fe9f812f75..3487ef9b17 100644 --- a/src/osx/combobox_osx.cpp +++ b/src/osx/combobox_osx.cpp @@ -131,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(); } @@ -187,10 +189,21 @@ wxString wxComboBox::GetStringSelection() const return sel == wxNOT_FOUND ? wxString() : GetString(sel); } +void wxComboBox::SetValue(const wxString& value) +{ + if ( HasFlag(wxCB_READONLY) ) + SetStringSelection( value ) ; + else + wxTextEntry::SetValue( value ); +} + 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 } @@ -202,7 +215,7 @@ void wxComboBox::EnableTextChangedEvents(bool WXUNUSED(enable)) bool wxComboBox::OSXHandleClicked( double WXUNUSED(timestampsec) ) { - wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId ); + wxCommandEvent event(wxEVT_COMBOBOX, m_windowId ); event.SetInt(GetSelection()); event.SetEventObject(this); event.SetString(GetStringSelection()); @@ -215,4 +228,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