| 36 #include "../ui/window.h" |
36 #include "../ui/window.h" |
| 37 #include "../ui/properties.h" |
37 #include "../ui/properties.h" |
| 38 #include "../common/context.h" |
38 #include "../common/context.h" |
| 39 #include "../common/menu.h" |
39 #include "../common/menu.h" |
| 40 #include "../common/toolbar.h" |
40 #include "../common/toolbar.h" |
| |
41 #include "../common/object.h" |
| 41 |
42 |
| 42 #include <cx/mempool.h> |
43 #include <cx/mempool.h> |
| 43 |
44 |
| 44 |
45 |
| 45 static UiObject* create_window(const char *title, BOOL simple, BOOL sidebar, BOOL splitview) { |
46 static UiObject* create_window(const char *title, BOOL simple, BOOL sidebar, BOOL splitview) { |
| 46 CxMempool *mp = cxMempoolCreateSimple(256); |
47 UiObject *obj = uic_object_new_toplevel(); |
| 47 UiObject *obj = cxCalloc(mp->allocator, 1, sizeof(UiObject)); |
|
| 48 obj->ref = 0; |
|
| 49 |
|
| 50 obj->ctx = uic_context(obj, mp); |
|
| 51 |
48 |
| 52 MainWindow *window = [[MainWindow alloc] init:obj withSidebar:sidebar withSplitview:splitview]; |
49 MainWindow *window = [[MainWindow alloc] init:obj withSidebar:sidebar withSplitview:splitview]; |
| 53 [[WindowManager sharedWindowManager] addWindow:window]; |
50 [[WindowManager sharedWindowManager] addWindow:window]; |
| 54 window.releasedWhenClosed = false; // TODO: we still need a cleanup strategy |
51 window.releasedWhenClosed = false; // TODO: we still need a cleanup strategy |
| 55 |
52 |