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 "gtkaccessibleprivate.h"
29 #include "gtkseparatormenuitem.h"
32 * SECTION:gtkseparatormenuitem
33 * @Short_description: A separator used in menus
34 * @Title: GtkSeparatorMenuItem
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.
41 static AtkObject *gtk_separator_menu_item_get_accessible (GtkWidget *widget);
43 G_DEFINE_TYPE (GtkSeparatorMenuItem, gtk_separator_menu_item, GTK_TYPE_MENU_ITEM)
46 gtk_separator_menu_item_class_init (GtkSeparatorMenuItemClass *class)
48 GTK_CONTAINER_CLASS (class)->child_type = NULL;
49 GTK_WIDGET_CLASS (class)->get_accessible = gtk_separator_menu_item_get_accessible;
53 gtk_separator_menu_item_init (GtkSeparatorMenuItem *item)
55 GtkStyleContext *context;
57 context = gtk_widget_get_style_context (GTK_WIDGET (item));
58 gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
62 * gtk_separator_menu_item_new:
64 * Creates a new #GtkSeparatorMenuItem.
66 * Returns: a new #GtkSeparatorMenuItem.
69 gtk_separator_menu_item_new (void)
71 return g_object_new (GTK_TYPE_SEPARATOR_MENU_ITEM, NULL);
74 typedef struct _GtkSeparatorMenuItemAccessible GtkSeparatorMenuItemAccessible;
75 typedef struct _GtkSeparatorMenuItemAccessibleClass GtkSeparatorMenuItemAccessibleClass;
77 ATK_DEFINE_TYPE (GtkSeparatorMenuItemAccessible, _gtk_separator_menu_item_accessible, GTK_TYPE_MENU_ITEM);
80 _gtk_separator_menu_item_accessible_initialize (AtkObject *accessible,
83 ATK_OBJECT_CLASS (_gtk_separator_menu_item_accessible_parent_class)->initialize (accessible, widget);
85 atk_object_set_role (accessible, ATK_ROLE_SEPARATOR);
89 _gtk_separator_menu_item_accessible_class_init (GtkSeparatorMenuItemAccessibleClass *klass)
91 AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
93 atk_class->initialize = _gtk_separator_menu_item_accessible_initialize;
97 _gtk_separator_menu_item_accessible_init (GtkSeparatorMenuItemAccessible *self)
101 typedef AtkObjectFactoryClass GtkSeparatorMenuItemAccessibleFactoryClass;
102 typedef AtkObjectFactory GtkSeparatorMenuItemAccessibleFactory;
104 G_DEFINE_TYPE (GtkSeparatorMenuItemAccessibleFactory,
105 _gtk_separator_menu_item_accessible_factory,
106 ATK_TYPE_OBJECT_FACTORY);
109 _gtk_separator_menu_item_accessible_factory_get_accessible_type (void)
111 return _gtk_separator_menu_item_accessible_get_type ();
115 _gtk_separator_menu_item_accessible_factory_create_accessible (GObject *obj)
117 AtkObject *accessible;
119 accessible = g_object_new (_gtk_separator_menu_item_accessible_get_type (), NULL);
120 atk_object_initialize (accessible, obj);
126 _gtk_separator_menu_item_accessible_factory_class_init (AtkObjectFactoryClass *klass)
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;
133 _gtk_separator_menu_item_accessible_factory_init (AtkObjectFactory *factory)
138 gtk_separator_menu_item_get_accessible (GtkWidget *widget)
140 static gboolean initialized = FALSE;
142 if (G_UNLIKELY (!initialized))
144 _gtk_accessible_set_factory_type (GTK_TYPE_SEPARATOR_MENU_ITEM,
145 _gtk_separator_menu_item_accessible_factory_get_type ());
150 return GTK_WIDGET_CLASS (gtk_separator_menu_item_parent_class)->get_accessible (widget);