source: trunk/third/gtk/gtk/gtkhseparator.c @ 14482

Revision 14482, 3.0 KB checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r14481, which included commits to RCS files with non-trunk default branches.
Line 
1/* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
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.
8 *
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.
13 *
14 * You should have received a copy of the GNU Library 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.
18 */
19
20/*
21 * Modified by the GTK+ Team and others 1997-1999.  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/.
25 */
26
27#include "gtkhseparator.h"
28
29
30static void gtk_hseparator_class_init (GtkHSeparatorClass *klass);
31static void gtk_hseparator_init       (GtkHSeparator      *hseparator);
32static gint gtk_hseparator_expose     (GtkWidget          *widget,
33                                       GdkEventExpose     *event);
34
35
36GtkType
37gtk_hseparator_get_type (void)
38{
39  static GtkType hseparator_type = 0;
40
41  if (!hseparator_type)
42    {
43      static const GtkTypeInfo hseparator_info =
44      {
45        "GtkHSeparator",
46        sizeof (GtkHSeparator),
47        sizeof (GtkHSeparatorClass),
48        (GtkClassInitFunc) gtk_hseparator_class_init,
49        (GtkObjectInitFunc) gtk_hseparator_init,
50        /* reserved_1 */ NULL,
51        /* reserved_2 */ NULL,
52        (GtkClassInitFunc) NULL,
53      };
54
55      hseparator_type = gtk_type_unique (GTK_TYPE_SEPARATOR, &hseparator_info);
56    }
57
58  return hseparator_type;
59}
60
61static void
62gtk_hseparator_class_init (GtkHSeparatorClass *class)
63{
64  GtkWidgetClass *widget_class;
65
66  widget_class = (GtkWidgetClass*) class;
67
68  widget_class->expose_event = gtk_hseparator_expose;
69}
70
71static void
72gtk_hseparator_init (GtkHSeparator *hseparator)
73{
74  GTK_WIDGET (hseparator)->requisition.width = 1;
75  GTK_WIDGET (hseparator)->requisition.height = GTK_WIDGET (hseparator)->style->klass->ythickness;
76}
77
78GtkWidget*
79gtk_hseparator_new (void)
80{
81  return GTK_WIDGET (gtk_type_new (GTK_TYPE_HSEPARATOR));
82}
83
84
85static gint
86gtk_hseparator_expose (GtkWidget      *widget,
87                       GdkEventExpose *event)
88{
89  g_return_val_if_fail (widget != NULL, FALSE);
90  g_return_val_if_fail (GTK_IS_HSEPARATOR (widget), FALSE);
91  g_return_val_if_fail (event != NULL, FALSE);
92
93  if (GTK_WIDGET_DRAWABLE (widget))
94    gtk_paint_hline (widget->style, widget->window, GTK_STATE_NORMAL,
95                     &event->area, widget, "hseparator",
96                     widget->allocation.x,
97                     widget->allocation.x + widget->allocation.width,
98                     widget->allocation.y + (widget->allocation.height -
99                                             widget->style->klass->ythickness) / 2);
100
101  return FALSE;
102}
Note: See TracBrowser for help on using the repository browser.