- gtk_menu_append( GTK_MENU(menu), item );
- gtk_widget_show( item );
- };
- gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
-
- PostCreation();
-
- Show( TRUE );
-
- return TRUE;
-};
-
-void wxChoice::Append( const wxString &item )
-{
- GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
- GtkWidget *menu_item;
- menu_item = gtk_menu_item_new_with_label( item );
- gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
- GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
- gtk_menu_append( GTK_MENU(menu), menu_item );
- gtk_widget_show( menu_item );
-};
-
-void wxChoice::Clear(void)
-{
- gtk_option_menu_remove_menu( GTK_OPTION_MENU(m_widget) );
- GtkWidget *menu = gtk_menu_new();
- gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
-};
+
+ gtk_widget_show( menu_item );
+
+ m_clientList.Append( (wxObject*) NULL );
+
+ // return the index of the item in the control
+ return GetCount() - 1;
+}
+
+void wxChoice::DoSetClientData( int n, void* clientData )
+{
+ wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
+
+ wxNode *node = m_clientList.Nth( n );
+ wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetClientData") );
+
+ node->SetData( (wxObject*) clientData );
+}
+
+void* wxChoice::DoGetClientData( int n ) const
+{
+ wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid combobox") );
+
+ wxNode *node = m_clientList.Nth( n );
+ wxCHECK_MSG( node, NULL, wxT("invalid index in wxChoice::DoGetClientData") );
+
+ return node->Data();
+}
+
+void wxChoice::DoSetClientObject( int n, wxClientData* clientData )
+{
+ wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
+
+ wxNode *node = m_clientList.Nth( n );
+ wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetClientObject") );
+
+ wxClientData *cd = (wxClientData*) node->Data();
+ delete cd;
+
+ node->SetData( (wxObject*) clientData );
+}
+
+wxClientData* wxChoice::DoGetClientObject( int n ) const
+{
+ wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid combobox") );
+
+ wxNode *node = m_clientList.Nth( n );
+ wxCHECK_MSG( node, (wxClientData *)NULL,
+ wxT("invalid index in wxChoice::DoGetClientObject") );
+
+ return (wxClientData*) node->Data();
+}
+
+void wxChoice::Clear()
+{
+ wxCHECK_RET( m_widget != NULL, wxT("invalid choice") );
+
+ gtk_option_menu_remove_menu( GTK_OPTION_MENU(m_widget) );
+ GtkWidget *menu = gtk_menu_new();
+ gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
+
+ if (m_clientDataItemsType == ClientData_Object)
+ {
+ wxNode *node = m_clientList.First();
+ while (node)
+ {
+ wxClientData *cd = (wxClientData*)node->Data();
+ if (cd) delete cd;
+ node = node->Next();
+ }
+ }
+ m_clientList.Clear();
+}
+
+void wxChoice::Delete( int WXUNUSED(n) )
+{
+ wxFAIL_MSG( wxT("wxChoice:Delete not implemented") );
+}