63 UiWindow::UiWindow(winrt::Microsoft::UI::Xaml::Window& win) : window(win) {} |
63 UiWindow::UiWindow(winrt::Microsoft::UI::Xaml::Window& win) : window(win) {} |
64 |
64 |
65 UiObject* ui_window(const char* title, void* window_data) { |
65 UiObject* ui_window(const char* title, void* window_data) { |
66 UiObject* obj = ui_simple_window(title, window_data); |
66 UiObject* obj = ui_simple_window(title, window_data); |
67 |
67 |
|
68 /* |
68 if (uic_get_menu_list()) { |
69 if (uic_get_menu_list()) { |
69 // create/add menubar |
70 // create/add menubar |
70 MenuBar mb = ui_create_menubar(obj); |
71 MenuBar mb = ui_create_menubar(obj); |
71 mb.VerticalAlignment(VerticalAlignment::Top); |
72 mb.VerticalAlignment(VerticalAlignment::Top); |
72 obj->container->Add(mb, false); |
73 obj->container->Add(mb, false); |
73 } |
74 } |
|
75 */ |
74 |
76 |
75 if (uic_toolbar_isenabled()) { |
77 if (uic_toolbar_isenabled()) { |
76 // create a grid for the toolbar: ColumnDefinitions="Auto, *, Auto" |
78 // create a grid for the toolbar: ColumnDefinitions="Auto, *, Auto" |
77 Grid toolbar_grid = Grid(); |
79 Grid toolbar_grid = Grid(); |
78 GridLength gl; |
80 GridLength gl; |
228 dialog.Title(winrt::box_value(str)); |
230 dialog.Title(winrt::box_value(str)); |
229 free(str); |
231 free(str); |
230 } |
232 } |
231 |
233 |
232 TextBox textfield{ nullptr }; |
234 TextBox textfield{ nullptr }; |
233 if (args.input) { |
235 PasswordBox password{ nullptr }; |
|
236 if(args.input || args.password) { |
234 StackPanel panel = StackPanel(); |
237 StackPanel panel = StackPanel(); |
235 panel.Orientation(Orientation::Vertical); |
238 panel.Orientation(Orientation::Vertical); |
236 if (args.content) { |
239 if (args.content) { |
237 wchar_t *str = str2wstr(args.content, nullptr); |
240 wchar_t *str = str2wstr(args.content, nullptr); |
238 TextBlock label = TextBlock(); |
241 TextBlock label = TextBlock(); |
239 label.Text(str); |
242 label.Text(str); |
240 panel.Children().Append(label); |
243 panel.Children().Append(label); |
241 free(str); |
244 free(str); |
242 } |
245 } |
243 |
246 |
244 textfield = TextBox(); |
|
245 Thickness margin = { 0, 5, 0, 0 }; |
247 Thickness margin = { 0, 5, 0, 0 }; |
246 textfield.Margin(margin); |
248 if (args.password) { |
|
249 password = PasswordBox(); |
|
250 password.Margin(margin); |
|
251 panel.Children().Append(password); |
|
252 } else { |
|
253 textfield = TextBox(); |
|
254 textfield.Margin(margin); |
|
255 panel.Children().Append(textfield); |
|
256 } |
|
257 |
247 panel.Margin(margin); |
258 panel.Margin(margin); |
248 |
|
249 panel.Children().Append(textfield); |
|
250 |
259 |
251 dialog.Content(panel); |
260 dialog.Content(panel); |
252 |
261 |
253 } else { |
262 } else { |
254 if (args.content) { |
263 if (args.content) { |
288 evt.intval = 1; |
297 evt.intval = 1; |
289 } else if (result == ContentDialogResult::Secondary) { |
298 } else if (result == ContentDialogResult::Secondary) { |
290 evt.intval = 2; |
299 evt.intval = 2; |
291 } |
300 } |
292 |
301 |
293 if (args.input) { |
302 if (args.password) { |
|
303 std::wstring wstr(password.Password()); |
|
304 char *text = wchar2utf8(wstr.c_str(), wstr.length()); |
|
305 evt.eventdata = text; |
|
306 } else if (args.input) { |
294 std::wstring wstr(textfield.Text()); |
307 std::wstring wstr(textfield.Text()); |
295 char *text = wchar2utf8(wstr.c_str(), wstr.length()); |
308 char *text = wchar2utf8(wstr.c_str(), wstr.length()); |
296 evt.eventdata = text; |
309 evt.eventdata = text; |
297 } |
310 } |
298 |
311 |