29 #ifndef TEXT_H |
29 #ifndef TEXT_H |
30 #define TEXT_H |
30 #define TEXT_H |
31 |
31 |
32 #include "../ui/text.h" |
32 #include "../ui/text.h" |
33 #include "toolkit.h" |
33 #include "toolkit.h" |
|
34 #include "../../ucx/list.h" |
34 |
35 |
35 #ifdef __cplusplus |
36 #ifdef __cplusplus |
36 extern "C" { |
37 extern "C" { |
37 #endif |
38 #endif |
38 |
39 |
|
40 #define UI_TEXTBUF_INSERT 0 |
|
41 #define UI_TEXTBUF_DELETE 1 |
|
42 typedef struct UiTextBufOp { |
|
43 int type; // UI_TEXTBUF_INSERT, UI_TEXTBUF_DELETE |
|
44 int start; |
|
45 int end; |
|
46 int len; |
|
47 char *text; |
|
48 } UiTextBufOp; |
|
49 |
|
50 typedef struct UiUndoMgr { |
|
51 UcxList *begin; |
|
52 UcxList *cur; |
|
53 int length; |
|
54 int event; |
|
55 } UiUndoMgr; |
|
56 |
39 char* ui_textarea_get(UiText *text); |
57 char* ui_textarea_get(UiText *text); |
40 void ui_textarea_set(UiText *text, char *str); |
58 void ui_textarea_set(UiText *text, char *str); |
41 |
59 |
|
60 UiUndoMgr* ui_create_undomgr(); |
|
61 void ui_text_modify_callback(Widget widget, UiText *value, XtPointer data); |
|
62 int ui_check_insertstr(char *oldstr, int oldlen, char *newstr, int newlen); |
|
63 void ui_free_textbuf_op(UiTextBufOp *op); |
42 |
64 |
43 #ifdef __cplusplus |
65 #ifdef __cplusplus |
44 } |
66 } |
45 #endif |
67 #endif |
46 |
68 |