m_strings = (wxSortedArrayString *)NULL;
}
+bool wxChoice::Create( wxWindow *parent, wxWindowID id,
+ const wxPoint &pos, const wxSize &size,
+ const wxArrayString& choices,
+ long style, const wxValidator& validator,
+ const wxString &name )
+{
+ wxCArrayString chs(choices);
+
+ return Create( parent, id, pos, size, chs.GetCount(), chs.GetStrings(),
+ style, validator, name );
+}
+
bool wxChoice::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
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",
size_t count = GetCount();
for ( size_t n = 0; n < count; n++ )
{
- GetTextExtent( GetString(n), &width, NULL, NULL, NULL, &m_font );
+ GetTextExtent( GetString(n), &width, NULL, NULL, NULL );
if ( width > ret.x )
ret.x = width;
}
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();
return ret;
}
#endif
}
+// static
+wxVisualAttributes
+wxChoice::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+ return GetDefaultAttributesFromGTKWidget(gtk_option_menu_new);
+}
+
#endif // wxUSE_CHOICE