32 |
32 |
33 #include "../ui/window.h" |
33 #include "../ui/window.h" |
34 #include "../ui/properties.h" |
34 #include "../ui/properties.h" |
35 #include "../common/context.h" |
35 #include "../common/context.h" |
36 |
36 |
37 #include <cx/basic_mempool.h> |
37 #include <cx/mempool.h> |
38 |
38 |
39 #include "menu.h" |
39 #include "menu.h" |
40 #include "toolbar.h" |
40 #include "toolbar.h" |
41 #include "container.h" |
41 #include "container.h" |
42 |
42 |
65 gtk_main_quit(); |
65 gtk_main_quit(); |
66 } |
66 } |
67 #endif |
67 #endif |
68 } |
68 } |
69 |
69 |
70 static UiObject* create_window(char *title, void *window_data, UiBool simple) { |
70 static UiObject* create_window(const char *title, void *window_data, UiBool simple) { |
71 CxMempool *mp = cxBasicMempoolCreate(256); |
71 CxMempool *mp = cxBasicMempoolCreate(256); |
72 UiObject *obj = cxCalloc(mp->allocator, 1, sizeof(UiObject)); |
72 UiObject *obj = cxCalloc(mp->allocator, 1, sizeof(UiObject)); |
73 |
73 |
74 #ifndef UI_GTK2 |
74 #ifndef UI_GTK2 |
75 obj->widget = gtk_application_window_new(ui_get_application()); |
75 obj->widget = gtk_application_window_new(ui_get_application()); |
76 #else |
76 #else |
77 obj->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
77 obj->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
78 #endif |
78 #endif |
79 |
79 |
80 |
80 |
81 obj->ctx = uic_context(obj, mp->allocator); |
81 obj->ctx = uic_context(obj, mp); |
82 obj->window = window_data; |
82 obj->window = window_data; |
83 |
83 |
84 if(title != NULL) { |
84 if(title != NULL) { |
85 gtk_window_set_title(GTK_WINDOW(obj->widget), title); |
85 gtk_window_set_title(GTK_WINDOW(obj->widget), title); |
86 } |
86 } |
136 nwindows++; |
136 nwindows++; |
137 return obj; |
137 return obj; |
138 } |
138 } |
139 |
139 |
140 |
140 |
141 UiObject* ui_window(char *title, void *window_data) { |
141 UiObject* ui_window(const char *title, void *window_data) { |
142 return create_window(title, window_data, FALSE); |
142 return create_window(title, window_data, FALSE); |
143 } |
143 } |
144 |
144 |
145 UiObject* ui_simplewindow(char *title, void *window_data) { |
145 UiObject* ui_simplewindow(const char *title, void *window_data) { |
146 return create_window(title, window_data, TRUE); |
146 return create_window(title, window_data, TRUE); |
147 } |
147 } |
148 |
148 |
149 static char* ui_gtkfilechooser(UiObject *obj, GtkFileChooserAction action) { |
149 static char* ui_gtkfilechooser(UiObject *obj, GtkFileChooserAction action) { |
150 char *button; |
150 char *button; |