ui/winui/toolkit.cpp

branch
newapi
changeset 184
8c9b4b28aaa9
parent 183
3ce2eb11913b
child 189
4daddc326877
equal deleted inserted replaced
183:3ce2eb11913b 184:8c9b4b28aaa9
36 #include <winrt/Microsoft.UI.Xaml.Controls.Primitives.h> 36 #include <winrt/Microsoft.UI.Xaml.Controls.Primitives.h>
37 #include <winrt/Microsoft.UI.Xaml.XamlTypeInfo.h> 37 #include <winrt/Microsoft.UI.Xaml.XamlTypeInfo.h>
38 #include <winrt/Microsoft.UI.Xaml.Markup.h> 38 #include <winrt/Microsoft.UI.Xaml.Markup.h>
39 39
40 #include <cx/allocator.h> 40 #include <cx/allocator.h>
41 #include <cx/mempool.h>
41 42
42 43
43 using namespace winrt; 44 using namespace winrt;
44 using namespace Microsoft::UI::Xaml; 45 using namespace Microsoft::UI::Xaml;
45 using namespace Microsoft::UI::Xaml::Controls; 46 using namespace Microsoft::UI::Xaml::Controls;
46 using namespace Microsoft::UI::Xaml::XamlTypeInfo; 47 using namespace Microsoft::UI::Xaml::XamlTypeInfo;
47 using namespace Microsoft::UI::Xaml::Markup; 48 using namespace Microsoft::UI::Xaml::Markup;
48 using namespace Windows::UI::Xaml::Interop; 49 using namespace Windows::UI::Xaml::Interop;
50 using namespace winrt::Windows::Foundation;
49 51
50 static const char* application_name; 52 static const char* application_name;
51 53
52 static ui_callback startup_func; 54 static ui_callback startup_func;
53 static void* startup_data; 55 static void* startup_data;
85 } 87 }
86 private: 88 private:
87 XamlControlsXamlMetaDataProvider provider; 89 XamlControlsXamlMetaDataProvider provider;
88 }; 90 };
89 91
90 UiWindow::UiWindow(winrt::Microsoft::UI::Xaml::Window& win) : window(win) {};
91
92 UiWidget::UiWidget(winrt::Microsoft::UI::Xaml::UIElement& elm) : uielement(elm) {} 92 UiWidget::UiWidget(winrt::Microsoft::UI::Xaml::UIElement& elm) : uielement(elm) {}
93 93
94 extern "C" void destroy_ui_window_wrapper(void* ptr) {
95 UiWindow* win = (UiWindow*)ptr;
96 delete win;
97 }
98
99 extern "C" void destroy_ui_widget_wrapper(void* ptr) {
100 UiWidget* widget = (UiWidget*)ptr;
101 delete widget;
102 }
103
104 void ui_context_add_window_destructor(UiContext* ctx, UiWindow* win) {
105 // TODO:
106 }
107
108 void ui_context_add_widget_destructor(UiContext* ctx, UiWidget* widget) {
109 // TODO:
110 }
94 111
95 112
96 113
97 void ui_init(const char* appname, int argc, char** argv) { 114 void ui_init(const char* appname, int argc, char** argv) {
98 application_name = appname; 115 application_name = appname;

mercurial