+ m_clientDataList.Append( (wxObject*) NULL );
+ m_clientObjectList.Append( (wxObject*) clientData );
+
+ return AppendCommon( item );
+}
+
+int wxComboBox::InsertCommon( const wxString &item, int pos )
+{
+ wxCHECK_MSG( !(GetWindowStyle() & wxCB_SORT), -1,
+ wxT("can't insert into sorted list"));
+
+ wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") );
+
+ int count = GetCount();
+ if (pos == count)
+ {
+ return AppendCommon(item);
+ }
+
+ DisableEvents();
+
+ GtkWidget *list = GTK_COMBO(m_widget)->list;
+
+ GtkWidget *list_item = gtk_list_item_new_with_label( wxGTK_CONV( item ) );
+
+ GList *gitem_list = g_list_alloc ();
+ gitem_list->data = list_item;
+ gtk_list_insert_items( GTK_LIST (list), gitem_list, pos );
+
+ if (GTK_WIDGET_REALIZED(m_widget))
+ {
+ gtk_widget_realize( list_item );
+ gtk_widget_realize( GTK_BIN(list_item)->child );
+
+ if (m_widgetStyle)
+ ApplyWidgetStyle();
+ }
+
+ gtk_widget_show( list_item );
+
+ EnableEvents();
+
+ return pos;
+}
+
+int wxComboBox::Insert( const wxString &item, int pos )
+{
+ const int count = GetCount();
+ wxCHECK_MSG( (pos >= 0) && (pos <= count), -1, wxT("invalid index") );
+
+ if (pos == count)
+ {
+ return Append(item);
+ }
+
+ m_clientDataList.Insert( pos, (wxObject*) NULL );
+ m_clientObjectList.Insert( pos, (wxObject*) NULL );
+
+ return InsertCommon( item, pos );
+}
+
+int wxComboBox::Insert( const wxString &item, int pos, void *clientData )
+{
+ int count = GetCount();
+ wxCHECK_MSG( (pos >= 0) && (pos <= count), -1, wxT("invalid index") );
+
+ if (pos == count)
+ {
+ return Append(item, clientData);
+ }
+
+ m_clientDataList.Insert( pos, (wxObject*) clientData );
+ m_clientObjectList.Insert( pos, (wxObject*)NULL );
+
+ return InsertCommon( item, pos );
+}
+
+int wxComboBox::Insert( const wxString &item, int pos, wxClientData *clientData )
+{
+ int count = GetCount();
+ wxCHECK_MSG( (pos >= 0) && (pos <= count), -1, wxT("invalid index") );
+
+ if (pos == count)
+ {
+ return Append(item, clientData);
+ }
+
+ m_clientDataList.Insert( pos, (wxObject*) NULL );
+ m_clientObjectList.Insert( pos, (wxObject*) clientData );
+
+ return InsertCommon( item, pos );
+}
+
+void wxComboBox::SetClientData( int n, void* clientData )
+{
+ wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
+
+ wxList::compatibility_iterator node = m_clientDataList.Item( n );
+ if (!node) return;
+
+ node->SetData( (wxObject*) clientData );
+}
+
+void* wxComboBox::GetClientData( int n ) const
+{
+ wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid combobox") );
+
+ wxList::compatibility_iterator node = m_clientDataList.Item( n );
+
+ return node ? node->GetData() : NULL;
+}
+
+void wxComboBox::SetClientObject( int n, wxClientData* clientData )
+{
+ wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
+
+ wxList::compatibility_iterator node = m_clientObjectList.Item( n );
+ if (!node) return;
+
+ wxClientData *cd = (wxClientData*) node->GetData();
+ if (cd) delete cd;
+
+ node->SetData( (wxObject*) clientData );
+}
+
+wxClientData* wxComboBox::GetClientObject( int n ) const
+{
+ wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, wxT("invalid combobox") );
+
+ wxList::compatibility_iterator node = m_clientObjectList.Item( n );
+
+ return node ? (wxClientData*) node->GetData() : NULL;
+}
+
+void wxComboBox::Clear()
+{
+ wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
+
+ DisableEvents();
+
+ GtkWidget *list = GTK_COMBO(m_widget)->list;
+ gtk_list_clear_items( GTK_LIST(list), 0, Number() );
+
+ wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
+ while (node)
+ {
+ wxClientData *cd = (wxClientData*)node->GetData();
+ if (cd) delete cd;
+ node = node->GetNext();
+ }
+ m_clientObjectList.Clear();
+
+ m_clientDataList.Clear();
+
+ EnableEvents();