- SetWidgetStyle();
-
- GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
-
- gtk_widget_set_style( m_widget, m_widgetStyle );
- gtk_widget_set_style( GTK_WIDGET( menu_shell ), m_widgetStyle );
-
- GList *child = menu_shell->children;
- while (child)
- {
- gtk_widget_set_style( GTK_WIDGET( child->data ), m_widgetStyle );
-
- GtkBin *bin = GTK_BIN( child->data );
- GtkWidget *label = (GtkWidget *) NULL;
- if (bin->child) label = bin->child;
- if (!label) label = GTK_BUTTON(m_widget)->child;
-
- gtk_widget_set_style( label, m_widgetStyle );
-
- child = child->next;
- }
+ SetWidgetStyle();
+
+ GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
+
+ gtk_widget_set_style( m_widget, m_widgetStyle );
+ gtk_widget_set_style( GTK_WIDGET( menu_shell ), m_widgetStyle );
+
+ GList *child = menu_shell->children;
+ while (child)
+ {
+ gtk_widget_set_style( GTK_WIDGET( child->data ), m_widgetStyle );
+
+ GtkBin *bin = GTK_BIN( child->data );
+ GtkWidget *label = (GtkWidget *) NULL;
+ if (bin->child) label = bin->child;
+ if (!label) label = GTK_BUTTON(m_widget)->child;
+
+ gtk_widget_set_style( label, m_widgetStyle );
+
+ child = child->next;
+ }
+}
+
+size_t wxChoice::GtkAppendHelper(GtkWidget *menu, const wxString& item)
+{
+ GtkWidget *menu_item = gtk_menu_item_new_with_label( item.mbc_str() );
+
+ size_t index;
+ if ( m_strings )
+ {
+ // sorted control, need to insert at the correct index
+ index = m_strings->Add(item);
+
+ gtk_menu_insert( GTK_MENU(menu), menu_item, index );
+
+ if ( index )
+ {
+ m_clientList.Insert( m_clientList.Item(index - 1),
+ (wxObject*) NULL );
+ }
+ else
+ {
+ m_clientList.Insert( (wxObject*) NULL );
+ }
+ }
+ else
+ {
+ // normal control, just append
+ gtk_menu_append( GTK_MENU(menu), menu_item );
+
+ m_clientList.Append( (wxObject*) NULL );
+
+ // don't call wxChoice::GetCount() from here because it doesn't work
+ // if we're called from ctor (and GtkMenuShell is still NULL)
+ index = m_clientList.GetCount() - 1;
+ }
+
+ if (GTK_WIDGET_REALIZED(m_widget))
+ {
+ gtk_widget_realize( menu_item );
+ gtk_widget_realize( GTK_BIN(menu_item)->child );
+
+ if (m_widgetStyle) ApplyWidgetStyle();
+ }
+
+ gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
+ GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
+
+ gtk_widget_show( menu_item );
+
+ // return the index of the item in the control
+ return index;
+}
+
+wxSize wxChoice::DoGetBestSize() const
+{
+ wxSize ret( wxControl::DoGetBestSize() );
+ if (ret.x < 80) ret.x = 80;
+ ret.y = 16 + gdk_char_height( m_widget->style->font, 'H' );
+ return ret;