AUI Framework  master
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AAssHelper.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#include <AUI/Common/AObject.h>
   19#include <AUI/Common/ASignal.h>
   20#include <AUI/Common/AVector.h>
   21#include <optional>
   22
   23#include "Property/BackgroundCropping.h"
   24#include "Property/BackgroundImage.h"
   25#include "Rule.h"
   26
   27class IDrawable;
   28
   32class AAssHelper: public AObject {
   33    friend class AView;
   34
   35private:
   36    AVector<ass::Rule> mPossiblyApplicableRules;
   37
   38public:
   39    void onInvalidateFullAss() {
   40        emit invalidateFullAss();
   41    }
   42    void onInvalidateStateAss() {
   43        emit invalidateStateAss();
   44    }
   45
   46    [[nodiscard]]
   47    const AVector<ass::Rule>& getPossiblyApplicableRules() const {
   48        return mPossiblyApplicableRules;
   49    }
   50
   51    struct State {
   52        ass::BackgroundImage backgroundUrl;
   53        ass::BackgroundCropping backgroundCropping;
   54        AOptional<_<IDrawable>> backgroundImage;
   55        ImageRendering imageRendering = ImageRendering::PIXELATED;
   56    } state;
   57signals:
   58    emits<> invalidateFullAss;
   59    emits<> invalidateStateAss;
   60};
   61
   62
   63
Remember, ASS is not a butt. ASS is Aui Style Sheets.
Definition AAssHelper.h:32
Utility wrapper implementing the stack-allocated (fast) optional idiom.
Definition AOptional.h:33
A std::vector with AUI extensions.
Definition AVector.h:39
An abstract image that determines itself how it is displayed. Essentially an abstraction from vector ...
Definition IDrawable.h:28
ImageRendering
Controls the image rendering type.
Definition ImageRendering.h:25
ASignal< Args... > emits
A signal declaration.
Definition ASignal.h:572
#define emit
emits the specified signal in context of this object.
Definition AObject.h:343
Definition AAssHelper.h:51
Controls background texture cropping by exact UV coordinates. Useful for texture atlases.
Definition BackgroundCropping.h:27
Represents textured (image) background.
Definition BackgroundImage.h:89