ImGui

The ImGui Lua wrapper is a package that provides a Lua interface for the popular ImGui module. It allows developers to create in-game user interfaces using the familiar Lua programming language. The wrapper offers a simple and easy-to-use API that mirrors the C++ API of the ImGui module. This package provides a wide range of UI elements and widgets, customizable styling options, and support for multiple languages and internationalization. With this package, developers can easily add robust UI functionality to their games and applications written in Lua. The package also supports advanced layout and positioning options and built-in support for common UI interactions such as drag and drop, and context menus.

Some of the key features include:

  • A wide range of UI elements and widgets

  • Customizable styling options

  • Support for multiple languages and internationalization

  • Advanced layout and positioning options

  • Support for keyboard and mouse input

  • Built-in support for common UI interactions such as drag and drop, and context menus.

Reference

ImGui.setGlobalWindowPadding(x, y)

Sets the global window padding for all windows.

Parameters:
  • x (number) – Padding for the x-axis.

  • y (number) – Padding for the y-axis.

ImGui.setGlobalWindowRounding(r)

Sets the global window rounding for all windows.

Parameters:

r (number) – Rounding value.

ImGui.setGlobalFramePadding(x, y)

Sets the global frame padding for all windows.

Parameters:
  • x (number) – Padding for the x-axis.

  • y (number) – Padding for the y-axis.

ImGui.setGlobalFrameRounding(r)

Sets the global frame rounding for all windows.

Parameters:

r (number) – Rounding value.

ImGui.setGlobalItemSpacing(x, y)

Sets the global item spacing for all windows.

Parameters:
  • x (number) – Spacing for the x-axis.

  • y (number) – Spacing for the y-axis.

ImGui.setGlobalItemInnerSpacing(x, y)

Sets the global item inner spacing for all windows.

Parameters:
  • x (number) – Inner spacing for the x-axis.

  • y (number) – Inner spacing for the y-axis.

ImGui.setGlobalIndentSpacing(value)

Sets the global indent spacing for all windows.

Parameters:

value (number) – Indent spacing value.

ImGui.setGlobalScrollbarSize(value)

Sets the global scrollbar size for all windows.

Parameters:

value (number) – Scrollbar size value.

ImGui.setGlobalScrollbarRounding(value)

Sets the global scrollbar rounding for all windows.

Parameters:

value (number) – The value of the scrollbar rounding.

ImGui.setGlobalGrabMinSize(value)

Sets the global minimum width/height of a grab box for slider/scrollbar for all windows.

Parameters:

value (number) – The value of the minimum grab.

ImGui.setGlobalGrabRounding(value)

Sets the global radius of grabs corners rounding for all windows. Set to 0.0 to have rectangular slider grabs.

Parameters:

value (number) – The value of grabs corners rounding.

ImGui.beginDialog(text, x, y, flags)

Begins a new dialog.

Parameters:
  • text (str) – The title of the dialog.

  • x (number) – The x coordinate of the dialog (optional).

  • y (number) – The y coordinate of the dialog (optional).

  • flags (WindowFlags) – Configuration flags.

ImGui.endDialog()

Ends the current dialog.

ImGui.beginMainMenuBar()

Begins the main menu bar.

Returns:

Return true if the main menu bar is open, otherwise false.

Return type:

boolean

Usage:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if (gui.beginMainMenuBar()) then
    if (gui.beginMenu("File")) then
        if (gui.menuItem("New", "Open New File")) then
            -- new file logic here
        end
        if (gui.menuItem("Open", "Open New File")) then
            -- open file logic here
        end
        if (gui.menuItem("Save", "Save File")) then
            -- save file logic here
        end
        gui.endMenu()
    end
    if (gui.beginMenu("Edit", "Edit File")) then
        if (gui.menuItem("Undo", "Undo Change")) then
            -- undo logic here
       end
       if (gui.menuItem("Redo", "Redo change")) then
           -- redo logic here
       end
       gui.endMenu()
   end
   gui.endMainMenuBar()
end
ImGui.endMainMenuBar()

Ends the current main menu bar.

ImGui.beginMenuBar()

Begins a new menu-bar inside current window.


