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

Detailed Description

Member Function Documentation

> All members, including inherited

◆ applyGeometryToChildren()

void AWindowBase::applyGeometryToChildren ( )
overridevirtual

See Layout Managers for more info.

Reimplemented from AViewContainerBase.

◆ blockUserInput()

virtual void AWindowBase::blockUserInput ( bool blockUserInput = true)
virtual
Parameters
blockUserInputwhether block user input or not.

Visually nothing changes, but when the user tries to interact with the window, nothing happens with the window and on some platforms a system sound played notifying the user that the window is blocked.

It is userful when you open a modal window and you want the user to complete the action in the modal window first in order to continue interacting with the parent window.

Note
When displaying a modal dialog and has blocked the parent window, the application must unblock the parent window before the modal dialog destroyed, otherwise, another window will receive the keyboard focus and be activated.

Reimplemented in AWindow.

◆ createOverlappingSurface() [1/2]

_< AOverlappingSurface > AWindowBase::createOverlappingSurface ( const glm::ivec2 & position,
const glm::ivec2 & size,
bool closeOnClick = true )
inline

Creates a surface used for context menus and combo boxes. Closure of the surface is controlled by closeOnClick param but can be closed manually by calling closeOverlappingSurface.

Parameters
positionposition where does the surface should be created. It's not exact the top left corner of the surface but a hint (i.e. if the surface does not fit)
sizesize
closeOnClickwhen true, overlapped surface is automatically closed when mouse clicked. It's usable for dropdown and context menus.
Returns
a new surface.
auto surfaceContainer = AWindow::current()->createOverlappingSurface({0, 0}, {100, 100});
ALayoutInflater::inflate(surfaceContainer, Vertical {
    Button { "Item1" },
    Button { "Item2" },
    Button { "Item3" },
});
surfaceContainer->pack();
static void inflate(aui::no_escape< AViewContainer > root, const _< AView > &view)
Wraps view with root using Stacked layout and expanding.
_< AOverlappingSurface > createOverlappingSurface(const glm::ivec2 &position, const glm::ivec2 &size, bool closeOnClick=true)
Definition AWindowBase.h:236
static AWindowBase * current()
Button
Specifies button(s) to be displayed.
Definition AMessageBox.h:79

To create overlapping surface below some view, use AView::getPositionInWindow:

auto surfaceContainer = AWindow::current()->createOverlappingSurface(view->getPositionInWindow() + view->getSize(), {100, 100});

◆ createOverlappingSurface() [2/2]

_< AOverlappingSurface > AWindowBase::createOverlappingSurface ( const std::function< AOptional< glm::ivec2 >(unsigned)> & positionFactory,
const glm::ivec2 & size,
bool closeOnClick = true )
inline

Create a surface used for context menus and combo boxes. Closure of the surface is controlled by closeOnClick param but can be closed manually by calling closeOverlappingSurface.

Parameters
positionFactorya function that return position where does the surface should be created. If the surface does not fit, the function is called again with previous arg+1.
sizesize
closeOnClickwhen true, overlapped surface is automatically closed when mouse clicked. It's usable for dropdown and context menus.
Returns
a new surface.

◆ createOverlappingSurfaceImpl()

virtual _< AOverlappingSurface > AWindowBase::createOverlappingSurfaceImpl ( const glm::ivec2 & position,
const glm::ivec2 & size )
protectedpure virtual

◆ forceUpdateCursor()

virtual void AWindowBase::forceUpdateCursor ( )
virtual

Reimplemented in AWindow.

◆ frameMillis()

virtual unsigned AWindowBase::frameMillis ( ) const
nodiscardpure virtualnoexcept

Returns previous frame's rendering duration in millis, including native rendering preparation and buffer swapping. The value does not include the elapsed time between frames.

The value is updated after native buffer swap.

Implemented in AWindow.

◆ getDpiRatio()

float AWindowBase::getDpiRatio ( )
inline
See also
ScalingParams, scaling params affects dpi ratio
Note
dpi ratio value is rounded to 0.25

◆ getFps()

size_t AWindowBase::getFps ( )
inline
Note
FPS is captured every second
Returns
Last captured FPS

◆ isPreventingClickOnPointerRelease()

bool AWindowBase::isPreventingClickOnPointerRelease ( ) const
inlinenodiscardnoexcept

◆ markMinContentSizeInvalid()

void AWindowBase::markMinContentSizeInvalid ( )
overridevirtual

See Layout Managers for more info.

Reimplemented from AViewContainerBase.

◆ markPixelDataInvalid()

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

Reimplemented from AViewContainerBase.

◆ onDragEnter()

virtual bool AWindowBase::onDragEnter ( const ADragNDrop::EnterEvent & event)
virtual
Parameters
eventevent data.
Returns
true, if the application accepts the contents of the event, false otherwise.

This event handler decides does the application accepts the supplied data. If true, the data supplied to the onDragDrop() method will be the same.

onDragLeave() method will be called even if the application rejects the event.

It's guaranteed that onDragDrop method will not be called when onDragEnter rejects the same data.

Examples
examples/ui/views/src/ExampleWindow.h.

◆ onFocusLost()

void AWindowBase::onFocusLost ( )
overridevirtual

Reimplemented from AView.

◆ onGesture()

bool AWindowBase::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 AViewContainerBase.

◆ onKeyDown()

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

Reimplemented from AViewContainerBase.

◆ onPointerMove()

void AWindowBase::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 AViewContainerBase.

◆ onPointerPressed()

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

Reimplemented from AViewContainerBase.

◆ onPointerReleased()

void AWindowBase::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 AViewContainerBase.

◆ onScroll()

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

Handles mouse wheel events.

Parameters
eventevent info.

Reimplemented from AViewContainerBase.

◆ preventClickOnPointerRelease()

void AWindowBase::preventClickOnPointerRelease ( )

Also disables hover and pressed animations.

Used by AScrollArea when it's scroll is triggered.

Calls AView::onClickPrevented() over focus chain.

◆ render()

void AWindowBase::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 AViewContainerBase.

◆ setScalingParams()

void AWindowBase::setScalingParams ( ScalingParams params)

◆ shouldDisplayHoverAnimations()

bool AWindowBase::shouldDisplayHoverAnimations ( ) const
Returns
false when any keyboard button is pressed

Member Data Documentation

◆ mPreventClickOnPointerRelease

AOptional<bool> AWindowBase::mPreventClickOnPointerRelease
protected