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 "gtkhseparator.h"
21 static void gtk_hseparator_class_init (GtkHSeparatorClass *klass);
22 static void gtk_hseparator_init (GtkHSeparator *hseparator);
23 static gint gtk_hseparator_expose (GtkWidget *widget,
24 GdkEventExpose *event);
28 gtk_hseparator_get_type ()
30 static guint hseparator_type = 0;
34 GtkTypeInfo hseparator_info =
37 sizeof (GtkHSeparator),
38 sizeof (GtkHSeparatorClass),
39 (GtkClassInitFunc) gtk_hseparator_class_init,
40 (GtkObjectInitFunc) gtk_hseparator_init,
44 hseparator_type = gtk_type_unique (gtk_separator_get_type (), &hseparator_info);
47 return hseparator_type;
51 gtk_hseparator_class_init (GtkHSeparatorClass *class)
53 GtkWidgetClass *widget_class;
55 widget_class = (GtkWidgetClass*) class;
57 widget_class->expose_event = gtk_hseparator_expose;
61 gtk_hseparator_init (GtkHSeparator *hseparator)
63 GTK_WIDGET (hseparator)->requisition.width = 1;
64 GTK_WIDGET (hseparator)->requisition.height = GTK_WIDGET (hseparator)->style->klass->ythickness;
70 return GTK_WIDGET (gtk_type_new (gtk_hseparator_get_type ()));
75 gtk_hseparator_expose (GtkWidget *widget,
76 GdkEventExpose *event)
78 g_return_val_if_fail (widget != NULL, FALSE);
79 g_return_val_if_fail (GTK_IS_HSEPARATOR (widget), FALSE);
80 g_return_val_if_fail (event != NULL, FALSE);
82 if (GTK_WIDGET_DRAWABLE (widget))
83 gtk_draw_hline (widget->style, widget->window, GTK_STATE_NORMAL,
85 widget->allocation.x + widget->allocation.width,
86 widget->allocation.y + (widget->allocation.height -
87 widget->style->klass->ythickness) / 2);