AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
ScrollbarAppearance.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 dervisdev on 1/26/2023.
   14//
   15
   16#pragma once
   17
   18#include <AUI/Platform/ACursor.h>
   19#include <AUI/Util/AMetric.h>
   20#include "IProperty.h"
   21
   22
   23
   24namespace ass {
   25
   30    struct ScrollbarAppearance {
   31    public:
   35        enum AxisValue {
   39            ALWAYS,
   40
   44            ON_DEMAND,
   45
   49            NEVER,
   50        };
   51
   52        AxisValue getVertical() {
   53            return mVertical;
   54        }
   55
   56        AxisValue getHorizontal() {
   57            return mHorizontal;
   58        }
   59
   60        ScrollbarAppearance() = default;
   61        explicit ScrollbarAppearance(AxisValue both) : mVertical(both), mHorizontal(both) {};
   62        ScrollbarAppearance(AxisValue vertical, AxisValue horizontal) : mVertical(vertical), mHorizontal(horizontal) {};
   63
   64    private:
   65        AxisValue mVertical = AxisValue::ON_DEMAND;
   66        AxisValue mHorizontal = AxisValue::ON_DEMAND;
   67    };
   68
   69    namespace prop {
   70        template<>
   71        struct API_AUI_VIEWS Property<ScrollbarAppearance>: IPropertyBase {
   72        private:
   73            ScrollbarAppearance mInfo;
   74
   75        public:
   76            Property(const ScrollbarAppearance& info) : mInfo(info) { }
   77
   78            void applyFor(AView* view) override;
   79
   80            [[nodiscard]]
   81            const auto& value() const noexcept {
   82                return mInfo;
   83            }
   84        };
   85    }
   86}
Base class of all UI objects.
Definition AView.h:78
Controls how do scrollbars and content appear in AScrollArea. This rule is applicable to AScrollArea ...
Definition ScrollbarAppearance.h:30
AxisValue
Per-axis behaviour enum.
Definition ScrollbarAppearance.h:35
@ ALWAYS
Scrollbar is always visible, no matter whether or not any content is overflowing.
Definition ScrollbarAppearance.h:39
@ ON_DEMAND
Scrollbar appears only if content is overflowing.
Definition ScrollbarAppearance.h:44
@ NEVER
Scrollbar is always gone, no matter whether or not any content is overflowing.
Definition ScrollbarAppearance.h:49
Base class for all properties.
Definition IPropertyBase.h:50