Adds an UIElement The addChild method is mandatory. Such a child MUST be created through dplug.core.nogc.mallocEmplace. Note: to display a newly added widget, use position setter.
Check if given point is within the widget. Override this to disambiguate clicks and mouse-over between widgets that would otherwise partially overlap.
Appends the Elements that should be drawn, in order. You should empty it before calling this function. Everything visible get into the draw list, but that doesn't mean they will get drawn if they don't overlap with a dirty area.
Search subtree for an UIElement with ID id. Undefined Behaviour if ID are not unique.
Get this element ID. All UIElement can have a string as unique identifier, similar to HTML. Returns the empty string "" if there is no ID. Note: this return an interior slice, and could be invalidated if the ID is reassigned.
Get a user pointer. Allow dplug:gui extensions.
Properties to access this element ID.
A widget is "visible" when it has a true visibility flag, and its parent is itself visible.
Called periodically for every UIElement. Override this to create animations. Using setDirty there allows to redraw an element continuously (like a meter or an animated object). Warning: Summing dt will not lead to a time that increase like time. time can go backwards if the window was reopen. time is guaranteed to increase as fast as system time but is not synced to audio time.
Called when clicked with left/middle/right button This function is meant to be overriden. Between onBeginDrag and onStopDrag, isDragged will return true.
PBR layer draw method. This gives you 3 surfaces cropped by _position for drawing. Note that you are not forced to draw all to the surfaces at all, in which case the below UIElement will be displayed.
Raw layer draw method. This gives you 1 surface cropped by _position for drawing. Note that you are not forced to draw to the surfaces at all.
Called when this Element is clicked and get the "focus" (ie. keyboard focus). This function is meant to be overriden.
Called when focus is lost because another Element was clicked. This widget then loose the "focus" (ie. keyboard focus). This function is meant to be overriden.
Called when a key is pressed. This event bubbles down-up until being processed. Return true if treating the message.
Called when a key is pressed. This event bubbles down-up until being processed. Return true if treating the message.
onMouseClick is called for every new click, whether or not you are in a dragging operation. This function is meant to be overriden.
Called when mouse drag this Element. This function is meant to be overriden.
Called when mouse enter this Element. This function is meant to be overriden. Between onMouseEnter and onMouseExit, isMouseOver will return true.
Called when mouse enter this Element. This function is meant to be overriden. Between onMouseEnter and onMouseExit, isMouseOver will return true.
Called when mouse move over this Element. This function is meant to be overriden.
Mouse wheel was turned. This function is meant to be overriden. It should return true if the wheel is handled.
Called once a dragging operation is finished. This function is meant to be overriden. Between onBeginDrag and onStopDrag, isDragged will return true.
Changes the position of the element. This calls reflow if that position has changed. IMPORTANT: As of today you are not allowed to assign a position outside the extent of the window. This is purely a Dplug limitation.
Changes the position of the element. This calls reflow if that position has changed. Note: Widget coordinates are always integer coordinates. The input rectangle is rounded to nearest integer.
The goal of this method is to update positions of childrens. It is called whenever _position changes.
Removes a child (but does not destroy it, you take back the ownership of it). Useful for creating dynamic UI's. MAYDO: there are restrictions for where this is allowed. Find them.
This method is called for each item in the drawlist that was visible and has a dirty Raw layer. This is called after compositing, starting from the buffer output by the Compositor.
Mark a part of the element dirty. This part must be a subrect of its _position.
Mark this element as wholly dirty.
Set this element ID. All UIElement can have a string as unique identifier, similar to HTML. There is a maximum of 63 characters for this id though. This ID is supposed to be unique. If it isn't, a search by ID will return null. Chrome rules applies: can't contain any space characters.
Set a user pointer. Allow dplug:gui extensions.
Get visibility flag of the widget. A widget might still be invisible, if one of its parent is not visible.
Change visibility flag of the widget. This show and hide all children of this UIElement, regardless of their position on screen, invalidating their graphics if need be much like a position change.
The list of children UI elements.
Flags, for now immutable
Parent element. Following this chain gets to the root element.
Position is the graphical extent of the element, or something larger. An UIElement is not allowed though to draw further than its _position. For efficiency it's best to keep _position as small as feasible. This is an absolute "world" positioning data, that doesn't depend on the parent's position.
Higher z-order = above other UIElement. By default, every UIElement have the same z-order. Because the sort is stable, tree traversal order is the default order (depth first). The children added last with addChild is considered above its siblings if you don't have legacyZOrder.
Base class of the UI widget hierarchy.
MAYDO: a bunch of stuff in that class is intended specifically for the root element, there is probably a better design to find.