AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
type_of.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
18#include <AUI/Util/kAUI.h>
19#include <AUI/View/AView.h>
20#include <AUI/ASS/AAssHelper.h>
21
22#include "hovered.h"
23#include "activated.h"
24#include "focused.h"
25#include "disabled.h"
26
27namespace ass {
28
29 namespace detail {
30 template<typename T>
32 static_assert(std::is_polymorphic_v<T>, "Your type is not polymorphic! Please define at least virtual "
33 "destructor for using type_of (t) style selector "
34 "(see https://en.cppreference.com/w/cpp/language/object#Polymorphic_objects)");
35 public:
36 bool isPossiblyApplicable(AView* view) override {
37 return dynamic_cast<T*>(view) != nullptr;
38 }
39
40 };
41 }
42
43 template<typename T>
44 struct type_of: detail::Type<T> {
45 public:
46
51 };
52
53 template<typename T>
54 using t = type_of<T>;
55}
Base class of all UI objects.
Definition: AView.h:77
Definition: AAssSelector.h:28
Definition: activated.h:21
Definition: type_of.h:31
Definition: disabled.h:20
Definition: hovered.h:21
Definition: type_of.h:44