ui/winui/window.cpp

branch
newapi
changeset 183
3ce2eb11913b
parent 182
6cf690e042bd
child 184
8c9b4b28aaa9
--- a/ui/winui/window.cpp	Mon May 29 12:48:42 2023 +0200
+++ b/ui/winui/window.cpp	Fri Sep 22 21:32:45 2023 +0200
@@ -52,9 +52,7 @@
 using namespace Microsoft::UI::Xaml::XamlTypeInfo;
 using namespace Microsoft::UI::Xaml::Markup;
 using namespace Windows::UI::Xaml::Interop;
-
-
-
+using namespace winrt::Windows::Foundation;
 
 UiObject* ui_window(const char* title, void* window_data) {
 	CxMempool* mp = cxBasicMempoolCreate(256);
@@ -63,9 +61,14 @@
 	obj->ctx = uic_context(obj, mp->allocator);
 	obj->window = window_data;
 
-	obj->wobj = Window();
+	Window window = Window();
+
 	Grid grid = Grid();
-	obj->wobj.Content(grid);
+	window.Content(grid);
+
+	obj->wobj = new UiWindow(window);
+
+	window.Closed([&](IInspectable const& sender, WindowEventArgs) { delete obj->wobj; } );
 
 	obj->container = new UiBoxContainer(grid, UI_CONTAINER_VBOX);
 
@@ -87,6 +90,9 @@
 
 
 	obj->window = window_data;
+
+	//wptr2->Activate();
+	//obj->wobj = wptr2;
 	
 
 	return obj;

mercurial