AUI Framework  develop
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
  238    virtual void markMinContentSizeInvalid();
  239
  244        mExtraStylesheet = std::move(extraStylesheet);
  245        invalidateAssHelper();
  246    }
  247
  252
  256    [[nodiscard]]
  257    const _<AStylesheet>& extraStylesheet() const noexcept {
  258        return mExtraStylesheet;
  259    }
  260
  265    {
  266        return mOverflow;
  267    }
  268    void setOverflow(AOverflow overflow)
  269    {
  270        mOverflow = overflow;
  271    }
  272
  276    AOverflowMask getOverflowMask() const
  277    {
  278        return mOverflowMask;
  279    }
  280    void setOverflowMask(AOverflowMask overflow)
  281    {
  282        mOverflowMask = overflow;
  283    }
  284
  288    float getBorderRadius() const {
  289        return mBorderRadius;
  290    }
  291    void setBorderRadius(float radius) {
  292        mBorderRadius = radius;
  293    }
  294
  295    int getWidth() const
  296    {
  297        return mSize.x;
  298    }
  299
  300    int getHeight() const
  301    {
  302        return mSize.y;
  303    }
  304
  308    int getTotalOccupiedWidth() const
  309    {
  310        return !(mVisibility & Visibility::FLAG_CONSUME_SPACE) ? 0 : mSize.x + getTotalFieldHorizontal();
  311    }
  312
  316    int getTotalOccupiedHeight() const
  317    {
  318        return !(mVisibility & Visibility::FLAG_CONSUME_SPACE) ? 0 : mSize.y + getTotalFieldVertical();
  319    }
  320
  327    [[nodiscard]]
  328    glm::ivec2 getMinimumSizePlusMargin() {
  329        return getMinimumSize() + mMargin.occupiedSize();
  330    }
  331
  338    [[nodiscard]]
  339    const ABoxFields& getMargin()
  340    {
  341        ensureAssUpdated();
  342        return mMargin;
  343    }
  344
  351    void setMargin(const ABoxFields& margin) {
  352        mMargin = margin;
  353    }
  354
  362    virtual bool consumesClick(const glm::ivec2& pos);
  363
  368    [[nodiscard]]
  369    const ABoxFields& getPadding()
  370    {
  371        ensureAssUpdated();
  372        return mPadding;
  373    }
  374
  381    void setPadding(const ABoxFields& padding) {
  382        mPadding = padding;
  383    }
  384
  388    virtual AString debugString() const;
  389
  393    [[nodiscard]]
  394    int getTotalFieldHorizontal() const {
  395        return mPadding.horizontal() + mMargin.horizontal();
  396    }
  397
  401    [[nodiscard]]
  402    int getTotalFieldVertical() const {
  403        return mPadding.vertical() + mMargin.vertical();
  404    }
  405
  409    [[nodiscard]]
  410    glm::ivec2 getTotalFieldSize() const {
  411        return { getTotalFieldHorizontal(), getTotalFieldVertical() };
  412    }
  413
  417    AViewContainerBase* getParent() const
  418    {
  419        return mParent;
  420    }
  421
  425    const AOptional<ACursor>& getCursor() const
  426    {
  427        return mCursor;
  428    }
  429    void setCursor(AOptional<ACursor> cursor);
  430
  434    [[nodiscard]]
  435    virtual int getContentMinimumWidth();
  436
  440    [[nodiscard]]
  441    virtual int getContentMinimumHeight();
  442
  446    [[nodiscard]]
  447    glm::ivec2 getContentMinimumSize() noexcept {
  448        if (!mCachedMinContentSize) {
  449            glm::ivec2 minContentSize = glm::ivec2(getContentMinimumWidth(), getContentMinimumHeight());
  450            mCachedMinContentSize = minContentSize;
  451            return minContentSize;
  452        }
  453        return *mCachedMinContentSize;
  454    }
  455
  456    [[nodiscard]]
  457    bool isContentMinimumSizeInvalidated() noexcept {
  458        return !mCachedMinContentSize.hasValue();
  459    }
  460
  461    bool hasFocus() const;
  462
  463    virtual int getMinimumWidth();
  464    virtual int getMinimumHeight();
  465
  477    glm::ivec2 getMinimumSize() {
  478        return { getMinimumWidth(), getMinimumHeight() };
  479    }
  480
  481    void setMaxSize(const glm::ivec2& maxSize) {
  482        mMaxSize = maxSize;
  483    }
  484
  488    [[nodiscard]] const glm::ivec2& getMaxSize() const
  489    {
  490        return mMaxSize;
  491    }
  492
  496    glm::ivec2 getContentSize() const { return { getContentWidth(), getContentHeight() }; }
  497
  498    int getContentWidth() const
  499    {
  500        return static_cast<int>(mSize.x - mPadding.horizontal());
  501    }
  502
  503    int getContentHeight() const
  504    {
  505        return static_cast<int>(mSize.y - mPadding.vertical());
  506    }
  507
  508    [[nodiscard]]
  509    const glm::ivec2& getExpanding() const
  510    {
  511        return mExpanding;
  512    }
  513
  520    void setExpanding(glm::ivec2 expanding)
  521    {
  522        if (mExpanding == expanding) [[unlikely]] {
  523            return;
  524        }
  525        mExpanding = expanding;
  526        emit mExpandingChanged(expanding);
  527        markMinContentSizeInvalid();
  528    }
  529
  536    void setExpanding(int expanding)
  537    {
  538        setExpanding(glm::ivec2(expanding));
  539    }
  540    void setExpanding()
  541    {
  542        setExpanding(2);
  543    }
  544
  545    const _<AAnimator>& getAnimator() const {
  546        return mAnimator;
  547    }
  548
  549
  550    void setAnimator(const _<AAnimator>& animator);
  551    void getTransform(glm::mat4& transform) const;
  552
  553    [[nodiscard]]
  554    int getExpandingHorizontal() const
  555    {
  556        return mExpanding.x;
  557    }
  558
  559    [[nodiscard]]
  560    int getExpandingVertical() const
  561    {
  562        return mExpanding.y;
  563    }
  564
  565    [[nodiscard]] aui::float_within_0_1 getOpacity() const {
  566        return mOpacity;
  567    }
  568    void setOpacity(aui::float_within_0_1 opacity) {
  569        mOpacity = opacity;
  570    }
  571
  572    virtual void setPosition(glm::ivec2 position);
  573
  578    void setSizeForced(glm::ivec2 size) {
  579        mSize = size;
  580    }
  581    virtual void setSize(glm::ivec2 size);
  582
  588    virtual void setGeometry(int x, int y, int width, int height);
  589    void setGeometry(const glm::ivec2& position, const glm::ivec2& size) {
  590        setGeometry(position.x, position.y, size.x, size.y);
  591    }
  592
  593    bool isBlockClicksWhenPressed() const noexcept {
  594        return mBlockClicksWhenPressed;
  595    }
  596
  597    void setBlockClicksWhenPressed(bool value) noexcept {
  598        mBlockClicksWhenPressed = value;
  599    }
  600
  605    const glm::ivec2& getFixedSize() {
  606        return mFixedSize;
  607    }
  608    void setFixedSize(glm::ivec2 size) {
  609        AUI_ASSERTX(glm::all(glm::greaterThanEqual(size, glm::ivec2(-100000))), "abnormal fixed size");
  610        if (size == mFixedSize) [[unlikely]] {
  611            return;
  612        }
  613        mFixedSize = size;
  614        markMinContentSizeInvalid();
  615    }
  616
  617    [[nodiscard]]
  618    bool isMouseHover() const noexcept
  619    {
  620        return mHovered;
  621    }
  622
  623    [[nodiscard]]
  624    bool isPressed() const noexcept
  625    {
  626        return !mPressed.empty();
  627    }
  628
  629    [[nodiscard]]
  630    bool isPressed(APointerIndex index) const noexcept
  631    {
  632        return mPressed.contains(index);
  633    }
  634
  635    bool isFocused() const {
  636        return mHasFocus;
  637    }
  638    bool isMouseEntered() const {
  639        return mMouseEntered;
  640    }
  641
  642    Visibility getVisibility() const
  643    {
  644        return mVisibility;
  645    }
  646
  647    Visibility getVisibilityRecursive() const;
  648
  649    void setVisibility(Visibility visibility) noexcept;
  650
  651    void setVisible(bool visible) noexcept
  652    {
  653        setVisibility(visible ? Visibility::VISIBLE : Visibility::INVISIBLE);
  654    }
  655
  656    [[nodiscard]]
  657    MouseCollisionPolicy getMouseCollisionPolicy() const {
  658        return mMouseCollisionPolicy;
  659    }
  660
  661    void setMouseCollisionPolicy(MouseCollisionPolicy mouseCollisionPolicy) {
  662        mMouseCollisionPolicy = mouseCollisionPolicy;
  663    }
  664
  668    void click() {
  669        emit clickedButton(APointerIndex::button(AInput::LBUTTON));
  670        emit clicked();
  671    }
  672
  676    void pack();
  677
  683     void focus(bool needFocusChainUpdate = true);
  684
  690     virtual bool capturesFocus();
  691
  695    bool hasIndirectParent(const _<AView>& v);
  696
  700    [[nodiscard]] glm::ivec2 getPositionInWindow() const;
  701
  706    void addAssName(const AString& assName);
  707
  712    void removeAssName(const AString& assName);
  713
  719    void setAssName(const AString& assName, bool value) {
  720        if (value) {
  721            addAssName(assName);
  722        } else {
  723            removeAssName(assName);
  724        }
  725    }
  726
  738    inline AView& operator<<(const AString& assName) {
  739        addAssName(assName);
  740        return *this;
  741    }
  742
  743    const _<AAssHelper>& getAssHelper() const {
  744        return mAssHelper;
  745    }
  746
  747    const ass::PropertyListRecursive& getCustomAss() const {
  748        return mCustomStyleRule;
  749    }
  750
  751    void setCustomStyle(ass::PropertyListRecursive rule);
  752
  753    void ensureAssUpdated();
  754
  755    [[nodiscard]]
  756    _<AView> sharedPtr() {
  757        return _cast<AView>(AObject::sharedPtr());
  758    }
  759
  760    [[nodiscard]]
  761    _weak<AView> weakPtr() {
  762        return _weak<AView>(sharedPtr());
  763    }
  764
  774    virtual bool onGesture(const glm::ivec2& origin, const AGestureEvent& event);
  775
  776    virtual void onMouseEnter();
  777
  787    virtual void onPointerMove(glm::vec2 pos, const APointerMoveEvent& event);
  788    virtual void onMouseLeave();
  789    virtual void onDpiChanged();
  790
  795    virtual void onPointerPressed(const APointerPressedEvent& event);
  796
  807    virtual void onPointerReleased(const APointerReleasedEvent& event);
  808    virtual void onPointerDoubleClicked(const APointerPressedEvent& event);
  809
  814    virtual void onScroll(const AScrollEvent& event);
  815    virtual void onKeyDown(AInput::Key key);
  816    virtual void onKeyRepeat(AInput::Key key);
  817    virtual void onKeyUp(AInput::Key key);
  818    virtual void onFocusAcquired();
  819    virtual void onFocusLost();
  820    virtual void onCharEntered(char16_t c);
  821
  825    virtual bool handlesNonMouseNavigation();
  826
  827    virtual void forceUpdateLayoutRecursively();
  828
  829    virtual void setEnabled(bool enabled = true);
  830
  831    void setDisabled(bool disabled = true) {
  832        setEnabled(!disabled);
  833    }
  834
  835    void updateEnableState();
  836
  837    void enable()
  838    {
  839        setEnabled(true);
  840    }
  841    void disable()
  842    {
  843        setEnabled(false);
  844    }
  845
  850        setCustomStyle(std::move(rule));
  851    }
  852
  856    virtual void onClickPrevented();
  857
  872    virtual void invalidateAllStyles();
  873
  886        invalidateStateStylesImpl(getMinimumSizePlusMargin());
  887    }
  888
  892    virtual void invalidateAssHelper();
  893
  897    [[nodiscard]]
  898    virtual bool wantsTouchscreenKeyboard();
  899
  903    void setSkipUntilLayoutUpdate(bool skipUntilLayoutUpdate) {
  904        mSkipUntilLayoutUpdate = skipUntilLayoutUpdate;
  905    }
  906
  910    void setFloating(AFloat f) noexcept
  911    {
  912        mFloating = f;
  913    }
  914
  918    [[nodiscard]]
  919    AFloat getFloating() const noexcept
  920    {
  921        return mFloating;
  922    }
  923
  924signals:
  929
  938
  939    emits<bool> hoveredState;
  940    emits<> mouseEnter;
  941    emits<> mouseLeave;
  942
  943    emits<bool, APointerIndex> pressedState;
  944    emits<APointerIndex> pressed;
  945    emits<APointerIndex> released;
  946
  951
  956
  961
  966
  971
  976
  981
  986
  987    emits<APointerIndex> doubleClicked;
  988
  989    emits<> customCssPropertyChanged;
  990
  996    emits<> focusAcquired;
  997    emits<> focusLost;
  998
  999    emits<_<AView>> childFocused;
