X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3f26799e25db9960580c8bf5280cb6ccd5bd167c..f5ba273ecd799f652736ce2bc830283787302a56:/src/gtk/radiobox.cpp diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 6dda8dc6c4..10044f42a1 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -180,22 +180,31 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, m_x+10, m_y+10+(i*24), 10, 10 ); } + m_parent->DoAddChild( this ); + + PostCreation(); + + ApplyWidgetStyle(); + + SetLabel( title ); + + SetFont( parent->GetFont() ); + wxSize ls = LayoutItems(); + GtkRequisition req; + req.width = 2; + req.height = 2; + (* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req ); + if (req.width > ls.x) ls.x = req.width; + wxSize newSize = size; if (newSize.x == -1) newSize.x = ls.x; if (newSize.y == -1) newSize.y = ls.y; SetSize( newSize.x, newSize.y ); - m_parent->DoAddChild( this ); - - PostCreation(); - - SetLabel( title ); - SetBackgroundColour( parent->GetBackgroundColour() ); SetForegroundColour( parent->GetForegroundColour() ); - SetFont( parent->GetFont() ); Show( TRUE ); @@ -262,13 +271,17 @@ wxSize wxRadioBox::LayoutItems() for (int i1 = 0; i1< num_of_rows; i1++) { GtkWidget *button = GTK_WIDGET( node->Data() ); - GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child ); - GdkFont *font = m_widget->style->font; - int len = 22+gdk_string_measure( font, label->label ); - if (len > max_len) max_len = len; + + GtkRequisition req; + req.width = 2; + req.height = 2; + (* GTK_WIDGET_CLASS( GTK_OBJECT(button)->klass )->size_request ) + (button, &req ); + + if (req.width > max_len) max_len = req.width; gtk_pizza_move( GTK_PIZZA(m_parent->m_wxwindow), button, m_x+x, m_y+y ); - y += 22; + y += req.height; node = node->Next(); if (!node) break; @@ -293,7 +306,7 @@ wxSize wxRadioBox::LayoutItems() } res.x = x+4; - res.y += 9; + res.y += 4; } else { @@ -302,12 +315,15 @@ wxSize wxRadioBox::LayoutItems() wxNode *node = m_boxes.First(); while (node) { - GtkButton *button = GTK_BUTTON( node->Data() ); - GtkLabel *label = GTK_LABEL( button->child ); + GtkWidget *button = GTK_WIDGET( node->Data() ); + + GtkRequisition req; + req.width = 2; + req.height = 2; + (* GTK_WIDGET_CLASS( GTK_OBJECT(button)->klass )->size_request ) + (button, &req ); - GdkFont *font = m_widget->style->font; - int len = 22+gdk_string_measure( font, label->label ); - if (len > max) max = len; + if (req.width > max) max = req.width; node = node->Next(); }