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

Represents a window in the underlying windowing system. More...

#include <AUI/Platform/AWindow.h>

Public Member Functions

 AWindow (const AString &name="My window", int width=854_dp, int height=500_dp, AWindow *parent=nullptr, WindowStyle ws=WindowStyle::DEFAULT)
 
unsigned frameMillis () const noexcept override
 Returns previous frame's rendering duration in millis.
 
void redraw ()
 
void blockUserInput (bool blockUserInput=true) override
 Enables or disables user input for this window.
 
void setIcon (const AImage &image)
 
void quit ()
 Removes window from AWindowManager.
 
void setWindowStyle (WindowStyle ws)
 
void minimize ()
 Minimizes window (hide window to the taskbar, iconifies)
 
bool isMinimized () const
 
void maximize ()
 Maximizes window (makes window fullscreen)
 
bool isMaximized () const
 
void restore ()
 Restores window (shows window from taskbar)
 
void flagRedraw () override
 
void show ()
 
void close ()
 
void hide ()
 
bool isClosed () const noexcept
 
HWND getNativeHandle ()
 
auto nativeHandle () const
 
const AStringgetWindowTitle () const
 
glm::ivec2 getWindowPosition () const
 
void setPosition (glm::ivec2 position) override
 
void setSize (glm::ivec2 size) override
 
void setGeometry (int x, int y, int width, int height) override
 
void applyGeometryToChildren () override
 
void onFocusAcquired () override
 
void onFocusLost () override
 
void onKeyDown (AInput::Key key) override
 
void onKeyRepeat (AInput::Key key) override
 
void setFocusNextViewOnTab (bool value)
 
glm::ivec2 mapPositionTo (const glm::ivec2 &position, _< AWindow > other)
 Translates coordinates from the coordinate space of this window to the coordinate space of another window.
 
glm::ivec2 unmapPosition (const glm::ivec2 &position)
 Translates coordinates from the coordinate space of this window to the coordinate space of the monitor.
 
glm::ivec2 mapPosition (const glm::ivec2 &position)
 Translates coordinates from the monitor's coordinate space to the coordinate space of this window.
 
_< AOverlappingSurfacecreateOverlappingSurfaceImpl (const glm::ivec2 &position, const glm::ivec2 &size) override
 
void closeOverlappingSurfaceImpl (AOverlappingSurface *surface) override
 
virtual void onCloseButtonClicked ()
 
void forceUpdateCursor () override
 Updates cursor by triggering onPointerMove on the same position (mMousePos).
 
void showTouchscreenKeyboardImpl () override
 
void hideTouchscreenKeyboardImpl () override
 
void moveToCenter ()
 Moves the window to the center of monitor.
 
void setMobileScreenOrientation (AScreenOrientation screenOrientation)
 Controls mobile device's screen orientation when this window is on the foreground.
 
bool consumesClick (const glm::ivec2 &pos) override
 Determines whether this AView processes this click or passes it thru.
 
void onPointerMove (glm::vec2 pos, const APointerMoveEvent &event) override
 Handles pointer hover events.
 
- Public Member Functions inherited from AWindowBase
void preventClickOnPointerRelease ()
 Prevents click action on upcoming pointer release.
 
bool isPreventingClickOnPointerRelease () const noexcept
 
template<aui::invocable< const _< AView > & > Callback>
void iterateOverFocusChain (Callback &&callback)
 Iterates over focus chain, from parent to child.
 
const _unique< IRenderingContext > & getRenderingContext () const
 
BeforeFrameQueuebeforeFrameQueue () noexcept
 
void updateDpi ()
 
float getDpiRatio ()
 Returns current dpi ratio.
 
_< AViewgetFocusedView () const
 
void setFocusedView (const _< AView > &view)
 
void updateFocusChain ()
 
void onPointerPressed (const APointerPressedEvent &event) override
 Called on pointer (mouse) released event.
 
void onPointerMove (glm::vec2 pos, const APointerMoveEvent &event) override
 Handles pointer hover events.
 
void closeOverlappingSurfacesOnClick ()
 
bool isFocused () const
 
const glm::ivec2 & getMousePos () const
 
void onKeyDown (AInput::Key key) override
 
virtual void focusNextView ()
 
void makeCurrent ()
 
_< AOverlappingSurfacecreateOverlappingSurface (const glm::ivec2 &position, const glm::ivec2 &size, bool closeOnClick=true)
 