To be displayed correctly, the dialog parent needs to have the ImGui.WindowFlags.MenuBar flag enabled!.

Returns:

Return true if the menu bar is open, otherwise false.

Return type:

boolean

Usage:

1
2
3
4
5
6
7
if (gui.beginDialog("Dialog Menu Test", 200, 100, gui.WindowFlags.MenuBar)) then
    gui.text("Dialog menu test")
    if (gui.beginMenuBar()) then
        -- add menuItem here, as done in beginMainMenuBar example
    end
    gui.endDialog()
end
ImGui.endMenuBar()

Ends the current menu bar.

ImGui.beginMenu(label)

Begins a new menu.

Parameters:

label (str) – the label of the menu.

Returns:

Return true if the menu is open, otherwise false.

Return type:

boolean

ImGui.endMenu()

Ends the current menu.

ImGui.endChild()

Ends the current child window.

ImGui.beginGroup()

Begins a new group of items.

Usage:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
local gui = require 'engine/imgui'
gui.beginDialog("Basic Group")
gui.beginGroup()
gui.text("Group 1")
gui.button("Button 1")
gui.button("Button 2")
gui.endGroup()
gui.sameLine()
gui.beginGroup()
gui.text("Group 2")
gui.button("Button 3")
gui.button("Button 4")
gui.endGroup()
gui.endDialog()
ImGui.endGroup()

Ends the current group of items.

ImGui.menuItem(mainLabel, secondaryLabel)

Creates a new menu item.

Parameters:
  • mainLabel (str) – The main label of the menu item.

  • secondaryLabel (str) – The secondary label of the menu item.

Returns:

Return true if the menu item is pressed, otherwise false.

Return type:

boolean

ImGui.endTable()

Ends the current table.

ImGui.tableNextRow()

Appends into into the next row of the table.

ImGui.tableNextColumn()

Appends into into the next column of the table.

ImGui.tableNextRow()

Moves to the next row in the table.

ImGui.moveToNextColumn()

Moves to the next column in the table.

ImGui.tableSetCell(label)

Sets a cell in the table.

Parameters:

label (str) – The label of the cell.

ImGui.beginTabBar(label, flags)

Begins a new tab bar.

Parameters:
  • label (str) – The label of the tab bar.

  • flags (TabBarFlags) – Configuration flags.

Returns:

Return true if the tab bar is open, otherwise false.

Return type:

boolean

Usage:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
 local gui = require 'engine/imgui'

gui.beginDialog("MyTabBar")
if(gui.beginTabBar("MyTabBar", gui.TabBarFlags.Reorderable
    + gui.TabBarFlags.AutoSelectNewTabs)) then
    if (gui.beginTabItem("Avocado")) then
    gui.text("This is the Avocado tab!\nblah blah blah blah blah")
    gui.endTabItem()
    end
    if (gui.beginTabItem("Broccoli")) then
    gui.text("This is the Broccoli tab!\nblah blah blah blah blah")
    gui.endTabItem()
    end
    if (gui.beginTabItem("Cucumber")) then
    gui.text("This is the Cucumber tab!\nblah blah blah blah blah")
    gui.endTabItem()
    end
    gui.endTabBar()
end
gui.endDialog()
ImGui.endTabBar()

Ends the current tab bar.

ImGui.beginTabItem(label, flags)

Begins a new tab item.

Parameters:
  • label (str) – The label of the tab item.

  • flags (TabBarFlags) – Configuration flags.

Returns:

Return true if the tab item is open, otherwise false.

Return type:

boolean

ImGui.endTabItem()

Ends the current tab item.

ImGui.beginTooltip()

Begins a new tooltip.

ImGui.endTooltip()

Ends the current tab item.

ImGui.beginPopup(label, flags)

Begins a new popup window.

Parameters:
  • label (str) – The label of the pop up item.

  • flags (PopupFlags) – Configuration flags.

Returns:

Return true if the popup is open, otherwise false.

Return type:

boolean

Usage:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
-- How to create a basic popup
local gui = require 'engine/imgui'
gui.beginDialog("Basic PopUp")
if gui.button("Import asset") then
    gui.openPopup("Test")
