]> Pileus Git - ~andy/gtk/blob - gtk/gtkseparatormenuitem.c
configure.ac: Indeed the minimum required version is 2.29.4, not 2.29.2
[~andy/gtk] / gtk / gtkseparatormenuitem.c
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 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.
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  * Lesser General Public License for more details.
13  *
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.
18  */
19
20 /*
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/.
25  */
26
27 #include "config.h"
28 #include "gtkaccessibleprivate.h"
29 #include "gtkseparatormenuitem.h"
30
31 /**
32  * SECTION:gtkseparatormenuitem
33  * @Short_description: A separator used in menus
34  * @Title: GtkSeparatorMenuItem
35  *
36  * The #GtkSeparatorMenuItem is a separator used to group
37  * items within a menu. It displays a horizontal line with a shadow to
38  * make it appear sunken into the interface.
39  */
40
41 static AtkObject *gtk_separator_menu_item_get_accessible (GtkWidget *widget);
42
43 G_DEFINE_TYPE (GtkSeparatorMenuItem, gtk_separator_menu_item, GTK_TYPE_MENU_ITEM)
44
45 static void
46 gtk_separator_menu_item_class_init (GtkSeparatorMenuItemClass *class)
47 {
48   GTK_CONTAINER_CLASS (class)->child_type = NULL;
49   GTK_WIDGET_CLASS (class)->get_accessible = gtk_separator_menu_item_get_accessible;
50 }
51
52 static void 
53 gtk_separator_menu_item_init (GtkSeparatorMenuItem *item)
54 {
55   GtkStyleContext *context;
56
57   context = gtk_widget_get_style_context (GTK_WIDGET (item));
58   gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
59 }
60
61 /**
62  * gtk_separator_menu_item_new:
63  *
64  * Creates a new #GtkSeparatorMenuItem.
65  *
66  * Returns: a new #GtkSeparatorMenuItem.
67  */
68 GtkWidget *
69 gtk_separator_menu_item_new (void)
70 {
71   return g_object_new (GTK_TYPE_SEPARATOR_MENU_ITEM, NULL);
72 }
73
74 typedef struct _GtkSeparatorMenuItemAccessible GtkSeparatorMenuItemAccessible;
75 typedef struct _GtkSeparatorMenuItemAccessibleClass GtkSeparatorMenuItemAccessibleClass;
76
77 ATK_DEFINE_TYPE (GtkSeparatorMenuItemAccessible, _gtk_separator_menu_item_accessible, GTK_TYPE_MENU_ITEM);
78
79 static void
80 _gtk_separator_menu_item_accessible_initialize (AtkObject *accessible,
81                                                 gpointer   widget)
82 {
83   ATK_OBJECT_CLASS (_gtk_separator_menu_item_accessible_parent_class)->initialize (accessible, widget);
84
85   atk_object_set_role (accessible, ATK_ROLE_SEPARATOR);
86 }
87
88 static void
89 _gtk_separator_menu_item_accessible_class_init (GtkSeparatorMenuItemAccessibleClass *klass)
90 {
91   AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
92
93   atk_class->initialize = _gtk_separator_menu_item_accessible_initialize;
94 }
95
96 static void
97 _gtk_separator_menu_item_accessible_init (GtkSeparatorMenuItemAccessible *self)
98 {
99 }
100
101 typedef AtkObjectFactoryClass   GtkSeparatorMenuItemAccessibleFactoryClass;
102 typedef AtkObjectFactory        GtkSeparatorMenuItemAccessibleFactory;
103
104 G_DEFINE_TYPE (GtkSeparatorMenuItemAccessibleFactory,
105                _gtk_separator_menu_item_accessible_factory,
106                ATK_TYPE_OBJECT_FACTORY);
107
108 static GType
109 _gtk_separator_menu_item_accessible_factory_get_accessible_type (void)
110 {
111   return _gtk_separator_menu_item_accessible_get_type ();
112 }
113
114 static AtkObject *
115 _gtk_separator_menu_item_accessible_factory_create_accessible (GObject *obj)
116 {
117   AtkObject *accessible;
118
119   accessible = g_object_new (_gtk_separator_menu_item_accessible_get_type (), NULL);
120   atk_object_initialize (accessible, obj);
121
122   return accessible;
123 }
124
125 static void
126 _gtk_separator_menu_item_accessible_factory_class_init (AtkObjectFactoryClass *klass)
127 {
128   klass->create_accessible = _gtk_separator_menu_item_accessible_factory_create_accessible;
129   klass->get_accessible_type = _gtk_separator_menu_item_accessible_factory_get_accessible_type;
130 }
131
132 static void
133 _gtk_separator_menu_item_accessible_factory_init (AtkObjectFactory *factory)
134 {
135 }
136
137 static AtkObject *
138 gtk_separator_menu_item_get_accessible (GtkWidget *widget)
139 {
140   static gboolean initialized = FALSE;
141
142   if (G_UNLIKELY (!initialized))
143     {
144       _gtk_accessible_set_factory_type (GTK_TYPE_SEPARATOR_MENU_ITEM,
145                                         _gtk_separator_menu_item_accessible_factory_get_type ());
146
147       initialized = TRUE;
148     }
149
150   return GTK_WIDGET_CLASS (gtk_separator_menu_item_parent_class)->get_accessible (widget);
151 }