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#
#define AUI_SLOT(v) v, &aui::impl::slot::decode_type_t<std::decay_t<decltype(v)>>
Detailed Description#
Quick example:
| without | with |
If you are intended to reference this-> object, consider using me instead.
Examples#
examples/7guis/flight_booker/src/main.cpp
7GUIs Flight Booker — Flight Booker.
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);
},
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/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/notes/src/main.cpp
Notes App — Note taking app that demonstrates usage of AListModel, AProperty, user data saving and loading.
Button {
Horizontal { Icon { ":img/trash.svg" }, SpacerFixed { 2_dp }, Label { "Delete" } },
{ me::deleteCurrentNote },
} AUI_LET {
connect(AUI_REACT(mCurrentNote != nullptr), AUI_SLOT(it)::setEnabled);
},
},
experimental::Dynamic { AUI_REACT(noteEditor(mCurrentNote)) } AUI_OVERRIDE_STYLE { Expanding() },
} << ".plain_bg" AUI_OVERRIDE_STYLE { MinSize { 200_dp } },
})
examples/ui/contacts/src/main.cpp
AUI Contacts — Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
FontSize { 10_pt },
ATextAlign::CENTER,
Margin { 8_dp },
mSearchQuery->empty() ? Visibility::VISIBLE : Visibility::GONE,
}), AUI_SLOT(it)::setCustomStyle);
},
} AUI_OVERRIDE_STYLE { Padding(0, 8_dp) })
.build() AUI_OVERRIDE_STYLE { Expanding(0, 1), MinSize(200_dp) },
experimental::Dynamic {
examples/ui/views/src/ExampleWindow.cpp
Views Example — All-in-one views building example.
auto model = _new<DemoListModel>();
return Vertical {
Horizontal {
_new<AButton>("Add").connect(&AButton::clicked, AUI_SLOT(model)::addItem),
_new<AButton>("Remove").connect(&AButton::clicked, AUI_SLOT(model)::removeItem),
} AUI_OVERRIDE_STYLE { LayoutSpacing { 4_dp } },
_new<AListView>(model) AUI_OVERRIDE_STYLE {
MinSize { 60_dp, 60_dp },
}