libgimpwidgets: port to the new size request API

This commit is contained in:
Michael Natterer 2010-10-28 13:26:39 +02:00
parent 2ffda5a25d
commit 694e5ac9f6
2 changed files with 89 additions and 31 deletions

View File

@ -48,19 +48,23 @@
#define GIMP_FRAME_IN_EXPANDER_KEY "gimp-frame-in-expander"
static void gimp_frame_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gimp_frame_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gimp_frame_style_set (GtkWidget *widget,
GtkStyle *previous);
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);
static gint gimp_frame_get_indent (GtkWidget *widget);
static gint gimp_frame_get_label_spacing (GtkFrame *frame);
static void gimp_frame_get_preferred_width (GtkWidget *widget,
gint *minimum_width,
gint *natural_width);
static void gimp_frame_get_preferred_height (GtkWidget *widget,
gint *minimum_height,
gint *natural_height);
static void gimp_frame_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gimp_frame_style_set (GtkWidget *widget,
GtkStyle *previous);
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);
static gint gimp_frame_get_indent (GtkWidget *widget);
static gint gimp_frame_get_label_spacing (GtkFrame *frame);
G_DEFINE_TYPE (GimpFrame, gimp_frame, GTK_TYPE_FRAME)
@ -73,10 +77,11 @@ gimp_frame_class_init (GimpFrameClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (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->draw = gimp_frame_draw;
widget_class->get_preferred_width = gimp_frame_get_preferred_width;
widget_class->get_preferred_height = gimp_frame_get_preferred_height;
widget_class->size_allocate = gimp_frame_size_allocate;
widget_class->style_set = gimp_frame_style_set;
widget_class->draw = gimp_frame_draw;
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boolean ("label-bold",
@ -142,6 +147,30 @@ gimp_frame_size_request (GtkWidget *widget,
requisition->height += 2 * border_width;
}
static void
gimp_frame_get_preferred_width (GtkWidget *widget,
gint *minimum_width,
gint *natural_width)
{
GtkRequisition requisition;
gimp_frame_size_request (widget, &requisition);
*minimum_width = *natural_width = requisition.width;
}
static void
gimp_frame_get_preferred_height (GtkWidget *widget,
gint *minimum_height,
gint *natural_height)
{
GtkRequisition requisition;
gimp_frame_size_request (widget, &requisition);
*minimum_height = *natural_height = requisition.height;
}
static void
gimp_frame_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)

View File

@ -130,8 +130,12 @@ static void gimp_ruler_map (GtkWidget *widget);
static void gimp_ruler_unmap (GtkWidget *widget);
static void gimp_ruler_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gimp_ruler_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gimp_ruler_get_preferred_width (GtkWidget *widget,
gint *minimum_width,
gint *natural_width);
static void gimp_ruler_get_preferred_height (GtkWidget *widget,
gint *minimum_height,
gint *natural_height);
static void gimp_ruler_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static gboolean gimp_ruler_motion_notify (GtkWidget *widget,
@ -164,19 +168,20 @@ gimp_ruler_class_init (GimpRulerClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->dispose = gimp_ruler_dispose;
object_class->set_property = gimp_ruler_set_property;
object_class->get_property = gimp_ruler_get_property;
object_class->dispose = gimp_ruler_dispose;
object_class->set_property = gimp_ruler_set_property;
object_class->get_property = gimp_ruler_get_property;
widget_class->realize = gimp_ruler_realize;
widget_class->unrealize = gimp_ruler_unrealize;
widget_class->map = gimp_ruler_map;
widget_class->unmap = gimp_ruler_unmap;
widget_class->size_allocate = gimp_ruler_size_allocate;
widget_class->size_request = gimp_ruler_size_request;
widget_class->style_set = gimp_ruler_style_set;
widget_class->motion_notify_event = gimp_ruler_motion_notify;
widget_class->draw = gimp_ruler_draw;
widget_class->realize = gimp_ruler_realize;
widget_class->unrealize = gimp_ruler_unrealize;
widget_class->map = gimp_ruler_map;
widget_class->unmap = gimp_ruler_unmap;
widget_class->get_preferred_width = gimp_ruler_get_preferred_width;
widget_class->get_preferred_height = gimp_ruler_get_preferred_height;
widget_class->size_allocate = gimp_ruler_size_allocate;
widget_class->style_set = gimp_ruler_style_set;
widget_class->motion_notify_event = gimp_ruler_motion_notify;
widget_class->draw = gimp_ruler_draw;
g_type_class_add_private (object_class, sizeof (GimpRulerPrivate));
@ -918,6 +923,30 @@ gimp_ruler_size_request (GtkWidget *widget,
}
}
static void
gimp_ruler_get_preferred_width (GtkWidget *widget,
gint *minimum_width,
gint *natural_width)
{
GtkRequisition requisition;
gimp_ruler_size_request (widget, &requisition);
*minimum_width = *natural_width = requisition.width;
}
static void
gimp_ruler_get_preferred_height (GtkWidget *widget,
gint *minimum_height,
gint *natural_height)
{
GtkRequisition requisition;
gimp_ruler_size_request (widget, &requisition);
*minimum_height = *natural_height = requisition.height;
}
static void
gimp_ruler_style_set (GtkWidget *widget,
GtkStyle *prev_style)