carb::simplegui::ISimpleGui

Defined in carb/simplegui/ISimpleGui.h

struct carb::simplegui::ISimpleGui

Defines the simplegui interface.

Based on: ImGui 1.70

Public Functions

inline void sameLine()

Tell the widget to stay on the same line.

Public Members

Context *(*createContext)(const ContextDesc &desc)

Creates a new immediate mode gui context.

Parameters

desc – Context descriptor.

Returns

The context used for the current state of the gui.

void (*destroyContext)(Context *ctx)

Destroys an immediate mode gui context.

Parameters

ctx – The context to be destroyed.

void (*setCurrentContext)(Context *ctx)

Sets the current immediate mode gui context to be used.

Context *(*getCurrentContext)()

Gets the current immediate mode gui context that is used.

Returns

returns current immediate gui mode context.

void (*newFrame)()

Start rendering a new immediate mode gui frame.

void (*render)(float elapsedTime)

Render the immediate mode gui frame.

Parameters

elapsedTime – The amount of elapsed time since the last render() call.

void (*setDisplaySize)(Float2 size)

Sets the display size.

Parameters

size – The display size to be set.

Float2 (*getDisplaySize)()

Gets the display size.

Returns

The display size.

Style *(*getStyle)()

Gets the style struct.

Returns

The style struct.

void (*showDemoWindow)(bool *open)

Shows a demo window of all features supported.

Parameters

open – Is window opened, can be changed after the call.

void (*showMetricsWindow)(bool *open)

Create metrics window.

Display simplegui internals: draw commands (with individual draw calls and vertices), window list, basic internal state, etc.

Parameters

open – Is window opened, can be changed after the call.

void (*showStyleEditor)(Style *style)

Add style editor block (not a window).

You can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)

Parameters

styleStyle to edit. Pass nullptr to edit the default one.

bool (*showStyleSelector)(const char *label)

Add style selector block (not a window).

Essentially a combo listing the default styles.

Parameters

label – Label.

void (*showFontSelector)(const char *label)

Add font selector block (not a window).

Essentially a combo listing the loaded fonts.

Parameters

label – Label.

void (*showUserGuide)()

Add basic help/info block (not a window): how to manipulate simplegui as a end-user (mouse/keyboard controls).

const char *(*getImGuiVersion)()

Get underlying ImGui library version string.

Returns

The version string e.g. “1.70”.

void (*setStyleColors)(Style *style, StyleColorsPreset preset)

Set style colors from one of the predefined presets:

Parameters
  • styleStyle to change. Pass nullptr to change the default one.

  • preset – Colors preset.

bool (*begin)(const char *label, bool *open, WindowFlags flags)

Begins defining a new immediate mode gui (window).

Parameters
  • label – The window label.

  • open – Returns if the window was active.

  • windowFlags – The window flags to be used.

Returns

return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window.

void (*end)()

Ends defining a immediate mode.

bool (*beginChild)(const char *strId, Float2 size, bool border, WindowFlags flags)

Begins a scrolling child region.

Parameters
  • strId – The string identifier for the child region.

  • size – The size of the region. size==0.0f: use remaining window size, size<0.0f: use remaining window.

  • border – Draw border.

  • flags – Sets any WindowFlags for the dialog.

Returns

true if the region change, false if not.

bool (*beginChildId)(uint32_t id, Float2 size, bool border, WindowFlags flags)

Begins a scrolling child region.

Parameters
  • id – The identifier for the child region.

  • size – The size of the region. size==0.0f: use remaining window size, size<0.0f: use remaining window.

  • border – Draw border.

  • flags – Sets any WindowFlags for the dialog.

Returns

true if the region change, false if not.

void (*endChild)()

Ends a child region.

bool (*isWindowAppearing)()

Is window appearing?

Returns

true if window is appearing, false if not.

bool (*isWindowCollapsed)()

Is window collapsed?

Returns

true if window is collapsed, false is not.

bool (*isWindowFocused)(FocusedFlags flags)

Is current window focused? or its root/child, depending on flags.

see flags for options.

Parameters

flags – The focused flags to use.

Returns

true if window is focused, false if not.

bool (*isWindowHovered)(HoveredFlags flags)

Is current window hovered (and typically: not blocked by a popup/modal)? see flags for options.

If you are trying to check whether your mouse should be dispatched to simplegui or to your app, you should use the ‘io.WantCaptureMouse’ boolean for that! Please read the FAQ!

Parameters

flags – The hovered flags to use.

Returns

true if window is currently hovered over, flase if not.

DrawList *(*getWindowDrawList)()

Get the draw list associated to the window, to append your own drawing primitives.

Returns

The draw list associated to the window, to append your own drawing primitives.

float (*getWindowDpiScale)()

Gets the DPI scale currently associated to the current window’s viewport.

Returns

The DPI scale currently associated to the current window’s viewport.

Float2 (*getWindowPos)()

Get current window position in screen space.

This is useful if you want to do your own drawing via the DrawList API.

Returns

The current window position in screen space.

Float2 (*getWindowSize)()

Gets the current window size.

Returns

The current window size

float (*getWindowWidth)()

Gets the current window width.

Returns

The current window width.

float (*getWindowHeight)()

Gets the current window height.

Returns

The current window height.

Float2 (*getContentRegionMax)()

Gets the current content boundaries.

This is typically window boundaries including scrolling, or current column boundaries, in windows coordinates.

Returns

The current content boundaries.

Float2 (*getContentRegionAvail)()

Gets the current content region available.

This is: getContentRegionMax() - getCursorPos()

Returns

The current content region available.

float (*ContentRegionAvailWidth)()

Gets the width of the current content region available.

Returns

The width of the current content region available.

Float2 (*getWindowContentRegionMin)()

Content boundaries min (roughly (0,0)-Scroll), in window coordinates.

Float2 (*getWindowContentRegionMax)()

Gets the maximum content boundaries.

This is roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates.

Returns

The maximum content boundaries.

float (*getWindowContentRegionWidth)()

Content region width.

void (*setNextWindowPos)(Float2 position, Condition cond, Float2 pivot)

Sets the next window position.

Call before begin(). use pivot=(0.5f,0.5f) to center on given point, etc.

Parameters
  • position – The position to set.

  • pivot – The offset pivot.

void (*setNextWindowSize)(Float2 size, Condition cond)

Set next window size.

Set axis to 0.0f to force an auto-fit on this axis. call before begin()

Parameters

size – The next window size.

void (*setNextWindowSizeConstraints)(const Float2 &sizeMin, const Float2 &sizeMax)

Set next window size limits.

use -1,-1 on either X/Y axis to preserve the current size. Use callback to apply non-trivial programmatic constraints.

void (*setNextWindowContentSize)(const Float2 &size)

Set next window content size (~ enforce the range of scrollbars).

not including window decorations (title bar, menu bar, etc.). set an axis to 0.0f to leave it automatic. call before Begin()

void (*setNextWindowCollapsed)(bool collapsed, Condition cond)

Set next window collapsed state.

call before Begin()

void (*setNextWindowFocus)()

Set next window to be focused / front-most.

call before Begin()

void (*setNextWindowBgAlpha)(float alpha)

Set next window background color alpha.

helper to easily modify ImGuiCol_WindowBg/ChildBg/PopupBg.

void (*setWindowFontScale)(float scale)

Set font scale.

Adjust IO.FontGlobalScale if you want to scale all windows

void (*setWindowPos)(const char *name, const Float2 &pos, Condition cond)

Set named window position.

void (*setWindowSize)(const char *name, const Float2 &size, Condition cond)