end
if (gui.beginPopup("Test")) then
    gui.text("Select a file to open:")
    gui.text("File Path ...")
    if (gui.button("Open")) then
        print("Open a file...")
        -- Open file logic here
    end
    gui.sameLine()
    if (gui.button("Cancel")) then
        gui.closeCurrentPopup()
    end
    gui.endPopup()
end
gui.endDialog()
ImGui.endPopup()

Ends the current popup window.

ImGui.openPopup()

Opens a popup window identified by the label.

ImGui.closeCurrentPopup()

Closes the current popup window.

ImGui.beginPopupModal(label, flags)

Begins a new modal popup window.

Parameters:
  • label (str) – The label of the pop up modal item.

  • flags (PopupFlags) – Configuration flags.

Returns:

Return true if the popup is open, otherwise false.

Return type:

boolean

ImGui.text(text)

Displays text to the current window.

Parameters:

text (str) – The text to be displayed.

ImGui.textColored(text, color)

Displays text to the current window with a given color.

Parameters:
  • text (str) – the text to be displayed.

  • color (WidgetColor) – An instance of WidgetColor.

ImGui.textWrapped(text)

Displays wrapped text to the current window

Parameters:

text (str) – The text to be displayed.

ImGui.inputText(label, widgetString, flags)

Creates a text input widget.

Parameters:
  • label (str) – the label to add to the input widget.

  • widgetString (WidgetString) – An intance of WidgetString to interact with the inputText widget.

  • flags (InputTextFlags) – The flags to be used for the input label (optional).

Usage:

1
2
3
local gui = require 'engine/imgui'
widgetString = gui.WidgetString:new(32, "")
gui.inputText("your name", widgetString)
ImGui.inputNumber(label, widgetNumber, flags)

Creates a number input widget.

Parameters:
  • label (str) – the label to add to the input widget.

  • widgetNumber (WidgetNumber) – An intance of WidgetString to interact with the inputNumber widget.

  • flags (InputTextFlags) – The flags to be used for the input label (optional). They are the same for InputText.

Usage:

1
2
3
local gui = require 'engine/imgui'
widgetNumber = gui.WidgetNumber:new(42)
gui.inputNumber("Answer to The Ultimate Question of Life", widgetNumber)
ImGui.bulletText(text)

Creates a bullet point with accompanying text.

Parameters:

text (str) – The text to display next to the bullet point.

ImGui.progressBar(status)

Creates a new progress bar.

Parameters:

status (number) – Progress status (0.0f to 1.0f) to represent in the progress bar.

ImGui.sliderFloat(label, number, minValue, maxValue, format, flags)

Creates a new float slider.

Parameters:
  • label (str) – the label to add to the slider.

  • number (WidgetNumber) – The widgetNumber to use as storage.

  • minValue (number) – the minimum value for the slider.

  • maxValue (number) – the maximum value for the slider.

  • format (str) – format of the string in the slider. The default if omitted is “%f”.

  • flags (SliderFlags) – The flags to be used for the slider (optional).

ImGui.sliderInt(label, number, minValue, maxValue, format, flags)

Creates a new integer slider.

Parameters:
  • label (str) – The label to add to the slider.

  • number (WidgetNumber) – The widgetNumber to use as storage.

  • minValue (number) – The minimum value for the slider.

  • maxValue (number) – The maximum value for the slider.

  • format (str) – The format of the string in the slider. The default if omitted is “%d”.

  • flags (SliderFlags) – The flags to be used for the slider (optional).

ImGui.sliderVector3(label, widgetVector3, minValue, maxValue, format, flags)

Creates a set of three sliders for manipulating a vector3 object.

Parameters:
  • label (str) – The label to display next to the sliders.

  • widgetVector3 (WidgetVector3) – The vector3 widget object.

  • minValue (number) – The minimum value for the slider.

  • maxValue (number) – The maximum value for the slider.

  • format (str) – The format of the string in the slider. The default if omitted is “%f”.

  • flags (SliderFlags) – The flags to be used for the slider (optional).

ImGui.button(text, width, height)

Creates a new button.

Parameters:
  • text (str) – The text to be displayed on the button.

  • width (number) – The width of the button (optional).

  • height (number) – The height of the button (optional).

Returns:

Returns true if the button was clicked, otherwise false.

