joka.ui

The ui module includes a UI library.

Types 32

aliasUiFont = void *

The UI font type.

aliasUiTexture = void *

The UI texture type.

aliasUiIconId = uint

The UI icon ID type.

aliasUiTextSizeFunc = IVec2 function(UiFont font, uint fontScale, IStr text)

A function used for getting the width and height of the text.

aliasUiIconIdSizeFunc = IVec2 function(UiIconId iconId)

A function used for getting the width and height of an icon.

enumUiColorType : ubyte

A UI color.

borderDefault border color.
borderOffBorder color on no interaction.
iconDefault icon color.
iconOffIcon color on no interaction.
textDefault text color.
textOffText color on no interaction.
buttonDefault button color.
buttonOffButton color on no interaction.
buttonHoverButton color on hover.
buttonActiveButton color on press.
buttonFocusButton color on focus.
aliasUiColors = StaticArray!(Rgba, UiColorType.max + 1)

Static table of UI colors with UiColorType being the key.

structUiStyle

A style defines the visual appearance of the UI.

Fields
UiFont font
UiTexture texture
UiColors colors
uint fontScale
uint border
uint padding
aliasUiMouseButtonFlags = ubyte

A bitmask type for mouse button state, combining one or more UiMouseButtonFlag values.

Individual mouse button flags for use in a UiMouseButtonFlags bitmask.

none = 0x0No mouse button.
left = 0x1The left mouse button.
right = 0x2The right mouse button.
middle = 0x4The middle mouse button.
aliasUiKeyFlags = ushort

A bitmask type for keyboard key state, combining one or more UiKeyFlag values.

Individual key flags for use in a UiKeyFlags bitmask.

none = 0No key.
left = 1U << 1The left arrow key.
right = 1U << 2The right arrow key.
up = 1U << 3The up arrow key.
down = 1U << 4The down arrow key.
tab = 1U << 5The Tab key.
enter = 1U << 6The Enter key.
esc = 1U << 7The Escape key.
shift = 1U << 8The Shift key.
enumUiKeyNavigation : ubyte

Controls which axis or axes keyboard navigation responds to.

noneKeyboard navigation is disabled.
verticalOrHorizontalNavigation responds to both axes.
verticalNavigation responds to the vertical axis only.
horizontalNavigation responds to the horizontal axis only.
structUiInput
Fields
IVec2 mousePosition
IVec2 mousePressedPosition
UiMouseButtonFlags mouseButtonDown
UiMouseButtonFlags mouseButtonPressed
UiMouseButtonFlags mouseButtonReleased
bool mouseActionOnRelease
UiKeyFlags keyDown
UiKeyFlags keyPressed
UiKeyFlags keyReleased
UiKeyNavigation keyNavigation
UiKeyNavigation nextKeyNavigation
Methods
bool mouseAction(IRect area) @safe nothrow @nogc
bool keyNavigationUpAction() @safe nothrow @nogc
bool keyNavigationDownAction() @safe nothrow @nogc
bool keyNavigationAction() @safe nothrow @nogc
void clear() @safe nothrow @nogc
aliasUiCommandFlags = ubyte
none = 0x00
hover = 0x01
active = 0x02
focus = 0x04
off = 0x08
enumUiCommandType : ubyte
none
rect
text
icon
Fields
UiColorType colorType
Fields
ushort border
IRect data
Fields
IRect area
IStr data
Fields
IRect area
Fields
UiCommand[] data
Sz length
Methods
UiCommand[] items() @trusted @safe nothrow @nogc
UiCommand * ptr() @trusted @safe nothrow @nogc
bool isEmpty() @trusted @safe nothrow @nogc
Sz capacity() @trusted @safe nothrow @nogc
bool appendBlank() @safe nothrow @nogc
bool appendRef(ref UiCommand command) @trusted @safe nothrow @nogc
void clear() @safe nothrow @nogc
bool nextIsRectWith(Sz currentIndex, UiCommandFlags flags) @safe nothrow @nogc
aliasUiResultFlags = ubyte

The result of a UI control function.

The result values of a UI control function.

none = 0x00None.
active = 0x01Control is active (e.g. active window).
submitted = 0x02Control value submitted (e.g. clicked button).
changed = 0x04Control value changed (e.g. modified text).
pressedLeft = 0x08Pressed left on a active control in vertical navigation mode.
pressedRight = 0x10Pressed right on a active control in vertical navigation mode.
pressedUp = 0x20Pressed up on a active control in horizontal navigation mode.
pressedDown = 0x40Pressed down on a active control in horizontal navigation mode.
aliasUiFlags = ubyte

The option flags of a UI control function.

The option flag values of a UI control function.

none = 0x0000None.
alignCenter = 0x0001Align to the center.
alignRight = 0x0002Align to the right.
turnOff = 0x0004Turn off interactions.
checkNavigation = 0x0008Include key actions in result flags.
Fields
int currentFocusId
int nextFocusId
IVec2 nextFocusIdWrap
int focusIdCounter
bool focusIsActive
Methods
bool isFocused(int id) @safe nothrow @nogc
void setCurrentFocusId(int id) @safe nothrow @nogc
void wrapCurrentFocusIdIfNeeded(int startInclusive, int endInclusive) @safe nothrow @nogc

A UI focus grabber.

Fields
UiContext * _uiContext
int _previousFocusIdCounter
bool _canIgnore
Constructors
this(ref UiContext context, UiKeyNavigation keyNavigation = UiKeyNavigation.none, bool canIgnore = false)
Destructors
structUiLayout