1000
1001protected:
1005    AViewContainerBase* mParent = nullptr;
1006
1010    std::array<ass::prop::IPropertyBase*, int(ass::prop::PropertySlot::COUNT)> mAss;
1011
1016
1021
1025    glm::ivec2 mPosition = { 0, 0 };
1026
1031
1035    glm::ivec2 mSize = { 20, 20 };
1036
1041
1042    AOptional<glm::ivec2> mCachedMinContentSize;
1043    bool mMarkedMinContentSizeInvalid = false;
1044
1052    bool mRedrawRequested = false;
1053
1057    glm::ivec2 mMinSize = {0, 0};
1058
1062    glm::ivec2 mMaxSize = {0x7fffffff, 0x7fffffff};
1063
1067    glm::ivec2 mFixedSize = {0, 0};
1068
1075
1082
1089
1097    bool mSkipUntilLayoutUpdate = true;
1098
1112    bool transformGestureEventsToDesktop(const glm::ivec2& origin, const AGestureEvent& event);
1113
1114    void applyAssRule(const ass::PropertyList& propertyList);
1115    void applyAssRule(const ass::PropertyListRecursive& propertyList);
1116
1121    virtual AMenuModel composeContextMenu();
1122
1135    virtual void onViewGraphSubtreeChanged();
1136
1141    virtual void markPixelDataInvalid(ARect<int> invalidArea);
1142
1143    virtual void commitStyle();
1144
1145private:
1149    _<AAnimator> mAnimator;
1150
1154    AOverflowMask mOverflowMask = AOverflowMask::ROUNDED_RECT;
1155
1159    Visibility mVisibility = Visibility::VISIBLE;
1160    emits<Visibility> mVisibilityChanged;
1161
1165    _<AAssHelper> mAssHelper;
1166
1170    float mBorderRadius = 0;
1171
1175    MouseCollisionPolicy mMouseCollisionPolicy = MouseCollisionPolicy::DEFAULT;
1176
1180    aui::float_within_0_1 mOpacity = 1;
1181
1185    AOverflow mOverflow = AOverflow::VISIBLE;
1186
1197    _<AStylesheet> mExtraStylesheet;
1198
1203    virtual void notifyParentEnabledStateChanged(bool enabled);
1204
1209    [[nodiscard]]
1210    ALayoutDirection parentLayoutDirection() const noexcept;
1211
1216    bool mMouseEntered = false;
1217
1223    bool mBlockClicksWhenPressed = true;
1224
1225    AFieldSignalEmitter<bool> mHovered = AFieldSignalEmitter<bool>(hoveredState, mouseEnter, mouseLeave);
1226    ASmallVector<APointerIndex, 1> mPressed;
1227
1228    bool mEnabled = true;
1229    emits<bool> mEnabledChanged;
1230
1231    bool mDirectlyEnabled = true;
1232    bool mParentEnabled = true;
1233    AFieldSignalEmitter<bool> mHasFocus = AFieldSignalEmitter<bool>(focusState, focusAcquired, focusLost, false);
1234
1235    glm::ivec2 mExpanding = glm::ivec2{0, 0};
1236    emits<glm::ivec2> mExpandingChanged;
1237
1241    AFloat mFloating = AFloat::NONE;
1242
1243    struct RenderToTexture {
1244        _unique<IRenderViewToTexture> rendererInterface;
1245        IRenderViewToTexture::InvalidArea invalidArea;
1246
1247        bool drawFromTexture = true;
1248
1252        bool skipRedrawUntilTextureIsPresented = false;
1253    };
1254    AOptional<RenderToTexture> mRenderToTexture;
1255
1259    virtual void invalidateStateStylesImpl(glm::ivec2 prevMinimumSizePlusField);
1260
1261    void notifyParentChildFocused(const _<AView>& view);
1262};
1263
1264API_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:34
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:402
emits< AInput::Key > keyReleased
Keyboard key released.
Definition AView.h:975
AOptional< ACursor > mCursor
Determines shape which should pointer take when it's above this AView.
Definition AView.h:1020
AOverflowMask getOverflowMask() const
Controls how does the overflow (stencil) mask is produced.
Definition AView.h:276
virtual void onClickPrevented()
Called on AWindowBase::preventClickOnPointerRelease.
const ABoxFields & getMargin()
Returns the margin.
Definition AView.h:339
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:1035
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:1088
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:520
AFloat getFloating() const noexcept
Floating value for AText.
Definition AView.h:919
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:308
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:1005
glm::ivec2 mPosition
Top left corner's position relative to top left corner's position of the parent AView.
Definition AView.h:1025
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:1097
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:910
emits< glm::ivec2, glm::ivec2 > geometryChanged
Geometry (position and size) changed.
Definition AView.h:960
float getBorderRadius() const
border-radius, specified in ASS.
Definition AView.h:288
glm::ivec2 getTotalFieldSize() const
Definition AView.h:410
ass::PropertyListRecursive mCustomStyleRule
Custom ASS Rules.
Definition AView.h:1015
ABoxFields mMargin
Margin, which defines the spacing around this AView. Processed by the layout manager.
Definition AView.h:1074
glm::ivec2 mFixedSize
Fixed size.
Definition AView.h:1067
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:965
int getTotalFieldHorizontal() const
Definition AView.h:394
AViewContainerBase * getParent() const
Parent AView.
Definition AView.h:417
void pack()
Sets minimal size.
glm::ivec2 mMaxSize
Maximal size.
Definition AView.h:1062
void setExtraStylesheet(_< AStylesheet > extraStylesheet)
Definition AView.h:243
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:1010
void setSkipUntilLayoutUpdate(bool skipUntilLayoutUpdate)
Definition AView.h:903
emits< AInput::Key > keyPressed
Keyboard key pressed.
Definition AView.h:970
glm::ivec2 getMinimumSize()
Returns the minimum size required for this view.
Definition AView.h:477
emits< APointerIndex > clickedButton
Some mouse button clicked.
Definition AView.h:950
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:985
bool mRedrawRequested
Redraw requested flag for this particular view/.
Definition AView.h:1052
AOverflow getOverflow() const
Determines whether display graphics that go out of the bounds of this AView or not.
Definition AView.h:264
ABoxFields mPadding
Padding, which defines the spacing around content area inside the view. Processed by AView implementa...
Definition AView.h:1081
emits redrawn
View is painted onto the some surface.
Definition AView.h:937
const ABoxFields & getPadding()
Returns the padding.
Definition AView.h:369
void setMargin(const ABoxFields &margin)
Sets the margin.
Definition AView.h:351
emits< bool > focusState
Focus state changed.
Definition AView.h:995
AWindowBase * getWindow() const
Determines window which this AView belongs to.
virtual int getContentMinimumWidth()
glm::ivec2 getPositionInWindow() const
emits viewGraphSubtreeChanged
Definition AView.h:928
const AOptional< ACursor > & getCursor() const
Determines shape which should pointer take when it's above this AView.
Definition AView.h:425
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:257
glm::ivec2 getMinimumSizePlusMargin()
Definition AView.h:328
void click()
Definition AView.h:668
virtual void onPointerMove(glm::vec2 pos, const APointerMoveEvent &event)
Handles pointer hover events.
void invalidateStateStyles()
Updates state selectors for ASS.
Definition AView.h:885
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:488
int getTotalOccupiedHeight() const
Definition AView.h:316
emits< glm::ivec2 > mPositionChanged
Position changed.
Definition AView.h:1030
emits clickedRight
Right mouse button clicked.
Definition AView.h:980
virtual AMenuModel composeContextMenu()
Produce context (right click) menu.
void setExtraStylesheet(AStylesheet &&extraStylesheet)
void setSizeForced(glm::ivec2 size)
Definition AView.h:578
auto visibility() const
Visibility value.
Definition AView.h:146
virtual void onScroll(const AScrollEvent &event)
emits< glm::ivec2 > mSizeChanged
Size changed.
Definition AView.h:1040
virtual bool wantsTouchscreenKeyboard()
Returns true if view is textfield-like view which requires touchscreen keyboard when clicked.
glm::ivec2 getContentMinimumSize() noexcept
Definition AView.h:447
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:605
void setExpanding(int expanding)
Changes the expanding of view.
Definition AView.h:536
glm::ivec2 getContentSize() const
Definition AView.h:496
void setAssName(const AString &assName, bool value)
Depending on value, either adds or removes ass name.
Definition AView.h:719
emits clicked
Left mouse button clicked.
Definition AView.h:955
virtual void setGeometry(int x, int y, int width, int height)
Sets position and size of the view.
void setPadding(const ABoxFields &padding)
Sets the padding.
Definition AView.h:381
virtual void onPointerReleased(const APointerReleasedEvent &event)
Called on pointer (mouse) released event.
void focus(bool needFocusChainUpdate=true)
Requests focus for this AView.
virtual void markMinContentSizeInvalid()
Marks this view it requires a layout update.
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:1057
void operator&(ass::PropertyListRecursive rule)
Helper function for kAUI.h:with_style.
Definition AView.h:849
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:577
#define emit
emits the specified signal in context of this object.
Definition AObject.h:344
#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 APropertyDef.h:23
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