1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 #include "gtkvseparator.h"
21 static void gtk_vseparator_class_init (GtkVSeparatorClass *klass);
22 static void gtk_vseparator_init (GtkVSeparator *vseparator);
23 static gint gtk_vseparator_expose (GtkWidget *widget,
24 GdkEventExpose *event);
28 gtk_vseparator_get_type ()
30 static guint vseparator_type = 0;
34 GtkTypeInfo vseparator_info =
37 sizeof (GtkVSeparator),
38 sizeof (GtkVSeparatorClass),
39 (GtkClassInitFunc) gtk_vseparator_class_init,
40 (GtkObjectInitFunc) gtk_vseparator_init,
44 vseparator_type = gtk_type_unique (gtk_separator_get_type (), &vseparator_info);
47 return vseparator_type;
51 gtk_vseparator_class_init (GtkVSeparatorClass *klass)
53 GtkWidgetClass *widget_class;
55 widget_class = (GtkWidgetClass*) klass;
57 widget_class->expose_event = gtk_vseparator_expose;
61 gtk_vseparator_init (GtkVSeparator *vseparator)
63 GTK_WIDGET (vseparator)->requisition.width = GTK_WIDGET (vseparator)->style->klass->xthickness;
64 GTK_WIDGET (vseparator)->requisition.height = 1;
70 return GTK_WIDGET (gtk_type_new (gtk_vseparator_get_type ()));
75 gtk_vseparator_expose (GtkWidget *widget,
76 GdkEventExpose *event)
78 g_return_val_if_fail (widget != NULL, FALSE);
79 g_return_val_if_fail (GTK_IS_VSEPARATOR (widget), FALSE);
80 g_return_val_if_fail (event != NULL, FALSE);
82 if (GTK_WIDGET_DRAWABLE (widget))
83 gtk_draw_vline (widget->style, widget->window, GTK_STATE_NORMAL,
85 widget->allocation.y + widget->allocation.height,
86 widget->allocation.x + (widget->allocation.width -
87 widget->style->klass->xthickness) / 2);