AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
Border.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 {
   29    struct Border {
   30        enum BorderType {
   31            SOLID,
   32        };
   33
   34        AMetric width;
   35        BorderType type;
   36        AColor color;
   37
   38        Border(const AMetric& width,
   39               BorderType type,
   40               const AColor& color):
   41            width(width),
   42            type(type),
   43            color(color) {
   44
   45        }
   46        Border(const AMetric& width,
   47               const AColor& color):
   48            width(width),
   49            type(SOLID),
   50            color(color) {
   51
   52        }
   53        Border(std::nullptr_t) {}
   54
   55    };
   56
   57    namespace prop {
   58        template<>
   59        struct API_AUI_VIEWS Property<Border>: IPropertyBase {
   60        private:
   61            Border mInfo;
   62
   63        public:
   64            Property(const Border& info) : mInfo(info) {
   65
   66            }
   67
   68            void renderFor(AView* view, const ARenderContext& ctx) override;
   69
   70            bool isNone() override;
   71
   72            PropertySlot getPropertySlot() const override;
   73
   74            [[nodiscard]]
   75            const auto& value() const noexcept {
   76                return mInfo;
   77            }
   78        };
   79    }
   80}
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 border.
Definition Border.h:29
Base class for all properties.
Definition IPropertyBase.h:50