class
WidgetBase for widgets.
Contents
Derived classes
Public static functions
-
static void disable(std::
initializer_list<std:: reference_wrapper<Widget>> widgets) - Disable a set of widgets.
-
static void enable(std::
initializer_list<std:: reference_wrapper<Widget>> widgets) - Enable a set of widgets.
-
static void setEnabled(bool enabled,
std::
initializer_list<std:: reference_wrapper<Widget>> widgets) - Enable or disable a set of widgets.
-
static void hide(std::
initializer_list<std:: reference_wrapper<Widget>> widgets) - Hide a set of widgets.
-
static void show(std::
initializer_list<std:: reference_wrapper<Widget>> widgets) - Show a set of widgets.
-
static void setVisible(bool visible,
std::
initializer_list<std:: reference_wrapper<Widget>> widgets) - Set a set of widgets visible.
Constructors, destructors, conversion operators
- Widget(AbstractPlane& plane, const Anchor& anchor, const Range2D& padding = {}) explicit
- Constructor.
Public functions
- auto rect() const -> Range2D
- Widget rectangle.
- auto padding() const -> Range2D
- Padding for widgets inside.
- auto flags() const -> WidgetFlags
- Flags.
- auto disable() -> Widget&
- Disable widget.
- auto enable() -> Widget&
- Enable widget.
- auto setEnabled(bool enabled) -> Widget&
- Enable or disable widget.
- auto hide() -> Widget&
- Hide widget.
- auto show() -> Widget&
- Show widget.
- auto setVisible(bool visible) -> Widget&
- Set widget visible.
Protected functions
- auto plane() -> AbstractPlane&
- Plane this widget is a part of.
- auto plane() const -> const AbstractPlane&
- void update() virtual
- Update the widget after its state changed.
- auto hoverEvent() -> bool virtual
- Hover event.
- auto pressEvent() -> bool virtual
- Press event.
- auto releaseEvent() -> bool virtual
- Release event.
- auto focusEvent() -> bool virtual
- Focus event.
- auto blurEvent() -> bool virtual
- Blur event.
Function documentation
static void Magnum:: Ui:: Widget:: disable(std:: initializer_list<std:: reference_wrapper<Widget>> widgets)
Disable a set of widgets.
Convenience batch alternative to disable().
static void Magnum:: Ui:: Widget:: enable(std:: initializer_list<std:: reference_wrapper<Widget>> widgets)
Enable a set of widgets.
Convenience batch alternative to enable().
static void Magnum:: Ui:: Widget:: setEnabled(bool enabled,
std:: initializer_list<std:: reference_wrapper<Widget>> widgets)
Enable or disable a set of widgets.
Convenience batch alternative to setEnabled().
static void Magnum:: Ui:: Widget:: hide(std:: initializer_list<std:: reference_wrapper<Widget>> widgets)
Hide a set of widgets.
Convenience batch alternative to hide().
static void Magnum:: Ui:: Widget:: show(std:: initializer_list<std:: reference_wrapper<Widget>> widgets)
Show a set of widgets.
Convenience batch alternative to show().
static void Magnum:: Ui:: Widget:: setVisible(bool visible,
std:: initializer_list<std:: reference_wrapper<Widget>> widgets)
Set a set of widgets visible.
Convenience batch alternative to setVisible().
Magnum:: Ui:: Widget:: Widget(AbstractPlane& plane,
const Anchor& anchor,
const Range2D& padding = {}) explicit
Constructor.
Parameters | |
---|---|
plane | Plane this widget is a part of |
anchor | Positioning anchor |
padding | Padding for widgets inside |
Widget& Magnum:: Ui:: Widget:: setEnabled(bool enabled)
Enable or disable widget.
Returns | Reference to self (for method chaining) |
---|
Widget& Magnum:: Ui:: Widget:: setVisible(bool visible)
Set widget visible.
Returns | Reference to self (for method chaining) |
---|
const AbstractPlane& Magnum:: Ui:: Widget:: plane() const protected
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Ui:: Widget:: update() virtual protected
Update the widget after its state changed.
Expects to do only visual update, should not do any expensive operations like text relayouting.
bool Magnum:: Ui:: Widget:: hoverEvent() virtual protected
Hover event.
Returns | True if the event was accepted, false if it was ignored |
---|
Called when the widget is hovered by the mouse or when the mouse leaves it again. Use Flag::false
.
bool Magnum:: Ui:: Widget:: pressEvent() virtual protected
Press event.
Returns | True if the event was accepted, false if it was ignored |
---|
When the widget is pressed, Flag::false
.
bool Magnum:: Ui:: Widget:: releaseEvent() virtual protected
Release event.
Returns | True if the event was accepted, false if it was ignored |
---|
On release after previous press event, Flag::false
.
bool Magnum:: Ui:: Widget:: focusEvent() virtual protected
Focus event.
Returns | True if the event was accepted, false if it was ignored |
---|
If both press and release event happened on the same widget, Flag::false
.
bool Magnum:: Ui:: Widget:: blurEvent() virtual protected
Blur event.
Returns | True if the event was accepted, false if it was ignored |
---|
If the widget was active previously and the user tapped outside, Flag::false
.