_< AOverlappingSurfacecreateOverlappingSurface (const std::function< AOptional< glm::ivec2 >(unsigned)> &positionFactory, const glm::ivec2 &size, bool closeOnClick=true)
 
void closeOverlappingSurface (AOverlappingSurface *surface)
 
void onFocusLost () override
 
void render (ARenderContext context) override
 Draws this AView. Noone should call this function except rendering routine.
 
void applyGeometryToChildren () override
 
void onPointerReleased (const APointerReleasedEvent &event) override
 Called on pointer (mouse) released event.
 
virtual bool onDragEnter (const ADragNDrop::EnterEvent &event)
 Called when the user holds a drag-n-drop object over the window.
 
virtual void onDragLeave ()
 
virtual void onDragDrop (const ADragNDrop::DropEvent &event)
 
void requestShowTouchscreenKeyboard ()
 On a mobile touchscreen device, requests system virtual keyboard.
 
void requestHideTouchscreenKeyboard ()
 On a mobile touchscreen device, requests hiding system virtual keyboard.
 
bool shouldDisplayHoverAnimations () const
 Determines whether views should display hover animations.
 
void onScroll (const AScrollEvent &event) override
 
bool onGesture (const glm::ivec2 &origin, const AGestureEvent &event) override
 
size_t getFps ()
 
void setTouchscreenKeyboardPolicy (ATouchscreenKeyboardPolicy policy) noexcept
 
void setScalingParams (ScalingParams params)
 Sets scaling params.
 
aui::lazy< Profiling > & profiling ()
 Get profiling settings (mutable).
 
void markMinContentSizeInvalid () override
 
- Public Member Functions inherited from AViewContainer
void addView (const _< AView > &view)
 Add view to the container.
 
void addView (size_t index, const _< AView > &view)
 Add view at specific index to the container.
 
void addViews (AVector< _< AView > > views)
 Add all views from vector.
 
void addViewCustomLayout (const _< AView > &view)
 Adds view to container without exposing it to the layout manager.
 
void removeView (const _< AView > &view)
 Remove view from the container.
 
void removeView (AView *view)
 Remove view from the container.
 
void removeView (size_t index)
 Remove view from the container at specified index.
 
void removeAllViews ()
 Remove all views from container.
 
void setViews (AVector< _< AView > > views)
 Replace views.
 
void setContents (const _< AViewContainer > &container)
 Moves (like via std::move) all children and layout of the specified container to this container.
 
const _unique< ALayout > & getLayout () const noexcept
 Get layout manager of the container.
 
void setLayout (_unique< ALayout > layout)
 Set new layout manager for this AViewContainerBase. DESTROYS OLD LAYOUT MANAGER WITH ITS VIEWS!!!
 
- Public Member Functions inherited from AViewContainerBase
void onMouseEnter () override
 
void onMouseLeave () override
 
void onDpiChanged () override
 
void onClickPrevented () override
 Called on AWindowBase::preventClickOnPointerRelease.
 
int getContentMinimumWidth () override
 
int getContentMinimumHeight () override
 
void onPointerDoubleClicked (const APointerPressedEvent &event) override
 
void setEnabled (bool enabled=true) override
 
auto begin () const
 
auto end () const
 
const AVector< _< AView > > & getViews () const
 Get all views of the container.
 
const _unique< ALayout > & getLayout () const noexcept
 Get layout manager of the container.
 
virtual _< AViewgetViewAt (glm::ivec2 pos, ABitField< AViewLookupFlags > flags=AViewLookupFlags::NONE) const noexcept
 Finds first direct child view under position.
 
_< AViewgetViewAtRecursive (glm::ivec2 pos, ABitField< AViewLookupFlags > flags=AViewLookupFlags::NONE) const noexcept
 Acts as AViewContainerBase::getViewAt but recursively (may include non-direct child).
 
template<aui::predicate< _< AView > > Callback>
bool getViewAtRecursive (glm::ivec2 pos, const Callback &callback, ABitField< AViewLookupFlags > flags=AViewLookupFlags::NONE)
 Acts as AViewContainerBase::getViewAtRecursive but calls a callback instead of returning value.
 
template<aui::predicate< _< AView > > Callback>
bool visitsViewRecursive (Callback &&callback, ABitField< AViewLookupFlags > flags=AViewLookupFlags::NONE)
 Performs recursive view traversal.
 
