Source/Gorgon/UI/Widget.h

Mon, 01 Nov 2021 06:57:22 +0200

author
cemkalyoncu
date
Mon, 01 Nov 2021 06:57:22 +0200
branch
4.x-dev
changeset 1753
b473f5a6ce85
parent 1751
c11e4d2ab93b
child 1758
185ba7aa8284
permissions
-rw-r--r--

* A bug in widget system is fixed

1247
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
1 #pragma once
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
2
1250
43222adb3e5f * Most of the WidgetContainer implementation
cemkalyoncu
parents: 1249
diff changeset
3 #include "../Layer.h"
1247
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
4 #include "../Geometry/Point.h"
1251
b0655bf8d5c7 * Automatic UI generation framework
cemkalyoncu
parents: 1250
diff changeset
5 #include "../Input/Keyboard.h"
1624
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
6 #include "../Property.h"
1393
dacae7e9c56f #103: Geometry properties for common geometry members
cemkalyoncu
parents: 1383
diff changeset
7 #include "../Geometry/PointProperty.h"
dacae7e9c56f #103: Geometry properties for common geometry members
cemkalyoncu
parents: 1383
diff changeset
8 #include "../Geometry/SizeProperty.h"
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
9 #include "Dimension.h"
1247
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
10
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
11 namespace Gorgon { namespace UI {
1250
43222adb3e5f * Most of the WidgetContainer implementation
cemkalyoncu
parents: 1249
diff changeset
12
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
13 class WidgetContainer;
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
14
1247
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
15 /**
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
16 * This class is the base for all widgets.
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
17 */
1465
d750468e775b * Minimum functionality for listbox
cemkalyoncu
parents: 1450
diff changeset
18 class Widget {
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
19 friend class WidgetContainer;
1744
5f97a7c6a353 * Fixed a scroll inconsistency
cemkalyoncu
parents: 1742
diff changeset
20 //non virtual functions for VS
5f97a7c6a353 * Fixed a scroll inconsistency
cemkalyoncu
parents: 1742
diff changeset
21 void resize_(const UnitSize &size) {
5f97a7c6a353 * Fixed a scroll inconsistency
cemkalyoncu
parents: 1742
diff changeset
22 Resize(size);
5f97a7c6a353 * Fixed a scroll inconsistency
cemkalyoncu
parents: 1742
diff changeset
23 }
1394
34aa18c6b320 * Virtual call bug is solved in visual studio
cemkalyoncu
parents: 1393
diff changeset
24
1247
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
25 public:
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
26
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
27 explicit Widget(const UnitSize &size) : Location(this), Size(this), Tooltip(this), size(size) {
1393
dacae7e9c56f #103: Geometry properties for common geometry members
cemkalyoncu
parents: 1383
diff changeset
28 }
dacae7e9c56f #103: Geometry properties for common geometry members
cemkalyoncu
parents: 1383
diff changeset
29
1465
d750468e775b * Minimum functionality for listbox
cemkalyoncu
parents: 1450
diff changeset
30 Widget(Widget &&) = default;
1450
0c2bcf1bf63a #183 ComponentStack CoordinateToValue is fixed
cemkalyoncu
parents: 1394
diff changeset
31
1510
c523825917a9 #216 Dialog system
cemkalyoncu
parents: 1503
diff changeset
32 virtual ~Widget();
1247
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
33
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
34 /// Moves this widget to the given position. Widget might be
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
35 /// moved by organizers.
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
36 void Move(UnitDimension x, UnitDimension y) { Move({x, y}); }
1247
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
37
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
38 /// Moves this widget to the given position.
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
39 void Move(const UnitPoint &value);
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
40
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
41 /// Returns the location of the widget. This is the assigned location
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
42 /// and may not reflect actual position. Widget might be moved by
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
43 /// organizers.
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
44 UnitPoint GetLocation() const {
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
45 return location;
1740
fe1c233c3a96 #337 UnitSize scale and location disparity
cemkalyoncu
parents: 1624
diff changeset
46 }
1253
68da813504f9 * Basics of widget system is finalized
cemkalyoncu
parents: 1252
diff changeset
47
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
48 /// Returns the current location of the widget in pixels. This might
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
49 /// be different than location that is set.
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
50 virtual Geometry::Point GetCurrentLocation() const = 0;
1253
68da813504f9 * Basics of widget system is finalized
cemkalyoncu
parents: 1252
diff changeset
51
1746
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
52 /// Returns the current location converted to requested units
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
53 UnitPoint GetCalculatedLocation(Dimension::Unit units = Dimension::MilliUnitSize) const {
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
54 return Convert(units, GetCurrentLocation());
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
55 }
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
56
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
57 /// Changes the size of the widget.
1744
5f97a7c6a353 * Fixed a scroll inconsistency
cemkalyoncu
parents: 1742
diff changeset
58 void Resize(UnitDimension w, UnitDimension h) { Resize({w, h}); };
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
59
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
60 /// Changes the size of the widget.
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
61 virtual void Resize(const UnitSize &size);
1253
68da813504f9 * Basics of widget system is finalized
cemkalyoncu
parents: 1252
diff changeset
62
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
63 /// Returns the size of the widget
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
64 UnitSize GetSize() const {
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
65 return size;
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
66 }
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
67
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
68 /// Returns the current size of the widget in pixels. This might be
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
69 /// different than the size that is set.
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
70 virtual Geometry::Size GetCurrentSize() const = 0;
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
71
1746
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
72 /// Returns the current size converted to requested units
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
73 UnitSize GetCalculatedSize(Dimension::Unit units = Dimension::MilliUnitSize) const {
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
74 return Convert(units, GetCurrentSize());
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
75 }
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
76 /// Returns the bounds of the widget in pixels.
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
77 Geometry::Bounds GetBounds() const { return {GetCurrentLocation(), GetCurrentSize()}; }
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
78
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
79 /// Returns the width of the widget
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
80 UnitDimension GetWidth() const { return GetSize().Width; }
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
81
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
82 /// Returns the height of the widget
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
83 UnitDimension GetHeight() const { return GetSize().Height; }
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
84
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
85 /// Returns the width of the widget in pixels.
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
86 int GetCurrentWidth() const { return GetCurrentSize().Width; }
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
87
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
88 /// Returns the height of the widget in pixels.
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
89 int GetCurrentHeight() const { return GetCurrentSize().Height; }
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
90
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
91 /// Sets the width of the widget
1747
2f9ad833617f #337 Min/max window size
cemkalyoncu
parents: 1746
diff changeset
92 virtual void SetWidth(UnitDimension width) { Resize(width, GetHeight()); }
1494
33abdc8b5e5b #203: All organizers are able to stream widgets and text
cemkalyoncu
parents: 1488
diff changeset
93
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
94 /// Sets the height of the widget
1747
2f9ad833617f #337 Min/max window size
cemkalyoncu
parents: 1746
diff changeset
95 virtual void SetHeight(UnitDimension height) { Resize(GetWidth(), height); }
1247
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
96
1249
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
97 /// Activates the widget. This might perform the action if the
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
98 /// widget is a button, forward the focus if it is a label or
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
99 /// focus if it is an input field.
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
100 virtual bool Activate() = 0;
1266
0fc123e9734c * RadioButtons widget
cemkalyoncu
parents: 1259
diff changeset
101
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
102 /// Removes the widget from its parent. Returns true if the widget
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
103 /// has no parent after the operation.
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
104 bool Remove();
1249
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
105
1279
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
106 /// If this widget can be focused currently
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
107 bool AllowFocus() const { return allowfocus() && visible; }
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
108
1249
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
109 /// Transfers the focus to this widget. Returns true if the focus
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
110 /// is actually transferred to this widget
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
111 bool Focus();
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
112
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
113 /// Removes the focus from this widget if this widget is focused.
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
114 /// This function will not transfer the focus to another widget.
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
115 bool Defocus();
1279
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
116
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
117 /// Returns if this widget is focused.
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
118 bool IsFocused() const { return focus; }
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
119
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
120 /// Shows this widget, widgets are visible by default.
1503
38acd13739cc #205 Close button (template, show/hide, enable/disable, events)
cemkalyoncu
parents: 1494
diff changeset
121 virtual void Show() { SetVisible(true); }
1279
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
122
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
123 /// Hides this widget, when hidden, widgets cannot gain focus
1566
3b5234e07735 #243 Dropdown bugs are fixed
cemkalyoncu
parents: 1562
diff changeset
124 virtual void Hide() { SetVisible(false); }
1279
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
125
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
126 /// Toggles the visibility state of the widget.
1566
3b5234e07735 #243 Dropdown bugs are fixed
cemkalyoncu
parents: 1562
diff changeset
127 void ToggleVisible() { SetVisible(!IsVisible ()); }
1279
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
128
1280
b045bad2d50e * BoundsChanged and FocusEvents
cemkalyoncu
parents: 1279
diff changeset
129 /// Changes the visibility of the widget
1566
3b5234e07735 #243 Dropdown bugs are fixed
cemkalyoncu
parents: 1562
diff changeset
130 virtual void SetVisible(bool value);
1279
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
131
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
132 /// Returns if the widget is visible
1566
3b5234e07735 #243 Dropdown bugs are fixed
cemkalyoncu
parents: 1562
diff changeset
133 virtual bool IsVisible() const {
1279
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
134 return visible;
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
135 }
1383
c844540dd8c0 #129: EnsureVisible function, tabbing to a widget ensures that widget is scrolled
cemkalyoncu
parents: 1370
diff changeset
136
c844540dd8c0 #129: EnsureVisible function, tabbing to a widget ensures that widget is scrolled
cemkalyoncu
parents: 1370
diff changeset
137 /// Ensures this widget is visible in its container by scrolling it
c844540dd8c0 #129: EnsureVisible function, tabbing to a widget ensures that widget is scrolled
cemkalyoncu
parents: 1370
diff changeset
138 /// into view. This function will not change visibility of the widget
c844540dd8c0 #129: EnsureVisible function, tabbing to a widget ensures that widget is scrolled
cemkalyoncu
parents: 1370
diff changeset
139 /// and will return false if the widget is not visible. This function
c844540dd8c0 #129: EnsureVisible function, tabbing to a widget ensures that widget is scrolled
cemkalyoncu
parents: 1370
diff changeset
140 /// cannot be expected to take outside factors into account, such as
c844540dd8c0 #129: EnsureVisible function, tabbing to a widget ensures that widget is scrolled
cemkalyoncu
parents: 1370
diff changeset
141 /// occlusion.
c844540dd8c0 #129: EnsureVisible function, tabbing to a widget ensures that widget is scrolled
cemkalyoncu
parents: 1370
diff changeset
142 bool EnsureVisible() const;
1252
60b953640d26 * More work on WidgetBase
cemkalyoncu
parents: 1251
diff changeset
143
1369
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
144 /// Enables the widget so that the user can interact with it
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
145 void Enable() { SetEnabled(true); }
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
146
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
147 /// Disables the widget so that the user cannot interact with it
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
148 void Disable() { SetEnabled(false); }
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
149
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
150 /// Toggles enabled state of the widget
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
151 void ToggleEnabled() { SetEnabled(!IsEnabled()); }
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
152
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
153 /// Sets the enabled state of the widget
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
154 virtual void SetEnabled(bool value) = 0;
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
155
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
156 /// Returns whether the widget is enabled.
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
157 virtual bool IsEnabled() const = 0;
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
158
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
159 /// Returns if this widget has a parent
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
160 bool HasParent() const { return parent != nullptr; }
1252
60b953640d26 * More work on WidgetBase
cemkalyoncu
parents: 1251
diff changeset
161
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
162 /// Returns the parent of this widget, throws if it does not have
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
163 /// a parent.
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
164 WidgetContainer &GetParent() const;
1484
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
165
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
166 /// Sets floating status of this widget. Floating widgets will not
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
167 /// be moved or resized by organizers.
1488
82a11d6bd77c #196 Dropdown can now open above
cemkalyoncu
parents: 1487
diff changeset
168 virtual void SetFloating(bool value) {
1484
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
169 if(floating != value)
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
170 boundschanged();
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
171
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
172 floating = value;
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
173 }
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
174
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
175 /// Returns floating status of this widget. Floating widgets will not
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
176 /// be moved or resized by organizers.
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
177 bool IsFloating() const {
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
178 return floating;
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
179 }
1250
43222adb3e5f * Most of the WidgetContainer implementation
cemkalyoncu
parents: 1249
diff changeset
180
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
181 /// This function should be called whenever a key is pressed or released.
1567
3f207fee94eb #216 Input dialog
cemkalyoncu
parents: 1566
diff changeset
182 virtual bool KeyPressed(Input::Key, float) { return false; }
1251
b0655bf8d5c7 * Automatic UI generation framework
cemkalyoncu
parents: 1250
diff changeset
183
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
184 /// This function should be called whenever a character is received from
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
185 /// operating system.
1567
3f207fee94eb #216 Input dialog
cemkalyoncu
parents: 1566
diff changeset
186 virtual bool CharacterPressed(Char) { return false; }
1338
781d716aab15 * Option to prevent text wrapping on demand
cemkalyoncu
parents: 1286
diff changeset
187
781d716aab15 * Option to prevent text wrapping on demand
cemkalyoncu
parents: 1286
diff changeset
188 /// For widgets that supports it, this will trigger finalization the user
781d716aab15 * Option to prevent text wrapping on demand
cemkalyoncu
parents: 1286
diff changeset
189 /// interaction. This may cause widget fire change event or reorganize
781d716aab15 * Option to prevent text wrapping on demand
cemkalyoncu
parents: 1286
diff changeset
190 /// itself.
781d716aab15 * Option to prevent text wrapping on demand
cemkalyoncu
parents: 1286
diff changeset
191 virtual bool Done() { return true; }
1624
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
192
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
193 /// Sets the tooltip to the given value. This will immediately update the display if it is
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
194 /// currently displayed.
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
195 void SetTooltip(const std::string &value) {
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
196 if(tooltip != value) {
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
197 tooltip = value;
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
198 TooltipChangedEvent();
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
199 }
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
200 }
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
201
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
202 /// Removes the tooltip from this widget
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
203 void RemoveTooltip() {
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
204 SetTooltip("");
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
205 }
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
206
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
207 /// Returns the tooltip of this widget.
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
208 std::string GetTooltip() const {
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
209 return tooltip;
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
210 }
1251
b0655bf8d5c7 * Automatic UI generation framework
cemkalyoncu
parents: 1250
diff changeset
211
1746
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
212 /// Converts the given size in units to pixels
1751
c11e4d2ab93b #337 New units: fractions and spaces
cemkalyoncu
parents: 1747
diff changeset
213 int Convert(const UnitDimension &val, bool isvertical, bool issize = false) const;
1746
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
214
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
215 /// Converts the given size in units to pixels
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
216 Geometry::Size Convert(const UnitSize &size) const;
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
217
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
218 /// Converts the given location in units to pixels
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
219 Geometry::Point Convert(const UnitPoint &location) const;
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
220
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
221 /// Converts the given size in units to requested units.
1751
c11e4d2ab93b #337 New units: fractions and spaces
cemkalyoncu
parents: 1747
diff changeset
222 UnitDimension Convert(Dimension::Unit target, const UnitDimension &val, bool isvertical, bool issize = false) const;
1746
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
223
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
224 /// Converts the given size in units to requested units.
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
225 UnitSize Convert(Dimension::Unit target, const UnitSize &size) const;
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
226
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
227 /// Converts the given location in units to requested units.
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
228 UnitPoint Convert(Dimension::Unit target, const UnitPoint &location) const;
37a08db9a582 #337 CalculatedSize/Location
cemkalyoncu
parents: 1745
diff changeset
229
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
230 /// This event will be fired when the widget receives or looses focus.
1465
d750468e775b * Minimum functionality for listbox
cemkalyoncu
parents: 1450
diff changeset
231 Event<Widget> FocusEvent = Event<Widget>{*this};
1280
b045bad2d50e * BoundsChanged and FocusEvents
cemkalyoncu
parents: 1279
diff changeset
232
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
233 /// This event will be fired when the area that the widget occupies on
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
234 /// its container is changed. It will be fired when the widget is hidden
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
235 /// or shown or its parent is changed. Movement, resize and parent change
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
236 /// will not trigger this event if the widget is not visible. Similarly,
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
237 /// if the object does not have a parent movement and resize will not
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
238 /// trigger this event. Organizers use this event to rearrange widgets,
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
239 /// thus it is not advisable to remove all handlers from this event.
1624
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
240 Event<Widget> BoundsChangedEvent = Event<Widget>{*this};
1356
b949126ed5e5 * Reorganized UIGenerate test
cemkalyoncu
parents: 1338
diff changeset
241
1621
0010d369a70c #300 MouseEnterEvent and MouseLeaveEvent for widgets
cemkalyoncu
parents: 1567
diff changeset
242 /// This event will be fired when the mouse enters the widget area.
1624
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
243 Event<Widget> MouseEnterEvent = Event<Widget>{*this};
1621
0010d369a70c #300 MouseEnterEvent and MouseLeaveEvent for widgets
cemkalyoncu
parents: 1567
diff changeset
244
0010d369a70c #300 MouseEnterEvent and MouseLeaveEvent for widgets
cemkalyoncu
parents: 1567
diff changeset
245 /// This event will be fired when the mouse exits the widget area.
1624
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
246 Event<Widget> MouseLeaveEvent = Event<Widget>{*this};
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
247
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
248 /// This event will be fired when the tooltip of the widget is changed
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
249 Event<Widget> TooltipChangedEvent = Event<Widget>{*this};
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
250
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
251 /// This event will be fired before the widget is destroyed. This event
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
252 /// is fired in the middle of the destruction. It is not safe to access
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
253 /// the widget at this point. Only the aliases to this widget should be
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
254 /// invalidated in the event handlers registered to this function.
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
255 Event<Widget> DestroyedEvent = Event<Widget>{*this};
1621
0010d369a70c #300 MouseEnterEvent and MouseLeaveEvent for widgets
cemkalyoncu
parents: 1567
diff changeset
256
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
257 Geometry::basic_PointProperty<Widget, UnitPoint, &Widget::GetLocation, &Widget::Move> Location;
1744
5f97a7c6a353 * Fixed a scroll inconsistency
cemkalyoncu
parents: 1742
diff changeset
258 Geometry::basic_SizeProperty<Widget, UnitSize, &Widget::GetSize, &Widget::resize_> Size;
1624
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
259 TextualProperty<Widget, std::string, &Widget::GetTooltip, &Widget::SetTooltip> Tooltip;
1393
dacae7e9c56f #103: Geometry properties for common geometry members
cemkalyoncu
parents: 1383
diff changeset
260
1356
b949126ed5e5 * Reorganized UIGenerate test
cemkalyoncu
parents: 1338
diff changeset
261 /// This is a debug feature
b949126ed5e5 * Reorganized UIGenerate test
cemkalyoncu
parents: 1338
diff changeset
262 void setname(std::string value) {
b949126ed5e5 * Reorganized UIGenerate test
cemkalyoncu
parents: 1338
diff changeset
263 #ifndef NDEBUG
b949126ed5e5 * Reorganized UIGenerate test
cemkalyoncu
parents: 1338
diff changeset
264 dbgname = value;
b949126ed5e5 * Reorganized UIGenerate test
cemkalyoncu
parents: 1338
diff changeset
265 #endif
b949126ed5e5 * Reorganized UIGenerate test
cemkalyoncu
parents: 1338
diff changeset
266 }
b949126ed5e5 * Reorganized UIGenerate test
cemkalyoncu
parents: 1338
diff changeset
267
b949126ed5e5 * Reorganized UIGenerate test
cemkalyoncu
parents: 1338
diff changeset
268 #ifndef NDEBUG
b949126ed5e5 * Reorganized UIGenerate test
cemkalyoncu
parents: 1338
diff changeset
269 std::string dbgname;
b949126ed5e5 * Reorganized UIGenerate test
cemkalyoncu
parents: 1338
diff changeset
270 #endif
1280
b045bad2d50e * BoundsChanged and FocusEvents
cemkalyoncu
parents: 1279
diff changeset
271
1249
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
272 protected:
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
273 /// Should resize the widget in pixels
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
274 virtual void resize(const Geometry::Size &size) = 0;
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
275
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
276 /// Should move the widget in pixels
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
277 virtual void move(const Geometry::Point &value) = 0;
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
278
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
279 /// Called when it is about to be added to the given container
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
280 virtual bool addingto(WidgetContainer &) { return true; }
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
281
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
282 /// When called, widget should locate itself on to this layer.
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
283 virtual void addto(Layer &layer) = 0;
1250
43222adb3e5f * Most of the WidgetContainer implementation
cemkalyoncu
parents: 1249
diff changeset
284
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
285 /// Called when this widget added to the given container
1370
be2cd62a4c20 #122: Disabled states are now generated
cemkalyoncu
parents: 1369
diff changeset
286 virtual void addedto(WidgetContainer &container);
1250
43222adb3e5f * Most of the WidgetContainer implementation
cemkalyoncu
parents: 1249
diff changeset
287
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
288 /// When called, widget should remove itself from the given layer
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
289 virtual void removefrom(Layer &layer) = 0;
1266
0fc123e9734c * RadioButtons widget
cemkalyoncu
parents: 1259
diff changeset
290
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
291 /// Called before this widget is removed from its parent.
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
292 virtual bool removingfrom() { return true; }
1250
43222adb3e5f * Most of the WidgetContainer implementation
cemkalyoncu
parents: 1249
diff changeset
293
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
294 /// Called after this widget is removed from its parent.
1286
939598d3a5d1 * Organizer support for containers
cemkalyoncu
parents: 1284
diff changeset
295 virtual void removed();
1250
43222adb3e5f * Most of the WidgetContainer implementation
cemkalyoncu
parents: 1249
diff changeset
296
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
297 /// When called, widget should reorder itself in layer hierarchy
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
298 virtual void setlayerorder(Layer &layer, int order) = 0;
1266
0fc123e9734c * RadioButtons widget
cemkalyoncu
parents: 1259
diff changeset
299
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
300 /// Should return true if the widget can be focused
1249
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
301 virtual bool allowfocus() const { return true; }
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
302
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
303 /// This is called after the focus is transferred to this widget.
1356
b949126ed5e5 * Reorganized UIGenerate test
cemkalyoncu
parents: 1338
diff changeset
304 virtual void focused();
1249
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
305
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
306 /// Should return true if the widget can loose the focus right now.
1279
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
307 /// Even if you return false, you still might be forced to loose
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
308 /// focus, even without this function getting called.
1249
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
309 virtual bool canloosefocus() const { return true; }
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
310
1279
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
311 /// This is called after the focus is lost. This is called even if
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
312 /// focus removal is forced.
1356
b949126ed5e5 * Reorganized UIGenerate test
cemkalyoncu
parents: 1338
diff changeset
313 virtual void focuslost();
1247
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
314
1286
939598d3a5d1 * Organizer support for containers
cemkalyoncu
parents: 1284
diff changeset
315 /// Call this function when the widget bounds is changed
939598d3a5d1 * Organizer support for containers
cemkalyoncu
parents: 1284
diff changeset
316 virtual void boundschanged();
1487
66f8110078d5 #196: Dropdown closes when it is displaced or lost focus
cemkalyoncu
parents: 1484
diff changeset
317
1566
3b5234e07735 #243 Dropdown bugs are fixed
cemkalyoncu
parents: 1562
diff changeset
318 /// Call this function when the bounds of the parent is changed
1742
6e10cbe21ea3 * Small fixes to previous changes
cemkalyoncu
parents: 1741
diff changeset
319 virtual void parentboundschanged();
1566
3b5234e07735 #243 Dropdown bugs are fixed
cemkalyoncu
parents: 1562
diff changeset
320
1369
5e3e8482f94b #68: Enabled/disabled states for widgets
cemkalyoncu
parents: 1356
diff changeset
321 /// This function is called when the parent's enabled state changes.
1562
8f6993937d51 * Dialogs now look much better
cemkalyoncu
parents: 1510
diff changeset
322 virtual void parentenabledchanged(bool /*state*/) { }
8f6993937d51 * Dialogs now look much better
cemkalyoncu
parents: 1510
diff changeset
323
8f6993937d51 * Dialogs now look much better
cemkalyoncu
parents: 1510
diff changeset
324 /// This function is called when this widget is made or unmade default.
8f6993937d51 * Dialogs now look much better
cemkalyoncu
parents: 1510
diff changeset
325 virtual void setdefaultstate(bool /*default*/) { }
8f6993937d51 * Dialogs now look much better
cemkalyoncu
parents: 1510
diff changeset
326
8f6993937d51 * Dialogs now look much better
cemkalyoncu
parents: 1510
diff changeset
327 /// This function is called when this widget is made or unmade cancel.
8f6993937d51 * Dialogs now look much better
cemkalyoncu
parents: 1510
diff changeset
328 virtual void setcancelstate(bool /*cancel*/) { }
1286
939598d3a5d1 * Organizer support for containers
cemkalyoncu
parents: 1284
diff changeset
329
1623
883289a2e6b5 #301 Hovered widget in containers
cemkalyoncu
parents: 1621
diff changeset
330 virtual void mouseenter();
883289a2e6b5 #301 Hovered widget in containers
cemkalyoncu
parents: 1621
diff changeset
331
883289a2e6b5 #301 Hovered widget in containers
cemkalyoncu
parents: 1621
diff changeset
332 virtual void mouseleave();
1744
5f97a7c6a353 * Fixed a scroll inconsistency
cemkalyoncu
parents: 1742
diff changeset
333
5f97a7c6a353 * Fixed a scroll inconsistency
cemkalyoncu
parents: 1742
diff changeset
334 /// This function will recalculate location and the size of the widget
5f97a7c6a353 * Fixed a scroll inconsistency
cemkalyoncu
parents: 1742
diff changeset
335 /// and if there is a change it will call necessary functions.
5f97a7c6a353 * Fixed a scroll inconsistency
cemkalyoncu
parents: 1742
diff changeset
336 void calculatebounds();
1623
883289a2e6b5 #301 Hovered widget in containers
cemkalyoncu
parents: 1621
diff changeset
337
1624
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
338 std::string tooltip;
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
339
1745
c417bc41d46c #337 Resize internal now uses units
cemkalyoncu
parents: 1744
diff changeset
340 /// last set location, used to determine if move is necessary
c417bc41d46c #337 Resize internal now uses units
cemkalyoncu
parents: 1744
diff changeset
341 Geometry::Point llocation = {0, 0};
c417bc41d46c #337 Resize internal now uses units
cemkalyoncu
parents: 1744
diff changeset
342
c417bc41d46c #337 Resize internal now uses units
cemkalyoncu
parents: 1744
diff changeset
343 /// last set size, used to determine if resize is necessary
c417bc41d46c #337 Resize internal now uses units
cemkalyoncu
parents: 1744
diff changeset
344 Geometry::Size lsize = {-1, -1};
1624
f88199e14d8c #301 Basic tooltip system is working
cemkalyoncu
parents: 1623
diff changeset
345
1247
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
346 private:
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
347 bool visible = true;
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
348 bool enabled = true;
1249
b9a720d08147 * Basic widget container design is finalized
cemkalyoncu
parents: 1248
diff changeset
349 bool focus = false;
1484
6a0de0bd14ad #134 Layer extender request
cemkalyoncu
parents: 1465
diff changeset
350 bool floating= false;
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
351
1753
b473f5a6ce85 * A bug in widget system is fixed
cemkalyoncu
parents: 1751
diff changeset
352 UnitPoint location = {0, 0};
b473f5a6ce85 * A bug in widget system is fixed
cemkalyoncu
parents: 1751
diff changeset
353 UnitSize size = {-1, -1};
1279
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
354
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
355 /// Never call this function
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
356 virtual void hide() = 0;
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
357
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
358 /// Never call this function
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
359 virtual void show() = 0;
88657b8e826c * Show/Hide functionality for widgets
cemkalyoncu
parents: 1272
diff changeset
360
1284
a66e180a235e * Click repeat for button
cemkalyoncu
parents: 1280
diff changeset
361 WidgetContainer *parent = nullptr;
1247
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
362 };
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
363
9875064f6925 * Initial work on widget system
cemkalyoncu
parents:
diff changeset
364
1741
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
365 }
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
366 namespace Widgets {
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
367 using UI::Pixels;
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
368 using UI::Percentage;
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
369 using UI::Units;
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
370 using UI::Dimension;
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
371 using UI::UnitDimension;
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
372 }
29e95844622d #337 Resize and move functions
cemkalyoncu
parents: 1740
diff changeset
373 }

mercurial