diff options
author | Li Yuan <li.yuan@sun.com> | 2005-01-27 13:16:19 +0800 |
---|---|---|
committer | Harry Lu <haip@src.gnome.org> | 2005-01-27 13:16:19 +0800 |
commit | d8d481373ff47bc77432b2f8d8de91afd1bd02a0 (patch) | |
tree | 8e8965a9867437704b2a317f2a52ff1a0880f71d /widgets/table/e-cell-text.c | |
parent | 7b6ba9e828c68f9229bcb8ad41a550119260aef6 (diff) | |
download | gsoc2013-evolution-d8d481373ff47bc77432b2f8d8de91afd1bd02a0.tar.gz gsoc2013-evolution-d8d481373ff47bc77432b2f8d8de91afd1bd02a0.tar.zst gsoc2013-evolution-d8d481373ff47bc77432b2f8d8de91afd1bd02a0.zip |
add an a11y name for the popup list. make shortcut key ALT+Arrow work.
2005-01-27 Li Yuan <li.yuan@sun.com>
* e-cell-combo.c: (e_cell_combo_init), (e_cell_combo_do_popup),
(e_cell_combo_list_button_press), (e_cell_combo_button_press),
(e_cell_combo_button_release), (e_cell_combo_key_press):
add an a11y name for the popup list.
make shortcut key ALT+Arrow work.
Fixes #70261
* e-cell-text.c: (e_cell_text_class_init), (_delete_selection),
(_insert):
add "text_inserted" and "text_deleted" signals to notify the
text has been changed.
(e_cell_text_get_text_by_view):
new helper function to get the text being editted.
* e-cell-text.h:
add signal declaration.
* e-cell-toggle.c: (etog_draw):
add range check for negative values.
* e-cell-vbox.c: (e_cell_vbox_class_init):
* e-cell-vbox.h:
make ECellVboxView public since it will be used in a11y part.
* e-table-click-to-add.c: (etcta_style_set),
(create_rect_and_text), (etcta_realize), (etcta_class_init),
(e_table_click_to_add_commit):
add "style_set" signal to click_to_add and implement
the style_set function.
(etcta_init):
add a11y name to click to add.
* e-table-click-to-add.h:
add "style_set" signal to click_to_add and implement
the style_set function.
* e-table-config.c: (config_button_up), (config_button_down):
check whether the columns are empty.
* e-table-group-container.c:
* e-table-group-container.h:
make ETableGroupContainerChildNode public since it
will be used in a11y part.
* e-table-item.c: (eti_init):
init eti->cols.
(eti_event):
at GDK_KEY_PRESS event and GDK_Down key pressed, we check
view_col value before we pass it to eti_e_cell_event.
(eti_class_init):
call the new initialize function
* e-table.c: (table_canvas_focus_event_cb):
if canvas has a focused item but the etable does not
have a cursor row, just focus the first item after check
whether the click_to_add should get the focus.
svn path=/trunk/; revision=28571
Diffstat (limited to 'widgets/table/e-cell-text.c')
-rw-r--r-- | widgets/table/e-cell-text.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index ecb9117e1c..cbc0fddca8 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -59,6 +59,7 @@ #define d(x) #define DO_SELECTION 1 +#define VIEW_TO_CELL(view) E_CELL_TEXT (((ECellView *)view)->ecell) #if d(!)0 #define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)), g_print ("%s: e_table_item_leave_edit\n", __FUNCTION__)) @@ -94,6 +95,15 @@ enum { E_SELECTION_CLIPBOARD }; +/* signals */ +enum { + TEXT_INSERTED, + TEXT_DELETED, + LAST_SIGNAL +}; + +static guint signals [LAST_SIGNAL] = { 0 }; + static GdkAtom clipboard_atom = GDK_NONE; #define PARENT_TYPE e_cell_get_type () @@ -1698,6 +1708,30 @@ e_cell_text_class_init (GObjectClass *object_class) parent_class = g_type_class_ref (PARENT_TYPE); + signals [TEXT_INSERTED] = + g_signal_new ("text_inserted", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (ECellTextClass, text_inserted), + NULL, NULL, + e_marshal_VOID__POINTER_INT_INT_INT_INT, + G_TYPE_NONE, 5, + G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT, + G_TYPE_INT, G_TYPE_INT); + + signals [TEXT_DELETED] = + g_signal_new ("text_deleted", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (ECellTextClass, text_deleted), + NULL, NULL, + e_marshal_VOID__POINTER_INT_INT_INT_INT, + G_TYPE_NONE, 5, + G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT, + G_TYPE_INT, G_TYPE_INT); + + + g_object_class_install_property (object_class, PROP_STRIKEOUT_COLUMN, g_param_spec_int ("strikeout_column", _("Strikeout Column"), @@ -2182,6 +2216,8 @@ _delete_selection (ECellTextView *text_view) memmove (sp, ep, length); edit->selection_end = edit->selection_start; + + g_signal_emit (VIEW_TO_CELL (text_view), signals[TEXT_DELETED], 0, text_view, edit->selection_start, ep-sp, edit->row, edit->model_col); } /* fixme: */ @@ -2209,6 +2245,8 @@ _insert (ECellTextView *text_view, char *string, int value) edit->selection_start += value; edit->selection_end = edit->selection_start; + + g_signal_emit (VIEW_TO_CELL (text_view), signals[TEXT_INSERTED], 0, text_view, edit->selection_end-value, value, edit->row, edit->model_col); } static void @@ -2778,3 +2816,39 @@ e_cell_text_delete_selection (ECellView *cell_view, gint col, gint row) command.position = E_TEP_SELECTION; e_cell_text_view_command (edit->tep, &command, edit); } + +/** + * e_cell_text_get_text_by_view: + * @cell_view: the given cell view + * @col: column of the given cell in the model + * @row: row of the given cell in the model + * + * Get the cell's text directly from CellEdit, + * during editting this cell, the cell's text value maybe inconsistant + * with the text got from table_model. + * The caller should free the text after using it. + * + * This API is most likely to be used by a11y implementations. + */ +char * +e_cell_text_get_text_by_view (ECellView *cell_view, gint col, gint row) +{ + ECellTextView *ectv; + CellEdit *edit; + gchar *ret, *model_text; + + ectv = (ECellTextView *)cell_view; + edit = ectv->edit; + + if (edit && ectv->edit->row == row && ectv->edit->model_col == col) { /* being editted now */ + ret = g_strdup (edit->text); + } else{ + model_text = e_cell_text_get_text (E_CELL_TEXT (cell_view->ecell), + cell_view->e_table_model, col, row); + ret = g_strdup (model_text); + e_cell_text_free_text (E_CELL_TEXT (cell_view->ecell), model_text); + } + + return ret; + +} |