m_parent->DoAddChild( this );
- PostCreation();
- InheritAttributes();
-
- SetBestSize(size);
-
- Show( TRUE );
+ PostCreation(size);
+ SetBestSize(size); // need this too because this is a wxControlWithItems
return TRUE;
}
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
}
-void wxChoice::ApplyWidgetStyle()
+void wxChoice::DoApplyWidgetStyle(GtkRcStyle *style)
{
- 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 );
+ gtk_widget_modify_style( m_widget, style );
+ gtk_widget_modify_style( GTK_WIDGET( menu_shell ), style );
GList *child = menu_shell->children;
while (child)
{
- gtk_widget_set_style( GTK_WIDGET( child->data ), m_widgetStyle );
+ gtk_widget_modify_style( GTK_WIDGET( child->data ), style );
GtkBin *bin = GTK_BIN( child->data );
GtkWidget *label = (GtkWidget *) NULL;
if (!label)
label = BUTTON_CHILD(m_widget);
- gtk_widget_set_style( label, m_widgetStyle );
+ gtk_widget_modify_style( label, style );
child = child->next;
}
gtk_widget_realize( menu_item );
gtk_widget_realize( GTK_BIN(menu_item)->child );
- if (m_widgetStyle) ApplyWidgetStyle();
+ ApplyWidgetStyle();
}
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
if ( ret.x < 80 )
ret.x = 80;
- ret.y = 16 + GetCharHeight();
+ // If this request_size is called with no entries then
+ // the returned height is wrong. Give it a reasonable
+ // default value.
+ if (ret.y <= 18)
+ ret.y = 8 + GetCharHeight();
+ CacheBestSize(ret);
return ret;
}
#endif
}
+// static
+wxVisualAttributes
+wxChoice::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+ return GetDefaultAttributesFromGTKWidget(gtk_option_menu_new);
+}
+
#endif // wxUSE_CHOICE