template<typename T>
_< T > getViewAtRecursiveOfType (glm::ivec2 pos, ABitField< AViewLookupFlags > flags=AViewLookupFlags::NONE)
 Acts as AViewContainerBase::getViewAtRecursive but finds a view castable to specified template type.
 
void setFocusChainTarget (_weak< AView > target)
 Set focus chain target.
 
_< AViewfocusChainTarget ()
 
void applyGeometryToChildrenIfNecessary ()
 
void onKeyUp (AInput::Key key) override
 
void onCharEntered (char16_t c) override
 
bool capturesFocus () override
 
const ASmallVector< PointerEventsMapping, 1 > & pointerEventsMapping () const noexcept
 
void forceUpdateLayoutRecursively () override
 
- Public Member Functions inherited from AView
auto enabled () const
 Whether view is enabled (i.e., reacts to user).
 
auto position () const
 Top left corner's position relative to top left corner's position of the parent AView.
 
auto size () const
 Size, including content area, border and padding.
 
auto expanding () const
 Expansion coefficient. Hints layout manager how much this AView should be extended relative to other AViews in the same container.
 
auto visibility () const
 Visibility value.
 
void redraw ()
 Request window manager to redraw this AView.
 
AWindowBasegetWindow () const
 Determines window which this AView belongs to.
 
virtual void drawStencilMask (ARenderContext ctx)
 
virtual void postRender (ARenderContext ctx)
 Performs post-draw routines of this AView. Noone should call this function except rendering routine.
 
void popStencilIfNeeded (ARenderContext ctx)
 
const AVector< AString > & getAssNames () const noexcept
 
glm::ivec2 getPosition () const noexcept
 Top left corner's position relative to top left corner's position of the parent AView.
 
glm::ivec2 getCenterPointInWindow () const noexcept
 The center point position of the view relatively to top left corner of the window.
 
glm::ivec2 getSize () const noexcept
 Size, including content area, border and padding.
 
glm::ivec2 getMinSize () const noexcept
 
void setMinSize (glm::ivec2 minSize) noexcept
 
void setExtraStylesheet (_< AStylesheet > extraStylesheet)
 
void setExtraStylesheet (AStylesheet &&extraStylesheet)
 
const _< AStylesheet > & extraStylesheet () const noexcept
 
AOverflow getOverflow () const
 Determines whether display graphics that go out of the bounds of this AView or not.
 
void setOverflow (AOverflow overflow)
 
AOverflowMask getOverflowMask () const
 Controls how does the overflow (stencil) mask is produced.
 
void setOverflowMask (AOverflowMask overflow)
 
float getBorderRadius () const
 border-radius, specified in ASS.
 
void setBorderRadius (float radius)
 
int getWidth () const
 
int getHeight () const
 
int getTotalOccupiedWidth () const
 
int getTotalOccupiedHeight () const
 
glm::ivec2 getMinimumSizePlusMargin ()
 
const ABoxFieldsgetMargin ()
 Returns the margin.
 
void setMargin (const ABoxFields &margin)
 Sets the margin.
 
const ABoxFieldsgetPadding ()
 Returns the padding.
 
void setPadding (const ABoxFields &padding)
 Sets the padding.
 
virtual AString debugString () const
 String which helps to identify this object in debug string output (i.e., for logging)
 
int getTotalFieldHorizontal () const
 
int getTotalFieldVertical () const
 
glm::ivec2 getTotalFieldSize () const
 
AViewContainerBasegetParent () const
 Parent AView.
 
const AOptional< ACursor > & getCursor () const
 Determines shape which should pointer take when it's above this AView.
 
void setCursor (AOptional< ACursor > cursor)
 
glm::ivec2 getContentMinimumSize () noexcept
 
bool isContentMinimumSizeInvalidated () noexcept
 
bool hasFocus () const
 
virtual int getMinimumWidth ()
 
virtual int getMinimumHeight ()
 
glm::ivec2 getMinimumSize ()
 
void setMaxSize (const glm::ivec2 &maxSize)
 
const glm::ivec2 & getMaxSize () const
 
int getContentWidth () const
 
int getContentHeight () const
 
const glm::ivec2 & getExpanding () const
 
void setExpanding (glm::ivec2 expanding)
 Changes the expanding of view.
 
