diff options
author | Li Yuan <li.yuan@sun.com> | 2005-01-27 13:28:27 +0800 |
---|---|---|
committer | Harry Lu <haip@src.gnome.org> | 2005-01-27 13:28:27 +0800 |
commit | 0dcae6d9d8e91ff3e9592cea78f5d43da3477beb (patch) | |
tree | fab192fb0b14d0cf3bf6c1f29dc639ed36b9b013 /a11y/e-table/gal-a11y-e-table.c | |
parent | d8d481373ff47bc77432b2f8d8de91afd1bd02a0 (diff) | |
download | gsoc2013-evolution-0dcae6d9d8e91ff3e9592cea78f5d43da3477beb.tar gsoc2013-evolution-0dcae6d9d8e91ff3e9592cea78f5d43da3477beb.tar.gz gsoc2013-evolution-0dcae6d9d8e91ff3e9592cea78f5d43da3477beb.tar.bz2 gsoc2013-evolution-0dcae6d9d8e91ff3e9592cea78f5d43da3477beb.tar.lz gsoc2013-evolution-0dcae6d9d8e91ff3e9592cea78f5d43da3477beb.tar.xz gsoc2013-evolution-0dcae6d9d8e91ff3e9592cea78f5d43da3477beb.tar.zst gsoc2013-evolution-0dcae6d9d8e91ff3e9592cea78f5d43da3477beb.zip |
add gal-a11y-e-cell-vbox.h and gal-a11y-e-cell-vbox.c
2005-01-27 Li Yuan <li.yuan@sun.com>
* gal/a11y/e-table/Makefile.am:
add gal-a11y-e-cell-vbox.h and gal-a11y-e-cell-vbox.c
* gal/a11y/e-table/gal-a11y-e-cell-popup.c:
(gal_a11y_e_cell_popup_new):
add i18n support to strings.
Fixes #70261
* gal/a11y/e-table/gal-a11y-e-cell-text.c:
(ect_dispose): disconnect the insert and the delete signal.
(ect_check):do some check works.
(ect_get_name), (ect_get_text),
(ect_get_character_at_offset), (ect_get_caret_offset),
(ect_get_character_count), (ect_get_n_selections),
(ect_get_selection), (ect_add_selection), (ect_set_caret_offset),
(ect_insert_text): use e_cell_text_get_text_by_view instead of
e_cell_text_get_text. make get_name work well when e-cell-text
is being edited.
(ect_do_action_edit): call e_table_item_enter_edit only when
the cell is editable.
(ect_text_inserted_cb), (ect_text_deleted_cb):
emit the text_changed::insert(delete) signal. make gnopernicus
know the text_changed.
(ect_class_init): add dispose function.
(ect_action_init): add the edit action.
(gal_a11y_e_cell_text_get_type): no ect_init function now.
(cell_text_destroyed): unref the atkobject.
(gal_a11y_e_cell_text_new): connect text_inserted and text_deleted
singals and make sure the state of editable is right.
* gal/a11y/e-table/gal-a11y-e-cell-text.h:
add two signal handler id.
* gal/a11y/e-table/gal-a11y-e-cell-toggle.c:
(gal_a11y_e_cell_toggle_dispose): fix #70261.
(model_change_cb): make gnopernicus to report state change signal.
(gal_a11y_e_cell_toggle_new):add i18n support to strings.
* gal/a11y/e-table/gal-a11y-e-cell-tree.c:
(gal_a11y_e_cell_tree_new):
add i18n support to strings.
Fixes #61688
* gal/a11y/e-table/gal-a11y-e-cell-vbox.c: (ecv_get_n_children),
(subcell_destroyed), (ecv_ref_child), (ecv_dispose),
(ecv_ref_accessible_at_point), (ecv_class_init), (ecv_init),
(ecv_atk_component_iface_init), (gal_a11y_e_cell_vbox_get_type),
(gal_a11y_e_cell_vbox_new):
* gal/a11y/e-table/gal-a11y-e-cell-vbox.h:
implement a11y object of ECellVbox.
Fixes #48976
* gal/a11y/e-table/gal-a11y-e-cell.c:
function name are changed form eti_* to gal_a11y_e_cell_*
(is_valid): check if the cell is valid.
(gal_a11y_e_cell_dispose): make sure state_set is null.
(gal_a11y_e_cell_get_name): implement the get_name function.
(gal_a11y_e_cell_ref_state_set): add VISIBLE state.
(gal_a11y_e_cell_get_parent),
(gal_a11y_e_cell_get_index_in_parent),
(gal_a11y_e_cell_get_extents): use e_tree_get_cell_geometry and
e_table_get_cell_geometry instead of e_table_item_get_cell_geometry.
(gal_a11y_e_cell_grab_focus): make grab_focus work with e-tree also.
(gal_a11y_e_cell_atk_component_iface_init),
(gal_a11y_e_cell_class_init): add get_name function.
(gal_a11y_e_cell_init): add some state to cell.
(idle_do_action): check if cell is valid.
(gal_a11y_e_cell_action_do_action): check if cell is valid.
(gal_a11y_e_cell_get_type), (gal_a11y_e_cell_construct):
ref e-table-item.
* gal/a11y/e-table/gal-a11y-e-table-click-to-add.c:
(etcta_get_description), (etcta_action_get_name): add i18n support to strings.
(etcta_get_name): if etcta has message, return it.
(etcta_ref_state_set): implement the ref_state_set function,
add SENSITIVE and SHOWING state.
(etcta_class_init):add ref_state_set function.
(etcta_selection_cursor_changed): call atk_focus_tracker_notify
to a11y-e-cell
(gal_a11y_e_table_click_to_add_new): connect
etcta_selection_cursor_changed to cursor_changed signal.
* gal/a11y/e-table/gal-a11y-e-table-item-factory.c:
(gal_a11y_e_table_item_factory_create_accessible):
parameters of gal_a11y_e_table_item_new have been changed.
Fixes #68675
Fixes #70324
Fixes #68681
Fixes #68627
* gal/a11y/e-table/gal-a11y-e-table-item.c:
remove the cell_data support.
(item_destroyed): add ATK_STATE_DEFUNCT state and unref selection.
(eti_ref_state_set): just ref state_set.
(eti_dispose): we have unref selection in item_destroyed.
remove the cell_data support.
(eti_ref_child): remove support for column header. use eti_ref_at
instead of atk_table_ref_at.
(eti_get_extents): add support for click to add.
(eti_ref_accessible_at_point): e-tree and e-table are different here.
(cell_destroyed): add a check and unref item. remove the cell_data support.
(eti_ref_at): if e-table-item has DEFUNCT state, return NULL.
remove the cell_data support.
(eti_get_column_header): use column name as the a11y name. set it role
as ATK_ROLE_TABLE_COLUMN_HEADER.
(table_is_row_selected): use view_to_model_row to convert row when
uses source model.
(table_get_selected_rows): if e-table-item has DEFUNCT state, return 0.
(table_remove_row_selection): use view_to_model_row to convert row
when uses source model.
(eti_rows_inserted), (eti_rows_deleted): remove the cell_data support.
(eti_tree_model_node_changed_cb): emit visible-data-changed signal. for
the eti_clear_rows have been removed.
(eti_header_structure_changed): remove the cell_data support.
(eti_class_init): add eti_ref_state_set, remove eti_get_parent
and eti_get_index_in_parent.
(eti_init): init parent and index_in_parent.
(gal_a11y_e_table_item_new): add some states. get name form parents.
init role correctly. add FOCUSED state to focused cell.
remove the cell_data support.
(eti_a11y_selection_changed_cb): if e-table-item has DEFUNCT state,
just return.
(eti_a11y_cursor_changed_cb): remove the FOCUESD state form the old cell.
(selection_add_selection): if it has been focused already, just return.
if another row was focused, clear it first.
(selection_ref_selection): use eti_ref_at instead of atk_table_ref_at.
(gal_a11y_e_table_item_init): add this function.
* gal/a11y/e-table/gal-a11y-e-table-item.h:
add gal_a11y_e_table_item_init and change the parameters of
gal_a11y_e_table_item_new.
* gal/a11y/e-table/gal-a11y-e-table.c:
(find_first_table_item): find the first item of the group.
(eti_get_accessible), (find_table_item): find the first table item.
(init_child_item): ref every group's first item.
(et_ref_accessible_at_point): no need to call init_child_item here.
just ref the item.
(et_get_n_children): add support for multiple ETableItems.
(et_ref_child): add support for multiple ETableItems.
(et_get_layer): Set AtkLayer as ATK_LAYER_WIDGET for e-table.
(et_atk_component_iface_init): add et_get_layer function.
(gal_a11y_e_table_new):ref the a11y and widget, and unref it in
the idle function to avoid crash.
Fixes #71158
* gal/a11y/e-table/gal-a11y-e-tree.c:
(init_child_item): just get the a11y object of the child item.
(et_get_layer): Set AtkLayer as ATK_LAYER_WIDGET for etree.
(et_atk_component_iface_init): add et_get_layer function.
* gal/util/e-marshal.list:
add support for the text_inserted and text_deleted signal.
svn path=/trunk/; revision=28572
Diffstat (limited to 'a11y/e-table/gal-a11y-e-table.c')
-rw-r--r-- | a11y/e-table/gal-a11y-e-table.c | 151 |
1 files changed, 130 insertions, 21 deletions
diff --git a/a11y/e-table/gal-a11y-e-table.c b/a11y/e-table/gal-a11y-e-table.c index 8f4f246e70..16fef97c9d 100644 --- a/a11y/e-table/gal-a11y-e-table.c +++ b/a11y/e-table/gal-a11y-e-table.c @@ -12,6 +12,7 @@ #include "gal-a11y-util.h" #include <gal/e-table/e-table.h> #include <gal/e-table/e-table-group.h> +#include <gal/e-table/e-table-group-container.h> #include <gal/e-table/e-table-group-leaf.h> #include <gal/e-table/e-table-click-to-add.h> @@ -27,16 +28,80 @@ struct _GalA11yETablePrivate { }; /* Static functions */ +static ETableItem * +find_first_table_item (ETableGroup *group) +{ + GnomeCanvasGroup *cgroup; + GList *l; -static void + cgroup = GNOME_CANVAS_GROUP (group); + + for (l = cgroup->item_list; l; l = l->next) { + GnomeCanvasItem *i; + + i = GNOME_CANVAS_ITEM (l->data); + + if (E_IS_TABLE_GROUP (i)) + return find_first_table_item (E_TABLE_GROUP (i)); + else if (E_IS_TABLE_ITEM (i)) { + return E_TABLE_ITEM (i); + } + } + + return NULL; +} + +static AtkObject* +eti_get_accessible (ETableItem *eti, AtkObject *parent) +{ + AtkObject *a11y = NULL; + + g_return_val_if_fail (eti, NULL); + + a11y = atk_gobject_accessible_for_object (G_OBJECT (eti)); + g_return_val_if_fail (a11y, NULL); + + return a11y; +} + +static ETableItem * +find_table_item (ETable *table) +{ + if (e_table_model_row_count(table->model) < 1) + return NULL; + else { + if (table->group) + return find_first_table_item (table->group); + } + + return NULL; +} + +static gboolean init_child_item (GalA11yETable *a11y) { - GalA11yETablePrivate *priv = GET_PRIVATE (a11y); - ETable *table = E_TABLE (GTK_ACCESSIBLE (a11y)->widget); - if (priv->child_item == NULL) { - priv->child_item = atk_gobject_accessible_for_object (G_OBJECT(E_TABLE_GROUP_LEAF (table->group)->item)); - priv->child_item->role = ATK_ROLE_TABLE; + ETable *table; + + if (!a11y || !GTK_IS_ACCESSIBLE (a11y)) + return FALSE; + + table = E_TABLE (GTK_ACCESSIBLE (a11y)->widget); + if (table && GTK_WIDGET_MAPPED (GTK_WIDGET (table)) && table->group && E_IS_TABLE_GROUP_CONTAINER(table->group)) { + ETableGroupContainer *etgc = (ETableGroupContainer *)table->group; + GList *list; + + for (list = etgc->children; list; list = g_list_next (list)) { + ETableGroupContainerChildNode *child_node = list->data; + ETableGroup *child = child_node->child; + ETableItem *eti = find_first_table_item (child); + + eti_get_accessible (eti, ATK_OBJECT (a11y)); + } } + g_object_unref (a11y); + g_object_unref (table); + + return FALSE; } static AtkObject* @@ -46,7 +111,8 @@ et_ref_accessible_at_point (AtkComponent *component, AtkCoordType coord_type) { GalA11yETable *a11y = GAL_A11Y_E_TABLE (component); - init_child_item (a11y); + if (GET_PRIVATE (a11y)->child_item) + g_object_ref (GET_PRIVATE (a11y)->child_item); return GET_PRIVATE (a11y)->child_item; } @@ -55,13 +121,23 @@ et_get_n_children (AtkObject *accessible) { GalA11yETable *a11y = GAL_A11Y_E_TABLE (accessible); ETable * et; + int n = 0; et = E_TABLE(GTK_ACCESSIBLE (a11y)->widget); - if (et && et->use_click_to_add) { - return 2; - } - return 1; + if (et->group) { + if (E_IS_TABLE_GROUP_LEAF (et->group)) + n = 1; + else if (E_IS_TABLE_GROUP_CONTAINER (et->group)) { + ETableGroupContainer *etgc = (ETableGroupContainer *)et->group; + n = g_list_length (etgc->children); + } + } + + if (et && et->use_click_to_add && et->click_to_add) { + n++; + } + return n; } static AtkObject* @@ -70,24 +146,40 @@ et_ref_child (AtkObject *accessible, { GalA11yETable *a11y = GAL_A11Y_E_TABLE (accessible); ETable * et; + gint child_no; et = E_TABLE(GTK_ACCESSIBLE (a11y)->widget); - if (i == 0) { - init_child_item (a11y); - g_object_ref (GET_PRIVATE (a11y)->child_item); - return GET_PRIVATE (a11y)->child_item; - } else if (i == 1) { + child_no = et_get_n_children (accessible); + if (i == 0 || i < child_no - 1) { + if (E_IS_TABLE_GROUP_LEAF (et->group)) { + ETableItem *eti = find_first_table_item (et->group); + AtkObject *aeti = eti_get_accessible (eti, accessible); + if (aeti) + g_object_ref (aeti); + return aeti; + + } else if (E_IS_TABLE_GROUP_CONTAINER (et->group)) { + ETableGroupContainer *etgc = (ETableGroupContainer *) et->group; + ETableGroupContainerChildNode *child_node = g_list_nth_data (etgc->children, i); + if (child_node) { + ETableGroup *child = child_node->child; + ETableItem * eti = find_first_table_item (child); + AtkObject *aeti = eti_get_accessible (eti, accessible); + if (aeti) + g_object_ref (aeti); + return aeti; + } + } + } else if (i == child_no -1) { AtkObject * accessible; ETableClickToAdd * etcta; if (et && et->use_click_to_add && et->click_to_add) { etcta = E_TABLE_CLICK_TO_ADD(et->click_to_add); - if (etcta->rect) { - accessible = atk_gobject_accessible_for_object (G_OBJECT(etcta)); - } else { - accessible = atk_gobject_accessible_for_object (G_OBJECT(etcta->row)); - } + accessible = atk_gobject_accessible_for_object (G_OBJECT(etcta)); + if (accessible) + g_object_ref (accessible); return accessible; } } @@ -95,6 +187,12 @@ et_ref_child (AtkObject *accessible, return NULL; } +static AtkLayer +et_get_layer (AtkComponent *component) +{ + return ATK_LAYER_WIDGET; +} + static void et_class_init (GalA11yETableClass *klass) { @@ -110,6 +208,7 @@ static void et_atk_component_iface_init (AtkComponentIface *iface) { iface->ref_accessible_at_point = et_ref_accessible_at_point; + iface->get_layer = et_get_layer; } static void @@ -181,5 +280,15 @@ gal_a11y_e_table_new (GObject *widget) GTK_ACCESSIBLE (a11y)->widget = GTK_WIDGET (widget); + /* we need to init all the children for multiple table items */ + if (table && GTK_WIDGET_MAPPED (GTK_WIDGET (table)) && table->group && E_IS_TABLE_GROUP_CONTAINER (table->group)) { + /* Ref it here so that it is still valid in the idle function */ + /* It will be unrefed in the idle function */ + g_object_ref (a11y); + g_object_ref (widget); + + g_idle_add ((GSourceFunc)init_child_item, a11y); + } + return ATK_OBJECT (a11y); } |