Return type:

boolean

ImGui.logButtons()

Logs button events in the ImGui interface.

ImGui.logToClipboard()

Logs the current ImGui interface to the clipboard. Useful for debugging.

ImGui.logFinish()

Stops logging events in the ImGui interface.

ImGui.logText(text)

Logs a text in the ImGui interface.

Parameters:

text (str) – the text to log

ImGui.separator()

Adds an horizontal separator between items.

ImGui.spacing()

Adds horizontal spacing between items.

ImGui.sameLine()

The next item will be created on the same line.

ImGui.selectable(text, flags)

Creates a selectable item.

Parameters:
  • text (str) – Text in the selectable item.

  • flags (SelectableFlags) – Configuration flags.

ImGui.checkbox(label, number)

Creates a new checkbox.

Parameters:
  • label (str) – The label of the checkbox.

  • number (WidgetNumber) – The widgetNumber to use as storage.

ImGui.checkboxFlags(label, flags)

Creates a new checkbox to enable/disable flags.

Parameters:
  • label (str) – The label of the checkbox.

  • flags (ConfigFlags) – Configuration flags.

ImGui.combo(label, number, items)

Creates a combo box with a list of items to choose from.


are indexed from 0 and arrays in Lua are indexed from 1. You will need to offset the arrays.

Parameters:
  • label (str) – The label of the combo box.

  • number (WidgetNumber) – The widgetNumber to use as storage. Note that arrays in ImGUI

  • items (array) – An array of strings to use as options.

ImGui.collapsingHeader(label)

Creates a collapsing header with a given label.

Parameters:

label (str) – The label of the header.

Returns:

Return true if the header is open, false if it is closed.

Return type:

boolean

ImGui.treeNode(label)

Creates a tree node.

Parameters:

label (str) – The label of the tree node.

Returns:

A boolean indicating whether the tree node is open.

Return type:

boolean

ImGui.treePop()

Ends the current tree node.


Called after treeNode(), it ends a tree node and automatically pops it from the ImGui tree structure.

ImGui.treePush(label)

Add a tree node to the GUI with the given label.

Parameters:

label (str) – The label to display on the tree node.

ImGui.colorEdit(label, color, flag)

Creates a color edit. Similar to @see colorPicker.

Parameters:
  • label (str) – The label of the color picker.

  • color (WidgetColor) – An instance of WidgetColor.

  • flag (ColorEditFlags) – User given flags to change the behaviour of the widget.

ImGui.setNextWindowPos(x, y)

Sets the position of the next window.

Parameters:
  • x (number) – The x-coordinate of the window position.

  • y (number) – The y-coordinate of the window position.

ImGui.setNextWindowSize(x, y)

Sets the size of the next window.

Parameters:
  • x (number) – Width of the window.

  • y (number) – Height of the window.

ImGui.setNextWindowContentSize(x, y)

Sets the content size of the ColorEditFlagsnext window.

Parameters:
  • x (number) – Width of the window content

  • y (number) – Height of the window content

ImGui.setNextWindowSizeConstraints(x, y)

Sets the size constraints of the next window.

Parameters:
  • x (number) – Minimum width of the window.

  • y (number) – Minimum height of the window.

ImGui.setNextWindowCollapsed(collapsed)

Sets the collapsed state of the next window.

Parameters:

collapsed (boolean) – Whether the window should be collapsed or not.

ImGui.setNextWindowFocus(focused)

Sets the focus state of the next window.

Parameters:

focused (boolean) – Whether the window should be focused or not.

ImGui.setNextWindowBgAlpha(alpha)

Sets the background alpha value of the next window.

Parameters:

alpha (number) – The alpha value of the background, between 0 and 1.

ImGui.isItemHovered()

Determines if the current item is hovered by the mouse cursor.

Returns:

True if the current item is being hovered by the mouse cursor, false otherwise.

Return type:

boolean

ImGui.isItemClicked()

Determines if the current item has been clicked.

Returns:

True if the current item has been clicked, false otherwise.

Return type:

boolean

ImGui.isItemToggledOpen()

Determines if the current item is open.

Returns:

True if the current item is toggled open, false otherwise.

Return type:

boolean

Usage:

