| 72 ui_window_widget_destroy(obj); |
72 ui_window_widget_destroy(obj); |
| 73 } |
73 } |
| 74 } |
74 } |
| 75 |
75 |
| 76 |
76 |
| 77 static UiObject* create_window(const char *title, void *window_data, Boolean simple) { |
77 static UiObject* create_window(const char *title, Boolean simple) { |
| 78 CxMempool *mp = cxMempoolCreateSimple(256); |
78 CxMempool *mp = cxMempoolCreateSimple(256); |
| 79 const CxAllocator *a = mp->allocator; |
79 const CxAllocator *a = mp->allocator; |
| 80 UiObject *obj = uic_object_new_toplevel(); |
80 UiObject *obj = uic_object_new_toplevel(); |
| 81 obj->window = window_data; |
|
| 82 obj->destroy = ui_window_widget_destroy; |
81 obj->destroy = ui_window_widget_destroy; |
| 83 |
82 |
| 84 int window_width = window_default_width; |
83 int window_width = window_default_width; |
| 85 int window_height = window_default_height; |
84 int window_height = window_default_height; |
| 86 if(!simple) { |
85 if(!simple) { |
| 149 obj->widget = toplevel; |
148 obj->widget = toplevel; |
| 150 nwindows++; |
149 nwindows++; |
| 151 return obj; |
150 return obj; |
| 152 } |
151 } |
| 153 |
152 |
| 154 UiObject* ui_window(const char *title, void *window_data) { |
153 UiObject* ui_window(const char *title) { |
| 155 return create_window(title, window_data, FALSE); |
154 return create_window(title, FALSE); |
| 156 } |
155 } |
| 157 |
156 |
| 158 UiObject* ui_simple_window(const char *title, void *window_data) { |
157 UiObject* ui_simple_window(const char *title) { |
| 159 return create_window(title, window_data, TRUE); |
158 return create_window(title, TRUE); |
| 160 } |
159 } |
| 161 |
160 |
| 162 void ui_window_size(UiObject *obj, int width, int height) { |
161 void ui_window_size(UiObject *obj, int width, int height) { |
| 163 XtVaSetValues(obj->widget, XmNwidth, width, XmNheight, height, NULL); |
162 XtVaSetValues(obj->widget, XmNwidth, width, XmNheight, height, NULL); |
| 164 } |
163 } |