void setExpanding (int expanding)
 Changes the expanding of view.
 
void setExpanding ()
 
const _< AAnimator > & getAnimator () const
 
void setAnimator (const _< AAnimator > &animator)
 
void getTransform (glm::mat4 &transform) const
 
int getExpandingHorizontal () const
 
int getExpandingVertical () const
 
aui::float_within_0_1 getOpacity () const
 
void setOpacity (aui::float_within_0_1 opacity)
 
void setSizeForced (glm::ivec2 size)
 
void setGeometry (const glm::ivec2 &position, const glm::ivec2 &size)
 
bool isBlockClicksWhenPressed () const noexcept
 
void setBlockClicksWhenPressed (bool value) noexcept
 
const glm::ivec2 & getFixedSize ()
 Fixed size.
 
void setFixedSize (glm::ivec2 size)
 
bool isMouseHover () const noexcept
 
bool isPressed () const noexcept
 
bool isPressed (APointerIndex index) const noexcept
 
bool isFocused () const
 
bool isMouseEntered () const
 
Visibility getVisibility () const
 
Visibility getVisibilityRecursive () const
 
void setVisibility (Visibility visibility) noexcept
 
void setVisible (bool visible) noexcept
 
MouseCollisionPolicy getMouseCollisionPolicy () const
 
void setMouseCollisionPolicy (MouseCollisionPolicy mouseCollisionPolicy)
 
void click ()
 
void pack ()
 Sets minimal size.
 
void focus (bool needFocusChainUpdate=true)
 Requests focus for this AView.
 
bool hasIndirectParent (const _< AView > &v)
 Checks if the specified view is an indirect parent of this view.
 
glm::ivec2 getPositionInWindow () const
 
void addAssName (const AString &assName)
 Adds an ASS class to this AView.
 
void removeAssName (const AString &assName)
 Removes an ASS class to this AView.
 
AViewoperator<< (const AString &assName)
 
const _< AAssHelper > & getAssHelper () const
 
const ass::PropertyListRecursivegetCustomAss () const
 
void setCustomStyle (ass::PropertyListRecursive rule)
 
void ensureAssUpdated ()
 
_< AViewsharedPtr ()
 
_weak< AViewweakPtr ()
 
virtual bool handlesNonMouseNavigation ()
 
void setDisabled (bool disabled=true)
 
void updateEnableState ()
 
void enable ()
 
void disable ()
 
void operator+ (ass::PropertyListRecursive rule)
 Helper function for kAUI.h:with_style.
 
void invalidateStateStyles ()
 Updates state selectors for ASS.
 
virtual bool wantsTouchscreenKeyboard ()
 Returns true if view is textfield-like view which requires touchscreen keyboard when clicked.
 
void setSkipUntilLayoutUpdate (bool skipUntilLayoutUpdate)
 
void setFloating (AFloat f) noexcept
 Set floating value for AText.
 
AFloat getFloating () const noexcept
 Floating value for AText.
 
- Public Member Functions inherited from AObject
_< AObjectsharedPtr ()
 
_weak< AObjectweakPtr ()
 
template<typename Connectable, ACompatibleSlotFor< Connectable > Function>
void connect (const Connectable &connectable, Function &&function)
 Connects signal or property to slot of "this" object.
 
void setSignalsEnabled (bool enabled)
 
bool isSignalsEnabled () const noexcept
 
template<ASignalInvokable T>
void operator^ (T &&t)
 
_< AAbstractThreadgetThread () const
 
bool isSlotsCallsOnlyOnMyThread () const noexcept
 
void setSlotsCallsOnlyOnMyThread (bool slotsCallsOnlyOnMyThread)
 
- Public Member Functions inherited from AObjectBase
 AObjectBase (AObjectBase &&rhs) noexcept
 
void clearSignals () noexcept
 
- Public Member Functions inherited from aui::noncopyable
 noncopyable (const noncopyable &)=delete
 
noncopyableoperator= (const noncopyable &)=delete
 

Static Public Member Functions

static bool isRedrawWillBeEfficient ()
 Checks whether last monitor frame is displayed and redraw will be efficient. If some object often updates UI thread for displaying some data it may cause extra CPU and GPU overload. AUI throttles window redraws and FPS does not go above 60 FPS but UI views may also cause extra CPU and GPU overload that does not have visual difference.
 