A UI layout helper.

Fields
IRect area
int slice
int spacing
bool isVertical
bool fromRightOrBottom
Methods
int w() @safe nothrow @nogc
int h() @safe nothrow @nogc
IRect pop(bool span = false) @safe nothrow @nogc
Fields
bool submittedByKeyboard
bool hover
bool active
bool focus
uint focusId
bool mouseAction
structUiContext

The UI context.

Fields
UiCommands commands
UiFocusState focusState
UiStyle * style
UiStyle _style
UiInput input
bool manualBordersMode
char[] charDataBuffer
Sz charDataLength
int charHeight
int charOffset
Methods
void ready(UiTextSizeFunc textSizeFunc, UiCommand[] commandsBuffer, char[] charDataBuffer, UiFont font, uint fontScale = 1, UiIconIdSizeFunc iconSizeFunc = null) @safe nothrow @nogc
void setBuffers(UiCommand[] newCommandsBuffer, char[] newCharDataBuffer) @safe nothrow @nogc
void setFont(UiFont font, uint fontScale = 1) @safe nothrow @nogc
void applyDefaultStyle() @safe nothrow @nogc
void restoreDefaultStyle() @trusted @safe nothrow @nogc
ScopedUiFocus captureFocus(UiKeyNavigation keyNavigation = UiKeyNavigation.none, bool canIgnore = false) @safe nothrow @nogc
UiLayout _row(IRect area, int areaCount, int spacing, bool fromRight, int infiniteSlice) static @safe nothrow @nogc
UiLayout rowItems(IRect area, int count, int spacing, bool fromRight = false) static @safe nothrow @nogc
UiLayout rowSlice(IRect area, int slice, int spacing) static @safe nothrow @nogc
UiLayout _col(IRect area, int areaCount, int spacing, bool fromBottom, int infiniteSlice) static @safe nothrow @nogc
UiLayout colItems(IRect area, int count, int spacing, bool fromBottom = false) static @safe nothrow @nogc
UiLayout colSlice(IRect area, int slice, int spacing) static @safe nothrow @nogc
IStrz makeStrzCopy(IStr text) @trusted @safe nothrow @nogc
void drawRect(IRect area, UiColorType colorType, bool hover, bool active, bool focus, bool off, uint border) @trusted @safe nothrow @nogc
void drawBorder(IRect area, bool off, uint border) @safe nothrow @nogc
void drawBox(IRect area, UiColorType colorType, bool hover, bool active, bool focus, bool off, uint border) @safe nothrow @nogc
void drawIcon(UiIconId iconId, UiColorType colorType, IRect area, UiFlags optionFlags) @safe nothrow @nogc
void drawText(IStr text, UiColorType colorType, IRect area, UiFlags optionFlags) @trusted @safe nothrow @nogc
void drawLabelContent(IRect area, IStr text, UiIconId iconId = 0, UiFlags optionFlags = defaultUiFlags) @safe nothrow @nogc
void begin() @safe nothrow @nogc
void end() @safe nothrow @nogc
UiControlInteraction registerControlInteraction(IRect area, UiFlags optionFlags) @safe nothrow @nogc
UiResultFlags handleButtonInteraction(UiControlInteraction interaction, IRect area, UiFlags optionFlags) @safe nothrow @nogc
UiColorType handleButtonColorType(UiControlInteraction interaction, UiFlags optionFlags) @safe nothrow @nogc
UiResultFlags label(IRect area, IStr text, UiIconId iconId = 0, UiFlags optionFlags = defaultUiFlags) @safe nothrow @nogc
UiResultFlags icon(IRect area, UiIconId iconId, UiFlags optionFlags = defaultUiFlags) @safe nothrow @nogc
UiResultFlags buttonWithIcon(IRect area, IStr text, UiIconId iconId, UiFlags optionFlags = defaultUiFlags) @safe nothrow @nogc
UiResultFlags button(IRect area, IStr text, UiFlags optionFlags = defaultUiFlags) @safe nothrow @nogc
UiResultFlags stepper(T)(IRect area, ref T number, T startInclusive, T stopInclusive, T step, IStr info = "", bool canLoop = true, IStr fmtStr = defaultAsciiFmtArgStr, UiFlags optionFlags = defaultUiFlags) @safe nothrow @nogc
UiResultFlags stepper(IRect area, ref int number, IStr info = "", bool canLoop = true, IStr fmtStr = "{}%", UiFlags optionFlags = defaultUiFlags) @safe nothrow @nogc
UiResultFlags cycler(T)(IRect area, ref T enumNumber, IStr info = "", bool canLoop = true, bool canKeepFirstChar = false, UiFlags optionFlags = defaultUiFlags) @safe nothrow @nogc
UiResultFlags toggle(IRect area, ref bool state, IStr info = "", IStr offText = "OFF", IStr onText = "ON", UiFlags optionFlags = defaultUiFlags) @safe nothrow @nogc
Constructors
this(UiTextSizeFunc textSizeFunc, UiCommand[] commandsBuffer, char[] charDataBuffer, UiFont font, uint fontScale = 1, UiIconIdSizeFunc iconSizeFunc = null)

Functions 1

fnIVec2 tempUiTextSizeFunc(UiFont font, uint fontScale, IStr text) @safe nothrow @nogc

Variables 1

enumvardefaultUiFlags = UiFlag.alignCenter

The default control flags.