aui::ui_building::view#
Declarative view trait.
| Header: | #include <AUI/Util/Declarative/Containers.h> |
| CMake: | aui_link(my_target PUBLIC aui::views) |
Examples#
examples/ui/views/src/ExampleWindow.cpp
Views Example — All-in-one views building example.
mAsync << AUI_THREADPOOL {
auto drawable = IDrawable::fromUrl(
"https://raster.shields.io/github/stars/aui-framework/aui?style=raster&logo=github");
AUI_UI_THREAD {
auto view = Icon { drawable } AUI_OVERRIDE_STYLE {
FixedSize { 80_dp, 20_dp },
BackgroundImage { {}, {}, {}, Sizing::COVER },
Margin { 4_dp },
ACursor::POINTER,
};
examples/7guis/cells/src/AST.cpp
7GUIs Cells — Spreadsheet processor (Excel).
formula::Value evaluate(const Spreadsheet& ctx) override {
return function(functions::Ctx {
.spreadsheet = ctx,
.args = AVector(
args | ranges::view::transform([&](const _unique<INode>& node) { return node->evaluate(ctx); }) |
ranges::to_vector),
});
}
};
auto out = std::make_unique<FunctionCall>();
examples/7guis/crud/src/main.cpp
7GUIs CRUD — Create/Read/Update/Delete example.
_new<ATextField>() AUI_OVERRIDE_STYLE { Expanding(1, 0) } && mFilterPrefix,
} AUI_OVERRIDE_STYLE { LayoutSpacing { 4_dp } },
AScrollArea::Builder().withExpanding().withContents(
AUI_DECLARATIVE_FOR(i, *mUsers | FILTER_VIEW, AVerticalLayout) {
auto view = _new<ALabel>();
view & i->displayName;
connect(mSelectedUser, view, [this, &view = *view, i] {
view.setAssName("selected", mSelectedUser == i);
});
connect(view->clicked, [this, i] {
examples/app/minesweeper/src/Style.cpp
Minesweeper Game — Minesweeper game implementation driven by ass.
examples/app/notes/src/main.cpp
Notes App — Note taking app that demonstrates usage of AListModel, AProperty, user data saving and loading.
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;
view.setAssName(".plain_bg", currentNote == note);
};
};
})