static _< AWindowwrapViewToWindow (const _< AView > &view, const AString &title, int width=854_dp, int height=500_dp, AWindow *parent=nullptr, WindowStyle ws=WindowStyle::DEFAULT)
 Wraps your AView to window.
 
static AWindowBasecurrent ()
 
- Static Public Member Functions inherited from AWindowBase
static AWindowManagergetWindowManager ()
 
template<typename WindowManager, typename... Args>
static void setWindowManager (Args &&... args)
 
static void destroyWindowManager ()
 
- Static Public Member Functions inherited from AObject
static void disconnect ()
 
template<AAnySignal Signal, aui::derived_from< AObjectBase > Object, ACompatibleSlotFor< Signal > Function>
static void connect (const Signal &signal, Object *object, Function &&function)
 Connects signal to the slot of the specified object.
 
template<AAnyProperty Property, aui::derived_from< AObjectBase > Object, typename Function>
static void connect (const Property &property, Object *object, Function &&function)
 Connects property to the slot of the specified object.
 
template<APropertyReadable PropertySource, APropertyWritable PropertyDestination>
requires requires { { *propertySource } -> aui::convertible_to<std::decay_t<decltype(*propertyDestination)>>; }
static void connect (PropertySource &&propertySource, PropertyDestination &&propertyDestination)
 Connects source property to the destination property.
 
template<APropertyWritable PropertySource, APropertyWritable PropertyDestination>
requires requires { { *propertySource } -> aui::convertible_to<std::decay_t<decltype(*propertyDestination)>>; { *propertyDestination } -> aui::convertible_to<std::decay_t<decltype(*propertySource)>>; }
static void biConnect (PropertySource &&propertySource, PropertyDestination &&propertyDestination)
 Connects source property to the destination property and opposite (bidirectionally).
 
template<AAnySignalOrProperty Connectable, aui::derived_from< AObjectBase > Object, ACompatibleSlotFor< Connectable > Function>
static void connect (const Connectable &connectable, Object &object, Function &&function)
 Connects signal or property to the slot of the specified object.
 
template<AAnySignalOrProperty Connectable, aui::derived_from< AObjectBase > Object, ACompatibleSlotFor< Connectable > Function>
static void connect (const Connectable &connectable, _< Object > object, Function &&function)
 Connects signal or property to the slot of the specified object.
 
template<AAnySignalOrProperty Connectable, aui::derived_from< AObjectBase > Object, typename Function>
static void connect (const Connectable &connectable, ASlotDef< Object *, Function > slotDef)
 Connects signal to the slot of the specified object. Slot is packed to single argument.
 
template<AAnyProperty Property, typename Object, ACompatibleSlotFor< Property > Function>
requires (!aui::derived_from<Object, AObject>)
static void connect (const Property &property, _< Object > object, Function &&function)
 Connects signal or property to the slot of the specified non-AObject type.
 
static void moveToThread (aui::no_escape< AObject > object, _< AAbstractThread > thread)
 

Signals and public fields

emits closed
 
emits shown
 
emits< glm::vec2 > moving
 Window is moving.
 
emits maximized
 Window is maximized.
 
emits minimized
 Window is minimized (hidden to the taskbar, iconified).
 
emits restored
 Window is restored (shown from the taskbar, deiconified).
 
- Signals and public fields inherited from AWindowBase
emits dpiChanged
 
emits< glm::ivec2 > mouseMove
 
emits< AInput::Key > keyDown
 
emits redrawn
 
emits touchscreenKeyboardShown
 On touch screen keyboard show.
 
emits touchscreenKeyboardHidden
 On touch screen keyboard hide.
 
- Signals and public fields inherited from AViewContainerBase
emits childrenChanged
 Emitted when addView(s)/removeView/setLayout was called.
 
- Signals and public fields inherited from AView
emits viewGraphSubtreeChanged
 
emits< bool > hoveredState
 
emits mouseEnter
 
emits mouseLeave
 
emits< bool, APointerIndexpressedState
 
emits< APointerIndexpressed
 
emits< APointerIndexreleased
 
emits< APointerIndexclickedButton
 Some mouse button clicked.
 
emits clicked
 Left mouse button clicked.
 
emits< glm::ivec2, glm::ivec2 > geometryChanged
 Geometry (position and size) changed.
 
emits< glm::ivec2 > scrolled
 Scroll event.
 
emits< AInput::Key > keyPressed
 Keyboard key pressed.
 