1
2
3
4
5
6
if ImGui.treeNode("My Tree Node") then
    if ImGui.isItemToggledOpen() then
        ImGui.text("Extra information")
    end
    ImGui.treePop()
end
ImGui.isMouseClicked(event)

Returns true if the mouse was clicked on the given event.

Parameters:

event (MouseButton) – The event for which to check for a mouse click.

ImGui.setMouseCursor(cursor)

Sets the mouse cursor to the given cursor type.

Parameters:

cursor (MouseCursor) – The cursor type to set.

class ImGui.WidgetString

A class to internally store strings to be used in the Lumino environment.

new(length, initialValue)

Creates a new WidgetString object with the given length and initial value.

Parameters:
  • length (number) – The lenght (in btyes) of the buffer where the string is stored.

  • initialValue (str) – The intial value of the string.

getValue()

Retrieves the value stored inside an instance of WidgetString.

Returns:

The string stored inside the instance of WidgetString.

Return type:

str

class ImGui.WidgetNumber

A class to internally store numbers to be used in the Lumino Lua environment.

new(initialValue)

Creates a new WidgetNumber object with the given initial value

Parameters:

initialValue (number) – The initial value stored internally.

getValue()

Retrieves the value stored inside an instance of WidgetNumber.

Returns:

The value interally stored inside the widget number.

Return type:

number

setValue(value)

Sets a new internal value to an instance of WidgetNumber.

Parameters:

value (number) – The value to set the widget number to.

class ImGui.WidgetVector3

A class to internally store a 3D vector to be used in the Lumino Lua environment.

new(x, y, z)

Creates a new WidgetVector3 object with the given initial values for x, y, z.

Parameters:
  • x (number) – The initial x component value.

  • y (number) – The initial y component value.

  • z (number) – The initial z component value.

Returns:

A new WidgetVector3 instance.

Return type:

WidgetVector3

getValue()

Retrieves the vector components stored inside an instance of WidgetVector3.

Returns:

The x, y, z components stored in the widget.

Return type:

number or number or number

setValue(x, y, z)

Sets new internal values for the x, y, z components of an instance of WidgetVector3.

Parameters:
  • x (number) – The x component to set.

  • y (number) – The y component to set.

  • z (number) – The z component to set.

class ImGui.WidgetColor

A class to internally link numbers to be used in the Dear ImGui api from the Lumino codebase to Lua environment.

new(r, g, b, a)

Creates a new WidgetColor object with the given RGBA values. The RGBA values range from 0 to 1.

Parameters:
  • r (number) – The red color component channel.

  • g (number) – The green color component channel.

  • b (number) – The blue color component channel.

  • a (number) – The alpha color component channel.

Returns:

A new WidgetColor instance.

Return type:

WidgetColor

getValue()

Retrieves the RGBA components stored inside an instance of WidgetColor. The RGBA values range from 0 to 1.

Returns:

The r, g, b, a components stored in the widget.

Return type:

number or number or number or number

setValue(r, g, b, a)

Sets new internal values for the r, g, b, a components of an instance of WidgetColor. The RGBA values range from 0 to 1.

Parameters:
  • r (number) – The r component to set.

  • g (number) – The g component to set.

  • b (number) – The b component to set.

  • a (number) – The a component to set.

class ImGui.ImGui
class ImGui.BackendFlags

Enumeration of the available backend flags.

Name

Description

None

No flag set.

HasGamepad

Backend platform supports gamepad and currently has one connected.

HasMouseCursors

Backend platform supports honoring GetMouseCursor() value to change the OS cursor shape.

HasSetMousePos

Backend platform supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set).

RendererHasVtxOffset

Backend renderer supports ImDrawCmd::VtxOffset. This enables output of large meshes (64K+ vertices) while still using 16-bit indices.

class ImGui.ConfigFlags

Enumeration of the available configuration flags.

Name

Description

None

No flag set.

NavEnableKeyboard

Enable keyboard controls.

NavEnableGamepad

Enable gamepad controls.

NavEnableSetMousePos

Enable mouse repositioning requests with io.WantSetMousePos.

NavNoCaptureKeyboard

Disable keyboard capture by ImGui.

NoMouse

