AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
disabled.h
1/*
2 * AUI Framework - Declarative UI toolkit for modern C++20
3 * Copyright (C) 2020-2024 Alex2772 and Contributors
4 *
5 * SPDX-License-Identifier: MPL-2.0
6 *
7 * This Source Code Form is subject to the terms of the Mozilla Public
8 * License, v. 2.0. If a copy of the MPL was not distributed with this
9 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 */
11
12//
13// Created by alex2 on 02.01.2021.
14//
15
16#pragma once
17
18namespace ass {
19 template<typename Base>
20 struct disabled: Base {
21 template<typename... Args>
22 disabled(Args&&... args):
23 Base(std::forward<Args>(args)...)
24 {
25
26 }
27
28 bool isStateApplicable(AView* view) override {
29 return Base::isStateApplicable(view) && !view->isEnabled();
30 }
31
32 void setupConnections(AView* view, const _<AAssHelper>& helper) override {
33 Base::setupConnections(view, helper);
34 view->enabledState.clearAllConnectionsWith(helper.get());
35 AObject::connect(view->enabledState, slot(helper)::onInvalidateStateAss);
36 }
37 };
38}
Base class of all UI objects.
Definition: AView.h:77
An std::weak_ptr with AUI extensions.
Definition: SharedPtrTypes.h:177
API_AUI_CORE const ACommandLineArgs & args() noexcept
Definition: OSAndroid.cpp:29
#define slot(v)
Passes some variable and type of the variable separated by comma. It's convenient to use with the con...
Definition: kAUI.h:90
Definition: disabled.h:20