| 123 UiSrvObj* ui_create_server_object(UiContext *ctx) { |
123 UiSrvObj* ui_create_server_object(UiContext *ctx) { |
| 124 const CxAllocator *a = ctx->allocator; |
124 const CxAllocator *a = ctx->allocator; |
| 125 UiSrvObj *obj = cxZalloc(a, sizeof(UiSrvObj)); |
125 UiSrvObj *obj = cxZalloc(a, sizeof(UiSrvObj)); |
| 126 |
126 |
| 127 char id[32]; |
127 char id[32]; |
| 128 snprintf(id, 32, "%" PRIu64, srv_obj_id_counter++); |
128 snprintf(id, 32, "%" PRIx64, srv_obj_id_counter++); |
| 129 obj->id = cx_strdup_a(a, id); |
129 obj->id = cx_strdup_a(a, id); |
| 130 obj->ctx = ctx; |
130 obj->ctx = ctx; |
| 131 |
131 |
| 132 obj->widgets = cxHashMapCreate(a, CX_STORE_POINTERS, 64); |
132 obj->widgets = cxHashMapCreate(a, CX_STORE_POINTERS, 64); |
| 133 |
133 |
| 136 |
136 |
| 137 void ui_reg_widget(UiWidget *widget) { |
137 void ui_reg_widget(UiWidget *widget) { |
| 138 UiSrvObj *obj = widget->obj; |
138 UiSrvObj *obj = widget->obj; |
| 139 |
139 |
| 140 char id[32]; |
140 char id[32]; |
| 141 snprintf(id, 32, "%" PRIu64, obj->widget_id_counter++); |
141 snprintf(id, 32, "%" PRIx64, obj->widget_id_counter++); |
| 142 |
142 |
| 143 widget->id = cx_strdup_a(widget->obj->ctx->allocator, cx_str(id)); |
143 widget->id = cx_strdup_a(widget->obj->ctx->allocator, cx_str(id)); |
| 144 cxMapPut(obj->widgets, id, widget); |
144 cxMapPut(obj->widgets, id, widget); |
| 145 } |
145 } |
| 146 |
|