Skip to content

ALabel#

Represents a simple single-line text display view.

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

Detailed Description#

ALabel is used for displaying nonformatted single-line text.

Examples#

examples/app/fractal/src/FractalWindow.cpp

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

FractalWindow::FractalWindow() : AWindow("Mandelbrot set") {
    setLayout(std::make_unique<AHorizontalLayout>());

    auto centerPosDisplay = _new<ALabel>("-");
    {
        centerPosDisplay->setCustomStyle({
          BackgroundSolid { 0x80000000_argb },
          Padding { 4_dp },
          TextColor { 0xffffff_rgb },

examples/app/minesweeper/src/NewGameWindow.h

Minesweeper Game - Minesweeper game implementation driven by ass.

    MinesweeperWindow* mMinesweeper;
    _<ANumberPicker> mWidth;
    _<ANumberPicker> mHeight;
    _<ANumberPicker> mMines;
    _<ALabel> mDifficultyLabel;

    void updateMinesMax();
    void updateDifficultyLabel();
    void begin();

examples/ui/views/src/ExampleWindow.cpp

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

                                    }
                                }),
                            _new<ASpacerExpanding>(),
                          },
                          AUI_DECLARATIVE_FOR(i, *state->colors, AWordWrappingLayout) {
                              return Horizontal {
                                  _new<ALabel>(i.toString()) AUI_WITH_STYLE {
                                      TextColor { i.readableBlackOrWhite() },
                                  }
                              } AUI_WITH_STYLE {

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).

    AProperty<AString> currentExpression;
};

static _<AView> labelTitle(AString s) {
    return _new<ALabel>(std::move(s)) AUI_WITH_STYLE {
        Opacity { 0.5f },
        ATextAlign::CENTER,
    };
}

examples/app/minesweeper/src/NewGameWindow.cpp

Minesweeper Game - Minesweeper game implementation driven by ass.

          "Mines count:"_as,
          mMines = _new<ANumberPicker>() AUI_LET { it->setMin(8); },
        },
      }),
      mDifficultyLabel = _new<ALabel>(),
      Horizontal {
        _new<ASpacerExpanding>(),
        _new<AButton>("Start game") AUI_LET {
                it->setDefault();
                connect(it->clicked, me::begin);