emits< AInput::Key > keyReleased
 Keyboard key released.
 
emits clickedRight
 Right mouse button clicked.
 
emits clickedRightOrLongPressed
 Right mouse button clicked or long press gesture applied.
 
emits< APointerIndexdoubleClicked
 
emits customCssPropertyChanged
 
emits< bool > focusState
 Focus state changed.
 
emits focusAcquired
 
emits focusLost
 
emits< _< AView > > childFocused
 

Protected Member Functions

virtual LRESULT winProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
virtual void doDrawWindow ()
 
virtual void onClosed ()
 
void windowNativePreInit (const AString &name, int width, int height, AWindow *parent, WindowStyle ws)
 
void allowDragNDrop ()
 Enables drag-n-drop for this window.
 
 AWindow (std::nullptr_t)
 Constructor for custom initialization logic.
 
void createDevtoolsWindow () override
 
float fetchDpiFromSystem () const override
 
- Protected Member Functions inherited from AWindowBase
void markPixelDataInvalid (ARect< int > invalidArea) override
 A view requests to redraw it and passes it's coords relative to this.
 
- Protected Member Functions inherited from AViewContainerBase
void drawView (const _< AView > &view, ARenderContext contextOfTheContainer)
 
template<typename Iterator>
void drawViews (Iterator begin, Iterator end, ARenderContext contextPassedToContainer)
 
void invalidateAllStyles () override
 Invalidates all styles, causing to iterate over all rules in global and parent stylesheets.
 
void onViewGraphSubtreeChanged () override
 Called when direct or indirect parent has changed.
 
void invalidateAssHelper () override
 Resets mAssHelper.
 
void setViews (AVector< _< AView > > views)
 Replace views.
 
void addViewCustomLayout (const _< AView > &view)
 Adds view to container without exposing it to the layout manager.
 
void addViews (AVector< _< AView > > views)
 Add all views from vector.
 
void addView (const _< AView > &view)
 Add view to the container.
 
void addView (size_t index, const _< AView > &view)
 Add view at specific index to the container.
 
void removeView (const _< AView > &view)
 Remove view from the container.
 
void removeView (AView *view)
 Remove view from the container.
 
void removeView (size_t index)
 Remove view from the container at specified index.
 
void removeAllViews ()
 Remove all views from container.
 
void setContents (const _< AViewContainer > &container)
 Moves (like via std::move) all children and layout of the specified container to this container.
 
void setLayout (_unique< ALayout > layout)
 Set new layout manager for this AViewContainerBase. DESTROYS OLD LAYOUT MANAGER WITH ITS VIEWS!!!
 
void renderChildren (ARenderContext contextPassedToContainer)
 
- Protected Member Functions inherited from AView
bool transformGestureEventsToDesktop (const glm::ivec2 &origin, const AGestureEvent &event)
 Converts touch screen events to desktop.
 
void applyAssRule (const ass::PropertyList &propertyList)
 
void applyAssRule (const ass::PropertyListRecursive &propertyList)
 
virtual AMenuModel composeContextMenu ()
 Produce context (right click) menu.
 
virtual void commitStyle ()
 
- Protected Member Functions inherited from AObject
void setThread (_< AAbstractThread > thread)
 Set thread of the object.
 

Protected Attributes

HICON mIcon = nullptr
 
AWindowNativePtr mHandle = 0
 
WindowStyle mWindowStyle = WindowStyle::DEFAULT
 
bool mFocusNextViewOnTab = false
 defines if the next view must be focused on tab button pressed
 
- Protected Attributes inherited from AWindowBase
bool mIsFocused = true
 
AOptional< bool > mPreventClickOnPointerRelease
 
bool mForceUpdateCursorGuard = false
 If true, AWindowBase::forceUpdateCursor takes no action.
 
bool mPerformDoubleClickOnPointerRelease = false
 
std::chrono::milliseconds mLastButtonPressedTime = std::chrono::milliseconds::zero()
 
AOptional< APointerIndexmLastButtonPressed
 
glm::vec2 mLastPosition = {0, 0}
 
_unique< IRenderingContextmRenderingContext
 
- Protected Attributes inherited from AViewContainerBase
AVector< _< AView > > mViews
 
bool mWantsLayoutUpdate = true
 
glm::ivec2 mLastLayoutUpdateSize {0, 0}
 
