aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorTim Wo <tim.wo@sun.com>2003-12-02 15:20:04 +0800
committerGilbert Fang <gilbertfang@src.gnome.org>2003-12-02 15:20:04 +0800
commitaddb2f0ea7693e78b2a52dc8b3fbabfdcf59e92d (patch)
tree449bf2c0a768a24fa691aa2c2776b3a3b2c7bb96 /widgets/table
parent3e2e35b2a2fda14262d3fb50b0442441e0fcada0 (diff)
downloadgsoc2013-evolution-addb2f0ea7693e78b2a52dc8b3fbabfdcf59e92d.tar
gsoc2013-evolution-addb2f0ea7693e78b2a52dc8b3fbabfdcf59e92d.tar.gz
gsoc2013-evolution-addb2f0ea7693e78b2a52dc8b3fbabfdcf59e92d.tar.bz2
gsoc2013-evolution-addb2f0ea7693e78b2a52dc8b3fbabfdcf59e92d.tar.lz
gsoc2013-evolution-addb2f0ea7693e78b2a52dc8b3fbabfdcf59e92d.tar.xz
gsoc2013-evolution-addb2f0ea7693e78b2a52dc8b3fbabfdcf59e92d.tar.zst
gsoc2013-evolution-addb2f0ea7693e78b2a52dc8b3fbabfdcf59e92d.zip
a11y implementations for ECellText. new functions to support corresponding
2003-12-02 Tim Wo <tim.wo@sun.com> * gal/a11y/e-table/gal-a11y-e-cell-text.c: (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_remove_selection), (ect_set_selection), (ect_set_caret_offset), (ect_set_text_contents), (ect_insert_text), (ect_copy_text), (ect_delete_text), (ect_cut_text), (ect_paste_text), (ect_class_init): a11y implementations for ECellText. * gal/e-table/e-cell-text.c: (e_cell_text_set_selection), (e_cell_text_get_selection), (e_cell_text_copy_clipboard), (e_cell_text_paste_clipboard), (e_cell_text_delete_selection): new functions to support corresponding atk operations. * gal/e-table/e-cell-text.h: some APIs added to support atk operations. svn path=/trunk/; revision=23568
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-cell-text.c180
-rw-r--r--widgets/table/e-cell-text.h15
2 files changed, 195 insertions, 0 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 5a0da69a7c..11c5429754 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -2574,3 +2574,183 @@ e_cell_text_get_color (ECellTextView *cell_view, gchar *color_spec)
return color;
}
+/**
+ * e_cell_text_set_selection:
+ * @cell_view: the given cell view
+ * @col: column of the given cell in the view
+ * @row: row of the given cell in the view
+ * @start: start offset of the selection
+ * @end: end offset of the selection
+ *
+ * Sets the selection of given text cell.
+ * If the current editing cell is not the given cell, this function
+ * will return FALSE;
+ *
+ * If success, the [start, end) part of the text will be selected.
+ *
+ * This API is most likely to be used by a11y implementations.
+ *
+ * Returns: whether the action is successful.
+ */
+gboolean
+e_cell_text_set_selection (ECellView *cell_view,
+ gint col,
+ gint row,
+ gint start,
+ gint end)
+{
+ ECellTextView *ectv;
+ CellEdit *edit;
+ ETextEventProcessorCommand command1, command2;
+
+ ectv = (ECellTextView *)cell_view;
+ edit = ectv->edit;
+ if (!edit)
+ return FALSE;
+
+ if (edit->view_col != col || edit->row != row)
+ return FALSE;
+
+ command1.action = E_TEP_MOVE;
+ command1.position = E_TEP_VALUE;
+ command1.value = start;
+ e_cell_text_view_command (edit->tep, &command1, edit);
+
+ command2.action = E_TEP_SELECT;
+ command2.position = E_TEP_VALUE;
+ command2.value = end;
+ e_cell_text_view_command (edit->tep, &command2, edit);
+
+ return TRUE;
+}
+
+/**
+ * e_cell_text_get_selection:
+ * @cell_view: the given cell view
+ * @col: column of the given cell in the view
+ * @row: row of the given cell in the view
+ * @start: a pointer to an int value indicates the start offset of the selection
+ * @end: a pointer to an int value indicates the end offset of the selection
+ *
+ * Gets the selection of given text cell.
+ * If the current editing cell is not the given cell, this function
+ * will return FALSE;
+ *
+ * This API is most likely to be used by a11y implementations.
+ *
+ * Returns: whether the action is successful.
+ */
+gboolean
+e_cell_text_get_selection (ECellView *cell_view,
+ gint col,
+ gint row,
+ gint *start,
+ gint *end)
+{
+ ECellTextView *ectv;
+ CellEdit *edit;
+
+ ectv = (ECellTextView *)cell_view;
+ edit = ectv->edit;
+ if (!edit)
+ return FALSE;
+
+ if (edit->view_col != col || edit->row != row)
+ return FALSE;
+
+ if (start)
+ *start = edit->selection_start;
+ if (end)
+ *end = edit->selection_end;
+ return TRUE;
+}
+
+/**
+ * e_cell_text_copy_clipboard:
+ * @cell_view: the given cell view
+ * @col: column of the given cell in the view
+ * @row: row of the given cell in the view
+ *
+ * Copys the selected text to clipboard.
+ *
+ * This API is most likely to be used by a11y implementations.
+ */
+void
+e_cell_text_copy_clipboard (ECellView *cell_view, gint col, gint row)
+{
+ ECellTextView *ectv;
+ CellEdit *edit;
+ ETextEventProcessorCommand command;
+
+ ectv = (ECellTextView *)cell_view;
+ edit = ectv->edit;
+ if (!edit)
+ return;
+
+ if (edit->view_col != col || edit->row != row)
+ return;
+
+ command.action = E_TEP_COPY;
+ command.time = GDK_CURRENT_TIME;
+ e_cell_text_view_command (edit->tep, &command, edit);
+}
+
+/**
+ * e_cell_text_paste_clipboard:
+ * @cell_view: the given cell view
+ * @col: column of the given cell in the view
+ * @row: row of the given cell in the view
+ *
+ * Pastes the text from the clipboardt.
+ *
+ * This API is most likely to be used by a11y implementations.
+ */
+void
+e_cell_text_paste_clipboard (ECellView *cell_view, gint col, gint row)
+{
+ ECellTextView *ectv;
+ CellEdit *edit;
+ ETextEventProcessorCommand command;
+
+ ectv = (ECellTextView *)cell_view;
+ edit = ectv->edit;
+ if (!edit)
+ return;
+
+ if (edit->view_col != col || edit->row != row)
+ return;
+
+ command.action = E_TEP_PASTE;
+ command.time = GDK_CURRENT_TIME;
+ e_cell_text_view_command (edit->tep, &command, edit);
+}
+
+/**
+ * e_cell_text_delete_selection:
+ * @cell_view: the given cell view
+ * @col: column of the given cell in the view
+ * @row: row of the given cell in the view
+ *
+ * Deletes the selected text of the cell.
+ *
+ * This API is most likely to be used by a11y implementations.
+ */
+void
+e_cell_text_delete_selection (ECellView *cell_view, gint col, gint row)
+{
+ ECellTextView *ectv;
+ CellEdit *edit;
+ ETextEventProcessorCommand command;
+
+ ectv = (ECellTextView *)cell_view;
+ edit = ectv->edit;
+ if (!edit)
+ return;
+
+ if (edit->view_col != col || edit->row != row)
+ return;
+
+ command.action = E_TEP_DELETE;
+ command.position = E_TEP_SELECTION;
+ e_cell_text_view_command (edit->tep, &command, edit);
+}
diff --git a/widgets/table/e-cell-text.h b/widgets/table/e-cell-text.h
index 6c51f32fd8..5310ffc5f9 100644
--- a/widgets/table/e-cell-text.h
+++ b/widgets/table/e-cell-text.h
@@ -101,6 +101,21 @@ void e_cell_text_free_text (ECellText *cell, char *text);
/* Sets the ETableModel value, based on the given string. */
void e_cell_text_set_value (ECellText *cell, ETableModel *model, int col, int row, const char *text);
+/* Sets the selection of given text cell */
+gboolean e_cell_text_set_selection (ECellView *cell_view, gint col, gint row, gint start, gint end);
+
+/* Gets the selection of given text cell */
+gboolean e_cell_text_get_selection (ECellView *cell_view, gint col, gint row, gint *start, gint *end);
+
+/* Copys the selected text to the clipboard */
+void e_cell_text_copy_clipboard (ECellView *cell_view, gint col, gint row);
+
+/* Pastes the text from the clipboard */
+void e_cell_text_paste_clipboard (ECellView *cell_view, gint col, gint row);
+
+/* Deletes selected text */
+void e_cell_text_delete_selection (ECellView *cell_view, gint col, gint row);
+
G_END_DECLS
#endif /* _E_CELL_TEXT_H_ */