ui/motif/text.c

changeset 131
774b741984a2
parent 122
e82b01d17a78
child 153
ee49d1852a5f
equal deleted inserted replaced
130:212b63dd61be 131:774b741984a2
155 155
156 int ui_textarea_length(UiText *text) { 156 int ui_textarea_length(UiText *text) {
157 return (int)XmTextGetLastPosition(text->obj); 157 return (int)XmTextGetLastPosition(text->obj);
158 } 158 }
159 159
160
161 void ui_text_set(UiText *text, char *str) {
162 if(text->set) {
163 text->set(text, str);
164 } else {
165 if(text->value) {
166 XtFree(text->value);
167 }
168 text->value = XtNewString(str);
169 }
170 }
171
172 char* ui_text_get(UiText *text) {
173 if(text->get) {
174 return text->get(text);
175 } else {
176 return text->value;
177 }
178 }
179
180
160 UiUndoMgr* ui_create_undomgr() { 181 UiUndoMgr* ui_create_undomgr() {
161 UiUndoMgr *mgr = malloc(sizeof(UiUndoMgr)); 182 UiUndoMgr *mgr = malloc(sizeof(UiUndoMgr));
162 mgr->begin = NULL; 183 mgr->begin = NULL;
163 mgr->cur = NULL; 184 mgr->cur = NULL;
164 mgr->length = 0; 185 mgr->length = 0;

mercurial