AUI Framework  master
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AView.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 <chrono>
   15#include <functional>
   16#include <array>
   17
   18#include <glm/glm.hpp>
   19
   20#include "AUI/Common/ASmallVector.h"
   21#include <AUI/ASS/Property/IProperty.h>
   22#include <AUI/ASS/Property/ScrollbarAppearance.h>
   23#include "AUI/Common/ABoxFields.h"
   24#include "AUI/Common/ADeque.h"
   25#include "AUI/Common/AObject.h"
   26#include "AUI/Common/SharedPtr.h"
   27#include "AUI/Platform/ACursor.h"
   28#include "AUI/Platform/AInput.h"
   29#include "AUI/Reflect/AClass.h"
   30#include "AUI/Font/AFontStyle.h"
   31#include "AUI/Util/AFieldSignalEmitter.h"
   32#include "AUI/Render/ARenderContext.h"
   33#include "AUI/Util/IBackgroundEffect.h"
   34#include <AUI/ASS/PropertyListRecursive.h>
   35#include <AUI/Enum/AOverflow.h>
   36#include <AUI/Enum/Visibility.h>
   37#include <AUI/Enum/MouseCollisionPolicy.h>
   38#include <AUI/Util/ALayoutDirection.h>
   39#include <AUI/Action/AMenu.h>
   40
   41#include <AUI/Event/AScrollEvent.h>
   42#include <AUI/Event/AGestureEvent.h>
   43#include <AUI/Event/APointerPressedEvent.h>
   44#include <AUI/Event/APointerReleasedEvent.h>
   45#include <AUI/Event/APointerMoveEvent.h>
   46#include <AUI/Render/ITexture.h>
   47#include <AUI/Render/IRenderViewToTexture.h>
   48#include <AUI/Enum/AFloat.h>
   49#include <AUI/Common/AProperty.h>
   50
   51
   52class AWindow;
   53class AWindowBase;
   54class AViewContainerBase;
   55class AAnimator;
   56class AAssHelper;
   57class AStylesheet;
   58
   64
   77class API_AUI_VIEWS AView: public AObject
   78{
   79    friend class AViewContainerBase;
   80    friend class AViewContainer;
   81    friend class IRenderViewToTexture;
   82public:
   83    AView();
   84    ~AView() override;
   85
   86
   90    auto enabled() const {
   91        return APropertyDef {
   92            this,
   93            &AView::mEnabled,
   94            &AView::setEnabled,
   95            mEnabledChanged,
   96        };
   97    }
   98
  102    auto position() const {
  103        return APropertyDef {
  104            this,
  105            &AView::mPosition,
  106            &AView::setPosition,
  107            mPositionChanged,
  108        };
  109    }
  110
  114    auto size() const {
  115        return APropertyDef {
  116            this,
  117            &AView::mSize,
  118            &AView::setSize,
  119            mSizeChanged,
  120        };
  121    }
  122
  134    auto expanding() const {
  135        return APropertyDef {
  136            this,
  137            &AView::mExpanding,
  138            [](AView& self, glm::ivec2 expanding) { self.setExpanding(expanding); },
  139            mExpandingChanged,
  140        };
  141    }
  142
  146    auto visibility() const {
  147        return APropertyDef {
  148            this,
  149            &AView::mVisibility,
  150            &AView::setVisibility,
  151            mVisibilityChanged,
  152        };
  153    }
  154
  158    void redraw();
  159
  164    AWindowBase* getWindow() const;
  165
  166    virtual void drawStencilMask(ARenderContext ctx);
  167
  175    virtual void render(ARenderContext ctx);
  176
  181    virtual void postRender(ARenderContext ctx);
  182
  183    void popStencilIfNeeded(ARenderContext ctx);
  184
  185    [[nodiscard]]
  186    const AVector<AString>& getAssNames() const noexcept {
  187        return mAssNames;
  188    }
  189
  193    [[nodiscard]]
  194    glm::ivec2 getPosition() const noexcept
  195    {
  196        return mPosition;
  197    }
  198
  207    [[nodiscard]]
  208    glm::ivec2 getCenterPointInWindow() const noexcept
  209    {
  210        return getPositionInWindow() + *size() / 2;
  211    }
  212
  216    [[nodiscard]]
  217    glm::ivec2 getSize() const noexcept
  218    {
  219        return mSize;
  220    }
  221
  225    glm::ivec2 getMinSize() const noexcept {
  226        return mMinSize;
  227    }
  228
  229    void setMinSize(glm::ivec2 minSize) noexcept {
  230        mMinSize = minSize;
  231    }
  232
  233    virtual void markMinContentSizeInvalid();
  234
  239        mExtraStylesheet = std::move(extraStylesheet);
  240        invalidateAssHelper();
  241    }
  242
  247
  251    [[nodiscard]]
  252    const _<AStylesheet>& extraStylesheet() const noexcept {
  253        return mExtraStylesheet;
  254    }
  255
  260    {
  261        return mOverflow;
  262    }
  263    void setOverflow(AOverflow overflow)
  264    {
  265        mOverflow = overflow;
  266    }
  267
  271    AOverflowMask getOverflowMask() const
  272    {
  273        return mOverflowMask;
  274    }
  275    void setOverflowMask(AOverflowMask overflow)
  276    {
  277        mOverflowMask = overflow;
  278    }
  279
  283    float getBorderRadius() const {
  284        return mBorderRadius;
  285    }
  286    void setBorderRadius(float radius) {
  287        mBorderRadius = radius;
  288    }
  289
  290    int getWidth() const
  291    {
  292        return mSize.x;
  293    }
  294
  295    int getHeight() const
  296    {
  297        return mSize.y;
  298    }
  299
  303    int getTotalOccupiedWidth() const
  304    {
  305        return !(mVisibility & Visibility::FLAG_CONSUME_SPACE) ? 0 : mSize.x + getTotalFieldHorizontal();
  306    }
  307
  311    int getTotalOccupiedHeight() const
  312    {
  313        return !(mVisibility & Visibility::FLAG_CONSUME_SPACE) ? 0 : mSize.y + getTotalFieldVertical();
  314    }
  315
  322    [[nodiscard]]
  323    glm::ivec2 getMinimumSizePlusMargin() {
  324        return getMinimumSize() + mMargin.occupiedSize();
  325    }
  326
  333    [[nodiscard]]
  334    const ABoxFields& getMargin()
  335    {
  336        ensureAssUpdated();
  337        return mMargin;
  338    }
  339
  346    void setMargin(const ABoxFields& margin) {
  347        mMargin = margin;
  348    }
  349
  357    virtual bool consumesClick(const glm::ivec2& pos);
  358
  363    [[nodiscard]]
  364    const ABoxFields& getPadding()
  365    {
  366        ensureAssUpdated();
  367        return mPadding;
  368    }
  369
  376    void setPadding(const ABoxFields& padding) {
  377        mPadding = padding;
  378    }
  379
  383    virtual AString debugString() const;
  384
  388    [[nodiscard]]
  389    int getTotalFieldHorizontal() const {
  390        return mPadding.horizontal() + mMargin.horizontal();
  391    }
  392
  396    [[nodiscard]]
  397    int getTotalFieldVertical() const {
  398        return mPadding.vertical() + mMargin.vertical();
  399    }
  400
  404    [[nodiscard]]
  405    glm::ivec2 getTotalFieldSize() const {
  406        return { getTotalFieldHorizontal(), getTotalFieldVertical() };
  407    }
  408
  412    AViewContainerBase* getParent() const
  413    {
  414        return mParent;
  415    }
  416
  420    const AOptional<ACursor>& getCursor() const
  421    {
  422        return mCursor;
  423    }
  424    void setCursor(AOptional<ACursor> cursor);
  425
  429    [[nodiscard]]
  430    virtual int getContentMinimumWidth();
  431
  435    [[nodiscard]]
  436    virtual int getContentMinimumHeight();
  437
  441    [[nodiscard]]
  442    glm::ivec2 getContentMinimumSize() noexcept {
  443        if (!mCachedMinContentSize) {
  444            glm::ivec2 minContentSize = glm::ivec2(getContentMinimumWidth(), getContentMinimumHeight());
  445            mCachedMinContentSize = minContentSize;
  446            return minContentSize;
  447        }
  448        return *mCachedMinContentSize;
  449    }
  450
  451    [[nodiscard]]
  452    bool isContentMinimumSizeInvalidated() noexcept {
  453        return !mCachedMinContentSize.hasValue();
  454    }
  455
  456    bool hasFocus() const;
  457
  458    virtual int getMinimumWidth();
  459    virtual int getMinimumHeight();
  460
  461    glm::ivec2 getMinimumSize() {
  462        return { getMinimumWidth(), getMinimumHeight() };
  463    }
  464
  465    void setMaxSize(const glm::ivec2& maxSize) {
  466        mMaxSize = maxSize;
  467    }
  468
  472    [[nodiscard]] const glm::ivec2& getMaxSize() const
  473    {
  474        return mMaxSize;
  475    }
  476
  480    glm::ivec2 getContentSize() const { return { getContentWidth(), getContentHeight() }; }
  481
  482    int getContentWidth() const
  483    {
  484        return static_cast<int>(mSize.x - mPadding.horizontal());
  485    }
  486
  487    int getContentHeight() const
  488    {
  489        return static_cast<int>(mSize.y - mPadding.vertical());
  490    }
  491
  492    [[nodiscard]]
  493    const glm::ivec2& getExpanding() const
  494    {
  495        return mExpanding;
  496    }
  497
  504    void setExpanding(glm::ivec2 expanding)
  505    {
  506        if (mExpanding == expanding) [[unlikely]] {
  507            return;
  508        }
  509        mExpanding = expanding;
  510        emit mExpandingChanged(expanding);
  511        markMinContentSizeInvalid();
  512    }
  513
  520    void setExpanding(int expanding)
  521    {
  522        setExpanding(glm::ivec2(expanding));
  523    }
  524    void setExpanding()
  525    {
  526        setExpanding(2);
  527    }
  528
  529    const _<AAnimator>& getAnimator() const {
  530        return mAnimator;
  531    }
  532
  533
  534    void setAnimator(const _<AAnimator>& animator);
  535    void getTransform(glm::mat4& transform) const;
  536
  537    [[nodiscard]]
  538    int getExpandingHorizontal() const
  539    {
  540        return mExpanding.x;
  541    }
  542
  543    [[nodiscard]]
  544    int getExpandingVertical() const
  545    {
  546        return mExpanding.y;
  547    }
  548
  549    [[nodiscard]] aui::float_within_0_1 getOpacity() const {
  550        return mOpacity;
  551    }
  552    void setOpacity(aui::float_within_0_1 opacity) {
  553        mOpacity = opacity;
  554    }
  555
  556    virtual void setPosition(glm::ivec2 position);
  557
  562    void setSizeForced(glm::ivec2 size) {
  563        mSize = size;
  564    }
  565    virtual void setSize(glm::ivec2 size);
  566    virtual void setGeometry(int x, int y, int width, int height);
  567    void setGeometry(const glm::ivec2& position, const glm::ivec2& size) {
  568        setGeometry(position.x, position.y, size.x, size.y);
  569    }
  570
  571    bool isBlockClicksWhenPressed() const noexcept {
  572        return mBlockClicksWhenPressed;
  573    }
  574
  575    void setBlockClicksWhenPressed(bool value) noexcept {
  576        mBlockClicksWhenPressed = value;
  577    }
  578
  583    const glm::ivec2& getFixedSize() {
  584        return mFixedSize;
  585    }
  586    void setFixedSize(glm::ivec2 size) {
  587        AUI_ASSERTX(glm::all(glm::greaterThanEqual(size, glm::ivec2(-100000))), "abnormal fixed size");
  588        if (size == mFixedSize) [[unlikely]] {
  589            return;
  590        }
  591        mFixedSize = size;
  592        markMinContentSizeInvalid();
  593    }
  594
  595    [[nodiscard]]
  596    bool isMouseHover() const noexcept
  597    {
  598        return mHovered;
  599    }
  600
  601    [[nodiscard]]
  602    bool isPressed() const noexcept
  603    {
  604        return !mPressed.empty();
  605    }
  606
  607    [[nodiscard]]
  608    bool isPressed(APointerIndex index) const noexcept
  609    {
  610        return mPressed.contains(index);
  611    }
  612
  613    bool isFocused() const {
  614        return mHasFocus;
  615    }
  616    bool isMouseEntered() const {
  617        return mMouseEntered;
  618    }
  619
  620    Visibility getVisibility() const
  621    {
  622        return mVisibility;
  623    }
  624
  625    Visibility getVisibilityRecursive() const;
  626
  627    void setVisibility(Visibility visibility) noexcept;
  628
  629    void setVisible(bool visible) noexcept
  630    {
  631        setVisibility(visible ? Visibility::VISIBLE : Visibility::INVISIBLE);
  632    }
  633
  634    [[nodiscard]]
  635    MouseCollisionPolicy getMouseCollisionPolicy() const {
  636        return mMouseCollisionPolicy;
  637    }
  638
  639    void setMouseCollisionPolicy(MouseCollisionPolicy mouseCollisionPolicy) {
  640        mMouseCollisionPolicy = mouseCollisionPolicy;
  641    }
  642
  646    void click() {
  647        emit clickedButton(APointerIndex::button(AInput::LBUTTON));
  648        emit clicked();
  649    }
  650
  654    void pack();
  655
  661     void focus(bool needFocusChainUpdate = true);
  662
  668     virtual bool capturesFocus();
  669
  673    bool hasIndirectParent(const _<AView>& v);
  674
  678    [[nodiscard]] glm::ivec2 getPositionInWindow() const;
  679
  684    void addAssName(const AString& assName);
  685
  690    void removeAssName(const AString& assName);
  691
  697    void setAssName(const AString& assName, bool value) {
  698        if (value) {
  699            addAssName(assName);
  700        } else {
  701            removeAssName(assName);
  702        }
  703    }
  704
  716    inline AView& operator<<(const AString& assName) {
  717        addAssName(assName);
  718        return *this;
  719    }
  720
  721    const _<AAssHelper>& getAssHelper() const {
  722        return mAssHelper;
  723    }
  724
  725    const ass::PropertyListRecursive& getCustomAss() const {
  726        return mCustomStyleRule;
  727    }
  728
  729    void setCustomStyle(ass::PropertyListRecursive rule);
  730
  731    void ensureAssUpdated();
  732
  733    [[nodiscard]]
  734    _<AView> sharedPtr() {
  735        return _cast<AView>(AObject::sharedPtr());
  736    }
  737
  738    [[nodiscard]]
  739    _weak<AView> weakPtr() {
  740        return _weak<AView>(sharedPtr());
  741    }
  742
  752    virtual bool onGesture(const glm::ivec2& origin, const AGestureEvent& event);
  753
  754    virtual void onMouseEnter();
  755
  765    virtual void onPointerMove(glm::vec2 pos, const APointerMoveEvent& event);
  766    virtual void onMouseLeave();
  767    virtual void onDpiChanged();
  768
  773    virtual void onPointerPressed(const APointerPressedEvent& event);
  774
  785    virtual void onPointerReleased(const APointerReleasedEvent& event);
  786    virtual void onPointerDoubleClicked(const APointerPressedEvent& event);
  787
  792    virtual void onScroll(const AScrollEvent& event);
  793    virtual void onKeyDown(AInput::Key key);
  794    virtual void onKeyRepeat(AInput::Key key);
  795    virtual void onKeyUp(AInput::Key key);
  796    virtual void onFocusAcquired();
  797    virtual void onFocusLost();
  798    virtual void onCharEntered(char16_t c);
  799
  803    virtual bool handlesNonMouseNavigation();
  804
  805    virtual void forceUpdateLayoutRecursively();
  806
  807    virtual void setEnabled(bool enabled = true);
  808
  809    void setDisabled(bool disabled = true) {
  810        setEnabled(!disabled);
  811    }
  812
  813    void updateEnableState();
  814
  815    void enable()
  816    {
  817        setEnabled(true);
  818    }
  819    void disable()
  820    {
  821        setEnabled(false);
  822    }
  823
  828        setCustomStyle(std::move(rule));
  829    }
  830
  834    virtual void onClickPrevented();
  835
  850    virtual void invalidateAllStyles();
  851
  864        invalidateStateStylesImpl(getMinimumSizePlusMargin());
  865    }
  866
  870    virtual void invalidateAssHelper();
  871
  875    [[nodiscard]]
  876    virtual bool wantsTouchscreenKeyboard();
  877
  881    void setSkipUntilLayoutUpdate(bool skipUntilLayoutUpdate) {
  882        mSkipUntilLayoutUpdate = skipUntilLayoutUpdate;
  883    }
  884
  888    void setFloating(AFloat f) noexcept
  889    {
  890        mFloating = f;
  891    }
  892
  896    [[nodiscard]]
  897    AFloat getFloating() const noexcept
  898    {
  899        return mFloating;
  900    }
  901
  902signals:
  907
  916
  917    emits<bool> hoveredState;
  918    emits<> mouseEnter;
  919    emits<> mouseLeave;
  920
  921    emits<bool, APointerIndex> pressedState;
  922    emits<APointerIndex> pressed;
  923    emits<APointerIndex> released;
  924
  929
  934
  939
  944
  949
  954
  959
  964
  965    emits<APointerIndex> doubleClicked;
  966
  967    emits<> customCssPropertyChanged;
  968
  974    emits<> focusAcquired;
  975    emits<> focusLost;
  976
  977    emits<_<AView>> childFocused;
  978
  979protected:
  983    AViewContainerBase* mParent = nullptr;
  984
  988    std::array<ass::prop::IPropertyBase*, int(ass::prop::PropertySlot::COUNT)> mAss;
  989
  994
  999
