many wxItemContainer-related changes:
1. the main function for item insertion is now DoInsertItems() which allows for much more efficient addition of many new items at once 2. the items client data management is done entirely in wxItemContainer itself, the derived classes don't have to distinguish between void and object client data 3. many fixes for sorted controls, in particular implemented wxCB_SORT support in wxGTK combobox git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47730 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -206,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 :)
|
||||
|
||||
@@ -246,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);
|
||||
@@ -288,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)
|
||||
@@ -314,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
|
||||
|
||||
Reference in New Issue
Block a user