ui/winui/window.cpp

branch
newapi
changeset 378
d41b1ffc5f77
parent 374
eae5d6623fd3
child 379
958bae372271
--- a/ui/winui/window.cpp	Sun Nov 10 10:16:47 2024 +0100
+++ b/ui/winui/window.cpp	Sun Nov 10 15:27:44 2024 +0100
@@ -65,12 +65,14 @@
 UiObject* ui_window(const char* title, void* window_data) {
 	UiObject* obj = ui_simple_window(title, window_data);
 
+	/*
 	if (uic_get_menu_list()) {
 		// create/add menubar
 		MenuBar mb = ui_create_menubar(obj);
 		mb.VerticalAlignment(VerticalAlignment::Top);
 		obj->container->Add(mb, false);
 	}
+	*/
 
 	if (uic_toolbar_isenabled()) {
 		// create a grid for the toolbar: ColumnDefinitions="Auto, *, Auto"
@@ -230,7 +232,8 @@
 	}
 
 	TextBox textfield{ nullptr };
-	if (args.input) {
+	PasswordBox password{ nullptr };
+	if(args.input || args.password) {
 		StackPanel panel = StackPanel();
 		panel.Orientation(Orientation::Vertical);
 		if (args.content) {
@@ -241,13 +244,19 @@
 			free(str);
 		}
 
-		textfield = TextBox();
 		Thickness margin = { 0, 5, 0, 0 };
-		textfield.Margin(margin);
+		if (args.password) {
+			password = PasswordBox();
+			password.Margin(margin);
+			panel.Children().Append(password);
+		} else {
+			textfield = TextBox();
+			textfield.Margin(margin);
+			panel.Children().Append(textfield);
+		}
+		
 		panel.Margin(margin);
 
-		panel.Children().Append(textfield);
-
 		dialog.Content(panel);
 
 	} else {
@@ -290,7 +299,11 @@
 			evt.intval = 2;
 		}
 
-		if (args.input) {
+		if (args.password) {
+			std::wstring wstr(password.Password());
+			char *text = wchar2utf8(wstr.c_str(), wstr.length());
+			evt.eventdata = text;
+		} else if (args.input) {
 			std::wstring wstr(textfield.Text());
 			char *text = wchar2utf8(wstr.c_str(), wstr.length());
 			evt.eventdata = text;

mercurial