Set named window size.

set axis to 0.0f to force an auto-fit on this axis.

void (*setWindowCollapsed)(const char *name, bool collapsed, Condition cond)

Set named window collapsed state.

void (*setWindowFocus)(const char *name)

Set named window to be focused / front-most.

use NULL to remove focus.

float (*getScrollX)()

Get scrolling amount [0..GetScrollMaxX()].

float (*getScrollY)()

Get scrolling amount [0..GetScrollMaxY()].

float (*getScrollMaxX)()

Get maximum scrolling amount ~~ ContentSize.X - WindowSize.X.

float (*getScrollMaxY)()

Get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y.

void (*setScrollX)(float scrollX)

Set scrolling amount [0..GetScrollMaxX()].

void (*setScrollY)(float scrollY)

Set scrolling amount [0..GetScrollMaxY()].

void (*setScrollHereY)(float centerYRatio)

Adjust scrolling amount to make current cursor position visible.

Parameters

centerYRatio – Center y ratio: 0.0: top, 0.5: center, 1.0: bottom.

void (*setScrollFromPosY)(float posY, float centerYRatio)

Adjust scrolling amount to make given position valid.

use getCursorPos() or getCursorStartPos()+offset to get valid positions. default: centerYRatio = 0.5f

void (*pushFont)(Font *font)

Use NULL as a shortcut to push default font.

void (*popFont)()

Pop font from the stack.

void (*pushStyleColor)(StyleColor styleColorIndex, Float4 color)

Pushes and applies a style color for the current widget.

Parameters
  • styleColorIndex – The style color index.

  • color – The color to be applied for the style color being pushed.

void (*popStyleColor)()

Pops off and stops applying the style color for the current widget.

void (*pushStyleVarFloat)(StyleVar styleVarIndex, float value)

Pushes a style variable(property) with a float value.

Parameters
  • styleVarIndex – The style variable(property) index.

  • value – The value to be applied.

void (*pushStyleVarFloat2)(StyleVar styleVarIndex, Float2 value)

Pushes a style variable(property) with a Float2 value.

Parameters
  • styleVarIndex – The style variable(property) index.

  • value – The value to be applied.

void (*popStyleVar)()

Pops off and stops applying the style variable(property) for the current widget.

const Float4 &(*getStyleColorVec4)(StyleColor colorIndex)

Retrieve style color as stored in ImGuiStyle structure.

use to feed back into PushStyleColor(), otherwhise use GetColorU32() to get style color with style alpha baked in.

Font *(*getFont)()

Get current font.

float (*getFontSize)()

Get current font size (= height in pixels) of current font with current scale applied.

Float2 (*getFontTexUvWhitePixel)()

Get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API.

uint32_t (*getColorU32StyleColor)(StyleColor colorIndex, float alphaMul)

Retrieve given style color with style alpha applied and optional extra alpha multiplier.

uint32_t (*getColorU32Vec4)(Float4 color)

Retrieve given color with style alpha applied.

uint32_t (*getColorU32)(uint32_t color)

Retrieve given color with style alpha applied.

void (*pushItemWidth)(float width)

Push an item width for next widgets.

In pixels. 0.0f = default to ~2/3 of windows width, >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -1.0f always align width to the right side).

Parameters

width – The width.

void (*popItemWidth)()

Pops an item width.

carb::Float2 (*calcItemSize)(carb::Float2 size, float defaultX, float defaultY)

Size of item given pushed settings and current cursor position NOTE: This is not the same as calcItemWidth.

float (*calcItemWidth)()

Width of item given pushed settings and current cursor position.

void (*pushTextWrapPos)(float wrapPosX)

Word-wrapping for Text*() commands.

< 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at ‘wrapPosX’ position in window local space

void (*popTextWrapPos)()

Pop text wrap pos form the stack.

void (*pushAllowKeyboardFocus)(bool allow)

Allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets.

void (*popAllowKeyboardFocus)()

Pop allow keyboard focus.

void (*pushButtonRepeat)(bool repeat)

In ‘repeat’ mode, Button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting).

Note that you can call IsItemActive() after any Button() to tell if the button is held in the current frame.

void (*popButtonRepeat)()

Pop button repeat.

void (*separator)()

Adds a widget separator.

void (*sameLineEx)(float posX, float spacingW)

Tell the widget to stay on the same line with parameters.

void (*newLine)()

Undo sameLine()

void (*spacing)()

Adds widget spacing.

void (*dummy)(Float2 size)

Adds a dummy element of a given size.

Parameters

size – The size of a dummy element.

void (*indent)()

Indents.

void (*indentEx)(float indentWidth)

Indents with width indent spacing.

void (*unindent)()

Undo indent.

void (*beginGroup)()

Lock horizontal starting position + capture group bounding box into one “item” (so you can use IsItemHovered() or layout primitives such as () on whole group, etc.)

void (*endGroup)()

End group.

Float2 (*getCursorPos)()

Cursor position is relative to window position.

Float2 (*getCursorStartPos)()

Initial cursor position.

Float2 (*getCursorScreenPos)()

Cursor position in absolute screen coordinates [0..io.DisplaySize] (useful to work with ImDrawList API)

void (*setCursorScreenPos)(const Float2 &pos)

Cursor position in absolute screen coordinates [0..io.DisplaySize].

void (*alignTextToFramePadding)()

Vertically align upcoming text baseline to FramePadding.y so that it will align properly to regularly framed items (call if you have text on a line before a framed item)

float (*getTextLineHeight)()

~ FontSize

float (*getTextLineHeightWithSpacing)()

~ FontSize + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of text)

float (*getFrameHeight)()

~ FontSize + style.FramePadding.y * 2

float (*getFrameHeightWithSpacing)()

~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets)

void (*pushIdString)(const char *id)

Push a string id for next widgets.

If you are creating widgets in a loop you most likely want to push a unique identifier (e.g. object pointer, loop index) so simplegui can differentiate them. popId() must be called later.

Parameters

id – The string id.

void (*pushIdStringBeginEnd)(const char *idBegin, const char *idEnd)

Push a string id for next widgets.

If you are creating widgets in a loop you most likely want to push a unique identifier (e.g. object pointer, loop index) so simplegui can differentiate them. popId() must be called later.

Parameters

id – The string id.

void (*pushIdInt)(int id)

Push an integer id for next widgets.

If you are creating widgets in a loop you most likely want to push a unique identifier (e.g. object pointer, loop index) so simplegui can differentiate them. popId() must be called later.

Parameters

id – The integer id.

void (*pushIdPtr)(const void *id)

Push pointer id for next widgets.

void (*popId)()

Pops an id.

uint32_t (*getIdString)(const char *id)

Calculate unique ID (hash of whole ID stack + given parameter).

e.g. if you want to query into ImGuiStorage yourself.

uint32_t (*getIdStringBeginEnd)(const char *idBegin, const char *idEnd)

Calculate unique ID (hash of whole ID stack + given parameter).

e.g. if you want to query into ImGuiStorage yourself.

void (*textUnformatted)(const char *text)

Shows a text widget, without text formatting.

Faster version, use for big texts.

Parameters

text – The null terminated text string.

void (*text)(const char *fmt, ...)

Shows a text widget.

Parameters
  • fmt – The formated label for the text.

  • ... – The variable arguments for the label.

void (*textColored)(const Float4 &color, const char *fmt, ...)

Shows a colored text widget.

Parameters
  • fmt – The formated label for the text.

  • ... – The variable arguments for the label.

void (*textDisabled)(const char *fmt, ...)

Shows a disabled text widget.

