AUI Framework  master
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
SplitterSizeInjector.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#include <AUI/View/ASplitterHelper.h>
   13
   17template<ALayoutDirection direction>
   19    const ASplitterHelper::Item& item;
   20    auto operator->() const { return this; }
   21
   22#define ASPLITTER_IMPL_FORWARD_METHOD(name)                  \
   23    template <typename... Args>                              \
   24    auto name(Args&&... args) const {                        \
   25        return item.view->name(std::forward<Args>(args)...); \
   26    }
   27    ASPLITTER_IMPL_FORWARD_METHOD(ensureAssUpdated)
   28    ASPLITTER_IMPL_FORWARD_METHOD(getExpanding)
   29    ASPLITTER_IMPL_FORWARD_METHOD(getVisibility)
   30    ASPLITTER_IMPL_FORWARD_METHOD(getMargin)
   31    ASPLITTER_IMPL_FORWARD_METHOD(setGeometry)
   32    ASPLITTER_IMPL_FORWARD_METHOD(getSize)
   33    ASPLITTER_IMPL_FORWARD_METHOD(getFixedSize)
   34    ASPLITTER_IMPL_FORWARD_METHOD(getMaxSize)
   35
   36    glm::ivec2 getMinimumSize() const {
   37        auto size = item.view->getMinimumSize();
   38        if (item.overridedSize) {
   39            auto& value = aui::layout_direction::getAxisValue(direction, size);
   40            value = glm::max(*item.overridedSize, value);
   41        }
   42        return size;
   43    }
   44
   45    bool operator==(const SizeInjector& rhs) const noexcept { return item.view == rhs.item.view; }
   46};
Definition ASplitterHelper.h:21
AView-like object that forwards some methods from AView and injects overridedSize if set.
Definition SplitterSizeInjector.h:18