AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
ABoxFields.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#pragma once
   13
   14#include <glm/glm.hpp>
   15
   21{
   22    int left = 0;
   23    int right = 0;
   24    int top = 0;
   25    int bottom = 0;
   26
   27
   28    [[nodiscard]]
   29    glm::ivec2 leftTop() const noexcept {
   30        return { left, top };
   31    }
   32
   33    [[nodiscard]]
   34    glm::ivec2 rightTop() const noexcept {
   35        return { right, top };
   36    }
   37
   38    [[nodiscard]]
   39    glm::ivec2 leftBottom() const noexcept {
   40        return { left, bottom };
   41    }
   42
   43    [[nodiscard]]
   44    glm::ivec2 rightBottom() const noexcept {
   45        return { right, bottom };
   46    }
   47
   48    [[nodiscard]]
   49    int horizontal() const noexcept
   50    {
   51        return left + right;
   52    }
   53
   54    [[nodiscard]]
   55    int vertical() const noexcept
   56    {
   57        return top + bottom;
   58    }
   59    
   60    [[nodiscard]]
   61    glm::ivec2 occupiedSize() const noexcept {
   62        return { horizontal(), vertical() };
   63    }
   64
   65};
Represents a rectangle fields. Useful for margin and padding around AViews.
Definition ABoxFields.h:21