--- a/ui/motif/text.h Fri Mar 28 20:03:01 2014 +0100 +++ b/ui/motif/text.h Fri Mar 28 20:03:49 2014 +0100 @@ -31,14 +31,36 @@ #include "../ui/text.h" #include "toolkit.h" +#include "../../ucx/list.h" #ifdef __cplusplus extern "C" { #endif +#define UI_TEXTBUF_INSERT 0 +#define UI_TEXTBUF_DELETE 1 +typedef struct UiTextBufOp { + int type; // UI_TEXTBUF_INSERT, UI_TEXTBUF_DELETE + int start; + int end; + int len; + char *text; +} UiTextBufOp; + +typedef struct UiUndoMgr { + UcxList *begin; + UcxList *cur; + int length; + int event; +} UiUndoMgr; + char* ui_textarea_get(UiText *text); void ui_textarea_set(UiText *text, char *str); +UiUndoMgr* ui_create_undomgr(); +void ui_text_modify_callback(Widget widget, UiText *value, XtPointer data); +int ui_check_insertstr(char *oldstr, int oldlen, char *newstr, int newlen); +void ui_free_textbuf_op(UiTextBufOp *op); #ifdef __cplusplus }