- Protected Attributes inherited from AView
AViewContainerBasemParent = nullptr
 Parent AView.
 
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.
 
ass::PropertyListRecursive mCustomStyleRule
 Custom ASS Rules.
 
AOptional< ACursormCursor = ACursor::DEFAULT
 Determines shape which should pointer take when it's above this AView.
 
glm::ivec2 mPosition = { 0, 0 }
 Top left corner's position relative to top left corner's position of the parent AView.
 
emits< glm::ivec2 > mPositionChanged
 Position changed.
 
glm::ivec2 mSize = { 20, 20 }
 Size, including content area, border and padding.
 
emits< glm::ivec2 > mSizeChanged
 Size changed.
 
AOptional< glm::ivec2 > mCachedMinContentSize
 
bool mMarkedMinContentSizeInvalid = false
 
bool mRedrawRequested = false
 Redraw requested flag for this particular view/.
 
glm::ivec2 mMinSize = {0, 0}
 Minimal size.
 
glm::ivec2 mMaxSize = {0x7fffffff, 0x7fffffff}
 Maximal size.
 
glm::ivec2 mFixedSize = {0, 0}
 Fixed size.
 
ABoxFields mMargin
 Margin, which defines the spacing around this AView. Processed by the layout manager.
 
ABoxFields mPadding
 Padding, which defines the spacing around content area inside the view. Processed by AView implementation.
 
AVector< AStringmAssNames
 ASS class names.
 
bool mSkipUntilLayoutUpdate = true
 If set to true, AViewContainer is obligated ignore this view. This value is set to false by AView::setGeometry.
 

Additional Inherited Members

- Public Types inherited from AWindowBase
using BeforeFrameQueue = AMessageQueue<AFakeMutex, IRenderer&>
 
- Static Public Attributes inherited from AWindowBase
static constexpr std::chrono::milliseconds DOUBLECLICK_MAX_DURATION = std::chrono::milliseconds(500)
 double click will be captured only if time elapsed since the previous click is less than DOUBLECLICK_MAX_DURATION
 
- Static Protected Member Functions inherited from AWindowBase
static AWindowBase *& currentWindowStorage ()
 
static _unique< AWindowManager > & getWindowManagerImpl ()
 

Detailed Description

Represents a window in the underlying windowing system.

Examples
/home/runner/work/aui/aui/aui.views/src/AUI/View/AView.h.

Constructor & Destructor Documentation

◆ AWindow()

AWindow::AWindow ( std::nullptr_t )
inlineprotected

Constructor for custom initialization logic.

Note
Please call windowNativePreInit

Member Function Documentation

◆ applyGeometryToChildren()

void AWindow::applyGeometryToChildren ( )
overridevirtual

Reimplemented from AViewContainerBase.

◆ blockUserInput()

void AWindow::blockUserInput ( bool blockUserInput = true)
overridevirtual

Enables or disables user input for this window.

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 from AWindowBase.

◆ closeOverlappingSurfaceImpl()

void AWindow::closeOverlappingSurfaceImpl ( AOverlappingSurface * surface)
overridevirtual

Implements AWindowBase.

◆ consumesClick()

bool AWindow::consumesClick ( const glm::ivec2 & pos)
overridevirtual

Determines whether this AView processes this click or passes it thru.

Parameters
posmouse position
Returns
true if AView processes this click

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

Reimplemented from AViewContainerBase.

◆ createDevtoolsWindow()

void AWindow::createDevtoolsWindow ( )
overrideprotectedvirtual

Reimplemented from AWindowBase.

◆ createOverlappingSurfaceImpl()

_< AOverlappingSurface > AWindow::createOverlappingSurfaceImpl ( const glm::ivec2 & position,
const glm::ivec2 & size )
overridevirtual

◆ current()

AWindowBase * AWindow::current ( )
static
Returns
Current window for current thread.

◆ fetchDpiFromSystem()

float AWindow::fetchDpiFromSystem ( ) const
overrideprotectedvirtual

Reimplemented from AWindowBase.

◆ flagRedraw()

void AWindow::flagRedraw ( )
overridevirtual

Reimplemented from AWindowBase.

◆ forceUpdateCursor()

void AWindow::forceUpdateCursor ( )
overridevirtual

Updates cursor by triggering onPointerMove on the same position (mMousePos).

Reimplemented from AWindowBase.

◆ frameMillis()

