AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AndSelector.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#pragma once
13
14#include "AAssSelector.h"
15
16namespace ass {
17 template <typename L, typename R>
18 struct AndSelector : public IAssSubSelector {
19 private:
20 L l;
21 R r;
22
23 public:
24 AndSelector(L l, R r) : l(std::move(l)), r(std::move(r)) {}
25
26 bool isPossiblyApplicable(AView* view) override {
27 return l.isPossiblyApplicable(view) && r.isPossiblyApplicable(view);
28 }
29
30 bool isStateApplicable(AView* view) override {
31 return l.isStateApplicable(view) && r.isStateApplicable(view);
32 }
33
34 void setupConnections(AView* view, const _<AAssHelper>& helper) override {
35 l.setupConnections(view, helper);
36 r.setupConnections(view, helper);
37 }
38 };
39
52 template <aui::derived_from<IAssSubSelector> L, aui::derived_from<IAssSubSelector> R>
54 return AndSelector<L, R>(std::move(l), std::move(r));
55 }
56}
Base class of all UI objects.
Definition AView.h:78
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:178
Definition AAssSelector.h:28
AndSelector< L, R > operator&&(L l, R r)
Makes a selector that applies two selectors.
Definition AndSelector.h:53
Definition AndSelector.h:18