ui/winui/MainWindow.xaml.cpp

Sun, 29 Sep 2024 19:06:29 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 29 Sep 2024 19:06:29 +0200
branch
newapi
changeset 318
8d8a31d55dd5
parent 211
5d71a36b833b
permissions
-rw-r--r--

fix simple window (libadwaita)

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 #include "MainWindow.xaml.h"
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 #if __has_include("MainWindow.g.cpp")
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 #include "MainWindow.g.cpp"
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 #endif
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 using namespace winrt;
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 using namespace Microsoft::UI::Xaml;
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 // 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
14 // 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
15
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 namespace winrt::winui::implementation
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 {
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 MainWindow::MainWindow()
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 {
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 InitializeComponent();
211
5d71a36b833b add custom titlebar (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 205
diff changeset
21 //ExtendsContentIntoTitleBar(true);
5d71a36b833b add custom titlebar (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 205
diff changeset
22 //SetTitleBar(AppTitleBar());
205
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 }
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 int32_t MainWindow::MyProperty()
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 {
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 throw hresult_not_implemented();
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 }
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 void MainWindow::MyProperty(int32_t /* value */)
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 {
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 throw hresult_not_implemented();
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 }
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 void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&)
b1ac0dd1d38b new winui vs project, add toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 {
211
5d71a36b833b add custom titlebar (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 205
diff changeset
37
205
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 }

mercurial