X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a5bbd1cc9119aa8df58e11d7d9db7ace0ef98bfd..11fe6505b848a968f4c89cb3c3fd37a6a03bcaea:/src/cocoa/combobox.mm diff --git a/src/cocoa/combobox.mm b/src/cocoa/combobox.mm index 822194e427..041fd382c5 100644 --- a/src/cocoa/combobox.mm +++ b/src/cocoa/combobox.mm @@ -86,8 +86,6 @@ #include "wx/app.h" #endif // WX_PRECOMP -#include "wx/cocoa/ObjcPose.h" - #import #import #import @@ -208,8 +206,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID winid, m_parent->CocoaAddChild(this); SetInitialFrameRect(pos,size); - for(int i = 0; i < n; ++i) - wxComboBox::DoAppend(choices[i]); + wxComboBox::Append(n, choices); [GetNSComboBox() setCompletes:true]; //autocomplete :) @@ -248,13 +245,13 @@ wxString wxComboBox::GetStringSelection() return wxStringWithNSString([GetNSComboBox() objectValueOfSelectedItem]); } -void wxComboBox::Clear() +void wxComboBox::DoClear() { [GetNSComboBox() removeAllItems]; m_Datas.Clear(); } -void wxComboBox::Delete(unsigned int n) +void wxComboBox::DoDeleteOneItem(unsigned int n) { [GetNSComboBox() removeItemAtIndex:n]; m_Datas.RemoveAt(n); @@ -290,20 +287,20 @@ int wxComboBox::GetSelection() const return [GetNSComboBox() indexOfSelectedItem]; } -int wxComboBox::DoAppend(const wxString& szItem) +int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, + wxClientDataType type) { - m_Datas.Add(NULL); wxAutoNSAutoreleasePool pool; - [GetNSComboBox() addItemWithObjectValue:wxNSStringWithWxString(szItem)]; - return [GetNSComboBox() numberOfItems]; -} - -int wxComboBox::DoInsert(const wxString& szItem, unsigned int nIndex) -{ - m_Datas.Insert(NULL, nIndex); - wxAutoNSAutoreleasePool pool; - [GetNSComboBox() insertItemWithObjectValue:wxNSStringWithWxString(szItem) atIndex:nIndex]; - return (int)nIndex; + const unsigned int numITems = items.GetCount(); + for ( unsigned int i = 0; i < numITems; ++i, ++pos ) + { + [GetNSComboBox() insertItemWithObjectValue:wxNSStringWithWxString(items[i]) atIndex:(pos)]; + m_Datas.Insert(NULL, pos); + AssignNewItemClientData(pos, clientData, i, type); + } + return pos - 1; } void wxComboBox::DoSetItemClientData(unsigned int nIndex, void* pData) @@ -316,14 +313,4 @@ void* wxComboBox::DoGetItemClientData(unsigned int nIndex) const return m_Datas[nIndex]; } -void wxComboBox::DoSetItemClientObject(unsigned int nIndex, wxClientData* pClientData) -{ - m_Datas[nIndex] = (void*) pClientData; -} - -wxClientData* wxComboBox::DoGetItemClientObject(unsigned int nIndex) const -{ - return (wxClientData*) m_Datas[nIndex]; -} - -#endif //wxUSE_COMBOBOX +#endif // wxUSE_COMBOBOX