ui/motif/text.c

changeset 27
77b09bb52ca0
parent 22
bcf880b29bc3
child 29
c96169444d88
equal deleted inserted replaced
26:a137277f9173 27:77b09bb52ca0
61 if(value) { 61 if(value) {
62 value->set = ui_textarea_set; 62 value->set = ui_textarea_set;
63 value->get = ui_textarea_get; 63 value->get = ui_textarea_get;
64 value->getsubstr = ui_textarea_getsubstr; 64 value->getsubstr = ui_textarea_getsubstr;
65 value->insert = ui_textarea_insert; 65 value->insert = ui_textarea_insert;
66 value->position = ui_textarea_position;
67 value->selection = ui_textarea_selection;
66 value->value = NULL; 68 value->value = NULL;
67 value->obj = text_area; 69 value->obj = text_area;
68 70
69 if(!value->undomgr) { 71 if(!value->undomgr) {
70 value->undomgr = ui_create_undomgr(); 72 value->undomgr = ui_create_undomgr();
112 if(text->value) { 114 if(text->value) {
113 XtFree(text->value); 115 XtFree(text->value);
114 } 116 }
115 text->value = NULL; 117 text->value = NULL;
116 XmTextInsert(text->obj, pos, str); 118 XmTextInsert(text->obj, pos, str);
119 }
120
121 int ui_textarea_position(UiText *text) {
122 long begin;
123 long end;
124 XmTextGetSelectionPosition(text->obj, &begin, &end);
125 return begin;
126 }
127
128 void ui_textarea_selection(UiText *text, int *begin, int *end) {
129 XmTextGetSelectionPosition(text->obj, (long*)begin, (long*)end);
117 } 130 }
118 131
119 UiUndoMgr* ui_create_undomgr() { 132 UiUndoMgr* ui_create_undomgr() {
120 UiUndoMgr *mgr = malloc(sizeof(UiUndoMgr)); 133 UiUndoMgr *mgr = malloc(sizeof(UiUndoMgr));
121 mgr->begin = NULL; 134 mgr->begin = NULL;

mercurial