AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AViewContainerBase Class Referenceabstract

A view that represents a set of views. More...

#include <AUI/View/AViewContainerBase.h>

Detailed Description

AViewContainerBase can store, render, resize, provide events to and handle the child views.

AViewContainerBase does not control the position and size of the child views by itself; instead, it delegates that responsibility to it's layout manager.

Since AViewContainerBase is an instance of AView, AViewContainerBase can handle AViewContainerBases recursively, thus, making possible complex UI by nested AViewContainerBases with different layout managers.

This class is abstract. The methods for modifying it's views are protected. You can use AViewContainer which exposes these methods to public or extend AViewContainerBase to make your own container-like view.

Examples
/home/runner/work/aui/aui/aui.views/src/AUI/View/AView.h, and examples/ui/contacts/src/view/ContactDetailsView.h.

Member Function Documentation

> All members, including inherited

◆ addViewCustomLayout()

void AViewContainerBase::addViewCustomLayout ( const _< AView > & view)
protected

User is obligated to manage view's layout by themselves. Implement applyGeometryToChildren() to do so.

View is not visible until it's layout is determined.

See also
AView::mSkipUntilLayoutUpdate

◆ applyGeometryToChildren()

virtual void AViewContainerBase::applyGeometryToChildren ( )
protectedvirtual

◆ applyGeometryToChildrenIfNecessary()

void AViewContainerBase::applyGeometryToChildrenIfNecessary ( )

See Layout Managers for more info.

◆ capturesFocus()

bool AViewContainerBase::capturesFocus ( )
overridevirtual
Returns
Can this view capture focus.

For containers, capturing focus is redundant.

Reimplemented from AView.

◆ consumesClick()

bool AViewContainerBase::consumesClick ( const glm::ivec2 & pos)
overridevirtual
Parameters
posmouse position
Returns
true if AView processes this click

Used in AViewContainer::getViewAt method subset, thus affecting click event handling.

Reimplemented from AView.

Reimplemented in AWindow.

◆ focusChainTarget()

_< AView > AViewContainerBase::focusChainTarget ( )
inline
Returns
Focus chain target.

See mFocusChainTarget for further info.

◆ forceUpdateLayoutRecursively()

void AViewContainerBase::forceUpdateLayoutRecursively ( )
overridevirtual

Reimplemented from AView.

◆ getContentMinimumHeight()

int AViewContainerBase::getContentMinimumHeight ( )
overridevirtual
Returns
minimal content-area height.

Reimplemented from AView.

Examples
examples/7guis/cells/src/main.cpp.

◆ getContentMinimumWidth()

int AViewContainerBase::getContentMinimumWidth ( )
overridevirtual
Returns
minimal content-area width.

Reimplemented from AView.

Examples
examples/7guis/cells/src/main.cpp.

◆ getViewAt()

virtual _< AView > AViewContainerBase::getViewAt ( glm::ivec2 pos,
ABitField< AViewLookupFlags > flags = AViewLookupFlags::NONE ) const
nodiscardvirtualnoexcept
Parameters
posposition relative to this container
flagssee AViewLookupFlags
Returns
found view or nullptr

Some containers may implement getViewAt by it's own (i.e. AListView for performance reasons).

◆ getViewAtRecursive() [1/2]

_< AView > AViewContainerBase::getViewAtRecursive ( glm::ivec2 pos,
ABitField< AViewLookupFlags > flags = AViewLookupFlags::NONE ) const
nodiscardnoexcept
Parameters
posposition relative to this container
flagssee AViewLookupFlags
Returns
found view or nullptr

◆ getViewAtRecursive() [2/2]

template<aui::predicate< _< AView > > Callback>
bool AViewContainerBase::getViewAtRecursive ( glm::ivec2 pos,
const Callback & callback,
ABitField< AViewLookupFlags > flags = AViewLookupFlags::NONE )
inline
Parameters
posposition relative to this container
callbackcallback to call
flagssee AViewLookupFlags
Returns
true if callback returned true; false otherwise

The passed callback is a predicate. If predicate returns true, the execution of lookup is stopped and getViewAt returns true. If predicate returns false, the lookup continues.

◆ getViewAtRecursiveOfType()

template<typename T>
_< T > AViewContainerBase::getViewAtRecursiveOfType ( glm::ivec2 pos,
ABitField< AViewLookupFlags > flags = AViewLookupFlags::NONE )
inline
Parameters
posposition relative to this container
flagssee AViewLookupFlags
Returns
found view or nullptr

◆ invalidateAllStyles()

void AViewContainerBase::invalidateAllStyles ( )
overrideprotectedvirtual

Unlike invalidateStateStyles(), completely resets styles for this view, causing it to iterate over all rules in global and parent stylesheets. This operation is much more expensive than invalidateStateStyles because invalidateStateStyles iterates over a small set of rules and performs fewer checks.

Prefer invalidateAllStyles over invalidateStateStyles when:

  • Added/removed rules to applicable stylesheets
  • The view is reinflated to other layout
  • Added/removed/changed ass names of this or parent views

Reimplemented from AView.

◆ invalidateAssHelper()

void AViewContainerBase::invalidateAssHelper ( )
overrideprotectedvirtual

Reimplemented from AView.

◆ markMinContentSizeInvalid()

void AViewContainerBase::markMinContentSizeInvalid ( )
overridevirtual

See Layout Managers for more info.

Reimplemented from AView.

Reimplemented in AWindowBase.

◆ markPixelDataInvalid()