Parameters
  • fmt – The formated label for the text.

  • ... – The variable arguments for the label.

void (*textWrapped)(const char *fmt, ...)

Shows a wrapped text widget.

Parameters
  • fmt – The formated label for the text.

  • ... – The variable arguments for the label.

void (*labelText)(const char *label, const char *fmt, ...)

Display text+label aligned the same way as value+label widgets.

void (*bulletText)(const char *fmt, ...)

Shortcut for Bullet()+Text()

bool (*buttonEx)(const char *label, const Float2 &size)

Shows a button widget.

Parameters

label – The label for the button.

Returns

true if the button was pressed, false if not.

bool (*smallButton)(const char *label)

Shows a smallButton widget.

Parameters

label – The label for the button.

Returns

true if the button was pressed, false if not.

bool (*invisibleButton)(const char *id, const Float2 &size)

Button behavior without the visuals.

Useful to build custom behaviors using the public api (along with isItemActive, isItemHovered, etc.)

bool (*arrowButton)(const char *id, Direction dir)

Arrow-like button with specified direction.

void (*image)(TextureId userTextureId, const Float2 &size, const Float2 &uv0, const Float2 &uv1, const Float4 &tintColor, const Float4 &borderColor)

Image with user texture id defaults: uv0 = Float2(0,0) uv1 = Float2(1,1) tintColor = Float4(1,1,1,1) borderColor = Float4(0,0,0,0)

bool (*imageButton)(TextureId userTextureId, const Float2 &size, const Float2 &uv0, const Float2 &uv1, int framePadding, const Float4 &bgColor, const Float4 &tintColor)

Image as a button.

<0 framePadding uses default frame padding settings. 0 for no padding defaults: uv0 = Float2(0,0) uv1 = Float2(1,1) framePadding = -1 bgColor = Float4(0,0,0,0) tintColor = Float4(1,1,1,1)

bool (*checkbox)(const char *label, bool *value)

Adds a checkbox widget.

Parameters
  • label – The checkbox label.

  • value – The current value of the checkbox

Returns

true if the checkbox was pressed, false if not.

bool (*checkboxFlags)(const char *label, uint32_t *flags, uint32_t flagsValue)

Flags checkbox.

bool (*radioButton)(const char *label, bool active)

Radio button.

bool (*radioButtonEx)(const char *label, int *v, int vButton)

Radio button.

void (*progressBar)(float fraction, Float2 size, const char *overlay)

Adds a progress bar widget.

Parameters
  • fraction – The progress value (0-1).

  • size – The widget size.

  • overlay – The text overlay, if nullptr the default with percents is displayed.

void (*bullet)()

Draws a small circle.

bool (*beginCombo)(const char *label, const char *previewValue, ComboFlags flags)

The new beginCombo()/endCombo() api allows you to manage your contents and selection state however you want it.

The old Combo() api are helpers over beginCombo()/endCombo() which are kept available for convenience purpose.

void (*endCombo)()

only call endCombo() if beginCombo() returns true!

bool (*combo)(const char *label, int *currentItem, const char *const *items, int itemCount)

Adds a combo box widget.

Parameters
  • label – The label for the combo box.

  • currentItem – The current (selected) element index.

  • items – The array of items.

  • itemCount – The number of items.

Returns

true if the selected item value has changed, false if not.

bool (*dragFloat)(const char *label, float *v, float vSpeed, float vMin, float vMax, const char *displayFormat, float power)

Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard.

manually input values aren’t clamped, can go off-bounds). If vMin >= vMax we have no bound. For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a ‘float v[X]’ function argument is the same as ‘float* v’, the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x. Speed are per-pixel of mouse movement (vSpeed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(vSpeed, minimum_step_at_given_precision). Defaults: float vSpeed = 1.0f, float vMin = 0.0f, float vMax = 0.0f, const char* displayFormat = “%.3f”, float power = 1.0f)

bool (*dragFloat2)(const char *label, float v[2], float vSpeed, float vMin, float vMax, const char *displayFormat, float power)

Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard.

manually input values aren’t clamped, can go off-bounds) Defaults: float vSpeed = 1.0f, float vMin = 0.0f, float vMax = 0.0f, const char* displayFormat = “%.3f”, float power = 1.0f)

bool (*dragFloat3)(const char *label, float v[3], float vSpeed, float vMin, float vMax, const char *displayFormat, float power)

Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard.

manually input values aren’t clamped, can go off-bounds) Defaults: float vSpeed = 1.0f, float vMin = 0.0f, float vMax = 0.0f, const char* displayFormat = “%.3f”, float power = 1.0f)

bool (*dragFloat4)(const char *label, float v[4], float vSpeed, float vMin, float vMax, const char *displayFormat, float power)

Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard.

manually input values aren’t clamped, can go off-bounds) Defaults: float vSpeed = 1.0f, float vMin = 0.0f, float vMax = 0.0f, const char* displayFormat = “%.3f”, float power = 1.0f)

bool (*dragFloatRange2)(const char *label, float *vCurrentMin, float *vCurrentMax, float vSpeed, float vMin, float vMax, const char *displayFormat, const char *displayFormatMax, float power)

Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: float vSpeed = 1.0f, float vMin = 0.0f, float vMax = 0.0f, const char* displayFormat = “%.3f”, const char* displayFormatMax = NULL, float power = 1.0f

bool (*dragInt)(const char *label, int *v, float vSpeed, int vMin, int vMax, const char *displayFormat)

Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard.

manually input values aren’t clamped, can go off-bounds). If vMin >= vMax we have no bound.. Defaults: float vSpeed = 1.0f, int vMin = 0, int vMax = 0, const char* displayFormat = “%.0f”

bool (*dragInt2)(const char *label, int v[2], float vSpeed, int vMin, int vMax, const char *displayFormat)

Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: float vSpeed = 1.0f, int vMin = 0, int vMax = 0, const char* displayFormat = “%.0f”

bool (*dragInt3)(const char *label, int v[3], float vSpeed, int vMin, int vMax, const char *displayFormat)

Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: float vSpeed = 1.0f, int vMin = 0, int vMax = 0, const char* displayFormat = “%.0f”

bool (*dragInt4)(const char *label, int v[4], float vSpeed, int vMin, int vMax, const char *displayFormat)

Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: float vSpeed = 1.0f, int vMin = 0, int vMax = 0, const char* displayFormat = “%.0f”

bool (*dragIntRange2)(const char *label, int *vCurrentMin, int *vCurrentMax, float vSpeed, int vMin, int vMax, const char *displayFormat, const char *displayFormatMax)

Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: float vSpeed = 1.0f, int vMin = 0, int vMax = 0, const char* displayFormat = “%.0f”, const char* displayFormatMax = NULL

bool (*dragScalar)(const char *label, DataType dataType, void *v, float vSpeed, const void *vMin, const void *vMax, const char *displayFormat, float power)

Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard.

manually input values aren’t clamped, can go off-bounds). If vMin >= vMax we have no bound.. Defaults: float vSpeed = 1.0f, int vMin = 0, int vMax = 0, const char* displayFormat = “%.0f”, power = 1.0f

bool (*dragScalarN)(const char *label, DataType dataType, void *v, int components, float vSpeed, const void *vMin, const void *vMax, const char *displayFormat, float power)

Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard.

manually input values aren’t clamped, can go off-bounds). If vMin >= vMax we have no bound.. Defaults: float vSpeed = 1.0f, int vMin = 0, int vMax = 0, const char* displayFormat = “%.0f”, power = 1.0f

