AAbstractSignal#
Base class for signal.
Header: | #include <AUI/Common/AAbstractSignal.h> |
CMake: | aui_link(my_target PUBLIC aui::core) |
Detailed Description#
Since ASignal is a template class, AAbstractSignal provides unified access to template inseparable fields of ASignal.
Examples#
examples/7guis/cells/src/main.cpp
7GUIs Cells - Spreadsheet processor (Excel).
private:
_<State> mState;
Cell& mCell;
AAbstractSignal::AutoDestroyedConnection mConnection;
void inflateLabel() {
mConnection = connect(mCell.value, [this](const formula::Value& v) {
ALayoutInflater::inflate(
this,
Public Types#
Connection#
struct AAbstractSignal::Connection
Connection handle.
Empty structure.
AutoDestroyedConnection#
struct AAbstractSignal::AutoDestroyedConnection
Connection owner which destroys the connection in destructor.
Examples#
Field | Description |
---|---|
_<Connection> value
|
|
AutoDestroyedConnection& operator
|
|
AutoDestroyedConnection& operator
|
|
AutoDestroyedConnection& operator
|
Public Methods#
addGenericObserver#
virtual _<Connection> AAbstractSignal::addGenericObserver(AObjectBase* receiver, std::function<void()> observer)
Creates generic connection (without arguments).
- Arguments
receiver
receiver object.observer
function to be called when signal is fired.
addIngoingConnectionIn#
static void AAbstractSignal::addIngoingConnectionIn(aui::no_escape<AObjectBase> object, _<Connection> connection)
Adds a connection to the specified object.
clearAllOutgoingConnections#
Destroys all connections of this signal, if any.
clearAllOutgoingConnectionsWith#
Destroys all connections with passed receiver, if any.
- Arguments
receiver
object to clear connections with.
Examples#
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]
hasOutgoingConnectionsWith#
- Arguments
receiver
receiver objects to check connections with.- Returns
- Whether this signal has connections with passed receiver object.
removeIngoingConnectionIn#
static void AAbstractSignal::removeIngoingConnectionIn(aui::no_escape<AObjectBase> object, Connection& connection, std::unique_lock<ASpinlockMutex>& lock)
Removes a connection from the specified object.