ui/wpf/UIcore/Toolkit.cs

Sun, 29 Sep 2024 18:51:03 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 29 Sep 2024 18:51:03 +0200
branch
newapi
changeset 315
144c2b4683cb
parent 82
0cdb8089a29f
permissions
-rw-r--r--

use GtkFileDialog on newer gtk4 versions

78
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 using System;
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 using System.Collections.Generic;
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 using System.Linq;
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 using System.Text;
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 using System.Threading;
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 using System.Threading.Tasks;
82
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
7 using System.Windows;
78
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 namespace UI
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 {
82
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
11 public class EventCallback
78
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 {
82
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
13 public IntPtr Object;
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
14 public Action<IntPtr> Action;
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
15
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
16 public EventCallback(IntPtr uiobj, Action<IntPtr> action)
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
17 {
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
18 Object = uiobj;
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
19 Action = action;
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
20 }
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
21
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
22 public void Callback(object sender, RoutedEventArgs a)
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
23 {
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
24 Action.Invoke(Object);
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
25 }
78
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 }
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 }

mercurial