bool (*sliderFloat)(const char *label, float *v, float vMin, float vMax, const char *displayFormat, float power)

Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Adjust displayFormat to decorate the value with a prefix or a suffix for in-slider labels or unit display. Use power!=1.0 for logarithmic sliders . Defaults: const char* displayFormat = “%.3f”, float power = 1.0f

bool (*sliderFloat2)(const char *label, float v[2], float vMin, float vMax, const char *displayFormat, float power)

Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: const char* displayFormat = “%.3f”, float power = 1.0f

bool (*sliderFloat3)(const char *label, float v[3], float vMin, float vMax, const char *displayFormat, float power)

Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: const char* displayFormat = “%.3f”, float power = 1.0f

bool (*sliderFloat4)(const char *label, float v[4], float vMin, float vMax, const char *displayFormat, float power)

Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: const char* displayFormat = “%.3f”, float power = 1.0f

bool (*sliderAngle)(const char *label, float *vRad, float vDegreesMin, float vDegreesMax)

Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: float vDegreesMin = -360.0f, float vDegreesMax = +360.0f

bool (*sliderInt)(const char *label, int *v, int vMin, int vMax, const char *displayFormat)

Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: const char* displayFormat = “%.0f”

bool (*sliderInt2)(const char *label, int v[2], int vMin, int vMax, const char *displayFormat)

Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: const char* displayFormat = “%.0f”

bool (*sliderInt3)(const char *label, int v[3], int vMin, int vMax, const char *displayFormat)

Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: const char* displayFormat = “%.0f”

bool (*sliderInt4)(const char *label, int v[4], int vMin, int vMax, const char *displayFormat)

Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: const char* displayFormat = “%.0f”

bool (*sliderScalar)(const char *label, DataType dataType, void *v, const void *vMin, const void *vMax, const char *displayFormat, float power)

Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: const char* displayFormat = “%.0f”, power = 1.0f

bool (*sliderScalarN)(const char *label, DataType dataType, void *v, int components, const void *vMin, const void *vMax, const char *displayFormat, float power)

Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: const char* displayFormat = “%.0f”, power = 1.0f

bool (*vSliderFloat)(const char *label, const Float2 &size, float *v, float vMin, float vMax, const char *displayFormat, float power)

Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: const char* displayFormat = “%.3f”, float power = 1.0f

bool (*vSliderInt)(const char *label, const Float2 &size, int *v, int vMin, int vMax, const char *displayFormat)

Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: const char* displayFormat = “%.0f”

bool (*vSliderScalar)(const char *label, const Float2 &size, DataType dataType, void *v, const void *vMin, const void *vMax, const char *displayFormat, float power)

Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard.

manually input values aren’t clamped, can go off-bounds). Defaults: const char* displayFormat = “%.0f”, power = 1.0f

bool (*inputText)(const char *label, char *buf, size_t bufSize, InputTextFlags flags, TextEditCallback callback, void *userData)

Widgets: Input with Keyboard.

bool (*inputTextMultiline)(const char *label, char *buf, size_t bufSize, const Float2 &size, InputTextFlags flags, TextEditCallback callback, void *userData)

Widgets: Input with Keyboard.

bool (*inputFloat)(const char *label, float *v, float step, float stepFast, int decimalPrecision, InputTextFlags extraFlags)

Widgets: Input with Keyboard.

Defaults: float step = 0.0f, float stepFast = 0.0f, int decimalPrecision = -1, InputTextFlags extraFlags = 0

bool (*inputFloat2)(const char *label, float v[2], int decimalPrecision, InputTextFlags extraFlags)

Widgets: Input with Keyboard.

Defaults: int decimalPrecision = -1, InputTextFlags extraFlags = 0

bool (*inputFloat3)(const char *label, float v[3], int decimalPrecision, InputTextFlags extraFlags)

Widgets: Input with Keyboard.

Defaults: int decimalPrecision = -1, InputTextFlags extraFlags = 0

bool (*inputFloat4)(const char *label, float v[4], int decimalPrecision, InputTextFlags extraFlags)

Widgets: Input with Keyboard.

Defaults: int decimalPrecision = -1, InputTextFlags extraFlags = 0

bool (*inputInt)(const char *label, int *v, int step, int stepFast, InputTextFlags extraFlags)

Widgets: Input with Keyboard.

Defaults: int step = 1, int stepFast = 100, InputTextFlags extraFlags = 0

bool (*inputInt2)(const char *label, int v[2], InputTextFlags extraFlags)

Widgets: Input with Keyboard.

bool (*inputInt3)(const char *label, int v[3], InputTextFlags extraFlags)

Widgets: Input with Keyboard.

bool (*inputInt4)(const char *label, int v[4], InputTextFlags extraFlags)

Widgets: Input with Keyboard.

bool (*inputDouble)(const char *label, double *v, double step, double stepFast, const char *displayFormat, InputTextFlags extraFlags)

Widgets: Input with Keyboard.

Defaults: double step = 0.0f, double stepFast = 0.0f, const char* displayFormat = “%.6f”, InputTextFlags extraFlags = 0

bool (*inputScalar)(const char *label, DataType dataType, void *v, const void *step, const void *stepFast, const char *displayFormat, InputTextFlags extraFlags)

Widgets: Input with Keyboard.

Defaults: double step = 0.0f, double stepFast = 0.0f, const char* displayFormat = “%.6f”, InputTextFlags extraFlags = 0

bool (*inputScalarN)(const char *label, DataType dataType, void *v, int components, const void *step, const void *stepFast, const char *displayFormat, InputTextFlags extraFlags)

Widgets: Input with Keyboard.

Defaults: double step = 0.0f, double stepFast = 0.0f, const char* displayFormat = “%.6f”, InputTextFlags extraFlags = 0

bool (*colorEdit3)(const char *label, float col[3], ColorEditFlags flags)

Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little colored preview square that can be left-clicked to open a picker, and right-clicked to open an option menu.)

bool (*colorEdit4)(const char *label, float col[4], ColorEditFlags flags)

Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little colored preview square that can be left-clicked to open a picker, and right-clicked to open an option menu.)

bool (*colorPicker3)(const char *label, float col[3], ColorEditFlags flags)

Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little colored preview square that can be left-clicked to open a picker, and right-clicked to open an option menu.)

bool (*colorPicker4)(const char *label, float col[4], ColorEditFlags flags, const float *refCol)

Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little colored preview square that can be left-clicked to open a picker, and right-clicked to open an option menu.)

bool (*colorButton)(const char *descId, const Float4 &col, ColorEditFlags flags, Float2 size)

display a colored square/button, hover for details, return true when pressed.

void (*setColorEditOptions)(ColorEditFlags flags)

initialize current options (generally on application startup) if you want to select a default format, picker type, etc.

User will be able to change many settings, unless you pass the _NoOptions flag to your calls.

bool (*treeNode)(const char *label)

Tree node.

if returning ‘true’ the node is open and the tree id is pushed into the id stack. user is responsible for calling TreePop().

bool (*treeNodeString)(const char *strId, const char *fmt, ...)

Tree node with string id.

read the FAQ about why and how to use ID. to align arbitrary text at the same level as a TreeNode() you can use Bullet().

bool (*treeNodePtr)(const void *ptrId, const char *fmt, ...)

Tree node with ptr id.

bool (*treeNodeEx)(const char *label, TreeNodeFlags flags)

Tree node with flags.

bool (*treeNodeStringEx)(const char *strId, TreeNodeFlags flags, const char *fmt, ...)

Tree node with flags and string id.

bool (*treeNodePtrEx)(const void *ptrId, TreeNodeFlags flags, const char *fmt, ...)

Tree node with flags and ptr id.

