class
#include <Magnum/Ui/Button.h>
Button Button widget.
Text and foreground. Emits tapped() signal on tap.
Styling
Ignores WidgetFlag::
Base classes
- class Widget
- Base for widgets.
Constructors, destructors, conversion operators
-
Button(Plane& plane,
const Anchor& anchor,
const std::
string& text, std:: size_t capacity = 0, Style style = Style:: Default) explicit - Constructor.
-
Button(Plane& plane,
const Anchor& anchor,
const std::
string& text, Style style) explicit -
template<std::Button(Plane& plane, const Anchor& anchor, const char(&text)[size], std::
size_t size> size_t capacity = 0, Style style = Style:: Default) explicit -
template<std::Button(Plane& plane, const Anchor& anchor, const char(&text)[size], Style style) explicit
size_t size> -
Button(Plane& plane,
const Anchor& anchor,
Containers::
ArrayView<const char> text, std:: size_t capacity = 0, Style style = Style:: Default) explicit -
Button(Plane& plane,
const Anchor& anchor,
Containers::
ArrayView<const char> text, Style style) explicit
Public functions
- auto setStyle(Style style) -> Button&
- Set widget style.
-
auto setText(const std::
string& text) -> Button& - Set text.
-
auto setText(Containers::
ArrayView<const char> text) -> Button& -
template<std::auto setText(const char(&text)[size]) -> Button&
size_t size> - auto tapped() -> Signal
- The button was tapped.
Function documentation
Magnum:: Ui:: Button:: Button(Plane& plane,
const Anchor& anchor,
const std:: string& text,
std:: size_t capacity = 0,
Style style = Style:: Default) explicit
Constructor.
Parameters | |
---|---|
plane | Plane this widget is a part of |
anchor | Positioning anchor |
text | Button text |
capacity | Button text capacity (see setText()) |
style | Widget style |
Magnum:: Ui:: Button:: Button(Plane& plane,
const Anchor& anchor,
const std:: string& text,
Style style) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<std:: size_t size>
Magnum:: Ui:: Button:: Button(Plane& plane,
const Anchor& anchor,
const char(&text)[size],
std:: size_t capacity = 0,
Style style = Style:: Default) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<std:: size_t size>
Magnum:: Ui:: Button:: Button(Plane& plane,
const Anchor& anchor,
const char(&text)[size],
Style style) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Magnum:: Ui:: Button:: Button(Plane& plane,
const Anchor& anchor,
Containers:: ArrayView<const char> text,
std:: size_t capacity = 0,
Style style = Style:: Default) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Magnum:: Ui:: Button:: Button(Plane& plane,
const Anchor& anchor,
Containers:: ArrayView<const char> text,
Style style) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Button& Magnum:: Ui:: Button:: setText(const std:: string& text)
Set text.
Returns | Reference to self (for method chaining) |
---|
The text is expected to not exceed the capacity defined in the constructor.
Button& Magnum:: Ui:: Button:: setText(Containers:: ArrayView<const char> text)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<std:: size_t size>
Button& Magnum:: Ui:: Button:: setText(const char(&text)[size])
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.