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 Lesser 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 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
27 #include "gtkvseparator.h"
30 static void gtk_vseparator_class_init (GtkVSeparatorClass *klass);
31 static void gtk_vseparator_init (GtkVSeparator *vseparator);
32 static gint gtk_vseparator_expose (GtkWidget *widget,
33 GdkEventExpose *event);
37 gtk_vseparator_get_type (void)
39 static GtkType vseparator_type = 0;
43 static const GtkTypeInfo vseparator_info =
46 sizeof (GtkVSeparator),
47 sizeof (GtkVSeparatorClass),
48 (GtkClassInitFunc) gtk_vseparator_class_init,
49 (GtkObjectInitFunc) gtk_vseparator_init,
50 /* reserved_1 */ NULL,
51 /* reserved_2 */ NULL,
52 (GtkClassInitFunc) NULL,
55 vseparator_type = gtk_type_unique (GTK_TYPE_SEPARATOR, &vseparator_info);
58 return vseparator_type;
62 gtk_vseparator_class_init (GtkVSeparatorClass *klass)
64 GtkWidgetClass *widget_class;
66 widget_class = (GtkWidgetClass*) klass;
68 widget_class->expose_event = gtk_vseparator_expose;
72 gtk_vseparator_init (GtkVSeparator *vseparator)
74 GTK_WIDGET (vseparator)->requisition.width = GTK_WIDGET (vseparator)->style->xthickness;
75 GTK_WIDGET (vseparator)->requisition.height = 1;
79 gtk_vseparator_new (void)
81 return GTK_WIDGET (gtk_type_new (GTK_TYPE_VSEPARATOR));
86 gtk_vseparator_expose (GtkWidget *widget,
87 GdkEventExpose *event)
89 if (GTK_WIDGET_DRAWABLE (widget))
90 gtk_paint_vline (widget->style, widget->window, GTK_STATE_NORMAL,
91 &event->area, widget, "vseparator",
93 widget->allocation.y + widget->allocation.height,
94 widget->allocation.x + (widget->allocation.width -
95 widget->style->xthickness) / 2);