void (*treePushString)(const char *strId)

~ Indent()+PushId().

Already called by TreeNode() when returning true, but you can call Push/Pop yourself for layout purpose

void (*treePop)()

~ Unindent()+PopId()

void (*treeAdvanceToLabelPos)()

Advance cursor x position by GetTreeNodeToLabelSpacing()

float (*getTreeNodeToLabelSpacing)()

Horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode.

void (*setNextTreeNodeOpen)(bool isOpen, Condition cond)

Set next TreeNode/CollapsingHeader open state.

bool (*collapsingHeader)(const char *label, TreeNodeFlags flags)

If returning ‘true’ the header is open.

doesn’t indent nor push on ID stack. user doesn’t have to call TreePop().

bool (*collapsingHeaderEx)(const char *label, bool *open, TreeNodeFlags flags)

When ‘open’ isn’t NULL, display an additional small close button on upper right of the header.

bool (*selectable)(const char *label, bool selected, SelectableFlags flags, const Float2 &size)

Selectable.

“bool selected” carry the selection state (read-only). Selectable() is clicked is returns true so you can modify your selection state. size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height.

bool (*selectableEx)(const char *label, bool *selected, SelectableFlags flags, const Float2 &size)

Selectable.

“bool* selected” point to the selection state (read-write), as a convenient helper.

bool (*listBox)(const char *label, int *currentItem, const char *const items[], int itemCount, int heightInItems)

ListBox.

bool (*listBoxEx)(const char *label, int *currentItem, bool (*itemsGetterFn)(void *data, int idx, const char **out_text), void *data, int itemCount, int heightInItems, )

ListBox.

bool (*listBoxHeader)(const char *label, const Float2 &size)

ListBox Header.

use if you want to reimplement ListBox() will custom data or interactions. make sure to call ListBoxFooter() afterwards.

bool (*listBoxHeaderEx)(const char *label, int itemCount, int heightInItems)

ListBox Header.

void (*listBoxFooter)()

Terminate the scrolling region.

void (*plotLines)(const char *label, const float *values, int valuesCount, int valuesOffset, const char *overlayText, float scaleMin, float scaleMax, Float2 graphSize, int stride)

Plot defaults: valuesOffset = 0 overlayText = nullptr scaleMin = FLT_MAX scaleMax = FLT_MAX graphSize = Float2(0,0) stride = sizeof(float)

void (*plotLinesEx)(const char *label, float (*valuesGetterFn)(void *data, int idx), void *data, int valuesCount, int valuesOffset, const char *overlayText, float scaleMin, float scaleMax, Float2 graphSize, )

Plot defaults: valuesOffset = 0 overlayText = nullptr scaleMin = FLT_MAX scaleMax = FLT_MAX graphSize = Float2(0,0)

void (*plotHistogram)(const char *label, const float *values, int valuesCount, int valuesOffset, const char *overlayText, float scaleMin, float scaleMax, Float2 graphSize, int stride)

Histogram defaults: valuesOffset = 0 overlayText = nullptr scaleMin = FLT_MAX scaleMax = FLT_MAX graphSize = Float2(0,0) stride = sizeof(float)

void (*plotHistogramEx)(const char *label, float (*valuesGetterFn)(void *data, int idx), void *data, int valuesCount, int valuesOffset, const char *overlayText, float scaleMin, float scaleMax, Float2 graphSize, )

Histogram defaults: valuesOffset = 0 overlayText = nullptr scaleMin = FLT_MAX scaleMax = FLT_MAX graphSize = Float2(0,0)

void (*valueBool)(const char *prefix, bool b)

Widgets: Value() Helpers.

Output single value in “name: value” format.

void (*valueInt)(const char *prefix, int v)

Widgets: Value() Helpers.

Output single value in “name: value” format.

void (*valueUInt32)(const char *prefix, uint32_t v)

Widgets: Value() Helpers.

Output single value in “name: value” format.

void (*valueFloat)(const char *prefix, float v, const char *floatFormat)

Widgets: Value() Helpers.

Output single value in “name: value” format.

bool (*beginMainMenuBar)()

Create and append to a full screen menu-bar.

void (*endMainMenuBar)()

Only call EndMainMenuBar() if BeginMainMenuBar() returns true!

bool (*beginMenuBar)()

Append to menu-bar of current window (requires WindowFlags_MenuBar flag set on parent window).

void (*endMenuBar)()

Only call EndMenuBar() if BeginMenuBar() returns true!

bool (*beginMenu)(const char *label, bool enabled)

Create a sub-menu entry.

only call EndMenu() if this returns true!

void (*endMenu)()

Only call EndMenu() if BeginMenu() returns true!

bool (*menuItem)(const char *label, const char *shortcut, bool selected, bool enabled)

Return true when activated.

shortcuts are displayed for convenience but not processed by simplegui at the moment

bool (*menuItemEx)(const char *label, const char *shortcut, bool *pSelected, bool enabled)

Return true when activated + toggle (*pSelected) if pSelected != NULL.

void (*setTooltip)(const char *fmt, ...)

Set text tooltip under mouse-cursor, typically use with ISimpleGui::IsItemHovered().

overidde any previous call to SetTooltip().

void (*beginTooltip)()

Begin/append a tooltip window.

to create full-featured tooltip (with any kind of contents).

void (*endTooltip)()

End tooltip.

void (*openPopup)(const char *strId)

Call to mark popup as open (don’t call every frame!).

popups are closed when user click outside, or if CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block. By default, Selectable()/MenuItem() are calling CloseCurrentPopup(). Popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level).

bool (*beginPopup)(const char *strId, WindowFlags flags)

Return true if the popup is open, and you can start outputting to it.

only call EndPopup() if BeginPopup() returns true!

bool (*beginPopupContextItem)(const char *strId, int mouseButton)

Helper to open and begin popup when clicked on last item.

if you can pass a NULL strId only if the previous item had an id. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp!

bool (*beginPopupContextWindow)(const char *strId, int mouseButton, bool alsoOverItems)

Helper to open and begin popup when clicked on current window.

bool (*beginPopupContextVoid)(const char *strId, int mouseButton)

Helper to open and begin popup when clicked in void (where there are no simplegui windows).

bool (*beginPopupModal)(const char *name, bool *open, WindowFlags flags)

Modal dialog (regular window with title bar, block interactions behind the modal window, can’t close the modal window by clicking outside)

void (*endPopup)()

Only call EndPopup() if BeginPopupXXX() returns true!

bool (*openPopupOnItemClick)(const char *strId, int mouseButton)

Helper to open popup when clicked on last item.

return true when just opened.

bool (*isPopupOpen)(const char *strId)

Return true if the popup is open.

void (*closeCurrentPopup)()

Close the popup we have begin-ed into.

clicking on a MenuItem or Selectable automatically close the current popup.

void (*columns)(int count, const char *id, bool border)

Columns.

You can also use SameLine(pos_x) for simplified columns. The columns API is still work-in-progress and rather lacking.

void (*nextColumn)()

Next column, defaults to current row or next row if the current row is finished.

int (*getColumnIndex)()

Get current column index.

float (*getColumnWidth)(int columnIndex)

Get column width (in pixels).

pass -1 to use current column

void (*setColumnWidth)(int columnIndex, float width)

Set column width (in pixels).

pass -1 to use current column

float (*getColumnOffset)(int columnIndex)

Get position of column line (in pixels, from the left side of the contents region).

pass -1 to use current column, otherwise 0..GetColumnsCount() inclusive. column 0 is typically 0.0f

void (*setColumnOffset)(int columnIndex, float offsetX)

