ui/winui/App.xaml.cpp

Fri, 14 Jun 2024 18:25:43 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 14 Jun 2024 18:25:43 +0200
branch
newapi
changeset 291
302a150ff5e4
parent 209
770b3548906c
permissions
-rw-r--r--

implement ui_list_getselection (GTK)

205
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 // Copyright (c) Microsoft Corporation and Contributors.
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 // Licensed under the MIT License.
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 #include "pch.h"
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 #include "App.xaml.h"
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 #include "MainWindow.xaml.h"
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8
209
770b3548906c use generated App class (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 205
diff changeset
9 #include "toolkit.h"
770b3548906c use generated App class (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 205
diff changeset
10
205
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 using namespace winrt;
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 using namespace Windows::Foundation;
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 using namespace Microsoft::UI::Xaml;
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 using namespace Microsoft::UI::Xaml::Controls;
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 using namespace Microsoft::UI::Xaml::Navigation;
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 using namespace winui;
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 using namespace winui::implementation;
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 // To learn more about WinUI, the WinUI project structure,
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 // and more about our project templates, see: http://aka.ms/winui-project-info.
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 /// <summary>
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 /// Initializes the singleton application object. This is the first line of authored code
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 /// executed, and as such is the logical equivalent of main() or WinMain().
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 /// </summary>
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 App::App()
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 {
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 InitializeComponent();
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 UnhandledException([this](IInspectable const&, UnhandledExceptionEventArgs const& e)
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 {
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 if (IsDebuggerPresent())
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 {
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 auto errorMessage = e.Message();
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 __debugbreak();
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 }
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38 });
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 #endif
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 }
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42 /// <summary>
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 /// Invoked when the application is launched.
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 /// </summary>
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 /// <param name="e">Details about the launch request and process.</param>
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 void App::OnLaunched(LaunchActivatedEventArgs const&)
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 {
209
770b3548906c use generated App class (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 205
diff changeset
48 ui_app_run_startup();
770b3548906c use generated App class (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 205
diff changeset
49 //window = make<MainWindow>();
770b3548906c use generated App class (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 205
diff changeset
50 //window.Activate();
205
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 }

mercurial