AUI_SLOT#
Passes some variable and type of the variable separated by comma. It's convenient to use with the connect function (see examples).
| Header: | #include <AUI/Util/kAUI.h> |
| CMake: | aui_link(my_target PUBLIC aui::core) |
Definition#
Detailed Description#
Quick example:
| without | with |
If you are intended to reference this-> object, consider using me instead.
Examples#
examples/app/notes/src/main.cpp
Notes App - Note taking app that demonstrates usage of AListModel, AProperty, user data saving and loading.
},
/// [scrollarea]
AScrollArea::Builder()
.withContents(
AUI_DECLARATIVE_FOR(note, *mNotes, AVerticalLayout) {
observeChangesForDirty(note);
return notePreview(note) AUI_LET {
connect(it->clicked, [this, note] { mCurrentNote = note; });
it& mCurrentNote > [note](AView& view, const _<Note>& currentNote) {
ALOG_DEBUG(LOG_TAG) << "currentNote == note " << currentNote << " == " << note;
examples/ui/contacts/src/main.cpp
AUI Contacts - Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
mSelectedContact = nullptr;
}
_<AView> indexedList() {
return AUI_DECLARATIVE_FOR(group, *mContacts | ranges::views::chunk_by([](const _<Contact>& lhs, const _<Contact>& rhs) {
return groupLetter(lhs->displayName) == groupLetter(rhs->displayName);
}), AVerticalLayout) {
auto firstContact = *ranges::begin(group);
auto firstLetter = groupLetter(firstContact->displayName);
ALogger::info("Test") << "Computing view for group " << AString(1, firstLetter);
examples/ui/views/src/ExampleWindow.cpp
Views Example - All-in-one views building example.
}
}),
_new<ASpacerExpanding>(),
} AUI_WITH_STYLE { LayoutSpacing { 4_dp } },
AUI_DECLARATIVE_FOR(i, *state->colors, AWordWrappingLayout) {
return Horizontal {
_new<ALabel>(i.toString()) AUI_WITH_STYLE {
TextColor { i.readableBlackOrWhite() },
}
} AUI_WITH_STYLE {
examples/app/game_of_life/src/main.cpp
Game of Life - Game of Life implementation that uses advanced large dynamic data rendering techniques such as ITexture, AImage to be GPU friendly. The computation is performed in AThreadPool.
s->resize(size.x * size.y);
}
connect(mTimer->fired, me::frame);
connect(isRunning.changed, AUI_SLOT(mTimer)::setRunning);
}
void frame() {
mFrame = AThreadPool::global() * [&] {
for (int y = 0; y < mSize.y; ++y) {
examples/app/minesweeper/src/Style.cpp
Minesweeper Game - Minesweeper game implementation driven by ass.
void setupConnections(AView* view, const _<AAssHelper>& helper) override {
IAssSubSelector::setupConnections(view, helper);
view->customCssPropertyChanged.clearAllOutgoingConnectionsWith(helper.get());
AObject::connect(view->customCssPropertyChanged, AUI_SLOT(helper)::onInvalidateStateAss);
}
};
/// [CellSelector]
examples/app/fractal/src/FractalWindow.cpp
Fractal Example - Fractal viewer application demonstrating usage of custom shaders.
},
},
},
Vertical {
_new<AButton>("Identity").connect(&AButton::clicked, AUI_SLOT(fractal)::reset),
_new<AButton>("Jump to coords...")
.connect(&AButton::clicked, this, [&, fractal]() { _new<JumpToCoordsWindow>(fractal, this)->show(); }),
_new<ALabel>("Iterations:"),
_new<ANumberPicker>().connect(
&ANumberPicker::valueChanged, this, [fractal](int v) { fractal->setIterations(v); }) AUI_LET {
examples/7guis/flight_booker/src/main.cpp
7GUIs Flight Booker - Flight Booker.
state.parsed = parseDate(s);
});
AObject::connect(
AUI_REACT(ass::PropertyList { BackgroundSolid(!state->parsed->hasValue() ? AColor::RED : AColor::WHITE) }),
AUI_SLOT(it)::setCustomStyle);
};
}
struct State {
DateTextFieldState departureDate { .parsed = system_clock::now() }, returnDate { .parsed = system_clock::now() };
examples/7guis/circle_drawer/src/main.cpp
7GUIs Circle Drawer - Undo, redo, dialog control.
Centered {
Horizontal {
Button { Label { "Undo" }, { me::undo } } AUI_LET {
connect(
AUI_REACT(mState.history.nextAction != mState.history.begin()), AUI_SLOT(it)::setEnabled);
},
Button { Label { "Redo" }, { me::redo } } AUI_LET {
connect(
AUI_REACT(mState.history.nextAction != mState.history.end()), AUI_SLOT(it)::setEnabled);
},