Disable mouse controls.

NoMouseCursorChange

Disable mouse cursor change requests.

IsSRGB

Enable sRGB gamma correction.

IsTouchScreen

Enable touch screen controls.

class ImGui.WindowFlags

Enumeration of the available window flags.

Name

Description

None

No flag set.

NoTitleBar

Window doesn’t have a title bar.

NoResize

Window can’t be resized.

NoMove

Window can’t be moved.

NoScrollbar

Window has no scrollbar.

NoScrollWithMouse

Window scrollbar doesn’t respond to mouse scrolling.

NoCollapse

Window can’t be collapsed.

AlwaysAutoResize

Window should resize to its content every frame.

ShowBorders

Window has borders.

NoSavedSettings

Never save settings (inodependent of ImGuiConfigFlags_NoSaveSettings).

NoMouseInputs

Window will not receive mouse inputs.

MenuBar

Window has a menu-bar.

HorizontalScrollbar

Window has a horizontal scrollbar.

NoFocusOnAppearing

Window doesn’t take focus when first appearing.

NoBringToFrontOnFocus

Window doesn’t bring to front when taking focus.

AlwaysVerticalScrollbar

Window has a vertical scrollbar.

AlwaysHorizontalScrollbar

Window has a horizontal scrollbar.

AlwaysUseWindowPadding

Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient).

NoNavInputs

No gamepad/keyboard navigation within the window.

NoNavFocus

No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB).

UnsavedDocument

Display a dot next to the title. When used in a tab/docking context, tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.

NoNav

No gamepad/keyboard navigation within the window and no focusing toward this window with gamepad/keyboard navigation.

NoDecoration

Disable title-bar, resizing borders, and scrollbar.

NoInputs

Window is completely sealed and won’t receive inputs.

class ImGui.TabBarFlags

Enumeration of available tab bar flags.

Name

Description

None

No flags.

Reorderable

Allow manually dragging tabs to re-order them + New tabs are appended at the end of list.

AutoSelectNewTabs

Automatically select new tabs when they appear.

TabListPopupButton

Disable buttons to open the tab list popup.

NoCloseWithMiddleMouseButton

Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button.

NoTabListScrollingButtons

Disable scrolling buttons (apply when fitting policy is ImGuiTabBarFlags_FittingPolicyScroll).

NoTooltip

Disable tooltips when hovering a tab.

FittingPolicyResizeDown

Resize tabs when they don’t fit.

FittingPolicyScroll

Add scroll buttons when tabs don’t fit.

FittingPolicyMask

Fitting policy mask (defaults to ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_FittingPolicyScroll).

FittingPolicyDefault

Fitting policy when there are no tabs.

class ImGui.PopupFlags

Enumeration of available popup flags.

Name

Description

None

No flag set.

MouseButtonLeft

Open on Left Mouse release.

MouseButtonRight

Open on Right Mouse release.

MouseButtonMiddle

Open on Middle Mouse release.

MouseButtonMask

Bit mask for buttons.

MouseButtonDefault

Open on MouseButtonRight Mouse release (default).

NoOpenOverExistingPopup

Don’t open if there’s already a popup at the same level of the popup stack.

NoOpenOverItems

Don’t return true when hovering items, only when hovering empty space.

AnyPopupId

Ignore the ImGuiID parameter and test for any popup.

AnyPopupLevel

Search/test at any level of the popup stack.

class ImGui.InputTextFlags

Enumeration for input text flags.

Name

Description

None

No flags.

CharsDecimal

Allow decimals and operators (0123456789.+-/).

CharsHexadecimal

Allow decimals, operators ad letters (0123456789ABCDEFabcdef).

CharsUppercase

Turn lowercase letters into uppercase.

CharsNoBlank

Filter out spaces, tabs.

AutoSelectAll

Select entire text when first taking mouse focus.

EnterReturnsTrue

Return ‘true’ when Enter is pressed (as opposed to every time the value was modified).

CallbackCompletion

Callback on pressing TAB (for completion handling).

CallbackHistory

Callback on pressing Up/Down arrows (for history handling).

CallbackAlways

Callback on each iteration. User code may query cursor position, modify text buffer.

CallbackCharFilter

