ui/common/app.c

changeset 1182
ec28b0c22af0
parent 956
4cdfbfd2038d
equal deleted inserted replaced
1181:469929a55765 1182:ec28b0c22af0
28 28
29 #include "app.h" 29 #include "app.h"
30 30
31 static ui_callback startup_func; 31 static ui_callback startup_func;
32 static void *startup_data; 32 static void *startup_data;
33 static ui_callback newwindow_func;
34 static void *newwindow_data;
33 static ui_callback open_func; 35 static ui_callback open_func;
34 void *open_data; 36 void *open_data;
35 static ui_callback exit_func; 37 static ui_callback exit_func;
36 void *exit_data; 38 void *exit_data;
37 39
38 40
39 void ui_onstartup(ui_callback f, void *userdata) { 41 void ui_onstartup(ui_callback f, void *userdata) {
40 startup_func = f; 42 startup_func = f;
41 startup_data = userdata; 43 startup_data = userdata;
44 }
45
46 void ui_onnewwindow(ui_callback f, void *userdata) {
47 newwindow_func = f;
48 newwindow_data = userdata;
42 } 49 }
43 50
44 void ui_onopen(ui_callback f, void *userdata) { 51 void ui_onopen(ui_callback f, void *userdata) {
45 open_func = f; 52 open_func = f;
46 open_data = userdata; 53 open_data = userdata;
56 if(startup_func) { 63 if(startup_func) {
57 startup_func(event, startup_data); 64 startup_func(event, startup_data);
58 } 65 }
59 } 66 }
60 67
68 void uic_application_newwindow(UiEvent *event) {
69 if(newwindow_func) {
70 newwindow_func(event, newwindow_data);
71 }
72 }
73
61 void uic_application_open(UiEvent *event) { 74 void uic_application_open(UiEvent *event) {
62 if(open_func) { 75 if(open_func) {
63 open_func(event, open_data); 76 open_func(event, open_data);
64 } 77 }
65 } 78 }
67 void uic_application_exit(UiEvent *event) { 80 void uic_application_exit(UiEvent *event) {
68 if(exit_func) { 81 if(exit_func) {
69 exit_func(event, exit_data); 82 exit_func(event, exit_data);
70 } 83 }
71 } 84 }
85
86 void ui_newwindow(void) {
87 uic_application_newwindow(NULL);
88 }

mercurial