~vcs-imports/atk/trunk

« back to all changes in this revision

Viewing changes to atk/atkvalue.c

  • Committer: billh
  • Date: 2001-04-26 14:23:41 UTC
  • Revision ID: vcs-imports@canonical.com-20010426142341-ggpqfzvs5gfsz2m0
Initial revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 "atkvalue.h"
 
21
 
 
22
GType
 
23
atk_value_get_type ()
 
24
{
 
25
  static GType type = 0;
 
26
 
 
27
  if (!type) {
 
28
    GTypeInfo tinfo =
 
29
    {
 
30
      sizeof (AtkValueIface),
 
31
      NULL,
 
32
      NULL,
 
33
 
 
34
    };
 
35
 
 
36
    type = g_type_register_static (G_TYPE_INTERFACE, "AtkValue", &tinfo, 0);
 
37
  }
 
38
 
 
39
  return type;
 
40
}
 
41
 
 
42
/**
 
43
 * atk_value_get_current_value:
 
44
 * @obj@: a GObject instance that implements AtkValueIface
 
45
 * @value: a #GValue representing the current accessible value
 
46
 *
 
47
 * WARNING: callers should not rely on %NULL or on a zero value for
 
48
 * indication of whether AtkValue is implemented, they should
 
49
 * use type checking/interface checking macros or the
 
50
 * atk_get_accessible_value() convenience method.
 
51
 **/
 
52
void
 
53
atk_value_get_current_value (AtkValue *obj,
 
54
                             GValue   *value)
 
55
{
 
56
  AtkValueIface *iface;
 
57
 
 
58
  g_return_if_fail (obj != NULL);
 
59
  g_return_if_fail (value != NULL);
 
60
  g_return_if_fail (ATK_IS_VALUE (obj));
 
61
  g_return_if_fail (G_IS_VALUE (value));
 
62
 
 
63
  iface = ATK_VALUE_GET_IFACE (obj);
 
64
 
 
65
  if (iface->get_current_value)
 
66
    (iface->get_current_value) (obj, value);
 
67
}
 
68
 
 
69
/**
 
70
 * atk_value_get_maximum_value:
 
71
 * @obj: a GObject instance that implements AtkValueIface
 
72
 * @value: a #GValue representing the maximum accessible value
 
73
 *
 
74
 * WARNING: callers should not rely on %NULL or on a zero value for
 
75
 * indication of whether AtkValue is implemented, they should
 
76
 * use type checking/interface checking macros or the
 
77
 * atk_get_accessible_value() convenience method.
 
78
 **/
 
79
void
 
80
atk_value_get_maximum_value  (AtkValue *obj,
 
81
                              GValue   *value)
 
82
{
 
83
  AtkValueIface *iface;
 
84
 
 
85
  g_return_if_fail (obj != NULL);
 
86
  g_return_if_fail (value != NULL);
 
87
  g_return_if_fail (ATK_IS_VALUE (obj));
 
88
  g_return_if_fail (G_IS_VALUE (value));
 
89
 
 
90
  iface = ATK_VALUE_GET_IFACE (obj);
 
91
 
 
92
  if (iface->get_maximum_value)
 
93
    (iface->get_maximum_value) (obj, value);
 
94
}
 
95
 
 
96
/**
 
97
 * atk_value_get_minimum_value:
 
98
 * @obj: a GObject instance that implements AtkValueIface
 
99
 * @value: a #GValue representing the minimum accessible value
 
100
 *
 
101
 * WARNING: callers should not rely on %NULL or on a zero value for
 
102
 * indication of whether AtkValue is implemented, they should
 
103
 * use type checking/interface checking macros or the
 
104
 * atk_get_accessible_value() convenience method.
 
105
 **/
 
106
void
 
107
atk_value_get_minimum_value (AtkValue *obj,
 
108
                             GValue   *value)
 
109
{
 
110
  AtkValueIface *iface;
 
111
 
 
112
  g_return_if_fail (obj != NULL);
 
113
  g_return_if_fail (value != NULL);
 
114
  g_return_if_fail (ATK_IS_VALUE (obj));
 
115
  g_return_if_fail (G_IS_VALUE (value));
 
116
 
 
117
  iface = ATK_VALUE_GET_IFACE (obj);
 
118
 
 
119
  if (iface->get_minimum_value)
 
120
    return (iface->get_minimum_value) (obj, value);
 
121
}
 
122
 
 
123
/**
 
124
 * atk_value_set_current_value:
 
125
 * @obj: a GObject instance that implements AtkValueIface
 
126
 * @value: a #GValue which is the desired new accessible value.
 
127
 * @return: %true if new value is successfully set, %false otherwise.
 
128
 **/
 
129
gboolean
 
130
atk_value_set_current_value (AtkValue *obj, 
 
131
                             GValue   *value)
 
132
{
 
133
  AtkValueIface *iface;
 
134
 
 
135
  g_return_val_if_fail (obj != NULL, FALSE);
 
136
  g_return_val_if_fail (value != NULL, FALSE);
 
137
  g_return_val_if_fail (ATK_IS_VALUE (obj), FALSE);
 
138
  g_return_val_if_fail (G_IS_VALUE (value), FALSE);
 
139
 
 
140
  iface = ATK_VALUE_GET_IFACE (obj);
 
141
 
 
142
  if (iface->set_current_value)
 
143
    return (iface->set_current_value) (obj, value);
 
144
  else
 
145
    return FALSE;
 
146
}