AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
Margin.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#include <AUI/Util/AMetric.h>
19#include "IProperty.h"
20
21namespace ass {
22
27 struct Margin {
32
34 left(all),
35 top(all),
36 right(all),
37 bottom(all)
38 {
39 }
40
42 left(horizontal),
43 top(vertical),
44 right(horizontal),
45 bottom(vertical)
46 {
47 }
48
50 left(horizontal),
51 top(top),
52 right(horizontal),
53 bottom(bottom)
54 {
55 }
56
58 left(left),
59 top(top),
60 right(right),
61 bottom(bottom)
62 {
63 }
64 };
65
66 namespace prop {
67 template<>
68 struct API_AUI_VIEWS Property<Margin>: IPropertyBase {
69 private:
70 Margin mInfo;
71
72 public:
73 Property(const Margin& info) : mInfo(info) {
74
75 }
76
77 void updateInvalidPixelRect(ARect<int>& invalidRect) const override;
78
79 void applyFor(AView* view) override;
80
81 [[nodiscard]]
82 const auto& value() const noexcept {
83 return mInfo;
84 }
85 };
86 }
87}
Base class of all UI objects.
Definition: AView.h:77
Axis aligned 2D rectangle.
Definition: ARect.h:24
Controls view's margins.
Definition: Margin.h:27
Base class for all properties.
Definition: IPropertyBase.h:49
Definition: IProperty.h:19
Definition: unset.h:28