f29dac4f3ec3805e70f0ea0195f27fcbf723f75a
[platform/core/uifw/at-spi2-atk.git] / atk-tests / test-simple-table.h
1 /* This file contains both declaration and definition of the TestSimpleTable,
2  * a GObject that pretends to implement the AtkTableIface interface (it 
3  * registers appropriate interface), but provides no implementation for any of the
4  * methods of this interface (NULL-filled vftbl).
5  */
6
7 #ifndef TESTSIMPLETABLE_H_
8 #define TESTSIMPLETABLE_H_
9
10 #include <glib-object.h>
11 #include <atk/atk.h> 
12
13 #include <string.h>
14
15 #include "test-simple-child.h"
16 #include "test-simple-text.h"
17
18 #define TEST_TYPE_SIMPLE_TABLE             (test_simple_table_get_type ())
19 #define TEST_SIMPLE_TABLE(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_SIMPLE_TABLE, TestSimpleTable))
20 #define TEST_SIMPLE_TABLE_CLASS(vtable)    (G_TYPE_CHECK_CLASS_CAST ((vtable), TEST_TYPE_SIMPLE_TABLE, TestSimpleTableClass))
21 #define TEST_IS_SIMPLE_TABLE(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_SIMPLE_TABLE))
22 #define TEST_IS_SIMPLE_TABLE_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), TEST_TYPE_SIMPLE_TABLE))
23 #define TEST_SIMPLE_TABLE_GET_CLASS(inst)  (G_TYPE_INSTANCE_GET_CLASS ((inst), TEST_TYPE_SIMPLE_TABLE, TestSimpleTableClass))
24
25 #define NROWS 4     /* row count */
26 #define NCOLS 5     /* column count */
27
28 static gint ids[NROWS][NCOLS] = 
29     { {0,  1,  2,  2,  3},
30       {4,  5,  6,  7,  8},
31       {9,  9, 10, 11, 12},
32       {9,  9, 13, 14, -1} };
33       
34 static gint row_ext[NROWS][NCOLS] = 
35     { {1,  1,  1,  1,  1},
36       {1,  1,  1,  1,  1},
37       {2,  2,  1,  1,  1},
38       {2,  2,  1,  1,  1} };
39
40 static gint col_ext[NROWS][NCOLS] = 
41     { {1,  1,  2,  2,  1},
42       {1,  1,  1,  1,  1},
43       {2,  2,  1,  1,  1},
44       {2,  2,  1,  1,  1} };
45
46 #define NCHILDREN 16    /* child object count */
47
48 // default string values
49 #define DEF_CAPTION_TEXT    "Default table caption"
50 #define DEF_SUMMARY_TEXT    "Default table summary"
51 #define DEF_ROW_DESCR_TPL   "Row No%d"
52 #define DEF_COL_DESCR_TPL   "Column No%d"
53
54 // convenience typedefs
55 typedef TestSimpleText TestSimpleHeader;
56 typedef TestSimpleText TestSimpleSummary;
57 //typedef TestSimpleText TestSimpleDescription;
58 typedef TestSimpleText TestSimpleCaption;
59
60 /* row and column headers */
61 typedef struct
62 {
63     AtkObject* hdr;
64     gboolean selected;  /* TRUE if the row/column is selected, FALSE otherwise */
65 } TestSimpleHeaderStruct;
66
67 /* This struct represents a table cell */
68 typedef struct
69 {
70     TestSimpleChild* elem;   /* the element */
71     guint ext_row;           /* its row extent */
72     guint ext_col;           /* its column extent */
73 } TestSimpleCell;
74
75 /* TestSimpleTable class */
76 typedef struct _TestSimpleTable TestSimpleTable;
77 typedef struct _TestSimpleTableClass TestSimpleTableClass;
78
79 struct _TestSimpleTable 
80 {
81     AtkObject parent;
82     gboolean disposed;
83     
84     /* Children of this object. */
85     TestSimpleChild* child[NCHILDREN];
86     
87     /* This object is not a child of the table object. */
88     TestSimpleChild* not_a_child;
89     
90     /* The table itself. */
91     TestSimpleCell tbl[NROWS][NCOLS];
92     
93     /* Row and column descriptors */
94     TestSimpleHeaderStruct row[NROWS];
95     TestSimpleHeaderStruct col[NCOLS];
96         
97     /* current number of rows and columns */
98     guint nrows;
99     guint ncols;
100     
101     AtkObject* caption;
102     
103     AtkObject* summary;
104 };
105
106 struct _TestSimpleTableClass 
107 {
108     AtkObjectClass parent;
109 };
110
111 #endif /*TESTSIMPLETABLE_H_*/