void AViewContainerBase::markPixelDataInvalid ( ARect< int > invalidArea)
overridevirtual
Parameters
invalidAreaarea to invalidate. Must be in this view's coordinate space.

Reimplemented from AView.

Reimplemented in AWindowBase.

◆ onCharEntered()

void AViewContainerBase::onCharEntered ( char16_t c)
overridevirtual

Reimplemented from AView.

◆ onClickPrevented()

void AViewContainerBase::onClickPrevented ( )
overridevirtual

Reimplemented from AView.

◆ onDpiChanged()

void AViewContainerBase::onDpiChanged ( )
overridevirtual

Reimplemented from AView.

◆ onGesture()

bool AViewContainerBase::onGesture ( const glm::ivec2 & origin,
const AGestureEvent & event )
overridevirtual

Handles touch screen gesture event.

Parameters
originposition where the event(s) started to occur from.
eventgesture event.
Note
The standard implementation AView::onGesture emulates desktop events such as right click and scroll.
See also
transformGestureEventsToDesktop
Returns
true, if consumed (handled). True value prevents click.

Reimplemented from AView.

Reimplemented in AWindowBase.

◆ onKeyDown()

void AViewContainerBase::onKeyDown ( AInput::Key key)
overridevirtual

Reimplemented from AView.

◆ onKeyRepeat()

void AViewContainerBase::onKeyRepeat ( AInput::Key key)
overridevirtual

Reimplemented from AView.

◆ onKeyUp()

void AViewContainerBase::onKeyUp ( AInput::Key key)
overridevirtual

Reimplemented from AView.

◆ onMouseEnter()

void AViewContainerBase::onMouseEnter ( )
overridevirtual

Reimplemented from AView.

◆ onMouseLeave()

void AViewContainerBase::onMouseLeave ( )
overridevirtual

Reimplemented from AView.

◆ onPointerDoubleClicked()

void AViewContainerBase::onPointerDoubleClicked ( const APointerPressedEvent & event)
overridevirtual

Reimplemented from AView.

◆ onPointerMove()

void AViewContainerBase::onPointerMove ( glm::vec2 pos,
const APointerMoveEvent & event )
overridevirtual
Parameters
posevent position
eventevent description
Note
If the view is pressed, it would still received move events. Use AView::isMouseHover to check is the pointer actually over view or not. See AView::onPointerReleased for more info.

Reimplemented from AView.

Reimplemented in AWindow, and AWindowBase.

◆ onPointerPressed()

void AViewContainerBase::onPointerPressed ( const APointerPressedEvent & event)
overridevirtual
Parameters
eventevent

Reimplemented from AView.

Reimplemented in AWindowBase.

◆ onPointerReleased()

void AViewContainerBase::onPointerReleased ( const APointerReleasedEvent & event)
overridevirtual
Parameters
eventevent
Note
To handle clicks, you should use AView::clicked signal instead. View still receives pointer move and released events even if cursor goes outside the view boundaries, or other exclusive event appeared (i.e. scrollarea scroll). AView::clicked emitted only if release event occurred inside view and no other event has prevented click gesture. See APointerReleasedEvent::triggerClick.

Reimplemented from AView.

Reimplemented in AWindowBase.

◆ onScroll()

void AViewContainerBase::onScroll ( const AScrollEvent & event)
overridevirtual

Handles mouse wheel events.

Parameters
eventevent info.

Reimplemented from AView.

Reimplemented in AWindowBase.

◆ onViewGraphSubtreeChanged()

void AViewContainerBase::onViewGraphSubtreeChanged ( )
overrideprotectedvirtual

Called when a new direct or indirect parent was assigned or removed.

If a subtree reattached atomically (i.e., there were no dangling state), the method is called once.

The method is mostly intended to invalidate styles in order to respond to stylesheet rules (mExtraStylesheet) of the new (in)direct parent.

Emits viewGraphSubtreeChanged signal.

Reimplemented from AView.

◆ pointerEventsMapping()

const ASmallVector< PointerEventsMapping, 1 > & AViewContainerBase::pointerEventsMapping ( ) const
inlinenoexcept
See also
mPointerEventsMapping

◆ render()

void AViewContainerBase::render ( ARenderContext ctx)
overridevirtual
See also
AView::drawView

AView::render is not guaranteed to be called on per-frame basis. Moreover, this method can be called multiple times if render-to-texture caching decides to do so.

Reimplemented from AView.

Reimplemented in AWindowBase.

◆ setContents()

void AViewContainerBase::setContents ( const _< AViewContainer > & container)
protected
Parameters
containercontainer. Must be pure AViewContainer (cannot be a derivative from AViewContainer).

◆ setEnabled()

void AViewContainerBase::setEnabled ( bool enabled = true)
overridevirtual

Reimplemented from AView.

◆ setFocusChainTarget()

void AViewContainerBase::setFocusChainTarget ( _weak< AView > target)
inline
Parameters
targeta new focus chain view belonging to this container

See mFocusChainTarget for further info.

◆ setSize()

void AViewContainerBase::setSize ( glm::ivec2 size)
overridevirtual

Reimplemented from AView.

◆ visitsViewRecursive()

template<aui::predicate< _< AView > > Callback>
bool AViewContainerBase::visitsViewRecursive ( Callback && callback,
ABitField< AViewLookupFlags > flags = AViewLookupFlags::NONE )
inline
Parameters
callbackcallback to call. Returns true to finish traversal.
flagssee AViewLookupFlags
Returns
true if there's at least one view for which callback returned true, false otherwise.