aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-cell-text.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-03-05 07:45:29 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-03-05 07:45:29 +0800
commit49ba8c5c71000ccae7f21177e8e18081ac254a31 (patch)
treec33125edb85bd48480f1a59f511b7d4d034b423c /widgets/table/e-cell-text.c
parentf3573fb2c91f02498dab4aa00e3b3ef191756025 (diff)
downloadgsoc2013-evolution-49ba8c5c71000ccae7f21177e8e18081ac254a31.tar.gz
gsoc2013-evolution-49ba8c5c71000ccae7f21177e8e18081ac254a31.tar.zst
gsoc2013-evolution-49ba8c5c71000ccae7f21177e8e18081ac254a31.zip
added "editable" Arg, to stop the user from editing the text. The user can
2001-03-04 Damon Chaplin <damon@ximian.com> * e-cell-text.c: added "editable" Arg, to stop the user from editing the text. The user can still select the text, though. The "editable" Arg is useful for ECellCombo where we want the user to select an item in the popup but not edit the field itself. * e-cell-combo.c: updated to select the matcing item before it pops up the list. svn path=/trunk/; revision=8544
Diffstat (limited to 'widgets/table/e-cell-text.c')
-rw-r--r--widgets/table/e-cell-text.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 2db05f7320..969e17f84f 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -66,6 +66,7 @@ enum {
ARG_STRIKEOUT_COLUMN,
ARG_BOLD_COLUMN,
ARG_COLOR_COLUMN,
+ ARG_EDITABLE,
};
@@ -1324,6 +1325,10 @@ ect_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
text->color_column = GTK_VALUE_INT (*arg);
break;
+ case ARG_EDITABLE:
+ text->editable = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
+ break;
+
default:
return;
}
@@ -1350,6 +1355,10 @@ ect_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
GTK_VALUE_INT (*arg) = text->color_column;
break;
+ case ARG_EDITABLE:
+ GTK_VALUE_BOOL (*arg) = text->editable ? TRUE : FALSE;
+ break;
+
default:
arg->type = GTK_TYPE_INVALID;
break;
@@ -1392,6 +1401,8 @@ e_cell_text_class_init (GtkObjectClass *object_class)
GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_BOLD_COLUMN);
gtk_object_add_arg_type ("ECellText::color_column",
GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_COLOR_COLUMN);
+ gtk_object_add_arg_type ("ECellText::editable",
+ GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE);
if (!clipboard_atom)
clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
@@ -1405,6 +1416,7 @@ e_cell_text_init (ECellText *ect)
ect->strikeout_column = -1;
ect->bold_column = -1;
ect->color_column = -1;
+ ect->editable = TRUE;
}
E_MAKE_TYPE(e_cell_text, "ECellText", ECellText, e_cell_text_class_init, e_cell_text_init, PARENT_TYPE);
@@ -1888,6 +1900,7 @@ e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProcessorCommand *
CellEdit *edit = (CellEdit *) data;
CurrentCell *cell = CURRENT_CELL(edit);
ECellTextView *text_view = cell->text_view;
+ ECellText *ect = E_CELL_TEXT (text_view->cell_view.ecell);
gboolean change = FALSE;
gboolean redraw = FALSE;
@@ -1897,6 +1910,14 @@ e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProcessorCommand *
font = text_view->font;
+ /* If the EText isn't editable, then ignore any commands that would
+ modify the text. */
+ if (!ect->editable && (command->action == E_TEP_DELETE
+ || command->action == E_TEP_INSERT
+ || command->action == E_TEP_PASTE
+ || command->action == E_TEP_GET_SELECTION))
+ return;
+
switch (command->action) {
case E_TEP_MOVE:
edit->selection_start = _get_position (text_view, command);