ui/gtk/text.h

branch
newapi
changeset 174
0358f1d9c506
parent 163
b70e2a77dea0
child 253
087cc9216f28
equal deleted inserted replaced
173:809581724cc7 174:0358f1d9c506
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 #include <cx/linked_list.h>
35 #include "../common/context.h" 35 #include "../common/context.h"
36 36
37 #ifdef __cplusplus 37 #ifdef __cplusplus
38 extern "C" { 38 extern "C" {
39 #endif 39 #endif
40 40
41 #define UI_TEXTBUF_INSERT 0 41 #define UI_TEXTBUF_INSERT 0
42 #define UI_TEXTBUF_DELETE 1 42 #define UI_TEXTBUF_DELETE 1
43 typedef struct UiTextBufOp { 43
44 typedef struct UiTextBufOp UiTextBufOp;
45 struct UiTextBufOp {
46 UiTextBufOp *prev;
47 UiTextBufOp *next;
44 int type; // UI_TEXTBUF_INSERT, UI_TEXTBUF_DELETE 48 int type; // UI_TEXTBUF_INSERT, UI_TEXTBUF_DELETE
45 int start; 49 int start;
46 int end; 50 int end;
47 int len; 51 int len;
48 char *text; 52 char *text;
49 } UiTextBufOp; 53 };
50 54
51 typedef struct UiUndoMgr { 55 typedef struct UiUndoMgr {
52 UcxList *begin; 56 UiTextBufOp *begin;
53 UcxList *cur; 57 UiTextBufOp *end;
54 int length; 58 UiTextBufOp *cur;
55 int event; 59 int length;
60 int event;
56 } UiUndoMgr; 61 } UiUndoMgr;
57 62
58 typedef struct UiTextArea { 63 typedef struct UiTextArea {
59 UiContext *ctx; 64 UiContext *ctx;
60 UiVar *var; 65 UiVar *var;
93 GtkTextBuffer *textbuffer, 98 GtkTextBuffer *textbuffer,
94 GtkTextIter *start, 99 GtkTextIter *start,
95 GtkTextIter *end, 100 GtkTextIter *end,
96 void *data); 101 void *data);
97 UiUndoMgr* ui_create_undomgr(); 102 UiUndoMgr* ui_create_undomgr();
103 void ui_destroy_undomgr(UiUndoMgr *mgr);
98 void ui_free_textbuf_op(UiTextBufOp *op); 104 void ui_free_textbuf_op(UiTextBufOp *op);
99 int ui_check_insertstr(char *oldstr, int oldlen, char *newstr, int newlen); 105 int ui_check_insertstr(char *oldstr, int oldlen, char *newstr, int newlen);
100 106
101 void ui_textfield_destroy(GtkWidget *object, UiTextField *textfield); 107 void ui_textfield_destroy(GtkWidget *object, UiTextField *textfield);
102 void ui_textfield_changed(GtkEditable *editable, UiTextField *textfield); 108 void ui_textfield_changed(GtkEditable *editable, UiTextField *textfield);

mercurial