ui/motif/text.c

changeset 27
77b09bb52ca0
parent 22
bcf880b29bc3
child 29
c96169444d88
--- a/ui/motif/text.c	Sat Apr 05 15:53:41 2014 +0200
+++ b/ui/motif/text.c	Sat Apr 05 18:41:30 2014 +0200
@@ -63,6 +63,8 @@
         value->get = ui_textarea_get;
         value->getsubstr = ui_textarea_getsubstr;
         value->insert = ui_textarea_insert;
+        value->position = ui_textarea_position;
+        value->selection = ui_textarea_selection;
         value->value = NULL;
         value->obj = text_area;
         
@@ -116,6 +118,17 @@
     XmTextInsert(text->obj, pos, str);
 }
 
+int ui_textarea_position(UiText *text) {
+    long begin;
+    long end;
+    XmTextGetSelectionPosition(text->obj, &begin, &end);
+    return begin;
+}
+
+void ui_textarea_selection(UiText *text, int *begin, int *end) {
+    XmTextGetSelectionPosition(text->obj, (long*)begin, (long*)end);
+}
+
 UiUndoMgr* ui_create_undomgr() {
     UiUndoMgr *mgr = malloc(sizeof(UiUndoMgr));
     mgr->begin = NULL;

mercurial