AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
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
31 struct BoxShadow {
32 AMetric offsetX;
33 AMetric offsetY;
34 AMetric blurRadius;
35 AMetric spreadRadius;
36 AColor color;
37
38 BoxShadow(AMetric offsetX,
39 AMetric offsetY,
40 AMetric blurRadius,
41 AMetric spreadRadius,
42 const AColor& color):
43 offsetX(offsetX),
44 offsetY(offsetY),
45 blurRadius(blurRadius),
46 spreadRadius(spreadRadius),
47 color(color) {}
48
49 BoxShadow(AMetric offsetX,
50 AMetric offsetY,
51 AMetric blurRadius,
52 const AColor& color):
53 offsetX(offsetX),
54 offsetY(offsetY),
55 blurRadius(blurRadius),
56 color(color) {}
57
58 BoxShadow(std::nullptr_t): color(0.f) {}
59 };
60
61 namespace prop {
62 template<>
63 struct API_AUI_VIEWS Property<BoxShadow>: IPropertyBase {
64 private:
65 BoxShadow mInfo;
66
67 public:
68 Property(const BoxShadow& info) : mInfo(info) {
69
70 }
71
72 void renderFor(AView* view, const ARenderContext& ctx) override;
73
74 bool isNone() override;
75
76 PropertySlot getPropertySlot() const override;
77
78 void updateInvalidPixelRect(ARect<int>& invalidRect) const override;
79
80 [[nodiscard]]
81 const auto& value() const noexcept {
82 return mInfo;
83 }
84 };
85 }
86}
Represents a 4-component floating point color (RGBA).
Definition AColor.h:26
Stores dimensions in scalable units (dp, pt, etc...).
Definition AMetric.h:75
Base class of all UI objects.
Definition AView.h:78
Axis aligned 2D rectangle.
Definition ARect.h:24
Render context passed to AView::render.
Definition ARenderContext.h:43
Represents box shadow.
Definition BoxShadow.h:31
Base class for all properties.
Definition IPropertyBase.h:50