| 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 } |