Skip to content

ALayout#

Base class for all layout managers.

Header:#include <AUI/Layout/ALayout.h>
CMake:aui_link(my_target PUBLIC aui::views)

Public Methods#

addView#


virtual void ALayout::addView(const _<AView>& view, AOptional<size_t> index = std::nullopt)

Attaches view to the layout.

Arguments
view
view to attach.
index
index to insert at. If not specified, when the view is inserted at the end.

See ABasicLayout for basic implementation of this method.

Examples#

examples/app/minesweeper/src/MinesweeperWindow.cpp

Minesweeper Game - Minesweeper game implementation driven by ass.

        int y = i / columns;
        auto cell = _new<CellView>(fieldAt(x, y));

        setupEventHandlers(x, y, cell);
        mGrid->addView(cell);
    }

    pack();
}
/// [beginGame]

getAllViews#


virtual AVector<_<AView>> ALayout::getAllViews()

Visits all views in the layout.

onResize#


virtual void ALayout::onResize(int x, int y, int width, int height)

Applies geometry to children.

Arguments
x
x coordinate in container's coordinate space, add padding if necessary.
y
y coordinate in container's coordinate space, add padding if necessary.
width
width of the container, add padding if necessary.
height
height of the container, add padding if necessary.

See layout-managers for more info.

removeView#


virtual void ALayout::removeView(aui::no_escape<AView> view, size_t index)

Detaches view from the layout.

Arguments
view
view to detach.
index
index of the view in the container. This value is indented for optimization purposes in most cases; the value may be ignored safely.

See ABasicLayout for basic implementation of this method.

setSpacing#


virtual void ALayout::setSpacing(int spacing)

Layout spacing.

Arguments
spacing
spacing in px.