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"
29class API_AUI_VIEWS AButton :
public AAbstractLabel {
33 explicit AButton(
AString text)
noexcept: AAbstractLabel(std::move(
text)) {}
35 virtual ~AButton() =
default;
38 bool isDefault()
const noexcept {
42 void setDefault(
bool isDefault =
true);
58class AButtonEx :
public AViewContainer {
64 ~AButtonEx()
override =
default;
67namespace declarative {
71struct Button : aui::ui_building::view_container_layout<AHorizontalLayout, AButtonEx> {
106 template <
typename... Views>
112namespace ass::button {
115 _unique<IAssSubSelector> mWrapped;
119 Default(T value): mWrapped(
new T(std::move(value))) {}
122 bool isPossiblyApplicable(
AView* view)
override {
123 return mWrapped->isPossiblyApplicable(view) &&
dynamic_cast<AButton*
>(view);
126 bool isStateApplicable(
AView* view)
override {
127 if (!mWrapped->isStateApplicable(view))
130 if (
auto c =
dynamic_cast<AButton*
>(view)) {
131 return c->isDefault();
137 IAssSubSelector::setupConnections(view, helper);
138 mWrapped->setupConnections(view, helper);
140 if (
auto c =
dynamic_cast<AButton*
>(view)) {
141 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 row.
Definition AHorizontalLayout.h:42
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:572
#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