[gimp/gtk3-port: 39/226] libgimpwidgets: port GimpFrame to GTK+ 3.0



commit 8c8f0c69d475a2f3ea713b4c7bd3e212289062bc
Author: Michael Natterer <mitch gimp org>
Date:   Tue Oct 19 12:44:39 2010 +0200

    libgimpwidgets: port GimpFrame to GTK+ 3.0

 libgimpwidgets/gimpframe.c |   27 +++++++++++----------------
 1 files changed, 11 insertions(+), 16 deletions(-)
---
diff --git a/libgimpwidgets/gimpframe.c b/libgimpwidgets/gimpframe.c
index 39dbb25..6316892 100644
--- a/libgimpwidgets/gimpframe.c
+++ b/libgimpwidgets/gimpframe.c
@@ -53,8 +53,8 @@ static void      gimp_frame_size_allocate       (GtkWidget      *widget,
                                                  GtkAllocation  *allocation);
 static void      gimp_frame_style_set           (GtkWidget      *widget,
                                                  GtkStyle       *previous);
-static gboolean  gimp_frame_expose_event        (GtkWidget      *widget,
-                                                 GdkEventExpose *event);
+static gboolean  gimp_frame_draw                (GtkWidget      *widget,
+                                                 cairo_t        *cr);
 static void      gimp_frame_child_allocate      (GtkFrame       *frame,
                                                  GtkAllocation  *allocation);
 static void      gimp_frame_label_widget_notify (GtkFrame       *frame);
@@ -75,7 +75,7 @@ gimp_frame_class_init (GimpFrameClass *klass)
   widget_class->size_request  = gimp_frame_size_request;
   widget_class->size_allocate = gimp_frame_size_allocate;
   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,
                                            g_param_spec_boolean ("label-bold",
@@ -112,7 +112,7 @@ gimp_frame_size_request (GtkWidget      *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
     {
@@ -126,7 +126,7 @@ gimp_frame_size_request (GtkWidget      *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,
                                 child_requisition.width + indent);
@@ -163,7 +163,7 @@ gimp_frame_size_allocate (GtkWidget     *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.y      = allocation->y + border_width;
@@ -194,7 +194,7 @@ gimp_frame_child_allocate (GtkFrame      *frame,
     {
       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;
     }
 
@@ -228,17 +228,12 @@ gimp_frame_style_set (GtkWidget *widget,
 }
 
 static gboolean
-gimp_frame_expose_event (GtkWidget      *widget,
-                         GdkEventExpose *event)
+gimp_frame_draw (GtkWidget *widget,
+                 cairo_t   *cr)
 {
-  if (gtk_widget_is_drawable (widget))
-    {
-      GtkWidgetClass *widget_class = g_type_class_peek_parent (parent_class);
-
-      return widget_class->expose_event (widget, event);
-    }
+  GtkWidgetClass *widget_class = g_type_class_peek_parent (parent_class);
 
-  return FALSE;
+  return widget_class->draw (widget, cr);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]