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-cell-vbox.c | |
parent | d8d481373ff47bc77432b2f8d8de91afd1bd02a0 (diff) | |
download | gsoc2013-evolution-0dcae6d9d8e91ff3e9592cea78f5d43da3477beb.tar.gz 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-cell-vbox.c')
-rw-r--r-- | a11y/e-table/gal-a11y-e-cell-vbox.c | 214 |
1 files changed, 214 insertions, 0 deletions
diff --git a/a11y/e-table/gal-a11y-e-cell-vbox.c b/a11y/e-table/gal-a11y-e-cell-vbox.c new file mode 100644 index 0000000000..4f2c156da8 --- /dev/null +++ b/a11y/e-table/gal-a11y-e-cell-vbox.c @@ -0,0 +1,214 @@ +/* Evolution Accessibility: gal-a11y-e-cell-vbox.c + * + * Copyright (C) 2004 Sun Microsystem, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Eric Zhao <eric.zhao@sun.com> Sun Microsystem Inc., 2004 + * + */ +#include "gal-a11y-e-cell-vbox.h" +#include "gal-a11y-e-cell-registry.h" +#include <gal/e-table/e-cell-vbox.h> +#include <atk/atkcomponent.h> + +static GObjectClass *parent_class; +static AtkComponentIface *component_parent_iface; +#define PARENT_TYPE (gal_a11y_e_cell_get_type ()) + +static gint +ecv_get_n_children (AtkObject *a11y) +{ + g_return_val_if_fail (GAL_A11Y_IS_E_CELL_VBOX (a11y), 0); + GalA11yECellVbox *gaev = GAL_A11Y_E_CELL_VBOX (a11y); + return (gaev->a11y_subcell_count); +} + +static void +subcell_destroyed (gpointer data) +{ + GalA11yECell *cell; + AtkObject *parent; + GalA11yECellVbox *gaev; + + g_return_if_fail (GAL_A11Y_IS_E_CELL (data)); + cell = GAL_A11Y_E_CELL (data); + + parent = atk_object_get_parent (ATK_OBJECT (cell)); + g_return_if_fail (GAL_A11Y_IS_E_CELL_VBOX (parent)); + gaev = GAL_A11Y_E_CELL_VBOX (parent); + + if (cell->view_col < gaev->a11y_subcell_count) + gaev->a11y_subcells[cell->view_col] = NULL; +} + +static AtkObject* +ecv_ref_child (AtkObject *a11y, gint i) +{ + GalA11yECellVbox *gaev = GAL_A11Y_E_CELL_VBOX (a11y); + GalA11yECell *gaec = GAL_A11Y_E_CELL (a11y); + ECellVboxView *ecvv = (ECellVboxView *) (gaec->cell_view); + AtkObject *ret; + if (i < gaev->a11y_subcell_count) { + if (gaev->a11y_subcells[i] == NULL) { + gint model_col, row; + row = gaec->row; + model_col = ecvv->model_cols[i]; + ECellView *subcell_view = ecvv->subcell_views[i]; + ret = gal_a11y_e_cell_registry_get_object (NULL, + gaec->item, + subcell_view, + a11y, + model_col, + gaec->view_col, /* FIXME should the view column use a fake one or the same as its parent? */ + row); + gaev->a11y_subcells[i] = ret; + g_object_ref (ret); + g_object_weak_ref (G_OBJECT (ret), + (GWeakNotify) subcell_destroyed, + ret); + } else { + ret = (AtkObject *) gaev->a11y_subcells[i]; + if (ATK_IS_OBJECT (ret)) + g_object_ref (ret); + else + ret = NULL; + } + } else { + ret = NULL; + } + + return ret; +} + +static void +ecv_dispose (GObject *object) +{ + GalA11yECellVbox *gaev = GAL_A11Y_E_CELL_VBOX (object); + if (gaev->a11y_subcells) + g_free (gaev->a11y_subcells); + + if (parent_class->dispose) + parent_class->dispose (object); +} + +/* AtkComponet interface */ +static AtkObject* +ecv_ref_accessible_at_point (AtkComponent *component, + gint x, + gint y, + AtkCoordType coord_type) +{ + gint x0, y0, width, height; + int subcell_height, i; + + GalA11yECell *gaec = GAL_A11Y_E_CELL (component); + ECellVboxView *ecvv = (ECellVboxView *) (gaec->cell_view); + + atk_component_get_extents (component, &x0, &y0, &width, &height, coord_type); + x -= x0; + y -= y0; + if (x < 0 || x > width || y < 0 || y > height) + return NULL; + + for (i = 0; i < ecvv->subcell_view_count; i++) { + subcell_height = e_cell_height (ecvv->subcell_views[i], ecvv->model_cols[i], gaec->view_col, gaec->row); + if ( 0 <= y && y <= subcell_height) { + return ecv_ref_child ((AtkObject *)component, i); + } else + y -= subcell_height; + } + + return NULL; +} + +static void +ecv_class_init (GalA11yECellVboxClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + AtkObjectClass *a11y_class = ATK_OBJECT_CLASS (klass); + parent_class = g_type_class_ref (PARENT_TYPE); + + object_class->dispose = ecv_dispose; + + a11y_class->get_n_children = ecv_get_n_children; + a11y_class->ref_child = ecv_ref_child; +} + +static void +ecv_init (GalA11yECellVbox *a11y) +{ +} + +static void +ecv_atk_component_iface_init (AtkComponentIface *iface) +{ + component_parent_iface = g_type_interface_peek_parent (iface); + + iface->ref_accessible_at_point = ecv_ref_accessible_at_point; +} + +GType +gal_a11y_e_cell_vbox_get_type (void) +{ + static GType type = 0; + if (!type) { + GTypeInfo info = { + sizeof (GalA11yECellVboxClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) ecv_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (GalA11yECellVbox), + 0, + (GInstanceInitFunc) ecv_init, + NULL /* value_cell */ + }; + + static const GInterfaceInfo atk_component_info = { + (GInterfaceInitFunc) ecv_atk_component_iface_init, + (GInterfaceFinalizeFunc) NULL, + NULL + }; + + type = g_type_register_static (PARENT_TYPE, "GalA11yECellVbox", &info, 0); + gal_a11y_e_cell_type_add_action_interface (type); + g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info); + } + + return type; +} + +AtkObject *gal_a11y_e_cell_vbox_new (ETableItem *item, + ECellView *cell_view, + AtkObject *parent, + int model_col, + int view_col, + int row) +{ + AtkObject *a11y; + + a11y = g_object_new (gal_a11y_e_cell_vbox_get_type (), NULL); + + gal_a11y_e_cell_construct (a11y, item, cell_view, parent, model_col, view_col, row); + + GalA11yECell *gaec = GAL_A11Y_E_CELL (a11y); + GalA11yECellVbox *gaev = GAL_A11Y_E_CELL_VBOX (a11y); + ECellVboxView *ecvv = (ECellVboxView *) (gaec->cell_view); + gaev->a11y_subcell_count = ecvv->subcell_view_count; + gaev->a11y_subcells = g_malloc0 (sizeof(AtkObject *)*gaev->a11y_subcell_count); + return a11y; +} |