| 34 #include <cx/list.h> |
34 #include <cx/list.h> |
| 35 #include <cx/array_list.h> |
35 #include <cx/array_list.h> |
| 36 #include "../ui/tree.h" |
36 #include "../ui/tree.h" |
| 37 #include "types.h" |
37 #include "types.h" |
| 38 #include "context.h" |
38 #include "context.h" |
| |
39 #include "../ui/image.h" |
| 39 |
40 |
| 40 |
41 |
| 41 |
42 |
| 42 UiObserver* ui_observer_new(ui_callback f, void *data) { |
43 UiObserver* ui_observer_new(ui_callback f, void *data) { |
| 43 UiObserver *observer = malloc(sizeof(UiObserver)); |
44 UiObserver *observer = malloc(sizeof(UiObserver)); |
| 393 } |
394 } |
| 394 } |
395 } |
| 395 } |
396 } |
| 396 } |
397 } |
| 397 |
398 |
| |
399 void ui_image_set(UiGeneric *g, void *img) { |
| |
400 // TODO: ref? |
| |
401 if(g->set) { |
| |
402 g->set(g, img, UI_IMAGE_OBJECT_TYPE); |
| |
403 } else { |
| |
404 g->value = img; |
| |
405 g->type = UI_IMAGE_OBJECT_TYPE; |
| |
406 } |
| |
407 } |
| |
408 |
| |
409 void* ui_image_get(UiGeneric *g) { |
| |
410 if(g->type) { |
| |
411 if(!strcmp(g->type, UI_IMAGE_OBJECT_TYPE)) { |
| |
412 return g->value; |
| |
413 } else { |
| |
414 return NULL; |
| |
415 } |
| |
416 } |
| |
417 return g->value; |
| |
418 } |
| |
419 |
| |
420 |
| 398 char* ui_text_get(UiText* s) { |
421 char* ui_text_get(UiText* s) { |
| 399 if (s) { |
422 if (s) { |
| 400 return s->get ? s->get(s) : s->value.ptr; |
423 return s->get ? s->get(s) : s->value.ptr; |
| 401 } |
424 } |
| 402 else { |
425 else { |