libgimpwidgets: port GimpFrame to GTK+ 3.0

This commit is contained in:
Michael Natterer 2010-10-19 12:44:39 +02:00
parent df65b0bdcd
commit 566a71ba7d

View file

@ -54,8 +54,8 @@ static void gimp_frame_size_allocate (GtkWidget *widget,
GtkAllocation *allocation); GtkAllocation *allocation);
static void gimp_frame_style_set (GtkWidget *widget, static void gimp_frame_style_set (GtkWidget *widget,
GtkStyle *previous); GtkStyle *previous);
static gboolean gimp_frame_expose_event (GtkWidget *widget, static gboolean gimp_frame_draw (GtkWidget *widget,
GdkEventExpose *event); cairo_t *cr);
static void gimp_frame_child_allocate (GtkFrame *frame, static void gimp_frame_child_allocate (GtkFrame *frame,
GtkAllocation *allocation); GtkAllocation *allocation);
static void gimp_frame_label_widget_notify (GtkFrame *frame); static void gimp_frame_label_widget_notify (GtkFrame *frame);
@ -76,7 +76,7 @@ gimp_frame_class_init (GimpFrameClass *klass)
widget_class->size_request = gimp_frame_size_request; widget_class->size_request = gimp_frame_size_request;
widget_class->size_allocate = gimp_frame_size_allocate; widget_class->size_allocate = gimp_frame_size_allocate;
widget_class->style_set = gimp_frame_style_set; widget_class->style_set = gimp_frame_style_set;
widget_class->expose_event = gimp_frame_expose_event; widget_class->draw = gimp_frame_draw;
gtk_widget_class_install_style_property (widget_class, gtk_widget_class_install_style_property (widget_class,
g_param_spec_boolean ("label-bold", g_param_spec_boolean ("label-bold",
@ -115,7 +115,7 @@ gimp_frame_size_request (GtkWidget *widget,
if (label_widget && gtk_widget_get_visible (label_widget)) if (label_widget && gtk_widget_get_visible (label_widget))
{ {
gtk_widget_size_request (label_widget, requisition); gtk_widget_get_preferred_size (label_widget, requisition, NULL);
} }
else else
{ {
@ -129,7 +129,7 @@ gimp_frame_size_request (GtkWidget *widget,
{ {
gint indent = gimp_frame_get_indent (widget); gint indent = gimp_frame_get_indent (widget);
gtk_widget_size_request (child, &child_requisition); gtk_widget_get_preferred_size (child, &child_requisition, NULL);
requisition->width = MAX (requisition->width, requisition->width = MAX (requisition->width,
child_requisition.width + indent); child_requisition.width + indent);
@ -167,7 +167,7 @@ gimp_frame_size_allocate (GtkWidget *widget,
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
gtk_widget_get_child_requisition (label_widget, &label_requisition); gtk_widget_get_preferred_size (label_widget, &label_requisition, NULL);
label_allocation.x = allocation->x + border_width; label_allocation.x = allocation->x + border_width;
label_allocation.y = allocation->y + border_width; label_allocation.y = allocation->y + border_width;
@ -198,7 +198,7 @@ gimp_frame_child_allocate (GtkFrame *frame,
{ {
GtkRequisition child_requisition; GtkRequisition child_requisition;
gtk_widget_get_child_requisition (label_widget, &child_requisition); gtk_widget_get_preferred_size (label_widget, &child_requisition, NULL);
spacing += child_requisition.height; spacing += child_requisition.height;
} }
@ -232,17 +232,12 @@ gimp_frame_style_set (GtkWidget *widget,
} }
static gboolean static gboolean
gimp_frame_expose_event (GtkWidget *widget, gimp_frame_draw (GtkWidget *widget,
GdkEventExpose *event) cairo_t *cr)
{ {
if (gtk_widget_is_drawable (widget)) GtkWidgetClass *widget_class = g_type_class_peek_parent (parent_class);
{
GtkWidgetClass *widget_class = g_type_class_peek_parent (parent_class);
return widget_class->expose_event (widget, event); return widget_class->draw (widget, cr);
}
return FALSE;
} }
static void static void