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 "gtkhseparator.h"
30 static void gtk_hseparator_class_init (GtkHSeparatorClass *klass);
31 static void gtk_hseparator_init (GtkHSeparator *hseparator);
32 static gint gtk_hseparator_expose (GtkWidget *widget,
33 GdkEventExpose *event);
37 gtk_hseparator_get_type (void)
39 static GType hseparator_type = 0;
43 static const GTypeInfo hseparator_info =
45 sizeof (GtkHSeparatorClass),
47 NULL, /* base_finalize */
48 (GClassInitFunc) gtk_hseparator_class_init,
49 NULL, /* class_finalize */
50 NULL, /* class_init */
51 sizeof (GtkHSeparator),
53 (GInstanceInitFunc) gtk_hseparator_init,
57 g_type_register_static (GTK_TYPE_SEPARATOR, "GtkHSeparator",
61 return hseparator_type;
65 gtk_hseparator_class_init (GtkHSeparatorClass *class)
67 GtkWidgetClass *widget_class;
69 widget_class = (GtkWidgetClass*) class;
71 widget_class->expose_event = gtk_hseparator_expose;
75 gtk_hseparator_init (GtkHSeparator *hseparator)
77 GTK_WIDGET (hseparator)->requisition.width = 1;
78 GTK_WIDGET (hseparator)->requisition.height = GTK_WIDGET (hseparator)->style->ythickness;
82 gtk_hseparator_new (void)
84 return g_object_new (GTK_TYPE_HSEPARATOR, NULL);
89 gtk_hseparator_expose (GtkWidget *widget,
90 GdkEventExpose *event)
92 if (GTK_WIDGET_DRAWABLE (widget))
93 gtk_paint_hline (widget->style, widget->window, GTK_STATE_NORMAL,
94 &event->area, widget, "hseparator",
96 widget->allocation.x + widget->allocation.width,
97 widget->allocation.y + (widget->allocation.height -
98 widget->style->ythickness) / 2);