Base class for all GUI controls
| 9 | /// Base class for all GUI controls |
| 10 | /// </summary> |
| 11 | public partial class Control : IComparable, IDrawable |
| 12 | { |
| 13 | private struct AnchorPresetData |
| 14 | { |
| 15 | public AnchorPresets Preset; |
| 16 | public Float2 Min; |
| 17 | public Float2 Max; |
| 18 | |
| 19 | public AnchorPresetData(AnchorPresets preset, Float2 min, Float2 max) |
| 20 | { |
| 21 | Preset = preset; |
| 22 | Min = min; |
| 23 | Max = max; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | private static readonly AnchorPresetData[] AnchorPresetsData = |
| 28 | { |
| 29 | new AnchorPresetData(AnchorPresets.TopLeft, new Float2(0, 0), new Float2(0, 0)), |
| 30 | new AnchorPresetData(AnchorPresets.TopCenter, new Float2(0.5f, 0), new Float2(0.5f, 0)), |
| 31 | new AnchorPresetData(AnchorPresets.TopRight, new Float2(1, 0), new Float2(1, 0)), |
| 32 | |
| 33 | new AnchorPresetData(AnchorPresets.MiddleLeft, new Float2(0, 0.5f), new Float2(0, 0.5f)), |
| 34 | new AnchorPresetData(AnchorPresets.MiddleCenter, new Float2(0.5f, 0.5f), new Float2(0.5f, 0.5f)), |
| 35 | new AnchorPresetData(AnchorPresets.MiddleRight, new Float2(1, 0.5f), new Float2(1, 0.5f)), |
| 36 | |
| 37 | new AnchorPresetData(AnchorPresets.BottomLeft, new Float2(0, 1), new Float2(0, 1)), |
| 38 | new AnchorPresetData(AnchorPresets.BottomCenter, new Float2(0.5f, 1), new Float2(0.5f, 1)), |
| 39 | new AnchorPresetData(AnchorPresets.BottomRight, new Float2(1, 1), new Float2(1, 1)), |
| 40 | |
| 41 | new AnchorPresetData(AnchorPresets.HorizontalStretchTop, new Float2(0, 0), new Float2(1, 0)), |
| 42 | new AnchorPresetData(AnchorPresets.HorizontalStretchMiddle, new Float2(0, 0.5f), new Float2(1, 0.5f)), |
| 43 | new AnchorPresetData(AnchorPresets.HorizontalStretchBottom, new Float2(0, 1), new Float2(1, 1)), |
| 44 | |
| 45 | new AnchorPresetData(AnchorPresets.VerticalStretchLeft, new Float2(0, 0), new Float2(0, 1)), |
| 46 | new AnchorPresetData(AnchorPresets.VerticalStretchCenter, new Float2(0.5f, 0), new Float2(0.5f, 1)), |
| 47 | new AnchorPresetData(AnchorPresets.VerticalStretchRight, new Float2(1, 0), new Float2(1, 1)), |
| 48 | |
| 49 | new AnchorPresetData(AnchorPresets.StretchAll, new Float2(0, 0), new Float2(1, 1)), |
| 50 | }; |
| 51 | |
| 52 | private ContainerControl _parent; |
| 53 | private RootControl _root; |
| 54 | private bool _isDisposing, _isFocused, _isNavFocused; |
| 55 | |
| 56 | // State |
| 57 | |
| 58 | // TODO: convert to flags |
| 59 | |
| 60 | private bool _isMouseOver, _isDragOver; |
| 61 | private bool _isVisible = true; |
| 62 | private bool _isEnabled = true; |
| 63 | private bool _autoFocus = true; |
| 64 | private bool _pivotRelativeSizing = false; |
| 65 | private List<int> _touchOvers; |
| 66 | private RootControl.UpdateDelegate _tooltipUpdate; |
| 67 | |
| 68 | // Transform |
nothing calls this directly
no test coverage detected