AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
Border.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 01.01.2021.
14//
15
16#pragma once
17
18
19#include <AUI/Util/AMetric.h>
20#include "IProperty.h"
21
22namespace ass {
27 struct Border {
28 enum BorderType {
29 SOLID,
30 };
31
33 BorderType type;
34 AColor color;
35
36 Border(const AMetric& width,
37 BorderType type,
38 const AColor& color):
39 width(width),
40 type(type),
41 color(color) {
42
43 }
44 Border(const AMetric& width,
45 const AColor& color):
46 width(width),
47 type(SOLID),
48 color(color) {
49
50 }
51 Border(std::nullptr_t) {}
52
53 };
54
55 namespace prop {
56 template<>
57 struct API_AUI_VIEWS Property<Border>: IPropertyBase {
58 private:
59 Border mInfo;
60
61 public:
62 Property(const Border& info) : mInfo(info) {
63
64 }
65
66 void renderFor(AView* view, const ARenderContext& ctx) override;
67
68 bool isNone() override;
69
70 PropertySlot getPropertySlot() const override;
71
72 [[nodiscard]]
73 const auto& value() const noexcept {
74 return mInfo;
75 }
76 };
77 }
78}
Represents a 4-component floating point color.
Definition: AColor.h:27
Stores dimensions in scalable units (dp, pt, etc...).
Definition: AMetric.h:75
Base class of all UI objects.
Definition: AView.h:77
Render context passed to AView::render.
Definition: ARenderContext.h:43
Definition: Type.h:16
Definition: Size.h:22
Represents border.
Definition: Border.h:27
Base class for all properties.
Definition: IPropertyBase.h:49
Definition: IProperty.h:19