Set position of column line (in pixels, from the left side of the contents region).

pass -1 to use current column

int (*getColumnsCount)()

Columnts count.

bool (*beginTabBar)(const char *strId, TabBarFlags flags)

Create and append into a TabBar.

defaults: flags = 0

void (*endTabBar)()

End TabBar.

bool (*beginTabItem)(const char *label, bool *open, TabItemFlags flags)

Create a Tab.

Returns true if the Tab is selected. defaults: open = nullptr flags = 0

void (*endTabItem)()

Only call endTabItem() if beginTabItem() returns true!

void (*setTabItemClosed)(const char *tabOrDockedWindowLabel)

Notify TabBar or Docking system of a closed tab/window ahead (useful to reduce visual flicker on reorderable tab bars).

For tab-bar: call after beginTabBar() and before Tab submissions. Otherwise call with a window name.

void (*dockSpace)(uint32_t id, const Float2 &size, DockNodeFlags flags, const WindowClass *windowClass)

defaults: size = Float2(0, 0), flags = 0, windowClass = nullptr

uint32_t (*dockSpaceOverViewport)(Viewport *viewport, DockNodeFlags dockspaceFlags, const WindowClass *windowClass)

defaults: viewport = nullptr, dockspaceFlags = 0, windowClass = nullptr

void (*setNextWindowDockId)(uint32_t dockId, Condition cond)

Set next window dock id (FIXME-DOCK).

void (*setNextWindowClass)(const WindowClass *windowClass)

Set next window user type (docking filters by same user_type).

uint32_t (*getWindowDockId)()

Get window dock Id.

bool (*isWindowDocked)()

Return is window Docked.

bool (*beginDragDropSource)(DragDropFlags flags)

Call when the current item is active.

If this return true, you can call setDragDropPayload() + endDragDropSource()

bool (*setDragDropPayload)(const char *type, const void *data, size_t size, Condition cond)

Type is a user defined string of maximum 32 characters.

Strings starting with ‘_’ are reserved for simplegui internal types. Data is copied and held by simplegui. Defaults: cond = 0

void (*endDragDropSource)()

Only call endDragDropSource() if beginDragDropSource() returns true!

bool (*beginDragDropTarget)()

Call after submitting an item that may receive a payload.

If this returns true, you can call acceptDragDropPayload() + endDragDropTarget()

const Payload *(*acceptDragDropPayload)(const char *type, DragDropFlags flags)

Accept contents of a given type.

If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released.

void (*endDragDropTarget)()

Only call endDragDropTarget() if beginDragDropTarget() returns true!

const Payload *(*getDragDropPayload)()

Peek directly into the current payload from anywhere.

may return NULL. use ImGuiPayload::IsDataType() to test for the payload type.

void (*pushClipRect)(const Float2 &clipRectMin, const Float2 &clipRectMax, bool intersectWithCurrentClipRect)

Clipping.

void (*popClipRect)()

Clipping.

void (*setItemDefaultFocus)()

Make last item the default focused item of a window.

Please use instead of “if (IsWindowAppearing())

SetScrollHere()” to signify “default item”.

void (*setKeyboardFocusHere)(int offset)

Focus keyboard on the next widget.

Use positive ‘offset’ to access sub components of a multiple component widget. Use -1 to access previous widget.

void (*clearActiveId)()

Clears the active element id in the internal state.

bool (*isItemHovered)(HoveredFlags flags)

Is the last item hovered? (and usable, aka not blocked by a popup, etc.).

See HoveredFlags for more options.

bool (*isItemActive)()

Is the last item active? (e.g.

button being held, text field being edited- items that don’t interact will always return false)

bool (*isItemFocused)()

Is the last item focused for keyboard/gamepad navigation?

bool (*isItemClicked)(int mouseButton)

Is the last item clicked? (e.g.

button/node just clicked on)

bool (*isItemVisible)()

Is the last item visible? (aka not out of sight due to clipping/scrolling.)

bool (*isItemEdited)()

Is the last item visible? (items may be out of sight because of clipping/scrolling)

bool (*isItemDeactivated)()

Was the last item just made inactive (item was previously active).

Useful for Undo/Redo patterns with widgets that requires continuous editing.

bool (*isItemDeactivatedAfterEdit)()

Was the last item just made inactive and made a value change when it was active? (e.g.

Slider/Drag moved).

Useful for Undo/Redo patterns with widgets that requires continuous editing. Note that you may get false positives (some widgets such as Combo()/ListBox()/Selectable() will return true even when clicking an already selected item).

bool (*isItemIdActive)(uint32_t id)

Is specific item active?

Float2 (*getItemRectMin)()

Get bounding rectangle of last item, in screen space.

Float2 (*getItemRectSize)()

Get size of last item, in screen space.

void (*setItemAllowOverlap)()

Allow last item to be overlapped by a subsequent item.

sometimes useful with invisible buttons, selectables, etc. to catch unused area.

bool (*isRectVisible)(const Float2 &size)

Test if rectangle (of given size, starting from cursor position) is visible / not clipped.

bool (*isRectVisibleEx)(const Float2 &rectMin, const Float2 &rectMax)

Test if rectangle (in screen space) is visible / not clipped.

to perform coarse clipping on user’s side.

float (*getTime)()

Time.

int (*getFrameCount)()

Frame Count.

DrawList *(*getOverlayDrawList)()

This draw list will be the last rendered one, useful to quickly draw overlays shapes/text.

void (*calcListClipping)(int itemCount, float itemsHeight, int *outItemsDisplayStart, int *outItemsDisplayEnd)

Calculate coarse clipping for large list of evenly sized items.

Prefer using the ImGuiListClipper higher-level helper if you can.

bool (*beginChildFrame)(uint32_t id, const Float2 &size, WindowFlags flags)

Helper to create a child window / scrolling region that looks like a normal widget frame.

void (*endChildFrame)()

Always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window)

int (*getKeyIndex)(int imguiKey)

Map ImGuiKey_* values into user’s key index.

== io.KeyMap[key]

bool (*isKeyDown)(int userKeyIndex)

Is key being held.

== io.KeysDown[userKeyIndex]. note that simplegui doesn’t know the semantic of each entry of io.KeyDown[]. Use your own indices/enums according to how your backend/engine stored them into KeyDown[]!

bool (*isKeyPressed)(int userKeyIndex, bool repeat)

Was key pressed (went from !Down to Down).

if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate

bool (*isKeyReleased)(int userKeyIndex)

Was key released (went from Down to !Down).

int (*getKeyPressedAmount)(int keyIndex, float repeatDelay, float rate)

Uses provided repeat rate/delay.

return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate

KeyModifiers (*getKeyModifiers)()

Gets the key modifiers for each frame.

Shortcut to bitwise modifier from ImGui::GetIO().KeyCtrl + .KeyShift + .KeyAlt + .KeySuper

Returns

The key modifiers for each frame.

bool (*isMouseDown)(int button)

Is mouse button held.

bool (*isAnyMouseDown)()

Is any mouse button held.

bool (*isMouseClicked)(int button, bool repeat)

Did mouse button clicked (went from !Down to Down)

bool (*isMouseDoubleClicked)(int button)

Did mouse button double-clicked.

a double-click returns false in IsMouseClicked(). uses io.MouseDoubleClickTime.

bool (*isMouseReleased)(int button)

Did mouse button released (went from Down to !Down)

bool (*isMouseDragging)(int button, float lockThreshold)

Is mouse dragging.

if lockThreshold < -1.0f uses io.MouseDraggingThreshold

