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 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#ifndef __ATK_VALUE_H__
21#define __ATK_VALUE_H__
22
23#if defined(ATK_DISABLE_SINGLE_INCLUDES) && !defined (__ATK_H_INSIDE__) && !defined (ATK_COMPILATION)
24#error "Only <atk/atk.h> can be included directly."
25#endif
26
27#include <atk/atkobject.h>
28#include <atk/atkrange.h>
29
30G_BEGIN_DECLS
31
32#define ATK_TYPE_VALUE (atk_value_get_type ())
33#define ATK_IS_VALUE(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_VALUE)
34#define ATK_VALUE(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_VALUE, AtkValue)
35#define ATK_VALUE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_VALUE, AtkValueIface))
36
37#ifndef _TYPEDEF_ATK_VALUE_
38#define _TYPEDEF_ATK_VALUE__
39typedef struct _AtkValue AtkValue;
40#endif
41typedef struct _AtkValueIface AtkValueIface;
42
43/**
44 * AtkValueType:
45 *
46 * Default types for a given value. Those are defined in order to
47 * easily get localized strings to describe a given value or a given
48 * subrange, using atk_value_type_get_localized_name().
49 *
50 */
51typedef enum
52{
53 ATK_VALUE_VERY_WEAK,
54 ATK_VALUE_WEAK,
55 ATK_VALUE_ACCEPTABLE,
56 ATK_VALUE_STRONG,
57 ATK_VALUE_VERY_STRONG,
58 ATK_VALUE_VERY_LOW,
59 ATK_VALUE_LOW,
60 ATK_VALUE_MEDIUM,
61 ATK_VALUE_HIGH,
62 ATK_VALUE_VERY_HIGH,
63 ATK_VALUE_VERY_BAD,
64 ATK_VALUE_BAD,
65 ATK_VALUE_GOOD,
66 ATK_VALUE_VERY_GOOD,
67 ATK_VALUE_BEST,
68 ATK_VALUE_LAST_DEFINED
69}AtkValueType;
70
71/**
72 * AtkValueIface:
73 * @get_current_value: This virtual function is deprecated since 2.12
74 * and it should not be overriden.
75 * @get_maximum_value: This virtual function is deprecated since 2.12
76 * and it should not be overriden.
77 * @get_minimum_value: This virtual function is deprecated since 2.12
78 * and it should not be overriden.
79 * @set_current_value: This virtual function is deprecated since 2.12
80 * and it should not be overriden.
81 * @get_minimum_increment: This virtual function is deprecated since
82 * 2.12 and it should not be overriden.
83 * @get_value_and_text: gets the current value and the human readable
84 * text alternative (if available) of this object. Since 2.12.
85 * @get_range: gets the range that defines the minimum and maximum
86 * value of this object. Returns NULL if there is no range
87 * defined. Since 2.12.
88 * @get_increment: gets the minimum increment by which the value of
89 * this object may be changed. If zero it is undefined. Since 2.12.
90 * @get_sub_ranges: returns a list of different subranges, and their
91 * description (if available) of this object. Returns NULL if there
92 * is not subranges defined. Since 2.12.
93 * @set_value: sets the value of this object. Since 2.12.
94 */
95struct _AtkValueIface
96{
97 GTypeInterface parent;
98
99 /*<deprecated>*/
100 void (* get_current_value) (AtkValue *obj,
101 GValue *value);
102 void (* get_maximum_value) (AtkValue *obj,
103 GValue *value);
104 void (* get_minimum_value) (AtkValue *obj,
105 GValue *value);
106 gboolean (* set_current_value) (AtkValue *obj,
107 const GValue *value);
108 void (* get_minimum_increment) (AtkValue *obj,
109 GValue *value);
110 /*</deprecated>*/
111 void (* get_value_and_text) (AtkValue *obj,
112 gdouble *value,
113 gchar **text);
114 AtkRange*(* get_range) (AtkValue *obj);
115 gdouble (* get_increment) (AtkValue *obj);
116 GSList* (* get_sub_ranges) (AtkValue *obj);
117 void (* set_value) (AtkValue *obj,
118 const gdouble new_value);
119
120};
121
122ATK_AVAILABLE_IN_ALL
123GType atk_value_get_type (void);
124
125ATK_DEPRECATED_IN_2_12_FOR(atk_value_get_value_and_text)
126void atk_value_get_current_value (AtkValue *obj,
127 GValue *value);
128
129ATK_DEPRECATED_IN_2_12_FOR(atk_value_get_range)
130void atk_value_get_maximum_value (AtkValue *obj,
131 GValue *value);
132ATK_DEPRECATED_IN_2_12_FOR(atk_value_get_range)
133void atk_value_get_minimum_value (AtkValue *obj,
134 GValue *value);
135ATK_DEPRECATED_IN_2_12_FOR(atk_value_set_value)
136gboolean atk_value_set_current_value (AtkValue *obj,
137 const GValue *value);
138ATK_DEPRECATED_IN_2_12_FOR(atk_value_get_increment)
139void atk_value_get_minimum_increment (AtkValue *obj,
140 GValue *value);
141
142ATK_AVAILABLE_IN_2_12
143void atk_value_get_value_and_text (AtkValue *obj,
144 gdouble *value,
145 gchar **text);
146ATK_AVAILABLE_IN_2_12
147AtkRange* atk_value_get_range (AtkValue *obj);
148ATK_AVAILABLE_IN_2_12
149gdouble atk_value_get_increment (AtkValue *obj);
150ATK_AVAILABLE_IN_2_12
151GSList* atk_value_get_sub_ranges (AtkValue *obj);
152ATK_AVAILABLE_IN_2_12
153void atk_value_set_value (AtkValue *obj,
154 const gdouble new_value);
155/* AtkValueType methods */
156ATK_AVAILABLE_IN_ALL
157const gchar* atk_value_type_get_name (AtkValueType value_type);
158ATK_AVAILABLE_IN_ALL
159const gchar* atk_value_type_get_localized_name (AtkValueType value_type);
160
161G_END_DECLS
162
163#endif /* __ATK_VALUE_H__ */
164