summaryrefslogtreecommitdiff
path: root/gtk/gtkvseparator.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/gtkvseparator.c
parent1d7c1e13e86001104ffddd0b750247dc4dfc4e46 (diff)
downloadgdk-pixbuf-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/gtkvseparator.c')
-rw-r--r--gtk/gtkvseparator.c78
1 files changed, 6 insertions, 72 deletions
diff --git a/gtk/gtkvseparator.c b/gtk/gtkvseparator.c
index c199b29a9..855c1688c 100644
--- a/gtk/gtkvseparator.c
+++ b/gtk/gtkvseparator.c
@@ -21,100 +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 "gtkorientable.h"
#include "gtkvseparator.h"
-#include "gtkintl.h"
#include "gtkalias.h"
-
-static void gtk_vseparator_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static gint gtk_vseparator_expose (GtkWidget *widget,
- GdkEventExpose *event);
-
-
G_DEFINE_TYPE (GtkVSeparator, gtk_vseparator, GTK_TYPE_SEPARATOR)
static void
gtk_vseparator_class_init (GtkVSeparatorClass *klass)
{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) klass;
-
- widget_class->size_request = gtk_vseparator_size_request;
- widget_class->expose_event = gtk_vseparator_expose;
}
static void
gtk_vseparator_init (GtkVSeparator *vseparator)
{
- GTK_WIDGET (vseparator)->requisition.width = GTK_WIDGET (vseparator)->style->xthickness;
- GTK_WIDGET (vseparator)->requisition.height = 1;
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (vseparator),
+ GTK_ORIENTATION_VERTICAL);
}
-GtkWidget*
+GtkWidget *
gtk_vseparator_new (void)
{
return g_object_new (GTK_TYPE_VSEPARATOR, NULL);
}
-static void
-gtk_vseparator_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- gboolean wide_separators;
- gint separator_width;
-
- gtk_widget_style_get (widget,
- "wide-separators", &wide_separators,
- "separator-width", &separator_width,
- NULL);
-
- if (wide_separators)
- requisition->width = separator_width;
- else
- requisition->width = widget->style->xthickness;
-}
-
-static gint
-gtk_vseparator_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- gboolean wide_separators;
- gint separator_width;
-
- gtk_widget_style_get (widget,
- "wide-separators", &wide_separators,
- "separator-width", &separator_width,
- NULL);
-
- if (wide_separators)
- gtk_paint_box (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), GTK_SHADOW_ETCHED_OUT,
- &event->area, widget, "vseparator",
- widget->allocation.x + (widget->allocation.width -
- separator_width) / 2,
- widget->allocation.y,
- separator_width,
- widget->allocation.height);
- else
- gtk_paint_vline (widget->style, widget->window,
- GTK_WIDGET_STATE (widget),
- &event->area, widget, "vseparator",
- widget->allocation.y,
- widget->allocation.y + widget->allocation.height - 1,
- widget->allocation.x + (widget->allocation.width -
- widget->style->xthickness) / 2);
- }
-
- return FALSE;
-}
-
#define __GTK_VSEPARATOR_C__
#include "gtkaliasdef.c"