ui/winui/window.cpp

branch
newapi
changeset 211
5d71a36b833b
parent 209
770b3548906c
child 212
ad5c74af14c4
--- a/ui/winui/window.cpp	Thu Oct 12 13:51:44 2023 +0200
+++ b/ui/winui/window.cpp	Thu Oct 12 13:52:18 2023 +0200
@@ -62,7 +62,7 @@
 
 	//Window window = Window();
 	Window window = make<winui::implementation::MainWindow>();
-	//window.ExtendsContentIntoTitleBar(true);
+	window.ExtendsContentIntoTitleBar(true);
 	if (title) {
 		wchar_t *wtitle = str2wstr(title, nullptr);
 		window.Title(wtitle);
@@ -76,6 +76,16 @@
 	Grid grid = Grid();
 	window.Content(grid);
 
+	StackPanel titleBar = StackPanel();
+	Thickness titleBarPadding = { 10, 5, 5, 10 };
+	titleBar.Padding(titleBarPadding);
+	titleBar.Orientation(Orientation::Horizontal);
+	TextBlock titleLabel = TextBlock();
+	titleLabel.Text(hstring(L"Window Title"));
+	titleBar.Children().Append(titleLabel);
+
+	window.SetTitleBar(titleBar);
+
 	obj->wobj = new UiWindow(window);
 	
 
@@ -86,6 +96,9 @@
 
 	obj->container = new UiBoxContainer(grid, UI_BOX_CONTAINER_VBOX, 0, 0);
 
+	titleBar.VerticalAlignment(VerticalAlignment::Top);
+	obj->container->Add(titleBar, false);
+
 	if (uic_get_menu_list()) {
 		// create/add menubar
 		MenuBar mb = ui_create_menubar(obj);

mercurial