bool (*isMouseHoveringRect)(const Float2 &rMin, const Float2 &rMax, bool clip)

Is mouse hovering given bounding rect (in screen space).

clipped by current clipping settings. disregarding of consideration of focus/window ordering/blocked by a popup.

Float2 (*getMousePos)()

Shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls.

Float2 (*getMousePosOnOpeningCurrentPopup)()

Retrieve backup of mouse position at the time of opening popup we have BeginPopup() into.

Float2 (*getMouseDragDelta)(int button, float lockThreshold)

Dragging amount since clicking.

if lockThreshold < -1.0f uses io.MouseDraggingThreshold

carb::Float2 (*getMouseWheel)()

Gets the mouse wheel delta for each frame.

Shortcut to ImGui::GetIO().MouseWheel + .MouseWheelH.

Returns

The mouse wheel delta for each frame.

MouseCursor (*getMouseCursor)()

Get desired cursor type, reset in ISimpleGui::newFrame(), this is updated during the frame.

valid before Render(). If you use software rendering by setting io.MouseDrawCursor simplegui will render those for you

void (*setMouseCursor)(MouseCursor type)

Set desired cursor type.

void (*captureKeyboardFromApp)(bool capture)

Manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application to handle).

e.g. force capture keyboard when your widget is being hovered.

void (*captureMouseFromApp)(bool capture)

Manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application to handle).

const char *(*getClipboardText)()

Used to capture text data to the clipboard.

Returns

The text captures from the clipboard

void (*setClipboardText)(const char *text)

Used to apply text into the clipboard.

Parameters

text – The text to be set into the clipboard.

bool (*getWantSaveIniSettings)()

Shortcut to ImGui::GetIO().WantSaveIniSettings provided by user, to be consistent with other calls.

void (*setWantSaveIniSettings)(bool wantSaveIniSettings)

Shortcut to ImGui::GetIO().WantSaveIniSettings provided by user, to be consistent with other calls.

void (*loadIniSettingsFromMemory)(const char *iniData, size_t iniSize)

Manually load the previously saved setting from memory loaded from an .ini settings file.

Parameters
  • iniData – The init data to be loaded.

  • initSize – The size of the ini data to be loaded.

const char *(*saveIniSettingsToMemory)(size_t *iniSize)

Manually save settings to a ini memory as a string.

Parameters

iniSize[out] – The ini size of memory to be saved.

Returns

The memory

Viewport *(*getMainViewport)()

Main viewport.

Same as GetPlatformIO().MainViewport == GetPlatformIO().Viewports[0]

void (*dockBuilderDockWindow)(const char *windowName, uint32_t nodeId)

Associates a windowName to a dock node id.

Parameters
  • windowName – The name of the window.

  • nodeId – The dock node id.

DockNode *(*dockBuilderGetNode)(uint32_t nodeId)

DO NOT HOLD ON ImGuiDockNode* pointer, will be invalided by any split/merge/remove operation.

void (*dockBuilderAddNode)(uint32_t nodeId, DockNodeFlags flags)

Defaults: flags = 0.

void (*dockBuilderRemoveNode)(uint32_t nodeId)

Remove node and all its child, undock all windows.

void (*dockBuilderRemoveNodeDockedWindows)(uint32_t nodeId, bool clearPersistentDockingReferences)

Defaults: clearPersistentDockingReferences = true.

void (*dockBuilderRemoveNodeChildNodes)(uint32_t nodeId)

Remove all split/hierarchy.

All remaining docked windows will be re-docked to the root.

uint32_t (*dockBuilderSplitNode)(uint32_t nodeId, Direction splitDir, float sizeRatioForNodeAtDir, uint32_t *outIdDir, uint32_t *outIdOther)

Dock building split node.

void (*dockBuilderFinish)(uint32_t nodeId)

Dock building finished.

Font *(*addFont)(const FontConfig *fontConfig)

Adds a font from a given font config.

Parameters

fontConfig – The font config struct.

Returns

A valid font, or nullptr if an error occurred.

Font *(*addFontDefault)(const FontConfig *fontConfig)

Adds a default font from a given font config.

Parameters

fontConfig – The font config struct.

Returns

A valid font, or nullptr if an error occurred.

Font *(*addFontFromFileTTF)(const char *filename, float sizePixels, const FontConfig *fontCfg, const Wchar *glyphRanges)

Adds a TTF font from a file.

Parameters
  • filename – The path to the file.

  • sizePixels – The size of the font in pixels.

  • fontCfg – (Optional) The font config struct.

  • glyphRanges – (Optional) The range of glyphs.

Returns

A valid font, or nullptr if an error occurred.

Font *(*addFontFromMemoryTTF)(void *fontData, int fontSize, float sizePixels, const FontConfig *fontCfg, const Wchar *glyphRanges)

Adds a TTF font from a memory region.

Parameters
  • fontData – The font data in memory.

  • fontSize – The number of bytes of the font data in memory.

  • sizePixels – The size of the font in pixels.

  • fontCfg – (Optional) The font config struct.

  • glyphRanges – (Optional) The range of glyphs.

Returns

A valid font, or nullptr if an error occurred.

Font *(*addFontFromMemoryCompressedTTF)(const void *compressedFontData, int compressedFontSize, float sizePixels, const FontConfig *fontCfg, const Wchar *glyphRanges)

Adds a compressed TTF font from a memory region.

Parameters
  • compressedFontData – The font data in memory.

  • compressedFontSize – The number of bytes of the font data in memory.

  • sizePixels – The size of the font in pixels.

  • fontCfg – (Optional) The font config struct.

  • glyphRanges – (Optional) The range of glyphs.

Returns

A valid font, or nullptr if an error occurred.

Font *(*addFontFromMemoryCompressedBase85TTF)(const char *compressedFontDataBase85, float sizePixels, const FontConfig *fontCfg, const Wchar *glyphRanges)

Adds a compressed base-85 TTF font from a memory region.

Parameters
  • compressedFontDataBase85 – The font data in memory.

  • sizePixels – The size of the font in pixels.

  • fontCfg – (Optional) The font config struct.

  • glyphRanges – (Optional) The range of glyphs.

Returns

A valid font, or nullptr if an error occurred.

int (*addFontCustomRectGlyph)(Font *font, Wchar id, int width, int height, float advanceX, const carb::Float2 &offset)

Add a custom rect glyph that can be built into the font atlas.

Call buildFont after.

Parameters
  • font – The font to add to.

  • id – The unicode point to add for.

  • width – The width of the glyph.

  • height – The height of the glyph

  • advanceX – The advance x for the glyph.

  • offset – The glyph offset.

Returns

The glpyh index.

const FontCustomRect *(*getFontCustomRectByIndex)(int index)

Gets the font custom rect by glyph index.

Parameters

index – The glyph index to get the custom rect information for.

Returns

The font glyph custom rect information.

bool (*buildFont)()

Builds the font atlas.

Returns

true if the font atlas was built sucessfully.

bool (*isFontBuilt)()

Determines if changes have been made to font atlas.

Returns

true if the font atlas is built.

void (*getFontTexDataAsAlpha8)(unsigned char **outPixels, int *outWidth, int *outHeight)

Gets the font texture data.

Parameters
  • outPixel – The pixel texture data in A8 format.

  • outWidth – The texture width.

  • outPixel – The texture height.

void (*clearFontInputData)()

Clear input data (all ImFontConfig structures including sizes, TTF data, glyph ranges, etc.) = all the data used to build the texture and fonts.

void (*clearFontTexData)()

Clear output texture data (CPU side).

Saves RAM once the texture has been copied to graphics memory.

