aboutsummaryrefslogtreecommitdiffstats
path: root/a11y/e-table
diff options
context:
space:
mode:
authorTim Wo <tim.wo@sun.com>2003-11-21 12:28:04 +0800
committerGilbert Fang <gilbertfang@src.gnome.org>2003-11-21 12:28:04 +0800
commit33a1687123f37ddea0d9bea13977c38f5f73b212 (patch)
tree1ed1e63a3fd4679899561f9e4de507a7b394de29 /a11y/e-table
parent1e103f9475ad27be34970a78b0416c5693942c5e (diff)
downloadgsoc2013-evolution-33a1687123f37ddea0d9bea13977c38f5f73b212.tar
gsoc2013-evolution-33a1687123f37ddea0d9bea13977c38f5f73b212.tar.gz
gsoc2013-evolution-33a1687123f37ddea0d9bea13977c38f5f73b212.tar.bz2
gsoc2013-evolution-33a1687123f37ddea0d9bea13977c38f5f73b212.tar.lz
gsoc2013-evolution-33a1687123f37ddea0d9bea13977c38f5f73b212.tar.xz
gsoc2013-evolution-33a1687123f37ddea0d9bea13977c38f5f73b212.tar.zst
gsoc2013-evolution-33a1687123f37ddea0d9bea13977c38f5f73b212.zip
override the function in base class, to retrieve the content of the text.
2003-11-21 Tim Wo <tim.wo@sun.com> * gal/a11y/e-table/gal-a11y-e-cell-text.c: (ect_get_name): override the function in base class, to retrieve the content of the text. (ect_do_action_edit): begin edit the cell when issuing the action. (ect_class_init): override the "get_name" function. (ect_init): add an action "edit" to the object. (gal_a11y_e_cell_text_get_type): add AtkAction interface to this type. * gal/a11y/e-table/gal-a11y-e-cell-toggle.c (gal_a11y_e_cell_toggle_dispose): disconnect the connected signal when disposing. (gal_a11y_e_cell_toggle_class_init): to override the dispose function. (toggle_cell_action): set position of the click event more precisely. (model_change_cb): set or remove the ATK_STATE_CHECKED flag according to the value in the model when it changes. (gal_a11y_e_cell_toggle_new): init the ATK_STATE_CHECKED flag and connect to the model cell change signal. * gal/a11y/e-table/gal-a11y-e-cell-toggle.h: add one member to save the connected signal id. * gal/a11y/e-table/gal-a11y-e-cell.c: (gal_a11y_e_cell_grab_focus): notify the selection model that the cursor has been changed. * gal/a11y/e-table/gal-a11y-e-table-item.c: (eti_a11y_cursor_changed_cb): emiting a signal to notify the AT applictions that the active descendant has been changed. (#51055) svn path=/trunk/; revision=23466
Diffstat (limited to 'a11y/e-table')
-rw-r--r--a11y/e-table/gal-a11y-e-cell-text.c26
-rw-r--r--a11y/e-table/gal-a11y-e-cell-toggle.c62
-rw-r--r--a11y/e-table/gal-a11y-e-cell-toggle.h2
-rw-r--r--a11y/e-table/gal-a11y-e-cell.c2
-rw-r--r--a11y/e-table/gal-a11y-e-table-item.c7
5 files changed, 94 insertions, 5 deletions
diff --git a/a11y/e-table/gal-a11y-e-cell-text.c b/a11y/e-table/gal-a11y-e-cell-text.c
index c5a94144a8..79c14aa428 100644
--- a/a11y/e-table/gal-a11y-e-cell-text.c
+++ b/a11y/e-table/gal-a11y-e-cell-text.c
@@ -13,6 +13,7 @@
#include <atk/atkobject.h>
#include <atk/atktext.h>
#include <atk/atkeditabletext.h>
+#include <atk/atkaction.h>
#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yECellTextClass))
static AtkObjectClass *parent_class;
@@ -23,6 +24,14 @@ static AtkObjectClass *parent_class;
#define e_cell_text_set_selection(a,b,c,d,e) FALSE
/* Static functions */
+static G_CONST_RETURN gchar*
+ect_get_name (AtkObject * a11y)
+{
+ GalA11yECell *gaec = GAL_A11Y_E_CELL (a11y);
+ ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
+ return e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
+}
+
static gchar *
ect_get_text (AtkText *text,
gint start_offset,
@@ -372,6 +381,13 @@ ect_paste_text (AtkEditableText *text,
static void
+ect_do_action_edit (AtkAction *action)
+{
+ GalA11yECell *a11y = GAL_A11Y_E_CELL (action);
+ e_table_item_enter_edit (a11y->item, a11y->view_col, a11y->row);
+}
+
+static void
ect_atk_text_iface_init (AtkTextIface *iface)
{
iface->get_text = ect_get_text;
@@ -408,12 +424,19 @@ ect_atk_editable_text_iface_init (AtkEditableTextIface *iface)
static void
ect_class_init (GalA11yECellTextClass *klass)
{
- parent_class = g_type_class_ref (PARENT_TYPE);
+ AtkObjectClass *a11y = ATK_OBJECT_CLASS (klass);
+ parent_class = g_type_class_ref (PARENT_TYPE);
+ a11y->get_name = ect_get_name;
}
static void
ect_init (GalA11yECellText *a11y)
{
+ gal_a11y_e_cell_add_action (a11y,
+ "edit",
+ "begin editing this cell",
+ NULL,
+ (ACTION_FUNC)ect_do_action_edit);
}
/**
@@ -459,6 +482,7 @@ gal_a11y_e_cell_text_get_type (void)
type = g_type_register_static (PARENT_TYPE, "GalA11yECellText", &info, 0);
g_type_add_interface_static (type, ATK_TYPE_TEXT, &atk_text_info);
g_type_add_interface_static (type, ATK_TYPE_EDITABLE_TEXT, &atk_editable_text_info);
+ gal_a11y_e_cell_type_add_action_interface (type);
}
return type;
diff --git a/a11y/e-table/gal-a11y-e-cell-toggle.c b/a11y/e-table/gal-a11y-e-cell-toggle.c
index 2daa7e7271..497483d255 100644
--- a/a11y/e-table/gal-a11y-e-cell-toggle.c
+++ b/a11y/e-table/gal-a11y-e-cell-toggle.c
@@ -3,8 +3,25 @@
#include <gal/e-table/e-cell-toggle.h>
#include <gal/e-table/e-table-model.h>
+#define PARENT_TYPE (gal_a11y_e_cell_get_type ())
+static GObjectClass *parent_class;
+
static void gal_a11y_e_cell_toggle_class_init (GalA11yECellToggleClass *klass);
+static void
+gal_a11y_e_cell_toggle_dispose (GObject *object)
+{
+ GalA11yECellToggle *a11y = GAL_A11Y_E_CELL_TOGGLE (object);
+
+ ETableModel *e_table_model = GAL_A11Y_E_CELL (a11y)->cell_view->e_table_model;
+
+ if (e_table_model)
+ g_signal_handler_disconnect (e_table_model, a11y->model_id);
+
+ if (parent_class->dispose)
+ parent_class->dispose (object);
+}
+
GType
gal_a11y_e_cell_toggle_get_type (void)
{
@@ -39,6 +56,10 @@ gal_a11y_e_cell_toggle_get_type (void)
static void
gal_a11y_e_cell_toggle_class_init (GalA11yECellToggleClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->dispose = gal_a11y_e_cell_toggle_dispose;
+ parent_class = g_type_class_ref (PARENT_TYPE);
}
static void
@@ -55,8 +76,10 @@ toggle_cell_action (GalA11yECell *cell)
e_table_item_get_cell_geometry (cell->item, &row, &col,
&x, &y, &width, &height);
- event.x = x ;
- event.y = y ;
+
+ event.x = x + width / 2 + (int)(GNOME_CANVAS_ITEM (cell->item)->x1);
+ event.y = y + height / 2 + (int)(GNOME_CANVAS_ITEM (cell->item)->y1);
+
event.type = GDK_BUTTON_PRESS;
event.window = GTK_LAYOUT(GNOME_CANVAS_ITEM(cell->item)->canvas)->bin_window;
event.button = 1;
@@ -67,6 +90,27 @@ toggle_cell_action (GalA11yECell *cell)
g_signal_emit_by_name (cell->item, "event", &event, &finished);
}
+static void
+model_change_cb (ETableModel *etm,
+ gint row,
+ gint col,
+ GalA11yECell *cell)
+{
+ gint value;
+
+ if (col == cell->model_col && row == cell->row) {
+
+ value = GPOINTER_TO_INT (
+ e_table_model_value_at (cell->cell_view->e_table_model,
+ cell->model_col, cell->row));
+ if (value)
+ gal_a11y_e_cell_add_state (cell, ATK_STATE_CHECKED, TRUE);
+ else
+ gal_a11y_e_cell_remove_state (cell, ATK_STATE_CHECKED, TRUE);
+ }
+}
+
+
AtkObject*
gal_a11y_e_cell_toggle_new (ETableItem *item,
ECellView *cell_view,
@@ -78,6 +122,7 @@ gal_a11y_e_cell_toggle_new (ETableItem *item,
AtkObject *a11y;
GalA11yECell *cell;
GalA11yECellToggle *toggle_cell;
+ gint value;
a11y = ATK_OBJECT(g_object_new (GAL_A11Y_TYPE_E_CELL_TOGGLE, NULL));
@@ -101,5 +146,18 @@ gal_a11y_e_cell_toggle_new (ETableItem *item,
NULL, /* action keybinding */
toggle_cell_action);
+ toggle_cell->model_id = g_signal_connect (cell_view->e_table_model,
+ "model_cell_changed",
+ (GCallback) model_change_cb,
+ a11y);
+
+ value = GPOINTER_TO_INT (
+ e_table_model_value_at (cell->cell_view->e_table_model,
+ cell->model_col, cell->row));
+ if (value)
+ gal_a11y_e_cell_add_state (cell, ATK_STATE_CHECKED, FALSE);
+ else
+ gal_a11y_e_cell_remove_state (cell, ATK_STATE_CHECKED, FALSE);
+
return a11y;
}
diff --git a/a11y/e-table/gal-a11y-e-cell-toggle.h b/a11y/e-table/gal-a11y-e-cell-toggle.h
index 9a740d7d84..06f9448e02 100644
--- a/a11y/e-table/gal-a11y-e-cell-toggle.h
+++ b/a11y/e-table/gal-a11y-e-cell-toggle.h
@@ -22,7 +22,7 @@ typedef struct _GalA11yECellToggleClass GalA11yECellToggleClass;
struct _GalA11yECellToggle
{
GalA11yECell parent;
- gboolean cell_value;
+ gint model_id;
};
GType gal_a11y_e_cell_toggle_get_type (void);
diff --git a/a11y/e-table/gal-a11y-e-cell.c b/a11y/e-table/gal-a11y-e-cell.c
index 2dfe6445be..34a7429cd5 100644
--- a/a11y/e-table/gal-a11y-e-cell.c
+++ b/a11y/e-table/gal-a11y-e-cell.c
@@ -131,8 +131,8 @@ eti_grab_focus (AtkComponent *component)
e_table = gtk_widget_get_parent (GNOME_CANVAS_ITEM (a11y->item)->canvas);
view_row = e_table_view_to_model_row (E_TABLE (e_table), a11y->row);
- e_selection_model_clear (a11y->item->selection);
e_selection_model_select_single_row (a11y->item->selection, view_row);
+ e_selection_model_change_cursor (a11y->item->selection, view_row, a11y->view_col);
gtk_widget_grab_focus (e_table);
toplevel = gtk_widget_get_toplevel (e_table);
diff --git a/a11y/e-table/gal-a11y-e-table-item.c b/a11y/e-table/gal-a11y-e-table-item.c
index a228f7ec86..c67428ffb9 100644
--- a/a11y/e-table/gal-a11y-e-table-item.c
+++ b/a11y/e-table/gal-a11y-e-table-item.c
@@ -961,9 +961,16 @@ static void
eti_a11y_cursor_changed_cb (ESelectionModel *selection,
int row, int col, GalA11yETableItem *a11y)
{
+ AtkObject * cell;
g_return_if_fail (GAL_A11Y_IS_E_TABLE_ITEM (a11y));
g_signal_emit_by_name (a11y, "selection_changed");
+
+ cell = atk_table_ref_at (ATK_TABLE (a11y), row, col);
+ if (ATK_IS_OBJECT (cell))
+ g_signal_emit_by_name (a11y,
+ "active-descendant-changed",
+ cell);
}
/* atk selection */