AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
BoxShadowInner.h
    1/*
    2 * AUI Framework - Declarative UI toolkit for modern C++20
    3 * Copyright (C) 2020-2025 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 BoxShadowInner {
   32        AMetric offsetX;
   33        AMetric offsetY;
   34        AMetric blurRadius;
   35        AMetric spreadRadius;
   36        AColor color;
   37
   38        BoxShadowInner(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        BoxShadowInner(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        BoxShadowInner(std::nullptr_t): color(0.f) {}
   59    };
   60
   61    namespace prop {
   62        template<>
   63        struct API_AUI_VIEWS Property<BoxShadowInner>: IPropertyBase {
   64        private:
   65            BoxShadowInner mInfo;
   66
   67        public:
   68            Property(const BoxShadowInner& 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            [[nodiscard]]
   79            const auto& value() const noexcept {
   80                return mInfo;
   81            }
   82        };
   83    }
   84}
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
Render context passed to AView::render.
Definition ARenderContext.h:43
Represents box shadow.
Definition BoxShadowInner.h:31
Base class for all properties.
Definition IPropertyBase.h:50