AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
BoxShadow.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 {
23
29 struct BoxShadow {
30 AMetric offsetX;
31 AMetric offsetY;
32 AMetric blurRadius;
33 AMetric spreadRadius;
34 AColor color;
35
36 BoxShadow(AMetric offsetX,
37 AMetric offsetY,
38 AMetric blurRadius,
39 AMetric spreadRadius,
40 const AColor& color):
41 offsetX(offsetX),
42 offsetY(offsetY),
43 blurRadius(blurRadius),
44 spreadRadius(spreadRadius),
45 color(color) {}
46
47 BoxShadow(AMetric offsetX,
48 AMetric offsetY,
49 AMetric blurRadius,
50 const AColor& color):
51 offsetX(offsetX),
52 offsetY(offsetY),
53 blurRadius(blurRadius),
54 color(color) {}
55
56 BoxShadow(std::nullptr_t): color(0.f) {}
57 };
58
59 namespace prop {
60 template<>
61 struct API_AUI_VIEWS Property<BoxShadow>: IPropertyBase {
62 private:
63 BoxShadow mInfo;
64
65 public:
66 Property(const BoxShadow& info) : mInfo(info) {
67
68 }
69
70 void renderFor(AView* view, const ARenderContext& ctx) override;
71
72 bool isNone() override;
73
74 PropertySlot getPropertySlot() const override;
75
76 void updateInvalidPixelRect(ARect<int>& invalidRect) const override;
77
78 [[nodiscard]]
79 const auto& value() const noexcept {
80 return mInfo;
81 }
82 };
83 }
84}
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
Axis aligned 2D rectangle.
Definition: ARect.h:24
Render context passed to AView::render.
Definition: ARenderContext.h:43
Represents box shadow.
Definition: BoxShadow.h:29
Base class for all properties.
Definition: IPropertyBase.h:49
Definition: IProperty.h:19