36 #include "../common/document.h" |
36 #include "../common/document.h" |
37 #include "../common/properties.h" |
37 #include "../common/properties.h" |
38 |
38 |
39 static const char *application_name; |
39 static const char *application_name; |
40 |
40 |
|
41 static ui_callback startup_func; |
|
42 static void *startup_data; |
|
43 static ui_callback open_func; |
|
44 void *open_data; |
|
45 static ui_callback exit_func; |
|
46 void *exit_data; |
|
47 |
41 static ui_callback appclose_fnc; |
48 static ui_callback appclose_fnc; |
42 static void *appclose_udata; |
49 static void *appclose_udata; |
43 |
50 |
44 //static QApplication app(qargc, qargv); |
51 static int is_toplevel_realized = 0; |
|
52 |
45 int app_argc; |
53 int app_argc; |
46 char **app_argv; |
54 char **app_argv; |
47 QApplication *application = NULL; |
55 QApplication *application = NULL; |
48 |
56 |
49 void ui_init(const char *appname, int argc, char **argv) { |
57 void ui_init(const char *appname, int argc, char **argv) { |
61 |
69 |
62 const char* ui_appname() { |
70 const char* ui_appname() { |
63 return application_name; |
71 return application_name; |
64 } |
72 } |
65 |
73 |
66 void ui_exitfunc(ui_callback f, void *udata) { |
74 void ui_onstartup(ui_callback f, void *userdata) { |
67 appclose_fnc = f; |
75 startup_func = f; |
68 appclose_udata = udata; |
76 startup_data = userdata; |
69 } |
77 } |
70 |
78 |
71 void ui_openfilefunc(ui_callback f, void *userdata) { |
79 void ui_onopen(ui_callback f, void *userdata) { |
72 // OS X only |
80 open_func = f; |
|
81 open_data = userdata; |
|
82 } |
|
83 |
|
84 void ui_onexit(ui_callback f, void *userdata) { |
|
85 exit_func = f; |
|
86 exit_data = userdata; |
73 } |
87 } |
74 |
88 |
75 void ui_main() { |
89 void ui_main() { |
76 application->exec(); |
90 application->exec(); |
77 |
91 |