1003    glm::ivec2 mPosition = { 0, 0 };
1004
1009
1013    glm::ivec2 mSize = { 20, 20 };
1014
1019
1020    AOptional<glm::ivec2> mCachedMinContentSize;
1021    bool mMarkedMinContentSizeInvalid = false;
1022
1030    bool mRedrawRequested = false;
1031
1035    glm::ivec2 mMinSize = {0, 0};
1036
1040    glm::ivec2 mMaxSize = {0x7fffffff, 0x7fffffff};
1041
1045    glm::ivec2 mFixedSize = {0, 0};
1046
1053
1060
1067
1075    bool mSkipUntilLayoutUpdate = true;
1076
1090    bool transformGestureEventsToDesktop(const glm::ivec2& origin, const AGestureEvent& event);
1091
1092    void applyAssRule(const ass::PropertyList& propertyList);
1093    void applyAssRule(const ass::PropertyListRecursive& propertyList);
1094
1099    virtual AMenuModel composeContextMenu();
1100
1113    virtual void onViewGraphSubtreeChanged();
1114
1119    virtual void markPixelDataInvalid(ARect<int> invalidArea);
1120
1121    virtual void commitStyle();
1122
1123private:
1127    _<AAnimator> mAnimator;
1128
1132    AOverflowMask mOverflowMask = AOverflowMask::ROUNDED_RECT;
1133
1137    Visibility mVisibility = Visibility::VISIBLE;
1138    emits<Visibility> mVisibilityChanged;
1139
1143    _<AAssHelper> mAssHelper;
1144
1148    float mBorderRadius = 0;
1149
1153    MouseCollisionPolicy mMouseCollisionPolicy = MouseCollisionPolicy::DEFAULT;
1154
1158    aui::float_within_0_1 mOpacity = 1;
1159
1163    AOverflow mOverflow = AOverflow::VISIBLE;
1164
1175    _<AStylesheet> mExtraStylesheet;
1176
1181    virtual void notifyParentEnabledStateChanged(bool enabled);
1182
1187    [[nodiscard]]
1188    ALayoutDirection parentLayoutDirection() const noexcept;
1189
1194    bool mMouseEntered = false;
1195
1201    bool mBlockClicksWhenPressed = true;
1202
1203    AFieldSignalEmitter<bool> mHovered = AFieldSignalEmitter<bool>(hoveredState, mouseEnter, mouseLeave);
1204    ASmallVector<APointerIndex, 1> mPressed;
1205
1206    bool mEnabled = true;
1207    emits<bool> mEnabledChanged;
1208
1209    bool mDirectlyEnabled = true;
1210    bool mParentEnabled = true;
1211    AFieldSignalEmitter<bool> mHasFocus = AFieldSignalEmitter<bool>(focusState, focusAcquired, focusLost, false);
1212
1213    glm::ivec2 mExpanding = glm::ivec2{0, 0};
1214    emits<glm::ivec2> mExpandingChanged;
1215
1219    AFloat mFloating = AFloat::NONE;
1220
1221    struct RenderToTexture {
1222        _unique<IRenderViewToTexture> rendererInterface;
1223        IRenderViewToTexture::InvalidArea invalidArea;
1224
1225        bool drawFromTexture = true;
1226
1230        bool skipRedrawUntilTextureIsPresented = false;
1231    };
1232    AOptional<RenderToTexture> mRenderToTexture;
1233
1237    virtual void invalidateStateStylesImpl(glm::ivec2 prevMinimumSizePlusField);
1238
1239    void notifyParentChildFocused(const _<AView>& view);
1240};
1241
1242API_AUI_VIEWS std::ostream& operator<<(std::ostream& os, const AView& view);
Definition AAnimator.h:26
Remember, ASS is not a butt. ASS is Aui Style Sheets.
Definition AAssHelper.h:32
@ DEFAULT
Default arrow.
Definition ACursor.h:37
Stores a value and observes it's changes, emitting a signal.
Definition AFieldSignalEmitter.h:21
Utility wrapper implementing the stack-allocated (fast) optional idiom.
Definition AOptional.h:33
Wrapper class that stores either mouse button index or finger index.
Definition APointerIndex.h:21
Vector-like container consisting of few elements on stack and switches to dynamic allocation vector i...
Definition ASmallVector.h:34
Represents a Unicode character string.
Definition AString.h:38
Definition AStylesheet.h:21
A std::vector with AUI extensions.
Definition AVector.h:39
A view that represents a set of views.
Definition AViewContainerBase.h:68
Base class of all UI objects.
Definition AView.h:78
int getTotalFieldVertical() const
Definition AView.h:397
emits< AInput::Key > keyReleased
Keyboard key released.
Definition AView.h:953
AOptional< ACursor > mCursor
Determines shape which should pointer take when it's above this AView.
Definition AView.h:998
AOverflowMask getOverflowMask() const
Controls how does the overflow (stencil) mask is produced.
Definition AView.h:271
virtual void onClickPrevented()
Called on AWindowBase::preventClickOnPointerRelease.
const ABoxFields & getMargin()
Returns the margin.
Definition AView.h:334
void removeAssName(const AString &assName)
Removes an ASS class to this AView.
glm::ivec2 mSize
Size, including content area, border and padding.
Definition AView.h:1013
bool transformGestureEventsToDesktop(const glm::ivec2 &origin, const AGestureEvent &event)
Converts touch screen events to desktop.
virtual void render(ARenderContext ctx)
Draws this AView. Noone should call this function except rendering routine.
auto enabled() const
Whether view is enabled (i.e., reacts to user).
Definition AView.h:90
virtual void invalidateAssHelper()
Resets mAssHelper.
AVector< AString > mAssNames
ASS class names.
Definition AView.h:1066
virtual AString debugString() const
String which helps to identify this object in debug string output (i.e., for logging)
void setExpanding(glm::ivec2 expanding)
Changes the expanding of view.
Definition AView.h:504
AFloat getFloating() const noexcept
Floating value for AText.
Definition AView.h:897
glm::ivec2 getCenterPointInWindow() const noexcept
The center point position of the view relatively to top left corner of the window.
Definition AView.h:208
virtual void postRender(ARenderContext ctx)
Performs post-draw routines of this AView. Noone should call this function except rendering routine.
int getTotalOccupiedWidth() const
Definition AView.h:303
bool hasIndirectParent(const _< AView > &v)
Checks if the specified view is an indirect parent of this view.
auto expanding() const
Expansion coefficient. Hints layout manager how much this AView should be extended relative to other ...
Definition AView.h:134
auto size() const
Size, including content area, border and padding.
Definition AView.h:114
AViewContainerBase * mParent
Parent AView.
Definition AView.h:983
glm::ivec2 mPosition
Top left corner's position relative to top left corner's position of the parent AView.
Definition AView.h:1003
glm::ivec2 getMinSize() const noexcept
Definition AView.h:225
bool mSkipUntilLayoutUpdate
If set to true, AViewContainer is obligated ignore this view. This value is set to false by AView::se...
Definition AView.h:1075
virtual bool capturesFocus()
glm::ivec2 getPosition() const noexcept
Top left corner's position relative to top left corner's position of the parent AView.
Definition AView.h:194
void setFloating(AFloat f) noexcept
Set floating value for AText.
Definition AView.h:888
emits< glm::ivec2, glm::ivec2 > geometryChanged
Geometry (position and size) changed.
Definition AView.h:938
float getBorderRadius() const
border-radius, specified in ASS.
Definition AView.h:283
glm::ivec2 getTotalFieldSize() const
Definition AView.h:405
ass::PropertyListRecursive mCustomStyleRule
Custom ASS Rules.
Definition AView.h:993
ABoxFields mMargin
Margin, which defines the spacing around this AView. Processed by the layout manager.
Definition AView.h:1052
glm::ivec2 mFixedSize
Fixed size.
Definition AView.h:1045
void redraw()
Request window manager to redraw this AView.
glm::ivec2 getSize() const noexcept
Size, including content area, border and padding.
Definition AView.h:217
emits< glm::ivec2 > scrolled
Scroll event.
Definition AView.h:943
int getTotalFieldHorizontal() const
Definition AView.h:389
AViewContainerBase * getParent() const
Parent AView.
Definition AView.h:412
void pack()
Sets minimal size.
glm::ivec2 mMaxSize
Maximal size.
Definition AView.h:1040
void setExtraStylesheet(_< AStylesheet > extraStylesheet)
Definition AView.h:238
virtual bool handlesNonMouseNavigation()
std::array< ass::prop::IPropertyBase *, int(ass::prop::PropertySlot::COUNT)> mAss
Drawing list, or baking drawing commands so that you don't have to parse the ASS every time.
Definition AView.h:988
void setSkipUntilLayoutUpdate(bool skipUntilLayoutUpdate)
Definition AView.h:881
emits< AInput::Key > keyPressed
Keyboard key pressed.
Definition AView.h:948
emits< APointerIndex > clickedButton
Some mouse button clicked.
Definition AView.h:928
void addAssName(const AString &assName)
Adds an ASS class to this AView.
virtual int getContentMinimumHeight()
virtual bool onGesture(const glm::ivec2 &origin, const AGestureEvent &event)
emits clickedRightOrLongPressed
Right mouse button clicked or long press gesture applied.
Definition AView.h:963
bool mRedrawRequested
Redraw requested flag for this particular view/.
Definition AView.h:1030
AOverflow getOverflow() const
Determines whether display graphics that go out of the bounds of this AView or not.
Definition AView.h:259
ABoxFields mPadding
Padding, which defines the spacing around content area inside the view. Processed by AView implementa...
Definition AView.h:1059
emits redrawn
View is painted onto the some surface.
Definition AView.h:915
const ABoxFields & getPadding()
Returns the padding.
Definition AView.h:364
void setMargin(const ABoxFields &margin)
Sets the margin.
Definition AView.h:346
emits< bool > focusState
Focus state changed.
Definition AView.h:973
AWindowBase * getWindow() const
Determines window which this AView belongs to.
virtual int getContentMinimumWidth()
glm::ivec2 getPositionInWindow() const
emits viewGraphSubtreeChanged
Definition AView.h:906
const AOptional< ACursor > & getCursor() const
Determines shape which should pointer take when it's above this AView.
Definition AView.h:420
virtual bool consumesClick(const glm::ivec2 &pos)
Determines whether this AView processes this click or passes it thru.
const _< AStylesheet > & extraStylesheet() const noexcept
Definition AView.h:252
glm::ivec2 getMinimumSizePlusMargin()
Definition AView.h:323
void click()
Definition AView.h:646
virtual void onPointerMove(glm::vec2 pos, const APointerMoveEvent &event)
Handles pointer hover events.
void invalidateStateStyles()
Updates state selectors for ASS.
Definition AView.h:863
virtual void invalidateAllStyles()
Invalidates all styles, causing to iterate over all rules in global and parent stylesheets.
virtual void onPointerPressed(const APointerPressedEvent &event)
Called on pointer (mouse) released event.
const glm::ivec2 & getMaxSize() const
Definition AView.h:472
int getTotalOccupiedHeight() const
Definition AView.h:311
emits< glm::ivec2 > mPositionChanged
Position changed.
Definition AView.h:1008
emits clickedRight
Right mouse button clicked.
Definition AView.h:958
virtual AMenuModel composeContextMenu()
Produce context (right click) menu.
void setExtraStylesheet(AStylesheet &&extraStylesheet)
void setSizeForced(glm::ivec2 size)
Definition AView.h:562
auto visibility() const
Visibility value.
Definition AView.h:146
virtual void onScroll(const AScrollEvent &event)
emits< glm::ivec2 > mSizeChanged
Size changed.
Definition AView.h:1018
virtual bool wantsTouchscreenKeyboard()
Returns true if view is textfield-like view which requires touchscreen keyboard when clicked.
glm::ivec2 getContentMinimumSize() noexcept
Definition AView.h:442
virtual void markPixelDataInvalid(ARect< int > invalidArea)
A view requests to redraw it and passes it's coords relative to this.
const glm::ivec2 & getFixedSize()
Fixed size.
Definition AView.h:583
void setExpanding(int expanding)
Changes the expanding of view.
Definition AView.h:520
glm::ivec2 getContentSize() const
Definition AView.h:480
void setAssName(const AString &assName, bool value)
Depending on value, either adds or removes ass name.
Definition AView.h:697
emits clicked
Left mouse button clicked.
Definition AView.h:933
void setPadding(const ABoxFields &padding)
Sets the padding.
Definition AView.h:376
virtual void onPointerReleased(const APointerReleasedEvent &event)
Called on pointer (mouse) released event.
void focus(bool needFocusChainUpdate=true)
Requests focus for this AView.
auto position() const
Top left corner's position relative to top left corner's position of the parent AView.
Definition AView.h:102
glm::ivec2 mMinSize
Minimal size.
Definition AView.h:1035
void operator&(ass::PropertyListRecursive rule)
Helper function for kAUI.h:with_style.
Definition AView.h:827
virtual void onViewGraphSubtreeChanged()
Called when direct or indirect parent has changed.
Definition AWindowBase.h:33
Represents a window in the underlying windowing system.
Definition AWindow.h:45
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:179
AOverflow
Controls visibility of the overflowed contents of AView with AView::drawStencilMask.
Definition AOverflow.h:24
AFloat
Specifies text floating in text wrapping views, i.e, ATextArea, AText.
Definition AFloat.h:19
@ VISIBLE
Overflowed contents are visible.
Definition AOverflow.h:28
@ NONE
Definition AFloat.h:23
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
#define AUI_ASSERTX(condition, what)
Asserts that the passed condition evaluates to true. Adds extra message string.
Definition Assert.h:74
Represents a rectangle fields. Useful for margin and padding around AViews.
Definition ABoxFields.h:21
Pointing method move event.
Definition APointerMoveEvent.h:21
Pointing method press event.
Definition APointerPressedEvent.h:21
Pointing method press event.
Definition APointerReleasedEvent.h:19
Property implementation to use with custom getter/setter.
Definition AProperty.h:234
Axis aligned 2D rectangle.
Definition ARect.h:24
Render context passed to AView::render.
Definition ARenderContext.h:43
Pointing method scroll event.
Definition AScrollEvent.h:20
Defines areas to invalidate (redraw).
Definition IRenderViewToTexture.h:32
Definition PropertyListRecursive.h:29
Definition PropertyList.h:28
Base class for all properties.
Definition IPropertyBase.h:50