ui/server/button.c

changeset 1033
eda1ff20cb27
parent 1016
ccde46662db7
equal deleted inserted replaced
1032:9136db051f28 1033:eda1ff20cb27
35 #include "widget.h" 35 #include "widget.h"
36 #include "var.h" 36 #include "var.h"
37 37
38 cxmutstr ui_button_args_to_string(UiContext *ctx, UiButtonArgs *args) { 38 cxmutstr ui_button_args_to_string(UiContext *ctx, UiButtonArgs *args) {
39 CxBuffer buf; 39 CxBuffer buf;
40 cxBufferInit(&buf, NULL, 256, ctx->allocator, CX_BUFFER_AUTO_EXTEND | CX_BUFFER_FREE_CONTENTS); 40 cxBufferInit(&buf, ctx->allocator, NULL, 256, CX_BUFFER_AUTO_EXTEND | CX_BUFFER_FREE_CONTENTS);
41 41
42 cxBufferPutString(&buf, "{"); 42 cxBufferPutString(&buf, "{");
43 43
44 UI_STANDARD_ARGS(&buf, args); 44 UI_STANDARD_ARGS(&buf, args);
45 UI_LABEL_ARGS(&buf, args); 45 UI_LABEL_ARGS(&buf, args);
52 return cx_mutstrn(buf.space, buf.size); 52 return cx_mutstrn(buf.space, buf.size);
53 } 53 }
54 54
55 cxmutstr ui_toggle_args_to_string(UiContext *ctx, UiToggleArgs *args, cxmutstr value) { 55 cxmutstr ui_toggle_args_to_string(UiContext *ctx, UiToggleArgs *args, cxmutstr value) {
56 CxBuffer buf; 56 CxBuffer buf;
57 cxBufferInit(&buf, NULL, 256, ctx->allocator, CX_BUFFER_AUTO_EXTEND | CX_BUFFER_FREE_CONTENTS); 57 cxBufferInit(&buf, ctx->allocator, NULL, 256, CX_BUFFER_AUTO_EXTEND | CX_BUFFER_FREE_CONTENTS);
58 58
59 cxBufferPutString(&buf, "{"); 59 cxBufferPutString(&buf, "{");
60 60
61 UI_STANDARD_ARGS(&buf, args); 61 UI_STANDARD_ARGS(&buf, args);
62 UI_LABEL_ARGS(&buf, args); 62 UI_LABEL_ARGS(&buf, args);
87 return (UiWidget*)widget; 87 return (UiWidget*)widget;
88 } 88 }
89 89
90 cxmutstr ui_button_serialize(UiCallbackWidget *w) { 90 cxmutstr ui_button_serialize(UiCallbackWidget *w) {
91 CxBuffer buf; 91 CxBuffer buf;
92 cxBufferInit(&buf, NULL, 1024, NULL, CX_BUFFER_AUTO_EXTEND | CX_BUFFER_FREE_CONTENTS); 92 cxBufferInit(&buf, cxDefaultAllocator, NULL, 1024, CX_BUFFER_AUTO_EXTEND | CX_BUFFER_FREE_CONTENTS);
93 93
94 cxBufferPutString(&buf, "{"); 94 cxBufferPutString(&buf, "{");
95 ui_serialize_type_obj_id(&w->widget, &buf); 95 ui_serialize_type_obj_id(&w->widget, &buf);
96 cxBufferPutString(&buf, ",\"args\":"); 96 cxBufferPutString(&buf, ",\"args\":");
97 cxBufferPutString(&buf, w->widget.args.ptr); 97 cxBufferPutString(&buf, w->widget.args.ptr);

mercurial