diff options
author | Mark Doffman <mdoff@silver-wind.(none)> | 2008-05-29 16:57:46 +0100 |
---|---|---|
committer | Mark Doffman <mdoff@silver-wind.(none)> | 2008-05-29 17:03:15 +0100 |
commit | 9fc4f70caa2c825f79953b7d88285674e0138025 (patch) | |
tree | 37b4f807b44571081410f21554f5b2edcca10bab /tests | |
parent | 866672e4a33e0b5f043699fab555340693943596 (diff) | |
download | at-spi2-atk-9fc4f70caa2c825f79953b7d88285674e0138025.tar.gz |
2008-05-29 Mark Doffman <mark.doffman@codethink.co.uk>
* my-atk-*
Modify some of the objects to have MyAtkObject
as their parent rather than GObject. This is so they
can act as a standard accessible as well as implementing
their own specialised interface.
* my-atk-selection* my-atk-table*
Add two new interfaces, taken from LSB test suite.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dummyatk/Makefile.am | 4 | ||||
-rw-r--r-- | tests/dummyatk/my-atk-action.c | 3 | ||||
-rw-r--r-- | tests/dummyatk/my-atk-action.h | 6 | ||||
-rw-r--r-- | tests/dummyatk/my-atk-object.h | 1 | ||||
-rw-r--r-- | tests/dummyatk/my-atk-selection.c | 332 | ||||
-rw-r--r-- | tests/dummyatk/my-atk-selection.h | 55 | ||||
-rw-r--r-- | tests/dummyatk/my-atk-streamable-content.c | 3 | ||||
-rw-r--r-- | tests/dummyatk/my-atk-streamable-content.h | 6 | ||||
-rw-r--r-- | tests/dummyatk/my-atk-table.c | 177 | ||||
-rw-r--r-- | tests/dummyatk/my-atk-table.h | 86 | ||||
-rw-r--r-- | tests/dummyatk/my-atk-text.c | 2 | ||||
-rw-r--r-- | tests/dummyatk/my-atk-text.h | 6 | ||||
-rw-r--r-- | tests/dummyatk/my-atk-value.c | 3 | ||||
-rw-r--r-- | tests/dummyatk/my-atk-value.h | 4 |
14 files changed, 676 insertions, 12 deletions
diff --git a/tests/dummyatk/Makefile.am b/tests/dummyatk/Makefile.am index 397460b..a00709b 100644 --- a/tests/dummyatk/Makefile.am +++ b/tests/dummyatk/Makefile.am @@ -19,8 +19,12 @@ libdummyatk_la_SOURCES = my-atk-action.c \ my-atk-hypertext.h \ my-atk-object.c \ my-atk-object.h \ + my-atk-selection.c \ + my-atk-selection.h \ my-atk-streamable-content.c \ my-atk-streamable-content.h \ + my-atk-table.c \ + my-atk-table.h \ my-atk-text.c \ my-atk-text.h \ my-atk-value.c \ diff --git a/tests/dummyatk/my-atk-action.c b/tests/dummyatk/my-atk-action.c index 048d0b2..1d189fe 100644 --- a/tests/dummyatk/my-atk-action.c +++ b/tests/dummyatk/my-atk-action.c @@ -2,6 +2,7 @@ #include <string.h> #include <atk/atk.h> +#include "my-atk-object.h" #include "my-atk-action.h" static GObjectClass *parent_class = NULL; @@ -210,7 +211,7 @@ GType my_atk_action_get_type(void) NULL, /* interface_finalize */ NULL /* interface_data */ }; - type = g_type_register_static (G_TYPE_OBJECT, + type = g_type_register_static (MY_TYPE_ATK_OBJECT, "MyAtkAction", &info, 0); g_type_add_interface_static (type, diff --git a/tests/dummyatk/my-atk-action.h b/tests/dummyatk/my-atk-action.h index dc4da8b..35d7e1d 100644 --- a/tests/dummyatk/my-atk-action.h +++ b/tests/dummyatk/my-atk-action.h @@ -5,6 +5,8 @@ #include <glib-object.h> #include <atk/atk.h> +#include "my-atk-object.h" + //declarations #define MY_TYPE_ATK_ACTION (my_atk_action_get_type ()) #define MY_ATK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_ACTION, MyAtkAction)) @@ -34,7 +36,7 @@ typedef struct _MyAtkActionClass MyAtkActionClass; struct _MyAtkAction { - GObject parent; + MyAtkObject parent; gboolean disposed; struct OneAction @@ -49,7 +51,7 @@ struct _MyAtkAction struct _MyAtkActionClass { - GObjectClass parent; + MyAtkObjectClass parent; }; GType my_atk_action_get_type(void); diff --git a/tests/dummyatk/my-atk-object.h b/tests/dummyatk/my-atk-object.h index 3e1eed6..6007e3c 100644 --- a/tests/dummyatk/my-atk-object.h +++ b/tests/dummyatk/my-atk-object.h @@ -18,6 +18,7 @@ struct _MyAtkObject AtkObject parent; //array of children GPtrArray* children; + gint id; }; struct _MyAtkObjectClass diff --git a/tests/dummyatk/my-atk-selection.c b/tests/dummyatk/my-atk-selection.c new file mode 100644 index 0000000..e3f386f --- /dev/null +++ b/tests/dummyatk/my-atk-selection.c @@ -0,0 +1,332 @@ +/* This file contains both declaration and definition of the MyAtkSelection, + * a GObject that implements the AtkSelectionIface interface. + */ + +#include <glib-object.h> +#include <atk/atk.h> + +#include "my-atk-object.h" +#include "my-atk-selection.h" + +/******************************************************************/ +/* Implementation */ +/******************************************************************/ +static GObjectClass *parent_class_simple_selection = NULL; + +/* Implementation of the AtkSelectionIface interface. */ +static gboolean +simple_selection_add_selection (AtkSelection *selection, gint i) +{ + MyAtkSelection* self = (MyAtkSelection*)selection; + if ((!self) || self->disposed) + { + return FALSE; + } + + if ((i >= 0) && (i < TEST_SELECTION_NCHILDREN)) + { + /* If the child is not selected, select it and send the signal */ + if (!self->is_selected[i]) + { + self->is_selected[i] = TRUE; + g_signal_emit_by_name ((gpointer)self, "selection-changed"); + } + + return TRUE; + } + else + { + return FALSE; + } + +} + +static gboolean +simple_selection_clear_selection (AtkSelection *selection) +{ + MyAtkSelection* self = (MyAtkSelection*)selection; + if ((!self) || self->disposed) + { + return FALSE; + } + + /* clear selection */ + { + gboolean changed = FALSE; + int i; + for (i = 0; i < TEST_SELECTION_NCHILDREN; ++i) + { + changed |= self->is_selected[i]; + self->is_selected[i] = FALSE; + } + + if (changed) + { + g_signal_emit_by_name ((gpointer)self, "selection-changed"); + } + } + + return TRUE; +} + +static AtkObject* +simple_selection_ref_selection (AtkSelection *selection, gint i) +{ + int pos; + int nsel; + MyAtkSelection* self = (MyAtkSelection*)selection; + if ((!self) || self->disposed) + { + return NULL; + } + + nsel = 0; + for (pos = 0; pos < TEST_SELECTION_NCHILDREN; ++pos) + { + if (self->is_selected[pos]) + { + if (i == nsel) + { + g_object_ref (G_OBJECT (self->child[pos])); + return ATK_OBJECT(self->child[pos]); + } + ++nsel; + } + } + + return NULL; +} + +static gint +simple_selection_get_selection_count (AtkSelection *selection) +{ + MyAtkSelection* self = (MyAtkSelection*)selection; + + int cnt = 0; + int i; + + if ((!self) || self->disposed) + { + return 0; + } + + for (i = 0; i < TEST_SELECTION_NCHILDREN; ++i) + { + if (self->is_selected[i]) + { + ++cnt; + } + } + + return cnt; +} + +static gboolean +simple_selection_is_child_selected (AtkSelection *selection, gint i) +{ + MyAtkSelection* self = (MyAtkSelection*)selection; + if ((!self) || self->disposed) + { + return FALSE; + } + + if ((i >= 0) && (i < TEST_SELECTION_NCHILDREN)) + { + return (self->is_selected[i]); + } + else + { + return FALSE; + } +} + +static gboolean +simple_selection_remove_selection (AtkSelection *selection, gint i) +{ + int pos; + int nsel; + + MyAtkSelection* self = (MyAtkSelection*)selection; + if ((!self) || self->disposed) + { + return FALSE; + } + + nsel = 0; + for (pos = 0; pos < TEST_SELECTION_NCHILDREN; ++pos) + { + if (self->is_selected[pos]) + { + if (i == nsel) + { + self->is_selected[pos] = FALSE; + g_signal_emit_by_name ((gpointer)self, "selection-changed"); + return TRUE; + } + ++nsel; + } + } + + return TRUE; +} + +static gboolean +simple_selection_select_all_selection (AtkSelection *selection) +{ + MyAtkSelection* self = (MyAtkSelection*)selection; + if ((!self) || self->disposed) + { + return FALSE; + } + + if (!self->multisel_supported) + { + return FALSE; + } + + /* select all */ + { + gboolean changed = FALSE; + int i; + for (i = 0; i < TEST_SELECTION_NCHILDREN; ++i) + { + changed |= !self->is_selected[i]; + self->is_selected[i] = TRUE; + } + + if (changed) + { + g_signal_emit_by_name ((gpointer)self, "selection-changed"); + } + } + + return TRUE; +} + +/******************************************************************/ +static void +simple_selection_interface_init (gpointer g_iface, gpointer iface_data) +{ + AtkSelectionIface *klass = (AtkSelectionIface *)g_iface; + + /* set up overrides here */ + klass->add_selection = + (gboolean (*) (AtkSelection *selection, gint i)) simple_selection_add_selection; + + klass->clear_selection = + (gboolean (*) (AtkSelection *selection)) simple_selection_clear_selection; + + klass->ref_selection = + (AtkObject* (*) (AtkSelection *selection, gint i)) simple_selection_ref_selection; + + klass->get_selection_count = + (gint (*) (AtkSelection *selection)) simple_selection_get_selection_count; + + klass->is_child_selected = + (gboolean (*) (AtkSelection *selection, gint i)) simple_selection_is_child_selected; + + klass->remove_selection = + (gboolean (*) (AtkSelection *selection, gint i)) simple_selection_remove_selection; + + klass->select_all_selection = + (gboolean (*) (AtkSelection *selection)) simple_selection_select_all_selection; +} + +static void +simple_selection_instance_init (GTypeInstance *instance, gpointer g_class) +{ + MyAtkSelection *self = (MyAtkSelection *)instance; + int i; + + self->disposed = FALSE; + self->multisel_supported = TRUE; + for (i = 0; i < TEST_SELECTION_NCHILDREN; ++i) + { + self->child[i] = MY_ATK_OBJECT (g_object_new (MY_TYPE_ATK_OBJECT, NULL)); + self->child[i]->id = i; + self->is_selected[i] = FALSE; /* not selected by default */ + } +} + +static void +my_atk_selection_dispose (GObject *obj) +{ + MyAtkSelection *self = (MyAtkSelection *)obj; + int i; + + if (self->disposed) + { + return; + } + + /* Make sure dispose does not run twice. */ + self->disposed = TRUE; + + for (i = 0; i < TEST_SELECTION_NCHILDREN; ++i) + { + g_object_unref (G_OBJECT (self->child[i])); + } + + /* Chain up to the parent class */ + G_OBJECT_CLASS (parent_class_simple_selection)->dispose (obj); +} + +static void +my_atk_selection_finalize (GObject *obj) +{ + /*MyAtkSelection *self = (MyAtkSelection *)obj; + if (self) + { + }*/ + + /* Chain up to the parent class */ + G_OBJECT_CLASS (parent_class_simple_selection)->finalize (obj); +} + +static void +my_atk_selection_class_init (gpointer g_class, gpointer g_class_data) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (g_class); + MyAtkSelectionClass *klass = MY_ATK_SELECTION_CLASS (g_class); + + gobject_class->dispose = my_atk_selection_dispose; + gobject_class->finalize = my_atk_selection_finalize; + + parent_class_simple_selection = g_type_class_peek_parent (klass); +} + +GType +my_atk_selection_get_type (void) +{ + static GType type = 0; + if (type == 0) + { + static const GTypeInfo info = + { + sizeof (MyAtkSelectionClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + my_atk_selection_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (MyAtkSelection), + 0, /* n_preallocs */ + simple_selection_instance_init /* instance_init */ + }; + + static const GInterfaceInfo iface_info = + { + (GInterfaceInitFunc) simple_selection_interface_init, /* interface_init */ + NULL, /* interface_finalize */ + NULL /* interface_data */ + }; + type = g_type_register_static (MY_TYPE_ATK_OBJECT, + "MyAtkSelectionType", + &info, 0); + g_type_add_interface_static (type, + ATK_TYPE_SELECTION, + &iface_info); + } + return type; +} + diff --git a/tests/dummyatk/my-atk-selection.h b/tests/dummyatk/my-atk-selection.h new file mode 100644 index 0000000..8e8fcf5 --- /dev/null +++ b/tests/dummyatk/my-atk-selection.h @@ -0,0 +1,55 @@ +/* This file contains both declaration and definition of the MyAtkSelection, + * a GObject that implements the AtkSelectionIface interface. + */ + +#ifndef MY_ATK_SELECTION_H +#define MY_ATK_SELECTION_H + +#include <glib-object.h> +#include <atk/atk.h> + +#include <my-atk-object.h> + +#define MY_TYPE_ATK_SELECTION (my_atk_selection_get_type ()) +#define MY_ATK_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_SELECTION, MyAtkSelection)) +#define MY_ATK_SELECTION_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_SELECTION, MyAtkSelectionClass)) +#define MY_IS_ATK_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_SELECTION)) +#define MY_IS_ATK_SELECTION_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_SELECTION)) +#define MY_ATK_SELECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_SELECTION, MyAtkSelectionClass)) + +/* Number of child objects for the MyAtkSelection instance */ +#define TEST_SELECTION_NCHILDREN 10 + +typedef struct _MyAtkSelection MyAtkSelection; +typedef struct _MyAtkSelectionClass MyAtkSelectionClass; + +struct _MyAtkSelection +{ + MyAtkObject parent; + + gboolean disposed; + + /* TRUE if multiple selection is supported, FALSE otherwise. + * default - TRUE. + */ + gboolean multisel_supported; + + /* Children of this object */ + MyAtkObject* child[TEST_SELECTION_NCHILDREN]; + + /* is_selected[i] == TRUE means the ith child is selected, == FALSE - + * it is not. + */ + gboolean is_selected[TEST_SELECTION_NCHILDREN]; +}; + +struct _MyAtkSelectionClass +{ + MyAtkObjectClass parent; +}; + +GType +my_atk_selection_get_type (void); + +#endif /*MY_ATK_SELECTION_H*/ + diff --git a/tests/dummyatk/my-atk-streamable-content.c b/tests/dummyatk/my-atk-streamable-content.c index 4141344..460dd9a 100644 --- a/tests/dummyatk/my-atk-streamable-content.c +++ b/tests/dummyatk/my-atk-streamable-content.c @@ -1,5 +1,6 @@ #include <atk/atk.h> +#include "my-atk-object.h" #include "my-atk-streamable-content.h" //*************************implementation*********************** @@ -86,7 +87,7 @@ GType my_atk_streamable_content_get_type() NULL, /* interface_finalize*/ NULL /* interface_data */ }; - type = g_type_register_static(G_TYPE_OBJECT, "MyAtkStreamableContent", &typeInfo, 0); + type = g_type_register_static(MY_TYPE_ATK_OBJECT, "MyAtkStreamableContent", &typeInfo, 0); g_type_add_interface_static(type, ATK_TYPE_STREAMABLE_CONTENT, &iface_info); diff --git a/tests/dummyatk/my-atk-streamable-content.h b/tests/dummyatk/my-atk-streamable-content.h index d8e0a4e..7a476ac 100644 --- a/tests/dummyatk/my-atk-streamable-content.h +++ b/tests/dummyatk/my-atk-streamable-content.h @@ -7,6 +7,8 @@ #include <atk/atk.h> +#include "my-atk-object.h" + #define MY_TYPE_ATK_STREAMABLE_CONTENT (my_atk_streamable_content_get_type ()) #define MY_ATK_STREAMABLE_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_STREAMABLE_CONTENT, MyAtkStreamableContent)) #define MY_ATK_STREAMABLE_CONTENT_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_STREAMABLE_CONTENT, MyAtkStreamableContentClass)) @@ -21,12 +23,12 @@ static const gchar* mime_types[]={"text/plain", "text/richtext"}; static const gchar* file_names[]={"file1", "file2"}; struct _MyAtkStreamableContent { - GObject parent; + MyAtkObject parent; }; struct _MyAtkStreamableContentClass { - GObjectClass parent; + MyAtkObjectClass parent; }; GType my_atk_streamable_content_get_type(); diff --git a/tests/dummyatk/my-atk-table.c b/tests/dummyatk/my-atk-table.c new file mode 100644 index 0000000..a76c70e --- /dev/null +++ b/tests/dummyatk/my-atk-table.c @@ -0,0 +1,177 @@ +/* This file contains both declaration and definition of the MyAtkTable, + * a GObject that pretends to implement the AtkTableIface interface (it + * registers appropriate interface), but provides no implementation for any of the + * methods of this interface (NULL-filled vftbl). + */ + +#include <glib-object.h> +#include <atk/atk.h> + +#include "my-atk-object.h" +#include "my-atk-table.h" + +/////////////////////////////////////////////////////////////////////////// +// Helper functions and data +/////////////////////////////////////////////////////////////////////////// +void +my_atk_table_select_rows (MyAtkTable* table, gboolean sel_scheme[]) +{ + // the function does nothing +} + +void +my_atk_table_select_columns (MyAtkTable* table, gboolean sel_scheme[]) +{ + // the function does nothing +} + +/////////////////////////////////////////////////////////////////////////// +// Implementation +/////////////////////////////////////////////////////////////////////////// +static GObjectClass *parent_class_table = NULL; + +/******************************************************************/ +static void +table_interface_init (gpointer g_iface, gpointer iface_data) +{ + AtkTableIface *klass = (AtkTableIface *)g_iface; + + /* set up overrides here */ + klass-> ref_at = + (AtkObject* (*) (AtkTable *table, gint row, gint column)) NULL; + klass-> get_index_at = + (gint (*) (AtkTable *table, gint row, gint column)) NULL; + klass-> get_column_at_index = + (gint (*) (AtkTable *table, gint index_)) NULL; + klass-> get_row_at_index = + (gint (*) (AtkTable *table, gint index_)) NULL; + klass-> get_n_columns = + (gint (*) (AtkTable *table)) NULL; + klass-> get_n_rows = + (gint (*) (AtkTable *table)) NULL; + klass-> get_column_extent_at = + (gint (*) (AtkTable *table, gint row, gint column)) NULL; + klass-> get_row_extent_at = + (gint (*) (AtkTable *table, gint row, gint column)) NULL; + klass-> get_caption = + (AtkObject* (*) (AtkTable *table)) NULL; + klass-> get_column_description = + (const gchar* (*) (AtkTable *table, gint column)) NULL; + klass-> get_column_header = + (AtkObject* (*) (AtkTable *table, gint column)) NULL; + klass-> get_row_description = + (const gchar* (*) (AtkTable *table, gint row)) NULL; + klass-> get_row_header = + (AtkObject* (*) (AtkTable *table, gint row)) NULL; + klass-> get_summary = + (AtkObject* (*) (AtkTable *table)) NULL; + klass-> set_caption = + (void (*) (AtkTable *table, AtkObject *caption)) NULL; + klass-> set_column_description = + (void (*) (AtkTable *table, gint column, const gchar *description)) NULL; + klass-> set_column_header = + (void (*) (AtkTable *table, gint column, AtkObject *header)) NULL; + klass-> set_row_description = + (void (*) (AtkTable *table, gint row, const gchar *description)) NULL; + klass-> set_row_header = + (void (*) (AtkTable *table, gint row, AtkObject *header)) NULL; + klass-> set_summary = + (void (*) (AtkTable *table, AtkObject *accessible)) NULL; + klass-> get_selected_columns = + (gint (*) (AtkTable *table, gint **selected)) NULL; + klass-> get_selected_rows = + (gint (*) (AtkTable *table, gint **selected)) NULL; + klass-> is_column_selected = + (gboolean (*) (AtkTable *table, gint column)) NULL; + klass-> is_row_selected = + (gboolean (*) (AtkTable *table, gint row)) NULL; + klass-> is_selected = + (gboolean (*) (AtkTable *table, gint row, gint column)) NULL; + klass-> add_row_selection = + (gboolean (*) (AtkTable *table, gint row)) NULL; + klass-> remove_row_selection = + (gboolean (*) (AtkTable *table, gint row)) NULL; + klass-> add_column_selection = + (gboolean (*) (AtkTable *table, gint column)) NULL; + klass-> remove_column_selection = + (gboolean (*) (AtkTable *table, gint column)) NULL; +} + +static void +table_instance_init (GTypeInstance *instance, gpointer g_class) +{ + MyAtkTable *self = (MyAtkTable *)instance; + + self->disposed = FALSE; +} + +static void +my_atk_table_dispose (GObject *obj) +{ + MyAtkTable *self = (MyAtkTable *)obj; + + if (self->disposed) + { + return; + } + + /* Make sure dispose does not run twice. */ + self->disposed = TRUE; + + /* Chain up to the parent class */ + G_OBJECT_CLASS (parent_class_table)->dispose (obj); +} + +static void +my_atk_table_finalize (GObject *obj) +{ + /* Chain up to the parent class */ + G_OBJECT_CLASS (parent_class_table)->finalize (obj); +} + +static void +my_atk_table_class_init (gpointer g_class, gpointer g_class_data) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (g_class); + MyAtkTableClass *klass = MY_ATK_TABLE_CLASS (g_class); + + gobject_class->dispose = my_atk_table_dispose; + gobject_class->finalize = my_atk_table_finalize; + + parent_class_table = g_type_class_peek_parent (klass); +} + +GType +my_atk_table_get_type (void) +{ + static GType type = 0; + if (type == 0) + { + static const GTypeInfo info = + { + sizeof (MyAtkTableClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + my_atk_table_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (MyAtkTable), + 0, /* n_preallocs */ + table_instance_init /* instance_init */ + }; + + static const GInterfaceInfo iface_info = + { + (GInterfaceInitFunc) table_interface_init, /* interface_init */ + NULL, /* interface_finalize */ + NULL /* interface_data */ + }; + type = g_type_register_static (MY_TYPE_ATK_OBJECT, + "MyAtkTableType", + &info, 0); + g_type_add_interface_static (type, + ATK_TYPE_TABLE, + &iface_info); + } + return type; +} diff --git a/tests/dummyatk/my-atk-table.h b/tests/dummyatk/my-atk-table.h new file mode 100644 index 0000000..7860a2d --- /dev/null +++ b/tests/dummyatk/my-atk-table.h @@ -0,0 +1,86 @@ +#ifndef MY_ATK_TABLE_H +#define MY_ATK_TABLE_H + +#include <glib-object.h> +#include <atk/atk.h> +#include <my-atk-object.h> + +#define MY_TYPE_ATK_TABLE (my_atk_table_get_type ()) +#define MY_ATK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_TABLE, MyAtkTable)) +#define MY_ATK_TABLE_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_TABLE, MyAtkTableClass)) +#define MY_IS_ATK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_TABLE)) +#define MY_IS_ATK_TABLE_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_TABLE)) +#define MY_ATK_TABLE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_TABLE, MyAtkTableClass)) + +#define NROWS 4 /* row count */ +#define NCOLS 5 /* column count */ + +static gint ids[NROWS][NCOLS] = + { {0, 1, 2, 2, 3}, + {4, 5, 6, 7, 8}, + {9, 9, 10, 11, 12}, + {9, 9, 13, 14, -1} }; + +static gint row_ext[NROWS][NCOLS] = + { {1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1}, + {2, 2, 1, 1, 1}, + {2, 2, 1, 1, 1} }; + +static gint col_ext[NROWS][NCOLS] = + { {1, 1, 2, 2, 1}, + {1, 1, 1, 1, 1}, + {2, 2, 1, 1, 1}, + {2, 2, 1, 1, 1} }; + +#define NCHILDREN 16 /* child object count */ + +// default string values +#define DEF_CAPTION_TEXT "Default table caption" +#define DEF_SUMMARY_TEXT "Default table summary" +#define DEF_ROW_DESCR_TPL "Row No%d" +#define DEF_COL_DESCR_TPL "Column No%d" + +/* row and column headers */ +typedef struct +{ + AtkObject* hdr; + gboolean selected; /* TRUE if the row/column is selected, FALSE otherwise */ +} TestSimpleHeaderStruct; + +/* This struct represents a table cell */ +typedef struct +{ + MyAtkObject* elem; /* the element */ + guint ext_row; /* its row extent */ + guint ext_col; /* its column extent */ +} TestSimpleCell; + +typedef struct _MyAtkTable MyAtkTable; +typedef struct _MyAtkTableClass MyAtkTableClass; + +struct _MyAtkTable +{ + MyAtkObject parent; + + gboolean disposed; + + MyAtkObject* child[NCHILDREN]; + MyAtkObject* not_a_child; + TestSimpleHeaderStruct row[NROWS]; + TestSimpleHeaderStruct col[NCOLS]; + guint nrows; + guint ncols; + AtkObject* caption; + AtkObject* summary; +}; + +struct _MyAtkTableClass +{ + MyAtkObjectClass parent; +}; + +GType +my_atk_table_get_type (void); + +#endif /*MY_ATK_TABLE_H*/ diff --git a/tests/dummyatk/my-atk-text.c b/tests/dummyatk/my-atk-text.c index caee42e..6729c4b 100644 --- a/tests/dummyatk/my-atk-text.c +++ b/tests/dummyatk/my-atk-text.c @@ -1277,7 +1277,7 @@ GType my_atk_text_get_type() NULL, /* interface_finalize*/ NULL /* interface_data */ }; - type = g_type_register_static(ATK_TYPE_OBJECT, "MyAtkText", &typeInfo, 0); + type = g_type_register_static(MY_TYPE_ATK_OBJECT, "MyAtkText", &typeInfo, 0); g_type_add_interface_static(type, ATK_TYPE_TEXT, &AtkTextIface_info); diff --git a/tests/dummyatk/my-atk-text.h b/tests/dummyatk/my-atk-text.h index 158e5db..7a6a73e 100644 --- a/tests/dummyatk/my-atk-text.h +++ b/tests/dummyatk/my-atk-text.h @@ -4,6 +4,8 @@ * MyAtkText: implements AtkText and AtkEditableText */ #include <atk/atk.h> + +#include "my-atk-object.h" #define MY_TYPE_ATK_TEXT (my_atk_text_get_type ()) #define MY_ATK_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_TEXT, MyAtkText)) @@ -33,7 +35,7 @@ typedef struct struct _MyAtkText { - AtkObject parent; + MyAtkObject parent; gchar* str;//string, containing text GList* attributes;//running atributes @@ -48,7 +50,7 @@ struct _MyAtkText struct _MyAtkTextClass { - AtkObjectClass parent; + MyAtkObjectClass parent; gchar* clipboard; }; diff --git a/tests/dummyatk/my-atk-value.c b/tests/dummyatk/my-atk-value.c index d94bd71..3530d4f 100644 --- a/tests/dummyatk/my-atk-value.c +++ b/tests/dummyatk/my-atk-value.c @@ -1,6 +1,7 @@ #include <atk/atk.h> #include <limits.h> +#include "my-atk-object.h" #include "my-atk-value.h" //*************************implementation*********************** @@ -103,7 +104,7 @@ GType my_atk_value_get_type() NULL, /* interface_finalize*/ NULL /* interface_data */ }; - type = g_type_register_static(ATK_TYPE_OBJECT, "MyAtkValue", &typeInfo, 0); + type = g_type_register_static(MY_TYPE_ATK_OBJECT, "MyAtkValue", &typeInfo, 0); g_type_add_interface_static(type, ATK_TYPE_VALUE, &iface_info); diff --git a/tests/dummyatk/my-atk-value.h b/tests/dummyatk/my-atk-value.h index 9e989fb..03ed6d1 100644 --- a/tests/dummyatk/my-atk-value.h +++ b/tests/dummyatk/my-atk-value.h @@ -18,7 +18,7 @@ typedef struct _MyAtkValueClass MyAtkValueClass; struct _MyAtkValue { - AtkObject parent; + MyAtkObject parent; gint minimum, maximum, current; gboolean readonly; @@ -26,7 +26,7 @@ struct _MyAtkValue struct _MyAtkValueClass { - AtkObjectClass parent; + MyAtkObjectClass parent; }; MyAtkValue* my_atk_value_new(gint minimum, gint maximium, gint current); |