summaryrefslogtreecommitdiff
path: root/gtk/gtkseparator.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2010-10-27 08:33:42 -0400
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2010-10-30 17:35:19 +0900
commit70c81d665114830dffb8d9cb11f9bd6abefd2845 (patch)
tree6e1e4fb60f9be9717032ebff5e064f487b043604 /gtk/gtkseparator.c
parent4927c16486951413db2746b9899fc01c8283b30b (diff)
downloadgtk+-70c81d665114830dffb8d9cb11f9bd6abefd2845.tar.gz
Remove size_request from GtkSeparator
Diffstat (limited to 'gtk/gtkseparator.c')
-rw-r--r--gtk/gtkseparator.c72
1 files changed, 45 insertions, 27 deletions
diff --git a/gtk/gtkseparator.c b/gtk/gtkseparator.c
index e3c1e6b011..025b80f9bc 100644
--- a/gtk/gtkseparator.c
+++ b/gtk/gtkseparator.c
@@ -61,9 +61,14 @@ static void gtk_separator_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
-
-static void gtk_separator_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
+static void gtk_separator_get_preferred_width
+ (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
+static void gtk_separator_get_preferred_height
+ (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
static gboolean gtk_separator_draw (GtkWidget *widget,
cairo_t *cr);
@@ -82,12 +87,12 @@ gtk_separator_class_init (GtkSeparatorClass *class)
object_class->set_property = gtk_separator_set_property;
object_class->get_property = gtk_separator_get_property;
- widget_class->size_request = gtk_separator_size_request;
+ widget_class->get_preferred_width = gtk_separator_get_preferred_width;
+ widget_class->get_preferred_height = gtk_separator_get_preferred_height;
+
widget_class->draw = gtk_separator_draw;
- g_object_class_override_property (object_class,
- PROP_ORIENTATION,
- "orientation");
+ g_object_class_override_property (object_class, PROP_ORIENTATION, "orientation");
g_type_class_add_private (object_class, sizeof (GtkSeparatorPrivate));
}
@@ -149,42 +154,55 @@ gtk_separator_get_property (GObject *object,
}
static void
-gtk_separator_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+gtk_separator_get_preferred_size (GtkWidget *widget,
+ GtkOrientation orientation,
+ gint *minimum,
+ gint *natural)
{
GtkSeparator *separator = GTK_SEPARATOR (widget);
GtkSeparatorPrivate *private = separator->priv;
GtkStyle *style;
- gboolean wide_separators;
- gint separator_width;
- gint separator_height;
+ gboolean wide_sep;
+ gint sep_width;
+ gint sep_height;
style = gtk_widget_get_style (widget);
gtk_widget_style_get (widget,
- "wide-separators", &wide_separators,
- "separator-width", &separator_width,
- "separator-height", &separator_height,
+ "wide-separators", &wide_sep,
+ "separator-width", &sep_width,
+ "separator-height", &sep_height,
NULL);
- requisition->width = 1;
- requisition->height = 1;
-
- if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (orientation == private->orientation)
{
- if (wide_separators)
- requisition->height = separator_height;
- else
- requisition->height = style->ythickness;
+ *minimum = *natural = 1;
+ }
+ else if (orientation == GTK_ORIENTATION_VERTICAL)
+ {
+ *minimum = *natural = wide_sep ? sep_height : style->ythickness;
}
else
{
- if (wide_separators)
- requisition->width = separator_width;
- else
- requisition->width = style->xthickness;
+ *minimum = *natural = wide_sep ? sep_width : style->xthickness;
}
}
+static void
+gtk_separator_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ gtk_separator_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum, natural);
+}
+
+static void
+gtk_separator_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ gtk_separator_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum, natural);
+}
+
static gboolean
gtk_separator_draw (GtkWidget *widget,
cairo_t *cr)