Add atk-bridge
[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  * @lc_category: one of the POSIX LC_TYPE enumeration, for instance
138  * LC_MESSAGES.
139  *
140  * Get a POSIX-compliant string describing the application's current
141  * locale setting for a particular @lctype category.
142  *
143  * @Since: AT-SPI 1.4
144  *
145  * Returns: a POSIX-compliant locale string, e.g. "C", "pt_BR", "sr@latn", etc.
146  **/
147 char *
148 AccessibleApplication_getLocale (AccessibleApplication *obj, int lc_category)
149 {
150   gchar *retval;
151   Accessibility_LOCALE_TYPE lctype;
152
153   cspi_return_val_if_fail (obj != NULL, CORBA_string_dup (""));
154
155   switch (lc_category) 
156   {
157   case LC_COLLATE:
158     lctype = Accessibility_LOCALE_TYPE_COLLATE;
159     break;
160   case LC_CTYPE:
161     lctype = Accessibility_LOCALE_TYPE_CTYPE;
162     break;
163   case LC_NUMERIC:
164     lctype = Accessibility_LOCALE_TYPE_NUMERIC;
165     break;
166   case LC_MONETARY:
167     lctype = Accessibility_LOCALE_TYPE_MONETARY;
168     break;
169   case LC_MESSAGES:
170   default:
171     lctype = Accessibility_LOCALE_TYPE_MESSAGES;
172     break;
173   }
174
175   retval = Accessibility_Application_getLocale (CSPI_OBJREF (obj),
176                                                 lctype,
177                                                 cspi_ev ());
178
179   cspi_return_val_if_ev ("id", CORBA_string_dup (""));
180
181   return CORBA_string_dup (retval);
182 }
183
184 /**
185  * AccessibleApplication_pause:
186  * @obj: a pointer to the #Accessible object on which to operate.
187  *
188  * Attempt to pause the application (used when client event queue is
189  *  over-full).
190  * Not Yet Implemented.
191  *
192  * Returns: #TRUE if the application was paused successfully, #FALSE otherwise.
193  *
194  **/
195 SPIBoolean
196 AccessibleApplication_pause (AccessibleApplication *obj)
197 {
198   return FALSE;
199 }
200
201 /**
202  * AccessibleApplication_resume:
203  * @obj: a pointer to the #Accessible object on which to operate.
204  *
205  * Attempt to resume the application (used after #AccessibleApplication_pause).
206  * Not Yet Implemented.
207  *
208  * Returns: #TRUE if application processing resumed successfully, #FALSE otherwise.
209  *
210  **/
211 SPIBoolean
212 AccessibleApplication_resume (AccessibleApplication *obj)
213 {
214   return FALSE;
215 }