2005-05-27 Kjartan Maraas <kmaraas@gnome.org>
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_application.c
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2001, 2002 Sun Microsystems Inc.,
6  * Copyright 2001, 2002 Ximian, Inc.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24 /*
25  *
26  * AccessibleApplication function prototypes
27  *
28  */
29
30 #include <cspi/spi-private.h>
31 #include <locale.h>
32
33 /**
34  * AccessibleApplication_ref:
35  * @obj: a pointer to the #AccessibleApplication on which to operate.
36  *
37  * Increment the reference count for an #AccessibleApplication.
38  **/
39 void
40 AccessibleApplication_ref (AccessibleApplication *obj)
41 {
42   cspi_object_ref (obj);
43 }
44
45 /**
46  * AccessibleApplication_unref:
47  * @obj: a pointer to the #AccessibleApplication object on which to operate.
48  *
49  * Decrement the reference count for an #AccessibleApplication.
50  **/
51 void
52 AccessibleApplication_unref (AccessibleApplication *obj)
53 {
54   cspi_object_unref (obj);
55 }
56
57 /**
58  * AccessibleApplication_getToolkitName:
59  * @obj: a pointer to the #AccessibleApplication to query.
60  *
61  * Get the name of the UI toolkit used by an #AccessibleApplication.
62  *
63  * Returns: a UTF-8 string indicating which UI toolkit is
64  *          used by an application.
65  **/
66 char *
67 AccessibleApplication_getToolkitName (AccessibleApplication *obj)
68 {
69   char *retval;
70
71   cspi_return_val_if_fail (obj != NULL, NULL);
72
73   retval =
74     Accessibility_Application__get_toolkitName (CSPI_OBJREF (obj),
75                                                 cspi_ev ());
76
77   cspi_return_val_if_ev ("toolkitName", NULL);
78
79   return retval;
80 }
81
82 /**
83  * AccessibleApplication_getVersion:
84  * @obj: a pointer to the #AccessibleApplication being queried.
85  *
86  * Get the version of the at-spi bridge exported by an
87  *      #AccessibleApplication instance.
88  *
89  * Returns: a UTF-8 string indicating the application's
90  *          at-spi version.
91  **/
92 char *
93 AccessibleApplication_getVersion (AccessibleApplication *obj)
94 {
95   char *retval;
96
97   cspi_return_val_if_fail (obj != NULL, NULL);
98
99   retval =
100     Accessibility_Application__get_version (CSPI_OBJREF (obj),
101                                             cspi_ev ());
102
103   cspi_return_val_if_ev ("version", NULL);
104
105   return retval;
106 }
107
108 /**
109  * AccessibleApplication_getID:
110  * @obj: a pointer to the #AccessibleApplication being queried.
111  *
112  * Get the unique ID assigned by the Registry to an
113  *      #AccessibleApplication instance.
114  * (Not Yet Implemented by the registry).
115  *
116  * Returns: a unique #long integer associated with the application
117  *          by the Registry, or 0 if the application is not registered.
118  **/
119 long
120 AccessibleApplication_getID (AccessibleApplication *obj)
121 {
122   long retval;
123
124   cspi_return_val_if_fail (obj != NULL, 0);
125
126   retval = Accessibility_Application__get_id (CSPI_OBJREF (obj),
127                                               cspi_ev ());
128
129   cspi_return_val_if_ev ("id", 0);
130
131   return retval;
132 }
133
134 /**
135  * AccessibleApplication_getLocale:
136  * @obj: a pointer to the #AccessibleApplication being queried.
137  *
138  * Get a POSIX-compliant string describing the application's current
139  * locale setting for a particular @lctype category.
140  *
141  * Returns: a POSIX-compliant locale string, e.g. "C", "pt_BR", "sr@latn", etc.
142  **/
143 char *
144 AccessibleApplication_getLocale (AccessibleApplication *obj, int lc_category)
145 {
146   gchar *retval;
147   Accessibility_LOCALE_TYPE lctype;
148
149   cspi_return_val_if_fail (obj != NULL, CORBA_string_dup (""));
150
151   switch (lc_category) 
152   {
153   case LC_COLLATE:
154     lctype = Accessibility_LOCALE_TYPE_COLLATE;
155     break;
156   case LC_CTYPE:
157     lctype = Accessibility_LOCALE_TYPE_CTYPE;
158     break;
159   case LC_NUMERIC:
160     lctype = Accessibility_LOCALE_TYPE_NUMERIC;
161     break;
162   case LC_MONETARY:
163     lctype = Accessibility_LOCALE_TYPE_MONETARY;
164     break;
165   case LC_MESSAGES:
166   default:
167     lctype = Accessibility_LOCALE_TYPE_MESSAGES;
168     break;
169   }
170
171   retval = Accessibility_Application_getLocale (CSPI_OBJREF (obj),
172                                                 lctype,
173                                                 cspi_ev ());
174
175   cspi_return_val_if_ev ("id", CORBA_string_dup (""));
176
177   return CORBA_string_dup (retval);
178 }
179
180 /**
181  * AccessibleApplication_pause:
182  * @obj: a pointer to the #Accessible object on which to operate.
183  *
184  * Attempt to pause the application (used when client event queue is
185  *  over-full).
186  * Not Yet Implemented.
187  *
188  * Returns: #TRUE if the application was paused successfully, #FALSE otherwise.
189  *
190  **/
191 SPIBoolean
192 AccessibleApplication_pause (AccessibleApplication *obj)
193 {
194   return FALSE;
195 }
196
197 /**
198  * AccessibleApplication_resume:
199  * @obj: a pointer to the #Accessible object on which to operate.
200  *
201  * Attempt to resume the application (used after #AccessibleApplication_pause).
202  * Not Yet Implemented.
203  *
204  * Returns: #TRUE if application processing resumed successfully, #FALSE otherwise.
205  *
206  **/
207 SPIBoolean
208 AccessibleApplication_resume (AccessibleApplication *obj)
209 {
210   return FALSE;
211 }