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/.
28 #include "gtkhseparator.h"
33 static void gtk_hseparator_size_request (GtkWidget *widget,
34 GtkRequisition *requisition);
35 static gint gtk_hseparator_expose (GtkWidget *widget,
36 GdkEventExpose *event);
38 G_DEFINE_TYPE (GtkHSeparator, gtk_hseparator, GTK_TYPE_SEPARATOR)
41 gtk_hseparator_class_init (GtkHSeparatorClass *class)
43 GtkWidgetClass *widget_class;
45 widget_class = (GtkWidgetClass*) class;
47 widget_class->size_request = gtk_hseparator_size_request;
48 widget_class->expose_event = gtk_hseparator_expose;
52 gtk_hseparator_init (GtkHSeparator *hseparator)
54 GTK_WIDGET (hseparator)->requisition.width = 1;
55 GTK_WIDGET (hseparator)->requisition.height = GTK_WIDGET (hseparator)->style->ythickness;
59 gtk_hseparator_new (void)
61 return g_object_new (GTK_TYPE_HSEPARATOR, NULL);
65 gtk_hseparator_size_request (GtkWidget *widget,
66 GtkRequisition *requisition)
68 gboolean wide_separators;
69 gint separator_height;
71 gtk_widget_style_get (widget,
72 "wide-separators", &wide_separators,
73 "separator-height", &separator_height,
77 requisition->height = separator_height;
79 requisition->height = widget->style->ythickness;
83 gtk_hseparator_expose (GtkWidget *widget,
84 GdkEventExpose *event)
86 if (GTK_WIDGET_DRAWABLE (widget))
88 gboolean wide_separators;
89 gint separator_height;
91 gtk_widget_style_get (widget,
92 "wide-separators", &wide_separators,
93 "separator-height", &separator_height,
97 gtk_paint_box (widget->style, widget->window,
98 GTK_WIDGET_STATE (widget), GTK_SHADOW_ETCHED_OUT,
99 &event->area, widget, "hseparator",
100 widget->allocation.x,
101 widget->allocation.y + (widget->allocation.height -
102 separator_height) / 2,
103 widget->allocation.width,
106 gtk_paint_hline (widget->style, widget->window,
107 GTK_WIDGET_STATE (widget),
108 &event->area, widget, "hseparator",
109 widget->allocation.x,
110 widget->allocation.x + widget->allocation.width - 1,
111 widget->allocation.y + (widget->allocation.height -
112 widget->style->ythickness) / 2);
118 #define __GTK_HSEPARATOR_C__
119 #include "gtkaliasdef.c"