ASplitter#
A resizeable horizontal or vertical layout.
Header: | #include <AUI/View/ASplitter.h> |
CMake: | aui_link(my_target PUBLIC aui::views) |
Detailed Description#
ASplitter lets the user control the size of child views by dragging the boundary between them. Any number of views may be controlled by a single splitter.
Generally, ASplitter mimics behaviour of linear layouts (i.e., Vertical
and Horizontal
):
1. if there's no expanding view, both linear layouts and ASplitter leave blank space at the end
2. expanding views use all available space.
ASplitter is applying geometry via min size-like logic by custom ALayout implementation.
ASplitter tends to reclaim space from non-expanding views in favour to expanding views. As such, there should be at least 1 view with expanding. If there's no such view, ASplitter adds ASpacerFixed to the end.
Valid expandings should be applied before constructing ASplitter. ASplitter does not support changing expanding on the fly.
ASplitter is constructed by builder. Use ASplitter::Horizontal()
and ASplitter::Vertical()
.
Public Types#
Builder#
class ASplitter::Builder
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/backdrop/src/main.cpp
Backdrop - Backdrop effects demo.
using namespace ass;
static auto headerWithContents(_<AView> content) {
auto result = Stacked {
AScrollArea::Builder().withContents(content).build() AUI_WITH_STYLE {
Expanding(),
Padding { 80_dp, 0, 0 },
} AUI_LET { it->setExtraStylesheet(
AStylesheet {
{
examples/ui/contacts/src/view/ContactDetailsView.cpp
AUI Contacts - Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
},
});
connect(mEditorMode, [this] {
setContents(Vertical::Expanding {
AScrollArea::Builder().withContents(Centered {
Vertical::Expanding {
Horizontal {
profilePhoto(mContact),
Centered::Expanding {
presentation(mContact->displayName) AUI_WITH_STYLE { FontSize { 12_pt } },
examples/7guis/crud/src/main.cpp
7GUIs CRUD - Create/Read/Update/Delete example.
Label { "Filter prefix:" },
_new<ATextField>() AUI_WITH_STYLE { Expanding(1, 0) } && mFilterPrefix,
},
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);
});
examples/7guis/cells/src/main.cpp
7GUIs Cells - Spreadsheet processor (Excel).
Empty structure.