15#include "AUI/Common/AString.h"
16#include "AUI/Render/IRenderer.h"
17#include "AUI/Layout/AHorizontalLayout.h"
19#include "AViewContainer.h"
20#include "AUI/ASS/Selector/AAssSelector.h"
21#include "AUI/Layout/AStackedLayout.h"
22#include "AUI/Util/UIBuildingHelpers.h"
31class API_AUI_VIEWS AButton :
public AAbstractLabel {
35 explicit AButton(
AString text)
noexcept: AAbstractLabel(std::move(
text)) {}
37 virtual ~AButton() =
default;
40 bool isDefault()
const noexcept {
44 void setDefault(
bool isDefault =
true);
60class AButtonEx :
public AViewContainer {
66 ~AButtonEx()
override =
default;
69namespace declarative {
73struct Button : aui::ui_building::view_container_layout<AStackedLayout, AButtonEx> {
108 template <
typename... Views>
114namespace ass::button {
117 _unique<IAssSubSelector> mWrapped;
121 Default(T value): mWrapped(
new T(std::move(value))) {}
124 bool isPossiblyApplicable(
AView* view)
override {
125 return mWrapped->isPossiblyApplicable(view) &&
dynamic_cast<AButton*
>(view);
128 bool isStateApplicable(
AView* view)
override {
129 if (!mWrapped->isStateApplicable(view))
132 if (
auto c =
dynamic_cast<AButton*
>(view)) {
133 return c->isDefault();
139 IAssSubSelector::setupConnections(view, helper);
140 mWrapped->setupConnections(view, helper);
142 if (
auto c =
dynamic_cast<AButton*
>(view)) {
143 c->defaultState.clearAllOutgoingConnectionsWith(helper.get());
auto text() const
Label's text property.
Definition AAbstractLabel.h:37
Stores a value and observes it's changes, emitting a signal.
Definition AFieldSignalEmitter.h:21
Places views in a stack (along z axis).
Definition AStackedLayout.h:37
Represents a Unicode character string.
Definition AString.h:38
Base class of all UI objects.
Definition AView.h:78
void addAssName(const AString &assName)
Adds an ASS class to this AView.
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:179
Definition AAssSelector.h:28
class_of c
Selects views that are of the specified classes.
Definition class_of.h:84
static decltype(auto) connect(const Signal &signal, Object *object, Function &&function)
Connects signal to the slot of the specified object.
Definition AObject.h:86
ASignal< Args... > emits
A signal declaration.
Definition ASignal.h:577
#define slot(v)
Passes some variable and type of the variable separated by comma. It's convenient to use with the con...
Definition kAUI.h:88
Declarative form of ALabel.
Definition ALabel.h:35