Added additional documentation and fixed a couple of latent bugs.
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_table.c
1 /**
2  * AccessibleTable_ref:
3  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
4  *
5  * Increment the reference count for an #AccessibleTable object.
6  *
7  * Returns: (no return code implemented yet).
8  *
9  **/
10 int
11 AccessibleTable_ref (AccessibleTable *obj)
12 {
13   Accessibility_Table_ref (*obj, &ev);
14   return 0;
15 }
16
17
18
19 /**
20  * AccessibleTable_unref:
21  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
22  *
23  * Decrement the reference count for an #AccessibleTable object.
24  *
25  * Returns: (no return code implemented yet).
26  *
27  **/
28 int
29 AccessibleTable_unref (AccessibleTable *obj)
30 {
31   Accessibility_Table_unref (*obj, &ev);
32   return 0;
33 }
34
35 /**
36  * AccessibleTable_getCaption:
37  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
38  *
39  * Get an accessible representation of the caption for an #AccessibleTable.
40  *
41  * Returns: an #Accessible object that serves as the table's caption.
42  *
43  **/
44 Accessible *
45 AccessibleTable_getCaption (AccessibleTable *obj)
46 {
47   return (Accessible *)
48     Accessibility_Table__get_caption (*obj, &ev);
49 }
50
51
52
53 /**
54  * AccessibleTable_getSummary:
55  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
56  *
57  * Get an accessible object which summarizes the contents of an #AccessibleTable.
58  *
59  * Returns: an #Accessible object that serves as the table's summary (often a
60  *          reduced #AccessibleTable).
61  *
62  **/
63 Accessible *
64 AccessibleTable_getSummary (AccessibleTable *obj)
65 {
66   return (Accessible *)
67     Accessibility_Table__get_summary (*obj, &ev);
68 }
69
70
71
72 /**
73  * AccessibleTable_getNRows:
74  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
75  *
76  * Get the number of rows in an #AccessibleTable,
77  *        exclusive of any rows that are programmatically hidden, but inclusive
78  *        of rows that may be outside of the current scrolling window or viewport.
79  *
80  * Returns: a #long integer indicating the number of rows in the table.
81  *
82  **/
83 long
84 AccessibleTable_getNRows (AccessibleTable *obj)
85 {
86   return (long)
87     Accessibility_Table__get_nRows (*obj, &ev);
88 }
89
90
91
92 /**
93  * AccessibleTable_getNColumns:
94  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
95  *
96  * Get the number of columns in an #AccessibleTable,
97  *        exclusive of any columns that are programmatically hidden, but inclusive
98  *        of columns that may be outside of the current scrolling window or viewport.
99  *
100  * Returns: a #long integer indicating the number of columns in the table.
101  *
102  **/
103 long
104 AccessibleTable_getNColumns (AccessibleTable *obj)
105 {
106   return (long)
107     Accessibility_Table__get_nColumns (*obj, &ev);
108 }
109
110
111 /**
112  * AccessibleTable_getAccessibleAt:
113  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
114  * @row: the specified table row, zero-indexed.
115  * @column: the specified table column, zero-indexed.
116  *
117  * Get the table cell at the specified row and column indices.
118  *          To get the accessible object at a particular (x, y) screen coordinate,
119  *          use #Accessible_getAccessibleAtPoint ().
120  *
121  * Returns: an #Accessible object representing the specified table cell.
122  *
123  **/
124 Accessible *
125 AccessibleTable_getAccessibleAt (AccessibleTable *obj,
126                                  long int row,
127                                  long int column)
128 {
129   return (Accessible *)
130     Accessibility_Table_getAccessibleAt (*obj,
131                                (CORBA_long) row, (CORBA_long) column, &ev);
132 }
133
134
135 /**
136  * AccessibleTable_getIndexAt:
137  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
138  * @row: the specified table row, zero-indexed.
139  * @column: the specified table column, zero-indexed.
140  *
141  * Get the 1-D child index corresponding to the specified 2-D row and column indices.
142  *          To get the accessible object at a particular (x, y) screen coordinate,
143  *          use #Accessible_getAccessibleAtPoint ().
144  * @see #AccessibleTable_getRowAtIndex(), #AccessibleTable_getColumnAtIndex()
145  *
146  * Returns: a long integer which serves as the index of a specified cell in the
147  *          table, in a form usable by #Accessible_getChildAtIndex().
148  *
149  **/
150 long
151 AccessibleTable_getIndexAt (AccessibleTable *obj,
152                             long int row,
153                             long int column)
154 {
155   return (long)
156     Accessibility_Table_getIndexAt (*obj,
157                                     (CORBA_long) row, (CORBA_long) column, &ev);
158 }
159
160
161
162 /**
163  * AccessibleTable_getRowAtIndex:
164  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
165  * @index: the specified child index, zero-indexed.
166  *
167  * Get the table row index occupied by the child at a particular 1-D child index.
168  *
169  * @see #AccessibleTable_getIndexAt(), #AccessibleTable_getColumnAtIndex()
170  *
171  * Returns: a long integer indicating the first row spanned by the child of a
172  *          table, at the specified 1-D (zero-offset) @index.
173  *
174  **/
175 long
176 AccessibleTable_getRowAtIndex (AccessibleTable *obj,
177                                long index)
178 {
179   return (long)
180     Accessibility_Table_getRowAtIndex (*obj,
181                                        (CORBA_long) index, &ev);
182 }
183
184
185
186 /**
187  * AccessibleTable_getColumnAtIndex:
188  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
189  * @index: the specified child index, zero-indexed.
190  *
191  * Get the table column index occupied by the child at a particular 1-D child index.
192  *
193  * @see #AccessibleTable_getIndexAt(), #AccessibleTable_getRowAtIndex()
194  *
195  * Returns: a long integer indicating the first column spanned by the child of a
196  *          table, at the specified 1-D (zero-offset) @index.
197  *
198  **/
199 long
200 AccessibleTable_getColumnAtIndex (AccessibleTable *obj,
201                                   long index)
202 {
203   return (long)
204     Accessibility_Table_getColumnAtIndex (*obj,
205                                           (CORBA_long) index, &ev);
206 }
207
208
209
210 /**
211  * AccessibleTable_getRowDescription:
212  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
213  * @row: the specified table row, zero-indexed.
214  *
215  * Get a text description of a particular table row.  This differs from
216  * AccessibleTable_getRowHeader, which returns an #Accessible.
217  *
218  * Returns: a UTF-8 string describing the specified table row, if available.
219  *
220  **/
221 char *
222 AccessibleTable_getRowDescription (AccessibleTable *obj,
223                                    long int row)
224 {
225   return (char *)
226     Accessibility_Table_getRowDescription (*obj,
227                                            (CORBA_long) row, &ev);
228 }
229
230
231
232 /**
233  * AccessibleTable_getColumnDescription:
234  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
235  * @column: the specified table column, zero-indexed.
236  *
237  * Get a text description of a particular table column.  This differs from
238  * AccessibleTable_getColumnHeader, which returns an #Accessible.
239  *
240  * Returns: a UTF-8 string describing the specified table column, if available.
241  *
242  **/
243 char *
244 AccessibleTable_getColumnDescription (AccessibleTable *obj,
245                                       long int column)
246 {
247   return (char *)
248     Accessibility_Table_getColumnDescription (*obj,
249                                               (CORBA_long) column, &ev);
250 }
251
252
253
254 /**
255  * AccessibleTable_getRowExtentAt:
256  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
257  * @row: the specified table row, zero-indexed.
258  * @column: the specified table column, zero-indexed.
259  *
260  * Get the number of rows spanned by the table cell at the specific row and column.
261  * (some tables can have cells which span multiple rows and/or columns).
262  *
263  * Returns: a long integer indicating the number of rows spanned by the specified cell.
264  *
265  **/
266 long
267 AccessibleTable_getRowExtentAt (AccessibleTable *obj,
268                                 long int row,
269                                 long int column)
270 {
271   return (long)
272     Accessibility_Table_getRowExtentAt (*obj,
273                                         (CORBA_long) row, (CORBA_long) column, &ev);
274 }
275
276
277
278 /**
279  * AccessibleTable_getColumnExtentAt:
280  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
281  * @row: the specified table row, zero-indexed.
282  * @column: the specified table column, zero-indexed.
283  *
284  * Get the number of columns spanned by the table cell at the specific row and column.
285  * (some tables can have cells which span multiple rows and/or columns).
286  *
287  * Returns: a long integer indicating the number of columns spanned by the specified cell.
288  *
289  **/
290 long
291 AccessibleTable_getColumnExtentAt (AccessibleTable *obj,
292                                    long int row,
293                                    long int column)
294 {
295   return (long)
296     Accessibility_Table_getColumnExtentAt (*obj,
297                                         (CORBA_long) row, (CORBA_long) column, &ev);
298 }
299
300
301 /**
302  * AccessibleTable_getRowHeader:
303  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
304  * @row: the specified table row, zero-indexed.
305  *
306  * Get the header associated with a table row, if available.  This differs from
307  * AccessibleTable_getRowDescription, which returns a string.
308  *
309  * Returns: a #Accessible representatin of the specified table row, if available.
310  *
311  **/
312 Accessible *
313 AccessibleTable_getRowHeader (AccessibleTable *obj,
314                               long int row)
315 {
316   return (Accessible *)
317     Accessibility_Table_getRowHeader (*obj,
318                                       (CORBA_long) row, &ev);
319 }
320
321
322
323 /**
324  * AccessibleTable_getColumnHeader:
325  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
326  * @column: the specified table column, zero-indexed.
327  *
328  * Get the header associated with a table column, if available.  This differs from
329  * AccessibleTable_getColumnDescription, which returns a string.
330  *
331  * Returns: a #Accessible representatin of the specified table column, if available.
332  *
333  **/
334 Accessible *
335 AccessibleTable_getColumnHeader (AccessibleTable *obj,
336                                  long int column)
337 {
338   return (Accessible *)
339     Accessibility_Table_getColumnHeader (*obj,
340                                       (CORBA_long) column, &ev);
341 }
342
343
344 /**
345  * AccessibleTable_getNSelectedRows:
346  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
347  *
348  * Query a table to find out how many rows are currently selected.  Not all tables
349  *  support row selection.
350  *
351  * Returns: a long integer indicating the number of rows currently selected.
352  **/
353 long
354 AccessibleTable_getNSelectedRows (AccessibleTable *obj)
355 {
356   return (long)
357     Accessibility_Table__get_nSelectedRows (*obj, &ev);
358 }
359
360
361
362 /**
363  * AccessibleTable_getSelectedRows:
364  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
365  * @selectedRows: a doubly indirected pointer which will be set to the address
366  *       of an array of long integers, specifying which rows are currently selected.
367  *
368  * Query a table for a list of indices of rows which are currently selected.
369  *
370  * Returns: a long integer indicating the length of the array returned in @selectedRows.
371  **/
372 long
373 AccessibleTable_getSelectedRows (AccessibleTable *obj,
374                                  long int **selectedRows)
375 {
376   Accessibility_LongSeq *rows = Accessibility_Table_getSelectedRows (*obj, &ev);
377   CORBA_long *i;
378   long *j;
379   long length;
380
381   i = rows->_buffer;
382   length = (long) rows->_length;
383   j = *selectedRows = (long *) malloc (sizeof(long)*length);
384   
385   while (length--)
386     *j++ = (CORBA_long) (*i++);
387
388   length = rows->_length;
389   CORBA_free (rows);
390   return length;
391 }
392
393
394
395 /**
396  * AccessibleTable_getNSelectedColumns:
397  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
398  *
399  * Query a table to find out how many columnss are currently selected.  Not all tables
400  *  support column selection.
401  *
402  * Returns: a long integer indicating the number of columns currently selected.
403  **/
404 long
405 AccessibleTable_getNSelectedColumns (AccessibleTable *obj)
406 {
407   return (long)
408     Accessibility_Table__get_nSelectedColumns (*obj, &ev);
409 }
410
411
412 /**
413  * AccessibleTable_getSelectedColumns:
414  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
415  * @selectedColumns: a doubly indirected pointer which will be set to the address
416  *       of an array of long integers, specifying which columns are currently selected.
417  *
418  * Query a table for a list of indices of columns which are currently selected.
419  *       Not all tables support column selection.
420  *
421  * Returns: a long integer indicating the length of the array returned in @selectedColumns.
422  **/
423 long
424 AccessibleTable_getSelectedColumns (AccessibleTable *obj,
425                                     long int **selectedColumns)
426 {
427   Accessibility_LongSeq *columns = Accessibility_Table_getSelectedColumns (*obj, &ev);
428   CORBA_long *i;
429   long *j;
430   long length;
431
432   i = columns->_buffer;
433   length = (long) columns->_length;
434   j = *selectedColumns = (long *) malloc (sizeof(long)*length);
435   
436   while (length--)
437     *j++ = (CORBA_long) (*i++);
438
439   length = columns->_length;
440   CORBA_free (columns);
441   return length;
442 }
443
444
445 /**
446  * AccessibleTable_isRowSelected:
447  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
448  * @row:
449  *
450  * Determine whether a table row is selected.  Not all tables support row selection.
451  *
452  * Returns: #TRUE if the specified row is currently selected, #FALSE if not.
453  *
454  **/
455 boolean
456 AccessibleTable_isRowSelected (AccessibleTable *obj,
457                                long int row)
458 {
459   return (boolean)
460     Accessibility_Table_isRowSelected (*obj,
461                                        (CORBA_long) row, &ev);
462 }
463
464
465
466 /**
467  * AccessibleTable_isColumnSelected:
468  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
469  * @column:
470  *
471  * Determine whether specified table column is selected.
472  * Not all tables support column selection.
473  *
474  * Returns: #TRUE if the specified column is currently selected, #FALSE if not.
475  *
476  **/
477 boolean
478 AccessibleTable_isColumnSelected (AccessibleTable *obj,
479                                   long int column)
480 {
481   return (boolean)
482     Accessibility_Table_isColumnSelected (*obj,
483                                        (CORBA_long) column, &ev);
484 }
485
486
487
488 /**
489  * AccessibleTable_isSelected:
490  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
491  * @row:
492  * @column:
493  *
494  * Determine whether the cell at a specific row and column is selected.
495  *
496  * Returns: #TRUE if the specified cell is currently selected, #FALSE if not.
497  *
498  **/
499 boolean
500 AccessibleTable_isSelected (AccessibleTable *obj,
501                             long int row,
502                             long int column)
503 {
504   return (boolean)
505   Accessibility_Table_isSelected (*obj,
506                                   (CORBA_long) row, (CORBA_long) column, &ev);
507 }
508