]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/combobox.mm
no changes, just a typo fix
[wxWidgets.git] / src / cocoa / combobox.mm
index 47619d7d27ee08a01c5bd931e1086da317f4483e..041fd382c5cb67a01d79e40252630514218f4ea0 100644 (file)
 
 #if wxUSE_COMBOBOX
 
+#include "wx/combobox.h"
+
 #ifndef WX_PRECOMP
     #include "wx/window.h"
     #include "wx/log.h"
+    #include "wx/app.h"
 #endif // WX_PRECOMP
 
-#include "wx/cocoa/ObjcPose.h"
-#include "wx/combobox.h"
-
 #import <AppKit/NSComboBox.h>
 #import <Foundation/NSNotification.h>
 #import <Foundation/NSString.h>
@@ -159,9 +159,6 @@ void wxCocoaNSComboBox::DisassociateNSComboBox(WX_NSComboBox cocoaNSComboBox)
 
 @end // implementation wxPoserNSComboBox
 
-#include "wx/app.h"
-#include "wx/combobox.h"
-
 #include "wx/cocoa/autorelease.h"
 #include "wx/cocoa/string.h"
 
@@ -209,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 :)
 
@@ -249,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);
@@ -291,20 +287,20 @@ int wxComboBox::GetSelection() const
     return [GetNSComboBox() indexOfSelectedItem];
 }
 
-int wxComboBox::DoAppend(const wxString& szItem)
-{
-    m_Datas.Add(NULL);
-    wxAutoNSAutoreleasePool pool;
-    [GetNSComboBox() addItemWithObjectValue:wxNSStringWithWxString(szItem)];
-    return [GetNSComboBox() numberOfItems];
-}
-
-int wxComboBox::DoInsert(const wxString& szItem, unsigned int nIndex)
+int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items,
+                              unsigned int pos,
+                              void **clientData,
+                              wxClientDataType type)
 {
-    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)
@@ -317,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