Skip to content

AUI_SLOT#

Passes some variable and type of the variable separated by comma. It's convenient to use with the connect function (see examples).

Header:#include <AUI/Util/kAUI.h>
CMake:aui_link(my_target PUBLIC aui::core)

Definition#

#define AUI_SLOT(v) v, &aui::impl::slot::decode_type_t<std::decay_t<decltype(v)>>

Detailed Description#

Quick example:

without with
connect(clicked, myObject, &MyObject::handleClicked);
connect(clicked, AUI_SLOT(myObject)::handleClicked);

If you are intended to reference this-> object, consider using me instead.

Examples#

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/app/fractal/src/FractalWindow.cpp

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

          },
        },
      },
      Vertical {
        _new<AButton>("Identity").connect(&AButton::clicked, AUI_SLOT(fractal)::reset),
        _new<AButton>("Jump to coords...")
            .connect(&AButton::clicked, this, [&, fractal]() { _new<JumpToCoordsWindow>(fractal, this)->show(); }),
        _new<ALabel>("Iterations:"),
        _new<ANumberPicker>().connect(
            &ANumberPicker::valueChanged, this, [fractal](int v) { fractal->setIterations(v); }) AUI_LET {

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.

            s->resize(size.x * size.y);
        }

        connect(mTimer->fired, me::frame);
        connect(isRunning.changed, AUI_SLOT(mTimer)::setRunning);
    }

    void frame() {
        mFrame = AThreadPool::global() * [&] {
            for (int y = 0; y < mSize.y; ++y) {

examples/app/minesweeper/src/Style.cpp

Minesweeper Game - Minesweeper game implementation driven by ass.

    void setupConnections(AView* view, const _<AAssHelper>& helper) override {
        IAssSubSelector::setupConnections(view, helper);
        view->customCssPropertyChanged.clearAllOutgoingConnectionsWith(helper.get());
        AObject::connect(view->customCssPropertyChanged, AUI_SLOT(helper)::onInvalidateStateAss);
    }
};
/// [CellSelector]

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

7GUIs Flight Booker - Flight Booker.

                    connect(it->selectionId().readProjected([](int selectionId) { return selectionId == 1; }),
                            mIsReturnFlight);
                },
            dateTextField(mDepartureDate),
            dateTextField(mReturnDate) AUI_LET { connect(mIsReturnFlight, AUI_SLOT(it)::setEnabled); },
            _new<AButton>("Book") AUI_LET {
                    connect(it->clicked, me::book);
                    connect(mIsValid, AUI_SLOT(it)::setEnabled);
                },
          },

Examples#