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"
27class API_AUI_VIEWS AButton :
public AAbstractLabel {
31 explicit AButton(
AString text)
noexcept: AAbstractLabel(std::move(
text)) {}
33 virtual ~AButton() =
default;
36 bool isDefault()
const noexcept {
40 void setDefault(
bool isDefault =
true);
56class AButtonEx :
public AViewContainer {
62 ~AButtonEx()
override =
default;
65namespace declarative {
66 struct Button : aui::ui_building::view_container_layout<AHorizontalLayout, AButtonEx> {
69 Button(
AString text) : layouted_container_factory<AHorizontalLayout, AButtonEx>({Label{std::move(text)}}) {}
71 Button(
const char* text) : layouted_container_factory<AHorizontalLayout, AButtonEx>({Label{text}}) {}
75namespace ass::button {
78 _unique<IAssSubSelector> mWrapped;
82 Default(T value): mWrapped(
new T(std::move(value))) {}
85 bool isPossiblyApplicable(
AView* view)
override {
86 return mWrapped->isPossiblyApplicable(view) &&
dynamic_cast<AButton*
>(view);
89 bool isStateApplicable(
AView* view)
override {
90 if (!mWrapped->isStateApplicable(view))
93 if (
auto c =
dynamic_cast<AButton*
>(view)) {
94 return c->isDefault();
100 IAssSubSelector::setupConnections(view, helper);
101 mWrapped->setupConnections(view, helper);
103 if (
auto c =
dynamic_cast<AButton*
>(view)) {
104 c->defaultState.clearAllConnectionsWith(helper.get());
bool consumesClick(const glm::ivec2 &pos) override
Determines whether this AView processes this click or passes it thru.
Definition AAbstractLabel.cpp:245
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:37
Base class of all UI objects.
Definition AView.h:78
void addAssName(const AString &assName)
Adds an ASS class to this AView.
Definition AView.cpp:281
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:178
Definition AAssSelector.h:28
class_of c
Selects views that are of the specified classes.
Definition class_of.h:84
ASignal< Args... > emits
A signal declaration.
Definition ASignal.h:348
#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
static void connect(const Signal &signal, Object *object, Function &&function)
Connects signal to the slot of the specified object.
Definition AObject.h:65