Skip to content

ass::Expanding#

Controls the expanding of AView.

Header:#include <AUI/ASS/Property/Expanding.h>
CMake:aui_link(my_target PUBLIC aui::views)

Examples#

examples/7guis/cells/src/main.cpp

7GUIs Cells — Spreadsheet processor (Excel).

                        }

                        views[0][0] = _new<AView>();   // blank
                        for (unsigned i = 0; i < mState->spreadsheet.size().x; ++i) {
                            views[0][i + 1] = Centered{ labelTitle(Cell::columnName(i)) } AUI_OVERRIDE_STYLE { Expanding(1, 0) };
                        }
                        for (unsigned row = 0; row < mState->spreadsheet.size().y; ++row) {
                            views[row + 1][0] = labelTitle("{}"_format(Cell::rowName(row)));
                            for (unsigned column = 0; column < mState->spreadsheet.size().x; ++column) {
                                views[row + 1][column + 1] = _new<CellView>(mState, mState->spreadsheet[{ column, row }]) AUI_OVERRIDE_STYLE {
examples/7guis/circle_drawer/src/main.cpp

7GUIs Circle Drawer — Undo, redo, dialog control.

class CircleDrawArea : public AView {
public:
    CircleDrawArea(_<State> state) : mState(std::move(state)) {
        setCustomStyle({
          Expanding(),
          BackgroundSolid(AColor::WHITE),
          Border(1_px, AColor::GRAY),
          AOverflow::HIDDEN_FROM_THIS,
        });
        connect(mState->circles.changed, me::redraw);
examples/7guis/timer/src/main.cpp

7GUIs Timer — Timer example.

class TimerWindow : public AWindow {
public:
    TimerWindow() : AWindow("AUI - 7GUIs - Timer", 300_dp, 50_dp) {
        setContents(Centered {
          Vertical::Expanding {
            Horizontal {
              Label { "Elapsed Time:" },
              Centered::Expanding {
                _new<AProgressBar>() AUI_LET {
                        it & mElapsedTimeRatio;
examples/7guis/crud/src/main.cpp

7GUIs CRUD — Create/Read/Update/Delete example.

            return user->displayName->startsWith(*mFilterPrefix);
        });

        setContents(Vertical {
          Horizontal::Expanding {
            Vertical::Expanding {
              Horizontal {
                Label { "Filter prefix:" },
                _new<ATextField>() AUI_OVERRIDE_STYLE { Expanding(1, 0) } && mFilterPrefix,
              } AUI_OVERRIDE_STYLE { LayoutSpacing { 4_dp } },
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.

            } AUI_OVERRIDE_STYLE { LayoutSpacing { 4_dp } },
          },
          Centered {
            _new<CellsView>(aui::ptr::fake_shared(&mCells)) AUI_OVERRIDE_STYLE {
                  Expanding(),
                  BackgroundSolid(AColor::BLACK),
                },
          },
        } AUI_OVERRIDE_STYLE { LayoutSpacing { 4_dp } });
    }
examples/app/notes/src/main.cpp

Notes App — Note taking app that demonstrates usage of AListModel, AProperty, user data saving and loading.

    }
    return AScrollArea::Builder().withContents(
        Vertical {
          _new<TitleTextArea>("Untitled") AUI_LET {
                  it->setCustomStyle({ FontSize { 14_pt }, Expanding { 1, 0 } });
                  AObject::biConnect(note->title, it->text());
                  if (note->content.raw.empty()) {
                      it->focus();
                  }
              },
examples/ui/contacts/src/main.cpp

AUI Contacts — Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.

                                    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 {
                  .content = AUI_REACT(mSelectedContact != nullptr ? contactDetails(mSelectedContact) : nullptr),
              } AUI_OVERRIDE_STYLE { Expanding(), MinSize(300_dp), BackgroundSolid { AColor::WHITE } },
            } AUI_OVERRIDE_STYLE {
examples/ui/backdrop/src/main.cpp

Backdrop — Backdrop effects demo.

static auto headerWithContents(_<AView> content) {
    auto result = Stacked {
        AScrollArea::Builder().withContents(content).build() AUI_OVERRIDE_STYLE {
              Expanding(),
              Padding { 80_dp, 0, 0 },
            } AUI_LET { it->setExtraStylesheet(
                     AStylesheet {
                         {
                             t<AScrollAreaViewport>(),
examples/ui/opengl_simple/src/main.cpp

OpenGL Example — Demonstrates how to integrate custom OpenGL rendering with AUI Framework.

    auto window = _new<AWindow>("OpenGL Demo", 600_dp, 300_dp);
    auto state = _new<State>();
    window->setContents(
        Stacked {
          _new<MyRenderer>(state) AUI_OVERRIDE_STYLE { Expanding() },
          Horizontal::Expanding {
            Vertical {
              Vertical {
                Label { AUI_REACT(fmt::format("FPS: {:.1f}", *state->fps)) },
              } AUI_OVERRIDE_STYLE {
examples/ui/views/src/ExampleWindow.cpp

Views Example — All-in-one views building example.

    addView(Horizontal {
      _new<ADrawableView>(IDrawable::fromUrl(":img/logo.svg")) AUI_OVERRIDE_STYLE { FixedSize { 32_dp } },
      AText::fromString("Building beautiful programs in pure C++ without chromium embedded framework") AUI_OVERRIDE_STYLE {
        Expanding(1, 1),
      },
      Horizontal {} AUI_LET {
              mAsync << AUI_THREADPOOL {
                  auto drawable = IDrawable::fromUrl(
                      "https://raster.shields.io/github/stars/aui-framework/aui?style=raster&logo=github");
examples/app/minesweeper/src/MinesweeperWindow.cpp

Minesweeper Game — Minesweeper game implementation driven by ass.

MinesweeperWindow::MinesweeperWindow() : AWindow("Minesweeper", 100_dp, 100_dp) {
    setContents(Vertical {
      Horizontal {
        Centered::Expanding {
          _new<AButton>("New game...").connect(&AButton::clicked, me::newGame),
        },
      },
      _container<AStackedLayout>(
          { // also assign ".frame" ASS class in place
examples/app/fractal/src/FractalWindow.cpp

Fractal Example — Fractal viewer application demonstrating usage of custom shaders.

        centerPosDisplay->setText("Center position: {} {}, scale: {}"_format(newPos.x, -newPos.y, scale));
    });

    setContents(Horizontal {
      Stacked::Expanding {
        fractal,
        Vertical::Expanding {
          SpacerExpanding {},
          Horizontal {
            SpacerExpanding {},
examples/ui/contacts/src/view/ContactDetailsView.cpp

AUI Contacts — Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.

    mOriginalContact = mContact;
    setExtraStylesheet(AStylesheet {
      {
        c(".row-value"),
        Expanding(1, 0),
      },
    });
    connect(mEditorMode, [this] {
        setContents(Vertical::Expanding {
          AScrollArea::Builder().withContents(Centered {