AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
focused.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 alex2772 on 1/3/21.
14//
15
16#pragma once
17
18
19namespace ass {
20 template<typename Base>
21 struct focused: Base {// ignore ass_selectors it's used in compound by class_of or t
22 template<typename... Args>
23 focused(Args&&... args):
24 Base(std::forward<Args>(args)...)
25 {
26
27 }
28
29 bool isStateApplicable(AView* view) override {
30 return Base::isStateApplicable(view) && view->hasFocus();
31 }
32
33 void setupConnections(AView* view, const _<AAssHelper>& helper) override {
34 Base::setupConnections(view, helper);
35 view->focusState.clearAllConnectionsWith(helper.get());
36 AObject::connect(view->focusState, slot(helper)::onInvalidateStateAss);
37 }
38 };
39}
Base class of all UI objects.
Definition AView.h:78
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:178
#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:88
static void connect(const Signal &signal, Object *object, Function &&function)
Connects signal to the slot of the specified object.
Definition AObject.h:65