void (*clearFonts)()

Clear output font data (glyphs storage, UV coordinates).

void (*clearFontInputOutput)()

Clear all input and output.

const Wchar *(*getFontGlyphRangesDefault)()

Basic Latin, Extended Latin.

const Wchar *(*getFontGlyphRangesKorean)()

Default + Korean characters.

const Wchar *(*getFontGlyphRangesJapanese)()

Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs.

const Wchar *(*getFontGlyphRangesChineseFull)()

Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs.

const Wchar *(*getGlyphRangesChineseSimplifiedCommon)()

Default + Half-Width + Japanese Hiragana/Katakana + set of 2500 CJK Unified Ideographs for common simplified Chinese.

const Wchar *(*getFontGlyphRangesCyrillic)()

Default + about 400 Cyrillic characters.

const Wchar *(*getFontGlyphRangesThai)()

Default + Thai characters.

void (*setFontGlobalScale)(float scale)

set Global Font Scale

void (*addWindowDrawCallback)(DrawCallback callback, void *userData)

Shortcut for getWindowDrawList() + DrawList::AddCallback()

void (*addLine)(DrawList *drawList, const carb::Float2 &a, const carb::Float2 &b, uint32_t col, float thickness)

Adds a line to the draw list.

void (*addRect)(DrawList *drawList, const carb::Float2 &a, const carb::Float2 &b, uint32_t col, float rounding, DrawCornerFlags roundingCornersFlags, float thickness)

Adds a rect to the draw list.

Parameters
  • a – Upper-left.

  • b – Lower-right.

  • col – color.

  • rounding – Default = 0.f;

  • roundingCornersFlags – 4-bits corresponding to which corner to round. Default = kDrawCornerFlagAll

  • thickness – Default = 1.0f

void (*addRectFilled)(DrawList *drawList, const carb::Float2 &a, const carb::Float2 &b, uint32_t col, float rounding, DrawCornerFlags roundingCornersFlags)

Adds a filled rect to the draw list.

Parameters
  • a – Upper-left.

  • b – Lower-right.

  • col – color.

  • rounding – Default = 0.f;

  • roundingCornersFlags – 4-bits corresponding to which corner to round. Default = kDrawCornerFlagAll

void (*addRectFilledMultiColor)(DrawList *drawList, const carb::Float2 &a, const carb::Float2 &b, uint32_t colUprLeft, uint32_t colUprRight, uint32_t colBotRight, uint32_t colBotLeft)

Adds a filled multi-color rect to the draw list.

void (*addQuad)(DrawList *drawList, const carb::Float2 &a, const carb::Float2 &b, const carb::Float2 &c, const carb::Float2 &d, uint32_t col, float thickness)

Adds a quad to the draw list.

Default: thickness = 1.0f.

void (*addQuadFilled)(DrawList *drawList, const carb::Float2 &a, const carb::Float2 &b, const carb::Float2 &c, const carb::Float2 &d, uint32_t col)

Adds a filled quad to the draw list.

void (*addTriangle)(DrawList *drawList, const carb::Float2 &a, const carb::Float2 &b, const carb::Float2 &c, uint32_t col, float thickness)

Adds a triangle to the draw list.

Defaults: thickness = 1.0f.

void (*addTriangleFilled)(DrawList *drawList, const carb::Float2 &a, const carb::Float2 &b, const carb::Float2 &c, uint32_t col)

Adds a filled triangle to the draw list.

void (*addCircle)(DrawList *drawList, const carb::Float2 &centre, float radius, uint32_t col, int32_t numSegments, float thickness)

Adds a circle to the draw list.

Defaults: numSegments = 12, thickness = 1.0f.

void (*addCircleFilled)(DrawList *drawList, const carb::Float2 &centre, float radius, uint32_t col, int32_t numSegments)

Adds a filled circle to the draw list.

Defaults: numSegments = 12, thickness = 1.0f.

void (*addText)(DrawList *drawList, const carb::Float2 &pos, uint32_t col, const char *textBegin, const char *textEnd)

Adds text to the draw list.

void (*addTextEx)(DrawList *drawList, const Font *font, float fontSize, const carb::Float2 &pos, uint32_t col, const char *textBegin, const char *textEnd, float wrapWidth, const carb::Float4 *cpuFineClipRect)

Adds text to the draw list.

Defaults: textEnd = nullptr, wrapWidth = 0.f, cpuFineClipRect = nullptr.

void (*addImage)(DrawList *drawList, TextureId textureId, const carb::Float2 &a, const carb::Float2 &b, const carb::Float2 &uvA, const carb::Float2 &uvB, uint32_t col)

Adds an image to the draw list.

void (*addImageQuad)(DrawList *drawList, TextureId textureId, const carb::Float2 &a, const carb::Float2 &b, const carb::Float2 &c, const carb::Float2 &d, const carb::Float2 &uvA, const carb::Float2 &uvB, const carb::Float2 &uvC, const carb::Float2 &uvD, uint32_t col)

Adds an image quad to the draw list.

defaults: uvA = (0, 0), uvB = (1, 0), uvC = (1, 1), uvD = (0, 1), col = 0xFFFFFFFF.

void (*addImageRounded)(DrawList *drawList, TextureId textureId, const carb::Float2 &a, const carb::Float2 &b, const carb::Float2 &uvA, const carb::Float2 &uvB, uint32_t col, float rounding, DrawCornerFlags roundingCorners)

Adds an rounded image to the draw list.

defaults: roundingCorners = kDrawCornerFlagAll

void (*addPolyline)(DrawList *drawList, const carb::Float2 *points, const int32_t numPoints, uint32_t col, bool closed, float thickness)

Adds a polygon line to the draw list.

void (*addConvexPolyFilled)(DrawList *drawList, const carb::Float2 *points, const int32_t numPoints, uint32_t col)

Adds a filled convex polygon to draw list.

Note: Anti-aliased filling requires points to be in clockwise order.

void (*addBezierCurve)(DrawList *drawList, const carb::Float2 &pos0, const carb::Float2 &cp0, const carb::Float2 &cp1, const carb::Float2 &pos1, uint32_t col, float thickness, int32_t numSegments)

Adds a bezier curve to draw list.

defaults: numSegments = 0.

ListClipper *(*createListClipper)(int32_t itemsCount, float itemsHeight)

Creates a ListClipper to clip large list of items.

Parameters
  • itemsCount – Number of items to clip. Use INT_MAX if you don’t know how many items you have (in which case the cursor won’t be advanced in the final step)

  • float – itemsHeight Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically getTextLineHeightWithSpacing() or getFrameHeightWithSpacing().

Returns

returns the created ListClipper instance.

bool (*stepListClipper)(ListClipper *listClipper)

Call until it returns false.

The displayStart/displayEnd fields will be set and you can process/draw those items.

Parameters

listClipper – The listClipper instance to advance.

void (*destroyListClipper)(ListClipper *listClipper)

Destroys a listClipper instance.

Parameters

listClipper – The listClipper instance to destroy.

bool (*feedKeyboardEvent)(Context *ctx, const input::KeyboardEvent &event)

Feed the keyboard event into the simplegui.

Parameters
  • ctx – The context to be fed input event to.

  • event – Keyboard event description.

bool (*feedMouseEvent)(Context *ctx, const input::MouseEvent &event)

Feed the mouse event into the simplegui.

Parameters
  • ctx – The context to be fed input event to.

  • event – Mouse event description.

Public Static Functions

static inline carb::InterfaceDesc getInterfaceDesc()

Returns

The carb::InterfaceDesc struct with information about this interface.