IUIContext

Work in progress. An ensemble of calls UIElement are allowed to make, that concern the whole UI. Whenever an API call makes sense globally for usage in an UIelement, it should be moved to IUIContext.

Members

Functions

getDefaultUIHeight
int getDefaultUIHeight()

Get default width of the UI, at creation time, in user pixels.

getDefaultUISizeInPixels
vec2i getDefaultUISizeInPixels()

Get default size of the UI, at creation time, in user pixels.

getDefaultUIWidth
int getDefaultUIWidth()

Get default width of the UI, at creation time, in user pixels.

getElementById
UIElement getElementById(const(char)* id)

Get the first UIElement with the given ID, or null. This just checks for exact id matches, without anything fancy. If you use dplug:wren-support, this is called by the $ operator or the UI.getElementById.

getRootElement
UIElement getRootElement()

Get root element of the hierarchy.

getUINearestValidSize
void getUINearestValidSize(int* widthLogicalPixels, int* heightLogicalPixels)

Find the nearest valid _logical_ UI size. Given an input size, get the nearest valid size.

getUIScale
float getUIScale()
getUISizeInPixelsLogical
vec2i getUISizeInPixelsLogical()

Get current size of the UI, in logical pixels.

getUISizeInPixelsPhysical
vec2i getUISizeInPixelsPhysical()

Get current size of the UI, in physical pixels.

getUISizeInPixelsUser
vec2i getUISizeInPixelsUser()

Get current size of the UI, in user pixels.

getUserPointer
void* getUserPointer(int pointerID)

Get an user-defined pointer stored globally for the UI. This is useful to implement an optional extension to dplug:gui. id 0..7 are reserved for future Dplug extensions. id 8..15 are for vendor-specific extensions.

getUserScale
float getUserScale()
globalImageResizer
ImageResizer* globalImageResizer()

A shared image resizer to be used in reflow() of element. Resizing using dplug:graphics use a lot of memory, so it can be better if this is a shared resource. It is lazily constructed.

globalThreadPool
ThreadPool* globalThreadPool()

A shared threadpool, used to draw widgets concurrently. NEW: A widget can opt to be drawn alone, and use the threadpool for its own drawing itself. Can ONLY be called from onDrawRaw AND when the flag flagDrawAloneRaw is used, or from onDrawPBR AND when the flag flagDrawAlonePBR is used.

isUIResizable
bool isUIResizable()
profiler
IProfiler profiler()

Returns a UI-wide profiler that records UI performance, as long as Dplug_ProfileUI version is defined. Else, it is a null IProfiler that forgets everything. For performance purpose, it is recommended: 1. not to record profile if Dplug_ProfileUI is not defined, 2. and undefine Dplug_ProfileUI if you're not looking for a bottleneck.

requestUIResize
bool requestUIResize(int widthLogicalPixels, int heightLogicalPixels)

Trigger a resize of the plugin window. This isn't guaranteed to succeed.

setUserPointer
void setUserPointer(int pointerID, void* userPointer)

Store an user-defined pointer globally for the UI. This is useful to implement an optional extension to dplug:gui. id 0..7 are reserved for future Dplug extensions. id 8..15 are for vendor-specific extensions. Warning: if you store an object here, keep in mind they won't get destroyed automatically.

Meta