-
Notifications
You must be signed in to change notification settings - Fork 140
Expand file tree
/
Copy pathBrowsePopup.cs
More file actions
56 lines (44 loc) · 1.59 KB
/
Copy pathBrowsePopup.cs
File metadata and controls
56 lines (44 loc) · 1.59 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
53
54
55
56
using OpenDreamClient.Interface.Controls;
using OpenDreamShared.Interface.Descriptors;
using OpenDreamShared.Interface.DMF;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
namespace OpenDreamClient.Interface;
internal sealed class BrowsePopup {
public event Action? Closed;
public readonly ControlBrowser Browser;
public readonly ControlWindow WindowElement;
private readonly OSWindow _window;
public BrowsePopup(
string name,
Vector2i size,
IClydeWindow ownerWindow,
WindowDescriptor? descriptor = null) {
WindowDescriptor popupWindowDescriptor = descriptor ?? new WindowDescriptor(name) {
Size = new DMFPropertySize(size)
};
popupWindowDescriptor.ControlDescriptors.Add(new ControlDescriptorBrowser {
Id = new DMFPropertyString("browser"),
Size = new DMFPropertySize(size),
Anchor1 = new DMFPropertyPos(0, 0),
Anchor2 = new DMFPropertyPos(100, 100),
});
WindowElement = new ControlWindow(popupWindowDescriptor);
WindowElement.CreateChildControls();
_window = WindowElement.CreateWindow();
_window.StartupLocation = WindowStartupLocation.CenterOwner;
_window.Owner = ownerWindow;
_window.Closed += OnWindowClosed;
Browser = (ControlBrowser)WindowElement.ChildControls[0];
}
public void Open() {
_window.Show();
// _window.Focus();
}
public void Close() {
_window.Close();
}
private void OnWindowClosed() {
Closed?.Invoke();
}
}