unsigned AWindow::frameMillis ( ) const
inlinenodiscardoverridevirtualnoexcept

Returns previous frame's rendering duration in millis.

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.

Implements AWindowBase.

◆ hideTouchscreenKeyboardImpl()

void AWindow::hideTouchscreenKeyboardImpl ( )
overridevirtual

Reimplemented from AWindowBase.

◆ isMaximized()

bool AWindow::isMaximized ( ) const
Returns
true if window maximized (fullscreen)

◆ isMinimized()

bool AWindow::isMinimized ( ) const
Returns
true if window minimized (hidden in taskbar, iconified)

◆ isRedrawWillBeEfficient()

bool AWindow::isRedrawWillBeEfficient ( )
static

Checks whether last monitor frame is displayed and redraw will be efficient. If some object often updates UI thread for displaying some data it may cause extra CPU and GPU overload. AUI throttles window redraws and FPS does not go above 60 FPS but UI views may also cause extra CPU and GPU overload that does not have visual difference.

Returns
true if 16 milliseconds elapsed since last frame

◆ mapPosition()

glm::ivec2 AWindow::mapPosition ( const glm::ivec2 & position)
nodiscard

Translates coordinates from the monitor's coordinate space to the coordinate space of this window.

Parameters
positionthe coordinate in screen space
Returns
coordinates in the space of this window

◆ mapPositionTo()

glm::ivec2 AWindow::mapPositionTo ( const glm::ivec2 & position,
_< AWindow > other )
nodiscard

Translates coordinates from the coordinate space of this window to the coordinate space of another window.

Parameters
positioncoordinates in the space of this window
otherother window
Returns
coordinates in the space of the other window

◆ moveToCenter()

void AWindow::moveToCenter ( )

Moves the window to the center of monitor.

When using in series with setSize(), do the setSize() first, when moveToCenter().

◆ onFocusAcquired()

void AWindow::onFocusAcquired ( )
overridevirtual

Reimplemented from AView.

◆ onFocusLost()

void AWindow::onFocusLost ( )
overridevirtual

Reimplemented from AView.

◆ onKeyDown()

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

Reimplemented from AViewContainerBase.

◆ onKeyRepeat()

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

Reimplemented from AViewContainerBase.

◆ onPointerMove()

void AWindow::onPointerMove ( glm::vec2 pos,
const APointerMoveEvent & event )
overridevirtual

Handles pointer hover events.

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.

◆ setGeometry()

void AWindow::setGeometry ( int x,
int y,
int width,
int height )
overridevirtual

Reimplemented from AView.

◆ setMobileScreenOrientation()

void AWindow::setMobileScreenOrientation ( AScreenOrientation screenOrientation)

Controls mobile device's screen orientation when this window is on the foreground.

Affects only mobile OSes. On window-based interfaces (desktop) does nothing.

◆ setPosition()

void AWindow::setPosition ( glm::ivec2 position)
overridevirtual

Reimplemented from AView.

◆ setSize()

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

Reimplemented from AViewContainerBase.

◆ show()

void AWindow::show ( )

Shows the window.

Behavior under UI tests
Does not actually shows the window and don't even needed in graphics environment.

◆ showTouchscreenKeyboardImpl()

void AWindow::showTouchscreenKeyboardImpl ( )
overridevirtual

Reimplemented from AWindowBase.

◆ unmapPosition()

glm::ivec2 AWindow::unmapPosition ( const glm::ivec2 & position)
nodiscard

Translates coordinates from the coordinate space of this window to the coordinate space of the monitor.

Parameters
positioncoordinates in the space of this window
Returns
the coordinates in space of the monitor

◆ wrapViewToWindow()

_< AWindow > AWindow::wrapViewToWindow ( const _< AView > & view,
const AString & title,
int width = 854_dp,
int height = 500_dp,
AWindow * parent = nullptr,
WindowStyle ws = WindowStyle::DEFAULT )
static

Wraps your AView to window.

Parameters
viewview to wrap
titlewindow title
widthwindow width
heightwindow height
parentparent window
wswindow style flags
Returns
created window, AWindow::show() is not called

Member Data Documentation

◆ moving

emits<glm::vec2> AWindow::moving

Window is moving.

Parameters
clientarea position.

The documentation for this class was generated from the following files:
Inheritance diagram for AWindow:
Collaboration diagram for AWindow: