forked from AtomicGameEngine/AtomicGameEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUIWidget.cs
More file actions
52 lines (43 loc) · 1.18 KB
/
UIWidget.cs
File metadata and controls
52 lines (43 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using static System.Reflection.IntrospectionExtensions;
namespace AtomicEngine
{
public partial class WidgetEvent : NativeEventData
{
public bool Handled
{
get
{
return GetHandled();
}
set
{
SetHandled(value);
}
}
public bool GetHandled()
{
return scriptMap.GetBool("Handled");
}
public void SetHandled(bool handled = true)
{
scriptMap.SetBool("Handled", true); // this isn't great, though syncs up for future reads
// sets the native event data
Set("Handled", handled);
}
}
public partial class UIWidget : AObject
{
static Dictionary<IntPtr, UIWidget> widgets = new Dictionary<IntPtr, UIWidget>();
internal override void PostNativeUpdate()
{
widgets[nativeInstance] = this;
SubscribeToEvent<WidgetDeletedEvent>(this, e =>
{
widgets.Remove(nativeInstance);
});
}
}
}