-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UIElementProps.cs
99 lines (76 loc) · 3.16 KB
/
UIElementProps.cs
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;
using System.Drawing;
namespace WinForMono {
public abstract partial class UIElement : WinformWrapper {
// Internal anchor point within the respective UIElement
public virtual UIAnchor anchor {
get => _anchor;
set { _anchor = value; invalidate_size(); }
}
private UIAnchor _anchor;
//-------------------------------------------------------------------------------------------
public Color border_colour {
get => _border_colour;
set {
_border_colour = value;
if (!hovering) underlying.Refresh();
}
}
private Color _border_colour;
//-------------------------------------------------------------------------------------------
public int border_size {
get;
set;
}
//-------------------------------------------------------------------------------------------
// Ensures the respective UIElement's width always == height
// Done by using the smaller of the width/height for *both* to ensure scaling works
public virtual bool copy_axis {
get => _copy_axis;
set { _copy_axis = value; invalidate_size(); }
}
private bool _copy_axis;
//-------------------------------------------------------------------------------------------
public virtual int corner_radius {
get;
set;
}
//-------------------------------------------------------------------------------------------
public virtual DrawStyle draw_style {
get => _draw_style;
set {
_draw_style = value;
refresh_underlying_region();
underlying.Refresh();
}
}
private DrawStyle _draw_style;
//-------------------------------------------------------------------------------------------
public Color hover_border_colour {
get => _hover_border_colour;
set {
_hover_border_colour = value;
if (hovering) underlying.Refresh();
}
}
private Color _hover_border_colour;
//-------------------------------------------------------------------------------------------
public virtual UIPosition position {
get => _position;
set { _position = value; invalidate_size(); }
}
private UIPosition _position;
//-------------------------------------------------------------------------------------------
public virtual UIPosition size {
get => _size;
set { _size = value; invalidate_size(); }
}
private UIPosition _size;
//-------------------------------------------------------------------------------------------
// Z order of controls, lower is further towards the front of the form
public virtual int z_index {
get => parent.underlying.Controls.GetChildIndex(this.underlying, true);
set => parent.underlying.Controls.SetChildIndex(this.underlying, value);
}
}
}