diff options
author | Li Yuan <li.yuan@sun.com> | 2004-09-30 15:32:36 +0800 |
---|---|---|
committer | Harry Lu <haip@src.gnome.org> | 2004-09-30 15:32:36 +0800 |
commit | 55e921af93354f13406657f4a5d68c5e426d9402 (patch) | |
tree | c3df07c23a7b26388ec7aa2ad510e06b39189c42 /a11y/calendar/ea-week-view-cell.c | |
parent | a575a7229795651453ffdc8809a2f642b5e4a00c (diff) | |
download | gsoc2013-evolution-55e921af93354f13406657f4a5d68c5e426d9402.tar.gz gsoc2013-evolution-55e921af93354f13406657f4a5d68c5e426d9402.tar.zst gsoc2013-evolution-55e921af93354f13406657f4a5d68c5e426d9402.zip |
Make accessibility name and description translatable.
2004-09-23 Li Yuan <li.yuan@sun.com>
* calendar/ea-cal-view-event.c: (ea_cal_view_event_get_type),
(ea_cal_view_event_get_name), (ea_cal_view_event_get_description):
Make accessibility name and description translatable.
(atk_action_interface_init), (ea_cal_view_event_do_action),
(ea_cal_view_event_get_n_actions),
(ea_cal_view_event_action_get_name):
Add action interface to ea-cal-view-event so that it can be
UI grabbed by GOK.
* calendar/ea-cal-view.c:
Make accessibility name and description translatable.
* calendar/ea-day-view-cell.c: (ea_day_view_cell_new):
Change atk role of ea-day-view-cell from ATK_ROLE_TABLE_CELL
to ATK_ROLE_UNKNOWN so that it can be UI grabbed by GOK.
(atk_component_interface_init), (component_interface_grab_focus):
Add a component interface function : grab_focus.
When grab focus, present the Evolution GUI to the front.
* calendar/ea-day-view-main-item.c:
(ea_day_view_main_item_get_description):
Make accessibility name and description translatable.
(ea_day_view_main_item_time_change_cb):
Notify the item_cell is selected.
* calendar/ea-day-view.c: (ea_day_view_get_name),
(ea_day_view_get_description):
Make accessibility name and description translatable.
* calendar/ea-gnome-calendar.c: (ea_gnome_calendar_get_name),
(ea_gnome_calendar_get_description), (ea_gnome_calendar_ref_child):
Make accessibility name and description translatable.
* calendar/ea-jump-button.c: (ea_jump_button_get_name),
(ea_jump_button_get_description):
Make accessibility name and description translatable.
* calendar/ea-week-view-cell.c: (ea_week_view_cell_get_name),
(atk_component_interface_init), (component_interface_get_extents),
(component_interface_grab_focus):
Add a component interface function : grab_focus.
Add support for different week start days.
When grab focus, present the Evolutioon GUI to the front.
* calendar/ea-week-view-main-item.c: (ea_week_view_main_item_new):
Set the atk role to ATK_ROLE_TABLE.
(ea_week_view_main_item_get_description):
Make accessibility name and description translatable.
(ea_week_view_main_item_time_change_cb):
Notify the item_cell is selected.
* calendar/ea-week-view.c: (ea_week_view_get_name),
(ea_week_view_get_description):
Make accessibility name and description translatable.
* widgets/ea-calendar-cell.c: (ea_calendar_cell_new):
Change atk role of ea-calendar-cell from ATK_ROLE_TABLE_CELL
to ATK_ROLE_UNKNOWN so that it can be UI grabbed by GOK.
* widgets/ea-calendar-item.c: (ea_calendar_item_class_init),
(ea_calendar_item_get_name), (ea_calendar_item_get_description):
Make accessibility name and description translatable.
(ea_calendar_item_ref_state_set),:
Implement ref_state_set so that ea-calendar-item can be UI
grabbed by GOK.
(ea_calendar_item_destory_cell_data):
Fix a crash here.
svn path=/trunk/; revision=27434
Diffstat (limited to 'a11y/calendar/ea-week-view-cell.c')
-rw-r--r-- | a11y/calendar/ea-week-view-cell.c | 134 |
1 files changed, 128 insertions, 6 deletions
diff --git a/a11y/calendar/ea-week-view-cell.c b/a11y/calendar/ea-week-view-cell.c index 5d97ed74b4..543b26794a 100644 --- a/a11y/calendar/ea-week-view-cell.c +++ b/a11y/calendar/ea-week-view-cell.c @@ -103,6 +103,8 @@ 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; #ifdef ACC_DEBUG @@ -208,6 +210,8 @@ ea_week_view_cell_get_name (AtkObject *accessible) GnomeCanvasItem *main_item; gchar *new_name = g_strdup (""); const gchar *row_label, *column_label; + gint new_column, new_row; + gint start_day; atk_gobj = ATK_GOBJECT_ACCESSIBLE (accessible); g_obj = atk_gobject_accessible_get_object (atk_gobj); @@ -217,10 +221,20 @@ ea_week_view_cell_get_name (AtkObject *accessible) cell = E_WEEK_VIEW_CELL (g_obj); main_item = cell->week_view->main_canvas_item; ea_main_item = atk_gobject_accessible_for_object (G_OBJECT (main_item)); + + start_day = cell->week_view->display_start_day; + if (cell->column + start_day >= 7) { + new_column = cell->column + start_day - 7; + new_row = cell->row + 1; + } else { + new_column = cell->column + start_day; + new_row = cell->row; + } + column_label = atk_table_get_column_description (ATK_TABLE (ea_main_item), - cell->column); + new_column); row_label = atk_table_get_row_description (ATK_TABLE (ea_main_item), - cell->row); + new_row); new_name = g_strconcat (column_label, " ", row_label, NULL); ATK_OBJECT_CLASS (parent_class)->set_name (accessible, new_name); g_free (new_name); @@ -314,6 +328,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 @@ -328,6 +343,7 @@ component_interface_get_extents (AtkComponent *component, GtkWidget *main_canvas; gint week_view_width, week_view_height; gint scroll_x, scroll_y; + gint start_day; *x = *y = *width = *height = 0; @@ -349,8 +365,114 @@ component_interface_get_extents (AtkComponent *component, coord_type); gnome_canvas_get_scroll_offsets (GNOME_CANVAS (week_view->main_canvas), &scroll_x, &scroll_y); - *x += week_view->col_offsets[cell->column] - scroll_x; - *y += week_view->row_offsets[cell->row*2]- scroll_y; - *width = week_view->col_widths[cell->column]; - *height = week_view->row_heights[ cell->row*2]*2; + start_day = week_view->display_start_day; + if (week_view->multi_week_view) { + if (week_view->compress_weekend && (cell->column == (5 - start_day))) { + *height = week_view->row_heights[cell->row*2]; + *width = week_view->col_widths[cell->column]; + *x += week_view->col_offsets[cell->column] - scroll_x; + *y += week_view->row_offsets[cell->row*2]- scroll_y; + } else if (week_view->compress_weekend && (cell->column == (6 - start_day))) { + *height = week_view->row_heights[cell->row*2]; + *width = week_view->col_widths[cell->column - 1]; + *x += week_view->col_offsets[cell->column - 1]- scroll_x; + *y += week_view->row_offsets[cell->row*2 + 1]- scroll_y; + } else if (week_view->compress_weekend && (cell->column > (6 - start_day))){ + *height = week_view->row_heights[cell->row*2]*2; + *width = week_view->col_widths[cell->column - 1]; + *x += week_view->col_offsets[cell->column - 1] - scroll_x; + *y += week_view->row_offsets[cell->row*2]- scroll_y; + } else { + *height = week_view->row_heights[cell->row*2]*2; + *width = week_view->col_widths[cell->column]; + *x += week_view->col_offsets[cell->column] - scroll_x; + *y += week_view->row_offsets[cell->row*2]- scroll_y; + } + } else { + if (start_day < 3) { + if (cell->column < 3) { + *height = week_view->row_heights[cell->column*2]*2; + *width = week_view->col_widths[0]; + *x += week_view->col_offsets[0] - scroll_x; + *y += week_view->row_offsets[cell->column*2]- scroll_y; + } else { + if (cell->column == 5 - start_day) { + *height = week_view->row_heights[(cell->column - 3)*2]; + *width = week_view->col_widths[1]; + *x += week_view->col_offsets[1] - scroll_x; + *y += week_view->row_offsets[(cell->column - 3)*2]- scroll_y; + } else if (cell->column == 6 - start_day) { + *height = week_view->row_heights[(cell->column - 4)*2]; + *width = week_view->col_widths[1]; + *x += week_view->col_offsets[1] - scroll_x; + *y += week_view->row_offsets[(cell->column - 3)*2 - 1]- scroll_y; + } else if (cell->column > 6 - start_day) { + *height = week_view->row_heights[(cell->column - 4)*2]*2; + *width = week_view->col_widths[1]; + *x += week_view->col_offsets[1] - scroll_x; + *y += week_view->row_offsets[(cell->column - 4)*2]- scroll_y; + } else { + *height = week_view->row_heights[(cell->column - 3)*2]*2; + *width = week_view->col_widths[1]; + *x += week_view->col_offsets[1] - scroll_x; + *y += week_view->row_offsets[(cell->column - 3)*2]- scroll_y; + } + } + } else if (cell->column < 4) { + if (cell->column == 5 - start_day) { + *height = week_view->row_heights[cell->column*2]; + *width = week_view->col_widths[0]; + *x += week_view->col_offsets[0] - scroll_x; + *y += week_view->row_offsets[cell->column*2]- scroll_y; + } else if (cell->column == 6 - start_day) { + *height = week_view->row_heights[(cell->column - 1)*2]; + *width = week_view->col_widths[0]; + *x += week_view->col_offsets[0] - scroll_x; + *y += week_view->row_offsets[cell->column*2 - 1]- scroll_y; + } else if (cell->column > 6 - start_day) { + *height = week_view->row_heights[(cell->column - 1)*2]*2; + *width = week_view->col_widths[0]; + *x += week_view->col_offsets[0] - scroll_x; + *y += week_view->row_offsets[(cell->column - 1)*2]- scroll_y; + } else { + *height = week_view->row_heights[(cell->column)*2]*2; + *width = week_view->col_widths[0]; + *x += week_view->col_offsets[0] - scroll_x; + *y += week_view->row_offsets[cell->column*2]- scroll_y; + } + } else { + *height = week_view->row_heights[(cell->column - 4)*2]*2; + *width = week_view->col_widths[1]; + *x += week_view->col_offsets[1] - scroll_x; + *y += week_view->row_offsets[(cell->column - 4)*2]- scroll_y; + } + } +} + +static gboolean +component_interface_grab_focus (AtkComponent *comp) +{ + GObject *g_obj; + EWeekViewCell *cell; + EWeekView *week_view; + GtkWidget *toplevel; + + g_return_val_if_fail (EA_IS_WEEK_VIEW_CELL (comp), FALSE); + + g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (comp)); + if (!g_obj) + return FALSE; + + cell = E_WEEK_VIEW_CELL (g_obj); + week_view = cell->week_view; + + week_view->selection_start_day = cell->row * 7 + cell->column; + week_view->selection_end_day = cell->row * 7 + cell->column; + gtk_widget_queue_draw (week_view->main_canvas); + + toplevel = gtk_widget_get_toplevel (GTK_WIDGET (week_view)); + if (GTK_WIDGET_TOPLEVEL (toplevel)) + gtk_window_present (GTK_WINDOW (toplevel)); + + return TRUE; } |