aui::lambda_overloaded#
Header: | #include <AUI/Traits/callables.h> |
CMake: | aui_link(my_target PUBLIC aui::core) |
Examples#
examples/7guis/flight_booker/src/main.cpp
7GUIs Flight Booker - Flight Booker.
auto dateTextField(DateTextFieldState& state) {
return _new<ATextField>() AUI_LET {
AObject::biConnect(
state.parsed.biProjected(aui::lambda_overloaded {
[](const AOptional<system_clock::time_point>& v) -> AString {
if (!v) {
return "";
}
return formatDate(*v);
examples/7guis/cells/src/main.cpp
7GUIs Cells - Spreadsheet processor (Excel).
mConnection = connect(mCell.value, [this](const formula::Value& v) {
ALayoutInflater::inflate(
this,
std::visit(
aui::lambda_overloaded {
[](std::nullopt_t) -> _<AView> { return _new<AView>(); },
[](double v) -> _<AView> { return Label { "{}"_format(v) } AUI_WITH_STYLE { ATextAlign::RIGHT }; },
[](const AString& v) -> _<AView> { return Label { "{}"_format(v) }; },
[](const formula::Range& v) -> _<AView> { return Label { "#RANGE?" }; },
},
examples/7guis/timer/src/main.cpp
7GUIs Timer - Timer example.
}),
Horizontal {
Label { "Duration:" },
_new<ASlider>() AUI_LET {
it&& mDuration.biProjected(aui::lambda_overloaded {
[](high_resolution_clock::duration d) -> aui::float_within_0_1 {
return float(d.count()) / float(MAX_DURATION.count());
},
[](aui::float_within_0_1 d) -> high_resolution_clock::duration {
return high_resolution_clock::duration(long(float(d) * float(MAX_DURATION.count())));
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;