// Name: choice.cpp
// Purpose:
// Author: Robert Roebling
-// Id: $id$
+// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
for (int i = 0; i < n; i++)
{
GtkWidget *item = gtk_menu_item_new_with_label( choices[i] );
- gtk_signal_connect( GTK_OBJECT( item ), "activate",
- GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
-
gtk_menu_append( GTK_MENU(menu), item );
- gtk_widget_show( item );
gtk_widget_realize( item );
gtk_widget_realize( GTK_BIN(item)->child );
+
+ gtk_widget_show( item );
+
+ gtk_signal_connect( GTK_OBJECT( item ), "activate",
+ GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
}
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
PostCreation();
SetBackgroundColour( parent->GetBackgroundColour() );
+ SetForegroundColour( parent->GetForegroundColour() );
Show( TRUE );
gtk_widget_realize( menu_item );
gtk_widget_realize( GTK_BIN(menu_item)->child );
- if (m_hasOwnStyle)
- {
-
- GtkBin *bin = GTK_BIN( menu_item );
-
- gtk_widget_set_style( bin->child,
- gtk_style_ref(
- gtk_widget_get_style( m_widget ) ) );
-
- gtk_widget_set_style( GTK_WIDGET( bin ),
- gtk_style_ref(
- gtk_widget_get_style( m_widget ) ) );
- }
+ if (m_widgetStyle) ApplyWidgetStyle();
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
if (n != -1) SetSelection( n );
}
-void wxChoice::SetFont( const wxFont &font )
+void wxChoice::ApplyWidgetStyle()
{
- wxCHECK_RET( m_widget != NULL, "invalid choice" );
-
- wxControl::SetFont( font );
-
+ 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,
- gtk_style_ref(
- gtk_widget_get_style( m_widget ) ) );
-
- child = child->next;
- }
-}
-
-void wxChoice::SetBackgroundColour( const wxColour &colour )
-{
- return;
-
- wxCHECK_RET( m_widget != NULL, "invalid choice" );
-
- wxControl::SetBackgroundColour( colour );
-
- if (!m_backgroundColour.Ok()) return;
-
- GtkStyle *style = gtk_widget_get_style( m_widget );
-
- GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
-
- gtk_widget_set_style( GTK_WIDGET( menu_shell ), gtk_style_ref( style ) );
-
- GList *child = menu_shell->children;
- while (child)
- {
- gtk_widget_set_style( GTK_WIDGET( child->data ), gtk_style_ref( style ) );
+ gtk_widget_set_style( label, m_widgetStyle );
+
child = child->next;
}
}
-
-