diff options
author | Li Yuan <li.yuan@sun.com> | 2005-02-25 14:48:18 +0800 |
---|---|---|
committer | Harry Lu <haip@src.gnome.org> | 2005-02-25 14:48:18 +0800 |
commit | 658dcc0fc89eb79a23bf3894975b9f758f4a1e33 (patch) | |
tree | 10e2856710aa28caa6faa73cea01fae214bc1702 /a11y/widgets/ea-calendar-cell.c | |
parent | 0ffd23b06370fc3c539cec4905f2c0c439779003 (diff) | |
download | gsoc2013-evolution-658dcc0fc89eb79a23bf3894975b9f758f4a1e33.tar gsoc2013-evolution-658dcc0fc89eb79a23bf3894975b9f758f4a1e33.tar.gz gsoc2013-evolution-658dcc0fc89eb79a23bf3894975b9f758f4a1e33.tar.bz2 gsoc2013-evolution-658dcc0fc89eb79a23bf3894975b9f758f4a1e33.tar.lz gsoc2013-evolution-658dcc0fc89eb79a23bf3894975b9f758f4a1e33.tar.xz gsoc2013-evolution-658dcc0fc89eb79a23bf3894975b9f758f4a1e33.tar.zst gsoc2013-evolution-658dcc0fc89eb79a23bf3894975b9f758f4a1e33.zip |
Fix for 72897 and 72797. no need to output the information. add instance
2005-02-23 Li Yuan <li.yuan@sun.com>
Fix for 72897 and 72797.
* ea-cell-table.c:
(ea_cell_table_destroy): no need to output the information.
* widgets/ea-calendar-cell.c:
(ea_calendar_cell_get_type): add instance init function.
(ea_calendar_cell_class_init): add ref_state_set function.
(ea_calendar_cell_init): instance init function.
(ea_calendar_cell_new): change the cell's role to ATK_ROLE_TABLE_CELL.
(ea_calendar_cell_ref_state_set): the ref_state_set function.
(atk_component_interface_init),
(component_interface_get_extents),
(component_interface_grab_focus): implement grab focus function.
* widgets/ea-calendar-cell.h:
add the state_set variable.
* widgets/ea-calendar-item.c:
(ea_calendar_item_new): change the item's role to ATK_ROLE_CALENDAR.
no need to connect "selection_preview_changed" signal here.
(date_range_changed_cb): call ea_calendar_set_focus_object.
(ea_calendar_set_focus_object): make the "gail-focus-object" of the item
point to the focused cell.
svn path=/trunk/; revision=28886
Diffstat (limited to 'a11y/widgets/ea-calendar-cell.c')
-rw-r--r-- | a11y/widgets/ea-calendar-cell.c | 66 |
1 files changed, 64 insertions, 2 deletions
diff --git a/a11y/widgets/ea-calendar-cell.c b/a11y/widgets/ea-calendar-cell.c index 682485605f..9601d0b259 100644 --- a/a11y/widgets/ea-calendar-cell.c +++ b/a11y/widgets/ea-calendar-cell.c @@ -23,6 +23,8 @@ * */ +#include <gtk/gtk.h> +#include <gal/util/e-util.h> #include "ea-calendar-cell.h" #include "ea-calendar-item.h" #include "ea-factory.h" @@ -89,11 +91,13 @@ e_calendar_cell_new (ECalendarItem *calitem, gint row, gint column) /* EaCalendarCell */ static void ea_calendar_cell_class_init (EaCalendarCellClass *klass); +static void ea_calendar_cell_init (EaCalendarCell *a11y); static G_CONST_RETURN gchar* ea_calendar_cell_get_name (AtkObject *accessible); static G_CONST_RETURN gchar* ea_calendar_cell_get_description (AtkObject *accessible); static AtkObject * ea_calendar_cell_get_parent (AtkObject *accessible); static gint ea_calendar_cell_get_index_in_parent (AtkObject *accessible); +static AtkStateSet *ea_calendar_cell_ref_state_set (AtkObject *accessible); /* component interface */ static void atk_component_interface_init (AtkComponentIface *iface); @@ -101,6 +105,7 @@ static void component_interface_get_extents (AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type); +static gboolean component_interface_grab_focus (AtkComponent *component); static gpointer parent_class = NULL; @@ -124,7 +129,7 @@ ea_calendar_cell_get_type (void) NULL, /* class data */ sizeof (EaCalendarCell), /* instance size */ 0, /* nb preallocs */ - (GInstanceInitFunc) NULL, /* instance init */ + (GInstanceInitFunc) ea_calendar_cell_init, /* instance init */ NULL /* value table */ }; @@ -160,6 +165,19 @@ ea_calendar_cell_class_init (EaCalendarCellClass *klass) class->get_parent = ea_calendar_cell_get_parent; class->get_index_in_parent = ea_calendar_cell_get_index_in_parent; + class->ref_state_set = ea_calendar_cell_ref_state_set; +} + +static void +ea_calendar_cell_init (EaCalendarCell *a11y) +{ + a11y->state_set = atk_state_set_new (); + atk_state_set_add_state (a11y->state_set, ATK_STATE_TRANSIENT); + atk_state_set_add_state (a11y->state_set, ATK_STATE_ENABLED); + atk_state_set_add_state (a11y->state_set, ATK_STATE_SENSITIVE); + atk_state_set_add_state (a11y->state_set, ATK_STATE_SELECTABLE); + atk_state_set_add_state (a11y->state_set, ATK_STATE_SHOWING); + atk_state_set_add_state (a11y->state_set, ATK_STATE_FOCUSABLE); } AtkObject* @@ -172,7 +190,7 @@ ea_calendar_cell_new (GObject *obj) object = g_object_new (EA_TYPE_CALENDAR_CELL, NULL); atk_object = ATK_OBJECT (object); atk_object_initialize (atk_object, obj); - atk_object->role = ATK_ROLE_UNKNOWN; + atk_object->role = ATK_ROLE_TABLE_CELL; #ifdef ACC_DEBUG ++n_ea_calendar_cell_created; @@ -268,6 +286,19 @@ ea_calendar_cell_get_index_in_parent (AtkObject *accessible) cell->row, cell->column); } +static AtkStateSet * +ea_calendar_cell_ref_state_set (AtkObject *accessible) +{ + EaCalendarCell *atk_cell = EA_CALENDAR_CELL (accessible); + + g_return_val_if_fail (atk_cell->state_set, NULL); + + g_object_ref(atk_cell->state_set); + + return atk_cell->state_set; + +} + /* Atk Component Interface */ static void @@ -276,6 +307,7 @@ atk_component_interface_init (AtkComponentIface *iface) g_return_if_fail (iface != NULL); iface->get_extents = component_interface_get_extents; + iface->grab_focus = component_interface_grab_focus; } static void @@ -323,3 +355,33 @@ component_interface_get_extents (AtkComponent *component, *x += canvas_x; *y += canvas_y; } + +static gboolean +component_interface_grab_focus (AtkComponent *component) +{ + GObject *g_obj; + GtkWidget *toplevel; + AtkObject *ea_calitem; + ECalendarItem *calitem; + EaCalendarCell *a11y; + gint index; + + a11y = EA_CALENDAR_CELL (component); + ea_calitem = ea_calendar_cell_get_parent (ATK_OBJECT (a11y)); + + g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE(ea_calitem)); + calitem = E_CALENDAR_ITEM (g_obj); + + index = atk_object_get_index_in_parent (ATK_OBJECT (a11y)); + + atk_selection_clear_selection (ATK_SELECTION (ea_calitem)); + atk_selection_add_selection (ATK_SELECTION (ea_calitem), index); + + gtk_widget_grab_focus (GTK_WIDGET (GNOME_CANVAS_ITEM (calitem)->canvas)); + toplevel = gtk_widget_get_toplevel (GTK_WIDGET (GNOME_CANVAS_ITEM (calitem)->canvas)); + if (toplevel && GTK_WIDGET_TOPLEVEL (toplevel)) + gtk_window_present (GTK_WINDOW (toplevel)); + + return TRUE; + +} |