ui/server/window.c

changeset 990
38a48b756d80
parent 986
6f7600c2b9e1
child 991
ab3125bd8b5f
equal deleted inserted replaced
989:cd1ccc0d3d05 990:38a48b756d80
95 cxBufferPutString(&buf, " \"title\":\""); 95 cxBufferPutString(&buf, " \"title\":\"");
96 cxBufferWrite(w->title.ptr, 1, w->title.length, &buf); 96 cxBufferWrite(w->title.ptr, 1, w->title.length, &buf);
97 cxBufferPutString(&buf, "\""); 97 cxBufferPutString(&buf, "\"");
98 } 98 }
99 99
100 size_t numchildren = cxListSize(w->widget.children); 100 ui_serialize_children(&w->widget, &buf);
101 if(numchildren > 0) {
102 cxBufferPutString(&buf, ",\"children\":[");
103 CxIterator i = cxListIterator(w->widget.children);
104 cx_foreach(UiWidget *, child, i) {
105 cxmutstr child_str = child->serialize(child);
106 cxBufferWrite(child_str.ptr, 1, child_str.length, &buf);
107 if(i.index+1 < numchildren) {
108 cxBufferPut(&buf, ',');
109 }
110 }
111 cxBufferPutString(&buf, "]");
112 }
113 101
114 cxBufferPutString(&buf, "}\n"); 102 cxBufferPutString(&buf, "}\n");
115 103
116 return cx_mutstrn(buf.space, buf.size); 104 return cx_mutstrn(buf.space, buf.size);
117 } 105 }

mercurial