diff options
author | Yuedong Du <yuedong.du@sun.com> | 2003-10-28 13:41:05 +0800 |
---|---|---|
committer | Yuedong Du <york@src.gnome.org> | 2003-10-28 13:41:05 +0800 |
commit | 9d85d642b2c21d8c0491fd0a9712aff76aa7dc08 (patch) | |
tree | 5f833ee9f48ad3b527c27c8047fa6717efeef9b8 /a11y/e-table/gal-a11y-e-cell-toggle.c | |
parent | 238350ee212d14e29fbf849450039b2d6fea761d (diff) | |
download | gsoc2013-evolution-9d85d642b2c21d8c0491fd0a9712aff76aa7dc08.tar.gz gsoc2013-evolution-9d85d642b2c21d8c0491fd0a9712aff76aa7dc08.tar.zst gsoc2013-evolution-9d85d642b2c21d8c0491fd0a9712aff76aa7dc08.zip |
add new file for toggle cell a11y object. new a11y object toggle cell
2003-10-26 Yuedong Du <yuedong.du@sun.com>
* gal/a11y/e-table/Makefile.am: add new file for toggle cell a11y
object.
* gal/a11y/e-table/gal-a11y-e-cell-toggle.c: new a11y object toggle cell (gal_a11y_e_cell_toggle_get_type),
(gal_a11y_e_cell_toggle_class_init), (toggle_cell_action), the
implementation of toggle cell action.
(gal_a11y_e_cell_toggle_new):
* gal/a11y/e-table/gal-a11y-e-cell-toggle.h: ditto
* gal/a11y/e-table/gal-a11y-e-cell.c:
(_gal_a11y_e_cell_get_action_info),
(_gal_a11y_e_cell_destroy_action_info),
(gal_a11y_e_cell_add_action), (gal_a11y_e_cell_remove_action),
(gal_a11y_e_cell_remove_action_by_name),
(gal_a11y_e_cell_action_get_n_actions),
(gal_a11y_e_cell_action_get_name),
(gal_a11y_e_cell_action_get_description),
(gal_a11y_e_cell_action_set_description),
(gal_a11y_e_cell_action_get_keybinding), (idle_do_action),
(gal_a11y_e_cell_action_do_action),
(gal_a11y_e_cell_atk_action_interface_init),
(gal_a11y_e_cell_type_add_action_interface),
(gal_a11y_e_cell_add_state): helper functions for add a action,
stealed from gailcell.c
* gal/a11y/e-table/gal-a11y-e-cell.h:
* gal/e-table/e-cell-toggle.c: (e_cell_toggle_class_init): register
toggle's a11y object.
svn path=/trunk/; revision=23095
Diffstat (limited to 'a11y/e-table/gal-a11y-e-cell-toggle.c')
-rw-r--r-- | a11y/e-table/gal-a11y-e-cell-toggle.c | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/a11y/e-table/gal-a11y-e-cell-toggle.c b/a11y/e-table/gal-a11y-e-cell-toggle.c new file mode 100644 index 0000000000..2daa7e7271 --- /dev/null +++ b/a11y/e-table/gal-a11y-e-cell-toggle.c @@ -0,0 +1,105 @@ +#include <gtk/gtk.h> +#include "gal-a11y-e-cell-toggle.h" +#include <gal/e-table/e-cell-toggle.h> +#include <gal/e-table/e-table-model.h> + +static void gal_a11y_e_cell_toggle_class_init (GalA11yECellToggleClass *klass); + +GType +gal_a11y_e_cell_toggle_get_type (void) +{ + static GType type = 0; + + if (!type) + { + static const GTypeInfo tinfo = + { + sizeof (GalA11yECellToggleClass), + (GBaseInitFunc) NULL, /* base init */ + (GBaseFinalizeFunc) NULL, /* base finalize */ + (GClassInitFunc) gal_a11y_e_cell_toggle_class_init, /* class init */ + (GClassFinalizeFunc) NULL, /* class finalize */ + NULL, /* class data */ + sizeof (GalA11yECellToggle), /* instance size */ + 0, /* nb preallocs */ + NULL, /* instance init */ + NULL /* value table */ + }; + + + type = g_type_register_static (GAL_A11Y_TYPE_E_CELL, + "GalA11yECellToggle", &tinfo, 0); + gal_a11y_e_cell_type_add_action_interface (type); + + } + return type; +} + + +static void +gal_a11y_e_cell_toggle_class_init (GalA11yECellToggleClass *klass) +{ +} + +static void +toggle_cell_action (GalA11yECell *cell) +{ + ECellToggle * ect; + gint finished; + GdkEventButton event; + gint x, y, width, height; + gint row, col; + + row = cell->row; + col = cell->view_col; + + e_table_item_get_cell_geometry (cell->item, &row, &col, + &x, &y, &width, &height); + event.x = x ; + event.y = y ; + event.type = GDK_BUTTON_PRESS; + event.window = GTK_LAYOUT(GNOME_CANVAS_ITEM(cell->item)->canvas)->bin_window; + event.button = 1; + event.send_event = TRUE; + event.time = GDK_CURRENT_TIME; + event.axes = NULL; + + g_signal_emit_by_name (cell->item, "event", &event, &finished); +} + +AtkObject* +gal_a11y_e_cell_toggle_new (ETableItem *item, + ECellView *cell_view, + AtkObject *parent, + int model_col, + int view_col, + int row) +{ + AtkObject *a11y; + GalA11yECell *cell; + GalA11yECellToggle *toggle_cell; + + a11y = ATK_OBJECT(g_object_new (GAL_A11Y_TYPE_E_CELL_TOGGLE, NULL)); + + g_return_val_if_fail (a11y != NULL, NULL); + + cell = GAL_A11Y_E_CELL(a11y); + toggle_cell = GAL_A11Y_E_CELL_TOGGLE(a11y); + a11y->role = ATK_ROLE_TABLE_CELL; + + gal_a11y_e_cell_construct (a11y, + item, + cell_view, + parent, + model_col, + view_col, + row); + + gal_a11y_e_cell_add_action (cell, + "toggle", /* action name*/ + "toggle the cell", /* action description */ + NULL, /* action keybinding */ + toggle_cell_action); + + return a11y; +} |