Callback on character inputs to replace or discard them. Modify ‘EventChar’ to replace or discard, or return 1 in callback to discard.

AllowTabInput

Pressing TAB input a ‘t’ character into the text field.

CtrlEnterForNewLine

In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite unfocus with Ctrl+Enter, add line with Enter).

NoHorizontalScroll

Disable following the cursor horizontally.

AlwaysOverwrite

Overwrite mode.

ReadOnly

Read-only mode.

Password

Password mode, display all characters as ‘’.

NoUndoRedo

Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().

CharsScientific

Allow scientific notation input (0123456789.+-*/eE).

CallbackResize

Callback on buffer capacity changes request (beyond ‘buf_size’ parameter value), allowing the string to grow.

CallbackEdit

Callback on any edit.

EscapeClearsAll

Clears the input when Escape key is pressed.

class ImGui.SliderFlags

Enumeration for slider flags

Name

Description

None

No flag set.

AlwaysClamp

Clamp value to min/max bounds when input manually with CTRL+Click. By default CTRL+Click allows going out of bounds.

Logarithmic

Make the widget logarithmic (linear otherwise). Consider using ImGuiSliderFlags_NoRoundToFormat with this if using a format-string with small amount of digits.

NoRoundToFormat

Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits).

NoInput

Disable CTRL+Click or Enter key allowing to input text directly into the widget.

class ImGui.SelectableFlags

Enum for selectable flags

Name

Description

None

No flag set.

DontClosePopups

Clicking this doesn’t close parent popup window.

SpanAllColumns

Selectable frame can span all columns (text will still fit in current column).

AllowDoubleClick

Generate press events on double clicks too.

Disabled

Cannot be selected, display grayed out text.

AllowItemOverlap

(WIP) Hit testing to allow subsequent widgets to overlap this one.

class ImGui.ColorEditFlags

Enumeration of flags for the color editing widgets.

Name

Description

None

No flag set.

NoAlpha

ColorEdit, ColorPicker, ColorButton: ignore Alpha component (will only read 3 components from the input pointer).

NoPicker

ColorEdit: disable picker when clicking on color square.

NoOptions

ColorEdit: disable toggling options menu when right-clicking on inputs/small preview.

NoSmallPreview

ColorEdit, ColorPicker: disable color square preview next to the inputs. (e.g. to show only the inputs)

NoInputs

ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview color square).

NoTooltip

ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview.

NoLabel

ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker).

NoSidePreview

ColorPicker: disable bigger color preview on right side of the picker, use small color square preview instead.

NoDragDrop

ColorEdit: disable drag and drop target. ColorButton: disable drag and drop source.

NoBorder

ColorButton: disable border (which is enforced by default)

AlphaBar

ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker.

AlphaPreview

ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque.

AlphaPreviewHalf

ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque.

HDR

ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well).

DisplayRGB

ColorEdit: override display type among RGB.

DisplayHSV

ColorEdit: override display type among HSV.

DisplayHex

ColorEdit: override display type among Hex.

Uint8

Display values formatted as 0..255.

Float

Display values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers.

PickerHueBar

Display a bar for Hue and rectangle for Sat/Value.

PickerHueWheel

Display a wheel for Hue and triangle for Sat/Value.

InputRGB

Input and output data in RGB format.

InputHSV

Input and output data in HSV format.

class ImGui.MouseButton

Enumeration for mouse button events.

Name

Description

Left

Index for the left mouse button.

Right

Index for the right mouse button.

Middle

Index for the middle mouse button.

COUNT

The number of mouse buttons.

class ImGui.MouseCursor

Enumeration of mouse cursor types for use with SetMouseCursor().

Name

Description

None

No cursor.

Arrow

Arrow cursor.

TextInput

Text input I-beam cursor.

ResizeAll

(Unused by Dear ImGui functions).

ResizeNS

Vertical resize cursor.

ResizeEW

Horizontal resize cursor.

ResizeNESW

Cursor for resizing bottom-left corner of window.

ResizeNWSE

Cursor for resizing bottom-right corner of window.

Hand

Sets mouse cursor to hand.

NotAllowed

Cursor for disallowed interaction (usually a crossed circle).

COUNT

Number of cursor types.

Examples