32 #include <stdbool.h> |
32 #include <stdbool.h> |
33 |
33 |
34 #include "window.h" |
34 #include "window.h" |
35 |
35 |
36 |
36 |
|
37 void application_init(void) { |
|
38 application_create_menu(); |
|
39 } |
|
40 |
37 |
41 |
38 void application_startup(UiEvent* event, void* data) { |
42 void application_startup(UiEvent* event, void* data) { |
39 application_create_menu(); |
43 UiObject* win = window_create(); |
40 |
44 |
41 UiObject* win = window_create(); |
45 DavApp* app = application_create_app_document(); |
|
46 UiContext* global = ui_global_context(); |
|
47 ui_attach_document(global, app); |
|
48 |
42 ui_show(win); |
49 ui_show(win); |
43 } |
50 } |
44 |
51 |
45 void application_create_menu(void) { |
52 void application_create_menu(void) { |
|
53 // menu |
46 |
54 |
|
55 |
|
56 // toolbar |
|
57 ui_toolbar_item("Home", .label = "Home", .icon = "Home"); |
|
58 |
|
59 ui_toolbar_menu("Repo", .label = "Repository") { |
|
60 ui_menu_itemlist(.varname = "repolist"); |
|
61 } |
|
62 |
|
63 ui_toolbar_add_default("Home", UI_TOOLBAR_LEFT); |
|
64 ui_toolbar_add_default("Repo", UI_TOOLBAR_LEFT); |
47 } |
65 } |
48 |
66 |
49 |
67 |
50 DavApp* application_create_app_document(void) { |
68 DavApp* application_create_app_document(void) { |
51 DavApp* doc = ui_document_new(sizeof(DavApp)); |
69 DavApp* doc = ui_document_new(sizeof(DavApp)); |
|
70 UiContext* ctx = ui_document_context(doc); |
|
71 doc->repos = ui_list_new(ctx, "repolist"); |
|
72 |
|
73 ui_list_append(doc->repos, "test"); |
|
74 |
|
75 |
|
76 |
52 return doc; |
77 return doc; |
53 } |
78 } |