1
/* ATK - Accessibility Toolkit
2
 * Copyright 2001 Sun Microsystems Inc.
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
#include "config.h"
21

            
22
#include "atkobject.h"
23

            
24
#include "atknoopobject.h"
25
#include "atknoopobjectfactory.h"
26

            
27
/**
28
 * AtkNoOpObjectFactory:
29
 *
30
 * The AtkObjectFactory which creates an AtkNoOpObject.
31
 *
32
 * The AtkObjectFactory which creates an AtkNoOpObject. An instance of
33
 * this is created by an AtkRegistry if no factory type has not been
34
 * specified to create an accessible object of a particular type.
35
 */
36
static void atk_no_op_object_factory_class_init (
37
    AtkNoOpObjectFactoryClass *klass);
38

            
39
static AtkObject *atk_no_op_object_factory_create_accessible (
40
    GObject *obj);
41
static GType atk_no_op_object_factory_get_accessible_type (void);
42

            
43
static gpointer parent_class = NULL;
44

            
45
GType
46
atk_no_op_object_factory_get_type (void)
47
{
48
  static GType type = 0;
49

            
50
  if (!type)
51
    {
52
      static const GTypeInfo tinfo = {
53
        sizeof (AtkNoOpObjectFactoryClass),
54
        (GBaseInitFunc) NULL,                                 /* base init */
55
        (GBaseFinalizeFunc) NULL,                             /* base finalize */
56
        (GClassInitFunc) atk_no_op_object_factory_class_init, /* class init */
57
        (GClassFinalizeFunc) NULL,                            /* class finalize */
58
        NULL,                                                 /* class data */
59
        sizeof (AtkNoOpObjectFactory),                        /* instance size */
60
        0,                                                    /* nb preallocs */
61
        (GInstanceInitFunc) NULL,                             /* instance init */
62
        NULL                                                  /* value table */
63
      };
64
      type = g_type_register_static (
65
          ATK_TYPE_OBJECT_FACTORY,
66
          "AtkNoOpObjectFactory", &tinfo, 0);
67
    }
68

            
69
  return type;
70
}
71

            
72
static void
73
atk_no_op_object_factory_class_init (AtkNoOpObjectFactoryClass *klass)
74
{
75
  AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass);
76

            
77
  parent_class = g_type_class_peek_parent (klass);
78

            
79
  class->create_accessible = atk_no_op_object_factory_create_accessible;
80
  class->get_accessible_type = atk_no_op_object_factory_get_accessible_type;
81
}
82

            
83
/**
84
 * atk_no_op_object_factory_new:
85
 *
86
 * Creates an instance of an #AtkObjectFactory which generates primitive
87
 * (non-functioning) #AtkObjects.
88
 *
89
 * Returns: an instance of an #AtkObjectFactory
90
 **/
91
AtkObjectFactory *
92
atk_no_op_object_factory_new (void)
93
{
94
  GObject *factory;
95

            
96
  factory = g_object_new (ATK_TYPE_NO_OP_OBJECT_FACTORY, NULL);
97

            
98
  g_return_val_if_fail (factory != NULL, NULL);
99
  return ATK_OBJECT_FACTORY (factory);
100
}
101

            
102
static AtkObject *
103
atk_no_op_object_factory_create_accessible (GObject *obj)
104
{
105
  AtkObject *accessible;
106

            
107
  accessible = atk_no_op_object_new (obj);
108

            
109
  return accessible;
110
}
111

            
112
static GType
113
atk_no_op_object_factory_get_accessible_type (void)
114
{
115
  return ATK_TYPE_NO_OP_OBJECT;
116
}