ui/common/object.c

branch
newapi
changeset 404
384f6d1f5784
parent 384
8be7fd628fbc
child 406
0ebf9d7b23e8
equal deleted inserted replaced
403:b59935b2de79 404:384f6d1f5784
30 #include <stdlib.h> 30 #include <stdlib.h>
31 31
32 #include "object.h" 32 #include "object.h"
33 #include "context.h" 33 #include "context.h"
34 34
35 #include "../ui/container.h"
36
35 void ui_end(UiObject *obj) { 37 void ui_end(UiObject *obj) {
36 if(!obj->next) { 38 if(!obj->next) {
37 return; 39 return;
38 } 40 }
39 41
45 47
46 if(prev) { 48 if(prev) {
47 // TODO: free last obj 49 // TODO: free last obj
48 prev->next = NULL; 50 prev->next = NULL;
49 } 51 }
52 }
53
54 void ui_end_new(UiObject *obj) {
55 if(!obj->container_end) {
56 return;
57 }
58 UiContainerX *rm = obj->container_end;
59 uic_object_pop_container(obj);
60 ui_free(obj->ctx, rm);
50 } 61 }
51 62
52 void ui_object_ref(UiObject *obj) { 63 void ui_object_ref(UiObject *obj) {
53 obj->ref++; 64 obj->ref++;
54 } 65 }
107 } 118 }
108 119
109 UiContainer* uic_get_current_container(UiObject *obj) { 120 UiContainer* uic_get_current_container(UiObject *obj) {
110 return uic_current_obj(obj)->container; 121 return uic_current_obj(obj)->container;
111 } 122 }
123
124 void uic_object_push_container(UiObject *toplevel, UiContainerX *newcontainer) {
125 newcontainer->prev = toplevel->container_end;
126 if(toplevel->container_end) {
127 toplevel->container_end->next = newcontainer;
128 toplevel->container_end = newcontainer;
129 } else {
130 toplevel->container_begin = newcontainer;
131 toplevel->container_end = newcontainer;
132 }
133 }
134
135 void uic_object_pop_container(UiObject *toplevel) {
136 toplevel->container_end = toplevel->container_end->prev;
137 if(toplevel->container_end) {
138 toplevel->container_end->next = NULL;
139 } else {
140 toplevel->container_begin = NULL;
141 }
142 }

mercurial