#include "wx/app.h"
#endif // WX_PRECOMP
-#include "wx/cocoa/ObjcPose.h"
-
#import <AppKit/NSComboBox.h>
#import <Foundation/NSNotification.h>
#import <Foundation/NSString.h>
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 :)
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);
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)
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