summaryrefslogtreecommitdiff
path: root/gtk/gtkhseparator.c
diff options
context:
space:
mode:
authorMichael Natterer <mitch@imendio.com>2008-09-30 14:20:30 +0000
committerMichael Natterer <mitch@src.gnome.org>2008-09-30 14:20:30 +0000
commit2f6285597f8b5859a3f565f63a24bad59d261a55 (patch)
tree35f70a0c4d18cb2e136cb501e3afabc3e6cba60a /gtk/gtkhseparator.c
parent1d7c1e13e86001104ffddd0b750247dc4dfc4e46 (diff)
downloadgtk+-2f6285597f8b5859a3f565f63a24bad59d261a55.tar.gz
Bug 553582 – Add orientation API to GtkSeparator
2008-09-30 Michael Natterer <mitch@imendio.com> Bug 553582 – Add orientation API to GtkSeparator * gtk/gtkseparator.[ch]: implement the GtkOrientable interface and swallow all code from GtkHSeparator and GtkVSeparator. Add gtk_separator_new() which takes a GtkOrientation argument. * gtk/gtkhseparator.c * gtk/gtkvseparator.c: remove all code except the constructor and call gtk_orientable_set_orientation() in init(). * gtk/gtk.symbols: add gtk_separator_new(). svn path=/trunk/; revision=21553
Diffstat (limited to 'gtk/gtkhseparator.c')
-rw-r--r--gtk/gtkhseparator.c77
1 files changed, 6 insertions, 71 deletions
diff --git a/gtk/gtkhseparator.c b/gtk/gtkhseparator.c
index a660fad1fe..91d437a1ac 100644
--- a/gtk/gtkhseparator.c
+++ b/gtk/gtkhseparator.c
@@ -21,99 +21,34 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
+
#include "gtkhseparator.h"
-#include "gtkintl.h"
+#include "gtkorientable.h"
#include "gtkalias.h"
-
-static void gtk_hseparator_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static gint gtk_hseparator_expose (GtkWidget *widget,
- GdkEventExpose *event);
-
G_DEFINE_TYPE (GtkHSeparator, gtk_hseparator, GTK_TYPE_SEPARATOR)
static void
gtk_hseparator_class_init (GtkHSeparatorClass *class)
{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->size_request = gtk_hseparator_size_request;
- widget_class->expose_event = gtk_hseparator_expose;
}
static void
gtk_hseparator_init (GtkHSeparator *hseparator)
{
- GTK_WIDGET (hseparator)->requisition.width = 1;
- GTK_WIDGET (hseparator)->requisition.height = GTK_WIDGET (hseparator)->style->ythickness;
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (hseparator),
+ GTK_ORIENTATION_HORIZONTAL);
}
-GtkWidget*
+GtkWidget *
gtk_hseparator_new (void)
{
return g_object_new (GTK_TYPE_HSEPARATOR, NULL);
}
-static void
-gtk_hseparator_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- gboolean wide_separators;
- gint separator_height;
-
- gtk_widget_style_get (widget,
- "wide-separators", &wide_separators,
- "separator-height", &separator_height,
- NULL);
-
- if (wide_separators)
- requisition->height = separator_height;
- else
- requisition->height = widget->style->ythickness;
-}
-
-static gint
-gtk_hseparator_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- gboolean wide_separators;
- gint separator_height;
-
- gtk_widget_style_get (widget,
- "wide-separators", &wide_separators,
- "separator-height", &separator_height,
- NULL);
-
- if (wide_separators)
- gtk_paint_box (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), GTK_SHADOW_ETCHED_OUT,
- &event->area, widget, "hseparator",
- widget->allocation.x,
- widget->allocation.y + (widget->allocation.height -
- separator_height) / 2,
- widget->allocation.width,
- separator_height);
- else
- gtk_paint_hline (widget->style, widget->window,
- GTK_WIDGET_STATE (widget),
- &event->area, widget, "hseparator",
- widget->allocation.x,
- widget->allocation.x + widget->allocation.width - 1,
- widget->allocation.y + (widget->allocation.height -
- widget->style->ythickness) / 2);
- }
-
- return FALSE;
-}
-
#define __GTK_HSEPARATOR_C__
#include "gtkaliasdef.c"