X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c4ca49cde3c56f0f7b249fc62925df3d99ab3c58..645b5bd6c0bc43c1029bcaeed32f34db063a3739:/src/gtk/radiobox.cpp diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 551fc826aa..f5779a8936 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -246,16 +246,10 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, bool wasShown = IsShown(); if ( wasShown ) Hide(); // prevent PostCreation() from showing us - PostCreation(); - InheritAttributes(); - - ApplyWidgetStyle(); SetLabel( title ); - SetFont( parent->GetFont() ); - - SetBestSize( size ); + PostCreation(size); if ( wasShown ) Show(); @@ -292,6 +286,7 @@ wxSize wxRadioBox::DoGetBestSize() const if (req.width > size.x) size.x = req.width; + CacheBestSize(size); return size; } @@ -687,19 +682,21 @@ void wxRadioBox::GtkEnableEvents() } } -void wxRadioBox::ApplyWidgetStyle() +void wxRadioBox::DoApplyWidgetStyle(GtkRcStyle *style) { - SetWidgetStyle(); + gtk_widget_modify_style( m_widget, style ); - gtk_widget_set_style( m_widget, m_widgetStyle ); +#ifdef __WXGTK20__ + gtk_widget_modify_style(GTK_FRAME(m_widget)->label_widget, style); +#endif wxList::compatibility_iterator node = m_boxes.GetFirst(); while (node) { GtkWidget *widget = GTK_WIDGET( node->GetData() ); - gtk_widget_set_style( widget, m_widgetStyle ); - gtk_widget_set_style( BUTTON_CHILD(node->GetData()), m_widgetStyle ); + gtk_widget_modify_style( widget, style ); + gtk_widget_modify_style( BUTTON_CHILD(node->GetData()), style ); node = node->GetNext(); } @@ -758,5 +755,19 @@ void wxRadioBox::OnInternalIdle() } } +// static +wxVisualAttributes +wxRadioBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) +{ + wxVisualAttributes attr; + // NB: we need toplevel window so that GTK+ can find the right style + GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL); + GtkWidget* widget = gtk_radio_button_new_with_label(NULL, ""); + gtk_container_add(GTK_CONTAINER(wnd), widget); + attr = GetDefaultAttributesFromGTKWidget(widget); + gtk_widget_destroy(wnd); + return attr; +} + #endif // wxUSE_RADIOBOX