aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@helixcode.com>2000-12-29 14:39:54 +0800
committerMiguel de Icaza <miguel@src.gnome.org>2000-12-29 14:39:54 +0800
commite6751a0011e1e265f520518b5f6c5e46267fc849 (patch)
treee0087151ade20c0c1607d5c08d0797e256a4e794
parent5ba789a65320e708d2ee38a1cc196ea5cc7cf99b (diff)
downloadgsoc2013-evolution-e6751a0011e1e265f520518b5f6c5e46267fc849.tar
gsoc2013-evolution-e6751a0011e1e265f520518b5f6c5e46267fc849.tar.gz
gsoc2013-evolution-e6751a0011e1e265f520518b5f6c5e46267fc849.tar.bz2
gsoc2013-evolution-e6751a0011e1e265f520518b5f6c5e46267fc849.tar.lz
gsoc2013-evolution-e6751a0011e1e265f520518b5f6c5e46267fc849.tar.xz
gsoc2013-evolution-e6751a0011e1e265f520518b5f6c5e46267fc849.tar.zst
gsoc2013-evolution-e6751a0011e1e265f520518b5f6c5e46267fc849.zip
Add support here for "cursor_pos". (et_get_arg): Handle ARG_CURSOR_POS.
2000-12-29 Miguel de Icaza <miguel@helixcode.com> * gal/e-text/e-entry.c: Add support here for "cursor_pos". (et_get_arg): Handle ARG_CURSOR_POS. (et_set_arg): ditto. * gal/e-text/e-text.c: Add new argument: "cursor_pos". (e_text_get_arg): Handle ARG_CURSOR_POS. (e_text_set_arg): Handle ARG_CURSOR_POS. (e_text_class_init): Add. svn path=/trunk/; revision=7192
-rw-r--r--widgets/text/e-entry.c20
-rw-r--r--widgets/text/e-text.c20
2 files changed, 35 insertions, 5 deletions
diff --git a/widgets/text/e-entry.c b/widgets/text/e-entry.c
index 93c3ffd936..44a20bb6f9 100644
--- a/widgets/text/e-entry.c
+++ b/widgets/text/e-entry.c
@@ -65,6 +65,7 @@ enum {
ARG_ALLOW_NEWLINES,
ARG_DRAW_BORDERS,
ARG_DRAW_BACKGROUND,
+ ARG_CURSOR_POS
};
static void
@@ -283,7 +284,12 @@ et_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
"draw_background", &GTK_VALUE_BOOL (*arg),
NULL);
break;
-
+
+ case ARG_CURSOR_POS:
+ gtk_object_get (item,
+ "cursor_pos", &GTK_VALUE_INT (*arg),
+ NULL);
+
default:
arg->type = GTK_TYPE_INVALID;
break;
@@ -418,10 +424,14 @@ et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
break;
}
- case ARG_DRAW_BACKGROUND:
+ case ARG_CURSOR_POS:
gtk_object_set (item,
- "draw_background", GTK_VALUE_BOOL (*arg),
- NULL);
+ "cursor_pos", GTK_VALUE_INT (*arg), NULL);
+ break;
+
+ case ARG_DRAW_BACKGROUND:
+ gtk_object_set (item, "draw_background",
+ GTK_VALUE_BOOL (*arg), NULL);
break;
}
}
@@ -497,6 +507,8 @@ e_entry_class_init (GtkObjectClass *object_class)
GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BORDERS);
gtk_object_add_arg_type ("EEntry::draw_background",
GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BACKGROUND);
+ gtk_object_add_arg_type ("EEntry::cursor_pos",
+ GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_CURSOR_POS);
}
E_MAKE_TYPE(e_entry, "EEntry", EEntry, e_entry_class_init, e_entry_init, PARENT_TYPE);
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index e9a448b9c2..fc07a6c78e 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -86,7 +86,8 @@ enum {
ARG_HEIGHT,
ARG_DRAW_BORDERS,
ARG_ALLOW_NEWLINES,
- ARG_DRAW_BACKGROUND
+ ARG_DRAW_BACKGROUND,
+ ARG_CURSOR_POS
};
@@ -286,6 +287,8 @@ e_text_class_init (ETextClass *klass)
GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_NEWLINES);
gtk_object_add_arg_type ("EText::draw_background",
GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BACKGROUND);
+ gtk_object_add_arg_type ("EText::cursor_pos",
+ GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_CURSOR_POS);
if (!clipboard_atom)
clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
@@ -1303,6 +1306,17 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
NULL);
break;
+ case ARG_CURSOR_POS: {
+ ETextEventProcessorCommand command;
+
+ command.action = E_TEP_MOVE;
+ command.position = E_TEP_VALUE;
+ command.value = GTK_VALUE_INT (*arg);
+ command.time = GDK_CURRENT_TIME;
+ e_text_command (text->tep, &command, text);
+ break;
+ }
+
default:
return;
}
@@ -1457,6 +1471,10 @@ e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
}
break;
+ case ARG_CURSOR_POS:
+ GTK_VALUE_INT (*arg) = text->selection_start;
+ break;
+
default:
arg->type = GTK_TYPE_INVALID;
break;