API Reference

CImGui.AcceptDragDropPayloadFunction
AcceptDragDropPayload(type, flags=ImGuiDragDropFlags_(0)) -> Ptr{ImGuiPayload}
BETA API

Missing Demo code. API may evolve.

CImGui.AddBezierCubicFunction
AddBezierCubic(handle::Ptr{ImDrawList}, pos0, cp0, cp1, pos1, col, thickness, num_segments=0)
CImGui.AddCallbackMethod
AddCallback(handle::Ptr{ImDrawList}, callback, callback_data)

Your rendering function must check for UserCallback in ImDrawCmd and call the function instead of rendering triangles.

CImGui.AddCircleFunction
AddCircle(handle::Ptr{ImDrawList}, centre, radius, col, num_segments=12, thickness=1.0)
CImGui.AddCircleFilledFunction
AddCircleFilled(handle::Ptr{ImDrawList}, centre, radius, col, num_segments=12)
CImGui.AddConvexPolyFilledMethod
AddConvexPolyFilled(handle::Ptr{ImDrawList}, points, num_points, col)
Note

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

CImGui.AddDrawCmdMethod
AddDrawCmd(handle::Ptr{ImDrawList})

This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible.

CImGui.AddFontMethod
AddFont(self::Ptr{ImFontAtlas}, font_cfg) -> Ptr{ImFont}
CImGui.AddFontFromFileTTFFunction
AddFontFromFileTTF(self::Ptr{ImFontAtlas}, filename, size_pixels, font_cfg=C_NULL, glyph_ranges=C_NULL) -> Ptr{ImFont}
CImGui.AddFontFromMemoryCompressedBase85TTFFunction
AddFontFromMemoryCompressedBase85TTF(self::Ptr{ImFontAtlas}, compressed_font_data_base85, size_pixels, font_cfg=C_NULL, glyph_ranges=C_NULL) -> Ptr{ImFont}

'compressedfontdata_base85' still owned by caller.

CImGui.AddFontFromMemoryCompressedTTFFunction
AddFontFromMemoryCompressedTTF(self::Ptr{ImFontAtlas}, compressed_font_data, compressed_font_size, size_pixels, font_cfg=C_NULL, glyph_ranges=C_NULL) -> Ptr{ImFont}

'compressedfontdata' still owned by caller.

CImGui.AddFontFromMemoryTTFFunction
AddFontFromMemoryTTF(self::Ptr{ImFontAtlas}, font_data, font_size, size_pixels, font_cfg=C_NULL, glyph_ranges=C_NULL) -> Ptr{ImFont}
Note

Transfer ownership of 'ttfdata' to ImFontAtlas! Will be deleted after destruction of the atlas. Set `fontcfg.FontDataOwnedByAtlas=false` to keep ownership of your data and it won't be freed.

CImGui.AddImageFunction
AddImage(handle::Ptr{ImDrawList}, user_texture_id, a, b, uv_a=(0,0), uv_b=(1,1), col=0xffffffff)
CImGui.AddImageQuadFunction
AddImageQuad(handle::Ptr{ImDrawList}, user_texture_id, a, b, c, d, uv_a=(0,0), uv_b=(1,0), uv_c=(1,1), uv_d=(0,1), col=0xffffffff)
CImGui.AddImageRoundedFunction
AddImageRounded(handle::Ptr{ImDrawList}, user_texture_id, a, b, uv_a, uv_b, col, rounding, rounding_corners=ImDrawFlags_All)
CImGui.AddInputCharactersUTF8Method
AddInputCharactersUTF8(io::Ptr{ImGuiIO}, utf8_chars)

Add new characters into InputCharacters[] from an UTF-8 string.

CImGui.AddLineFunction
AddLine(handle::Ptr{ImDrawList}, a, b, col, thickness=1.0)
CImGui.AddPolylineMethod
AddPolyline(handle::Ptr{ImDrawList}, points, num_points, col, closed, thickness)
CImGui.AddQuadFunction
AddQuad(handle::Ptr{ImDrawList}, a, b, c, d, col, thickness=1.0)
CImGui.AddRectFunction
AddRect(handle::Ptr{ImDrawList}, a, b, col, rounding=0.0, rounding_corners_flags=ImDrawFlags_RoundCornersAll, thickness=1.0)

Arguments

  • a: upper-left
  • b: lower-right
  • rounding_corners_flags: 4-bits corresponding to which corner to round
CImGui.AddRectFilledFunction
AddRectFilled(handle::Ptr{ImDrawList}, a, b, col, rounding=0.0, rounding_corners_flags=ImDrawFlags_RoundCornersAll)

Arguments

  • a: upper-left
  • b: lower-right
CImGui.AddRectFilledMultiColorMethod
AddRectFilledMultiColor(handle::Ptr{ImDrawList}, a, b, col_upr_left, col_upr_right, col_bot_right, col_bot_left)
CImGui.AddTextFunction
AddText(handle::Ptr{ImDrawList}, pos, col, text_begin, text_end=C_NULL)
CImGui.AddTextFunction
AddText(handle::Ptr{ImDrawList}, font::Ptr{ImFont}, font_size, pos, col, text_begin, text_end=C_NULL, wrap_width=0.0, cpu_fine_clip_rect=C_NULL)
CImGui.AddTriangleFunction
AddTriangle(handle::Ptr{ImDrawList}, a, b, c, col, thickness=1.0)
CImGui.AlignTextToFramePaddingMethod
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).

CImGui.AppendFunction
Append(handle::Ptr{ImGuiTextBuffer}, str, str_end=C_NULL)

Text buffer for logging/accumulating text.

CImGui.ArrowButtonMethod
ArrowButton(str_id, dir) -> Bool

Return true when the value has been changed or when pressed/selected. Create a square button with an arrow shape.

CImGui.BeginFunction
Begin(name, p_open=C_NULL, flags=0) -> Bool

Push window to the stack and start appending to it.

Usage

  • you may append multiple times to the same window during the same frame.
  • passing p_open != C_NULL shows a window-closing widget in the upper-right corner of the window, which clicking will set the boolean to false when clicked.
  • Begin return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window.
Note

Always call a matching End for each Begin call, regardless of its return value. This is due to legacy reason and is inconsistent with most other functions (such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc.) where the EndXXX call should only be called if the corresponding BeginXXX function returned true.

CImGui.BeginFunction
Begin(handle::Ptr{ImGuiListClipper}, items_count, items_height=-1.0)

Automatically called by constructor if you passed items_count or by Step in Step 1.

CImGui.BeginMethod
Begin(handle::Ptr{ImGuiTextBuffer}) -> Cstring
CImGui.BeginChildFunction
BeginChild(str_id, size=(0,0), border=false, flags=0) -> Bool
BeginChild(id::Integer, size=(0,0), border=false, flags=0) -> Bool

Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window. Child windows can embed their own child.

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

For each independent axis of size:

  • x == 0.0: use remaining host window size
  • x > 0.0: fixed size
  • x < 0.0: use remaining window size minus abs(size)

Each axis can use a different mode, e.g. ImVec2(0,400).

Note

Always call a matching EndChild for each BeginChild call, regardless of its return value. This is due to legacy reason and is inconsistent with most other functions (such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc.) where the EndXXX call should only be called if the corresponding BeginXXX function returned true.

CImGui.BeginChildFrameFunction
BeginChildFrame(id, size, flags=0) -> Bool

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

CImGui.BeginGroupMethod
BeginGroup()

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

CImGui.BeginListBoxFunction
BeginListBox(label, size=(0,0))

Use if you want to reimplement ListBox will custom data or interactions. If the function return true, you can output elements then call EndListBox afterwards.

CImGui.BeginMenuFunction
BeginMenu(label, enabled=true) -> Bool

Create a sub-menu entry. only call EndMenu() if this returns true!

CImGui.BeginMenuBarMethod
BeginMenuBar() -> Bool

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

CImGui.BeginPopupFunction
BeginPopup(str_id, flags=0) -> Bool

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

Note

Only call EndPopup if BeginPopup returns true!

CImGui.BeginPopupContextItemFunction
BeginPopupContextItem(str_id=C_NULL, flags=1) -> Bool

Helper to open and begin popup when clicked on last item. if you can pass a CNULL 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.

CImGui.BeginPopupContextVoidFunction
BeginPopupContextVoid(str_id=C_NULL, popup_flags=1) -> Bool

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

CImGui.BeginPopupContextWindowFunction
BeginPopupContextWindow(str_id=C_NULL, popup_flags=1) -> Bool

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

CImGui.BeginPopupModalFunction
BeginPopupModal(name, p_open=C_NULL, flags=0) -> Bool

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

CImGui.BeginTabBarFunction
igBeginTabBar(str_id, flags=ImGuiTabBarFlags_(0)) -> Bool

Create and append into a TabBar.

BETA API

API may evolve!

CImGui.BeginTabItemFunction
BeginTabItem(label, p_open=C_NULL, flags=ImGuiTabItemFlags_(0)) -> Bool
BETA API

API may evolve!

CImGui.BeginTableFunction
BeginTable(str_id, columns_count, flags = ImGuiTableFlags_(0), outer_size = ImVec2(0,0), inner_width = 0.0) -> Bool

Begin a table entry.

CImGui.BeginTooltipMethod
BeginTooltip()

Begin/append a tooltip window to create full-featured tooltip (with any kind of items).

CImGui.BuildMethod
Build(self::Ptr{ImFontAtlas}) -> Bool

Build pixels data. This is called automatically for you by the GetTexData*** functions.

CImGui.BulletMethod
Bullet()

Draw a small circle and keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses

CImGui.BulletTextMethod
BulletText(formatted_text)

Shortcut for Bullet+Text.

Limited support

Formatting is not supported which means you need to pass a formatted string to this function. It's recommended to use Julia stdlib Printf's @sprintf as a workaround when translating C/C++ code to Julia.

CImGui.ButtonFunction
Button(label) -> Bool
Button(label, size) -> Bool

Return true when the value has been changed or when pressed/selected.

CImGui.C_strMethod
C_str(handle::Ptr{ImGuiTextBuffer}) -> Cstring
CImGui.CalcItemWidthMethod
CalcItemWidth() -> Cfloat

Return width of item given pushed settings and current cursor position.

CImGui.CalcTextSizeFunction
CalcTextSize(text, text_end=C_NULL, hide_text_after_double_hash=false, wrap_width=-1) -> ImVec2
CImGui.ChannelsMergeMethod
ChannelsMerge(handle::Ptr{ImDrawList})
Tip
  • Use to simulate layers. By switching channels to can render out-of-order (e.g. submit foreground primitives before background primitives)
  • Use to minimize draw calls (e.g. if going back-and-forth between multiple non-overlapping clipping rectangles, prefer to append into separate channels then merge at the end)
CImGui.ChannelsSetCurrentMethod
ChannelsSetCurrent(handle::Ptr{ImDrawList}, channel_index)
Tip
  • Use to simulate layers. By switching channels to can render out-of-order (e.g. submit foreground primitives before background primitives)
  • Use to minimize draw calls (e.g. if going back-and-forth between multiple non-overlapping clipping rectangles, prefer to append into separate channels then merge at the end)
CImGui.ChannelsSplitMethod
ChannelsSplit(handle::Ptr{ImDrawList}, channels_count)
Tip
  • Use to simulate layers. By switching channels to can render out-of-order (e.g. submit foreground primitives before background primitives)
  • Use to minimize draw calls (e.g. if going back-and-forth between multiple non-overlapping clipping rectangles, prefer to append into separate channels then merge at the end)
CImGui.CheckboxMethod
Checkbox(label, v) -> Bool

Return true when the value has been changed or when pressed/selected.

CImGui.CheckboxFlagsMethod
CheckboxFlags(label, flags, flags_value) -> Bool

Return true when the value has been changed or when pressed/selected.

CImGui.ClearMethod
Clear(self::Ptr{ImFontAtlas})

Clear all input and output.

CImGui.ClearFontsMethod
ClearFonts(self::Ptr{ImFontAtlas})

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

CImGui.ClearInputDataMethod
ClearInputData(self::Ptr{ImFontAtlas})

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

CImGui.ClearTexDataMethod
ClearTexData(self::Ptr{ImFontAtlas})

Clear output texture data (CPU side). Saves RAM once the texture has been copied to graphics memory.

CImGui.ClipperMethod
Clipper() -> Ptr{ImGuiListClipper}

Manually clip large list of items.

If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse clipping based on visibility to save yourself from processing those items at all.

If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse clipping based on visibility to save yourself from processing those items at all.

The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped. ImGui already clip items based on their bounds but it needs to measure text size to do so. Coarse clipping before submission makes this cost and your own data fetching/submission cost null.

Example

clipper = CImGui.Clipper()
Begin(clipper, 1000)  # we have 1000 elements, evenly spaced.
while CImGui.Step()
    dis_start = CImGui.Get(clipper, :DisplayStart)
    dis_end = CImGui.Get(clipper, :DisplayEnd)-1
    foreach(i->CImGui.Text("line number $i"), dis_start:dis_end)
end
  • Step 0: the clipper let you process the first element, regardless of it being visible or not, so we can measure the element height (step skipped if we passed a known height as second arg to constructor).
  • Step 1: the clipper infer height from first element, calculate the actual range of elements to display, and position the cursor before the first element.
  • (Step 2: dummy step only required if an explicit items_height was passed to constructor or Begin and user call Step. Does nothing and switch to Step 3.)
  • Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns false to end the loop.

Arguments

  • items_count: use -1 to ignore (you can call Begin later). 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).
  • items_height: use -1.0 to be calculated automatically on first step. otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing or GetFrameHeightWithSpacing. If you don't specify an items_height, you NEED to call Step. If you specify items_height you may call the old Begin/End api directly, but prefer calling Step.
CImGui.CloneOutputMethod
CloneOutput(handle::Ptr{ImDrawList}) -> Ptr{ImDrawList}

Create a clone of the CmdBuffer/IdxBuffer/VtxBuffer.

CImGui.CloseCurrentPopupMethod
CloseCurrentPopup()

Close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup.

CImGui.CollapsingHeaderFunction
CollapsingHeader(label, p_open::Ref, flags=ImGuiTreeNodeFlags_(0)) -> Bool

When p_open isn't C_NULL, display an additional small close button on upper right of the header.

CImGui.CollapsingHeaderFunction
CollapsingHeader(label, flags=ImGuiTreeNodeFlags_(0)) -> Bool

If returning true the header is open. Doesn't indent nor push on ID stack. User doesn't have to call TreePop.

CImGui.ColorButtonFunction
ColorButton(desc_id, col, flags=0, size=(0,0))

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

CImGui.ColorConvertFloat4ToU32Method
ColorConvertFloat4ToU32(in) -> ImU32

Convert ImVec4 color to ImU32. You could use Base.convert(::Type{ImU32}, x::ImVec4) instead.

CImGui.ColorConvertU32ToFloat4Method
ColorConvertU32ToFloat4(in) -> ImVec4

Convert ImU32 color to ImVec4. You could use Base.convert(::Type{ImVec4}, x::ImU32) instead.

CImGui.ColorEdit3Function
ColorEdit3(label, col, flags=0) -> Bool
Tip

this function has a little colored preview square that can be left-clicked to open a picker, and right-clicked to open an option menu.

CImGui.ColorEdit4Function
ColorEdit4(label, col, flags=0) -> Bool
Tip

this function has a little colored preview square that can be left-clicked to open a picker, and right-clicked to open an option menu.

CImGui.ColumnsFunction
Columns(count=1, id=C_NULL, border=true)
Work in progress!

You can also use SameLine(pos_x) for simplified columns. The columns API is work-in-progress and rather lacking (columns are arguably the worst part of dear imgui at the moment!)

CImGui.ComboFunction
Combo(label, current_item, items_getter::Union{Ptr,Base.CFunction}, data, items_count, popup_max_height_in_items=-1) -> Bool
CImGui.ComboFunction
Combo(label, current_item, items::Vector, items_count, popup_max_height_in_items=-1) -> Bool

The old Combo api are helpers over BeginCombo/EndCombo which are kept available for convenience purpose.

CImGui.ComboFunction
Combo(label, current_item, items_separated_by_zeros, popup_max_height_in_items=-1) -> Bool

Separate items with within a string, end item-list with . e.g. OneTwoThree

CImGui.CreateContextMethod
CreateContext() -> Ptr{ImGuiContext}
CreateContext(shared_font_atlas::Ptr{ImFontAtlas}) -> Ptr{ImGuiContext}

Return a handle of ImGuiContext.

CImGui.DestroyContextMethod
DestroyContext()
DestroyContext(ctx::Ptr{ImGuiContext})

Destroy ImGuiContext. DestroyContext() will destroy current context.

CImGui.DragFloatFunction
DragFloat(label, v, v_speed=1.0, v_min=0.0, v_max=0.0, format="%.3f", flag=0) -> Bool

If v_min >= v_max we have no bound.

CImGui.DragFloat2Function
DragFloat2(label, v, v_speed=1.0, v_min=0.0, v_max=0.0, format="%.3f", flag=0) -> Bool

The expected number of elements to be accessible in v is 2.

CImGui.DragFloat3Function
DragFloat3(label, v, v_speed=1.0, v_min=0.0, v_max=0.0, format="%.3f", flag=0) -> Bool

The expected number of elements to be accessible in v is 3.

CImGui.DragFloat4Function
DragFloat4(label, v, v_speed=1.0, v_min=0.0, v_max=0.0, format="%.3f", flag=0) -> Bool

The expected number of elements to be accessible in v is 4.

CImGui.DragFloatRange2Function
DragFloatRange2(label, v_current_min, v_current_max, v_speed=1.0, v_min=0.0, v_max=0.0, format="%.3f", format_max=C_NULL, flag=0) -> Bool
CImGui.DragIntFunction
DragInt(label, v, v_speed=1.0, v_min=0, v_max=0, format="%d", flag=0)
CImGui.DragInt2Function
DragInt2(label, v, v_speed=1.0, v_min=0, v_max=0, format="%d", flag=0)

The expected number of elements to be accessible in v is 2.

CImGui.DragInt3Function
DragInt3(label, v, v_speed=1.0, v_min=0, v_max=0, format="%d", flag=0)

The expected number of elements to be accessible in v is 3.

CImGui.DragInt4Function
DragInt4(label, v, v_speed=1.0, v_min=0, v_max=0, format="%d", flag=0)

The expected number of elements to be accessible in v is 4.

CImGui.DragIntRange2Function
DragIntRange2(label, v_current_min, v_current_max, v_speed=1.0, v_min=0, v_max=0, format="%d", format_max=C_NULL, flag=0)
CImGui.DragScalarFunction
DragScalar(label, data_type, v, v_speed, v_min=C_NULL, v_max=C_NULL, format=C_NULL, flags=0)
CImGui.DragScalarNFunction
DragScalarN(label, data_type, v, components, v_speed, v_min=C_NULL, v_max=C_NULL, format=C_NULL, flag=0)
CImGui.DummyMethod
Dummy(size)
Dummy(x, y)

Add a dummy item of given size.

CImGui.EmptyMethod
Empty(handle::Ptr{ImGuiTextBuffer}) -> Bool
CImGui.EndMethod
End(handle::Ptr{ImGuiListClipper})

Automatically called on the last call of Step that returns false.

CImGui.EndMethod
End(handle::Ptr{ImGuiTextBuffer}) -> Cstring
CImGui.EndFrameMethod
EndFrame()

Calling this function ends the ImGui frame. This function is automatically called by Render, so you likely don't need to call it yourself directly. If you don't need to render data (skipping rendering), you may call EndFrame but you'll have wasted CPU already! If you don't need to render, better to not create any imgui windows and not call NewFrame at all!

CImGui.GetBackgroundDrawListMethod
GetBackgroundDrawList() -> Ptr{ImDrawList}

This draw list will be the first rendering one. Useful to quickly draw shapes/text behind dear imgui contents.

CImGui.GetColorU32Function
GetColorU32(r, g, b, a) -> ImU32
GetColorU32(col::ImVec4) -> ImU32
GetColorU32(col::ImU32) -> ImU32
GetColorU32(idx::Integer, alpha_mul=1.0) -> ImU32

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

CImGui.GetColumnOffsetFunction
GetColumnOffset(column_index=-1) -> Cfloat

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.0.

CImGui.GetColumnWidthFunction
GetColumnWidth(column_index=-1) -> Cfloat

Return column width (in pixels). Pass -1 to use current column.

CImGui.GetContentRegionMaxMethod
GetContentRegionMax() -> ImVec2

Return current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates.

CImGui.GetCursorPosMethod
GetCursorPos() -> ImVec2

Return cursor position which is relative to window position.

CImGui.GetCursorScreenPosMethod
GetCursorScreenPos() -> ImVec2

Return cursor position in absolute screen coordinates [0..io.DisplaySize]. This is useful to work with ImDrawList API.

CImGui.GetDragDropPayloadMethod
GetDragDropPayload() -> Ptr{ImGuiPayload}

Peek directly into the current payload from anywhere. May return C_NULL.

BETA API

Missing Demo code. API may evolve.

CImGui.GetDrawDataMethod
GetDrawData() -> Ptr{ImDrawData}

Return a handle of ImDrawData which is valid after Render and until the next call to NewFrame. This is what you have to render.

Obsolete

This used to be passed to your ImGuiIO.RenderDrawListsFn function.

CImGui.GetDrawListSharedDataMethod
GetDrawListSharedData() -> Ptr{ImDrawListSharedData}

This function might be used when creating your own ImDrawList instances.

CImGui.GetFontSizeMethod
GetFontSize() -> Cfloat

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

CImGui.GetFontTexUvWhitePixelMethod
GetFontTexUvWhitePixel() -> ImVec2

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

CImGui.GetForegroundDrawListMethod
GetForegroundDrawList() -> Ptr{ImDrawList}

this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents.

CImGui.GetFrameHeightMethod
GetFrameHeight() -> Cfloat

Return FontSize + ImGuiStyle.FramePadding.y * 2.

CImGui.GetFrameHeightWithSpacingMethod
GetFrameHeightWithSpacing() -> Cfloat

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

CImGui.GetGlyphRangesChineseFullMethod
GetGlyphRangesChineseFull(self::Ptr{ImFontAtlas}) -> Ptr{ImWchar}

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

CImGui.GetGlyphRangesChineseSimplifiedCommonMethod
GetGlyphRangesChineseSimplifiedCommon(self::Ptr{ImFontAtlas}) -> Ptr{ImWchar}

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

CImGui.GetGlyphRangesJapaneseMethod
GetGlyphRangesJapanese(self::Ptr{ImFontAtlas}) -> Ptr{ImWchar}

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

CImGui.GetIDMethod
GetID(str_id::AbstractString) -> ImGuiID
GetID(str_id_begin::AbstractString, str_id_end::AbstractString) -> ImGuiID
GetID(ptr_id::Ptr) -> ImGuiID

Calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself.

CImGui.GetIOMethod
GetIO() -> Ptr{ImGuiIO}

Return a handle of ImGuiIO which is for accessing the IO structure:

  • mouse/keyboard/gamepad inputs
  • time
  • various configuration options/flags
CImGui.GetItemRectMaxMethod
GetItemRectMax() -> ImVec2

Return bounding rectangle of last item, in screen space. See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.GetItemRectMinMethod
GetItemRectMin() -> ImVec2

Return bounding rectangle of last item, in screen space. See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.GetItemRectSizeMethod
GetItemRectSize() -> ImVec2

Return size of last item, in screen space. See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.GetKeyIndexMethod
GetKeyIndex(imgui_key) -> Cint

Map ImGuiKey_* values into user's key index. == io.KeyMap[key]

CImGui.GetKeyPressedAmountMethod
GetKeyPressedAmount(key_index, repeat_delay, rate) -> Cint

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

CImGui.GetMouseCursorMethod
GetMouseCursor() -> ImGuiMouseCursor

Get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render. If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you.

CImGui.GetMouseDragDeltaFunction
GetMouseDragDelta(button=0, lock_threshold=-1.0) -> ImVec2

Dragging amount since clicking. if lock_threshold < -1.0f uses io.MouseDraggingThreshold.

CImGui.GetMousePosMethod
GetMousePos() -> ImVec2

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

CImGui.GetScrollMaxXMethod
GetScrollMaxX() -> Cfloat

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

CImGui.GetScrollMaxYMethod
GetScrollMaxY() -> Cfloat

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

CImGui.GetScrollYMethod
GetScrollY() -> Cfloat

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

CImGui.GetStyleMethod
GetStyle() -> Ptr{ImGuiStyle}

Return a handle of ImGuiStyle which is for accessing the Style structure (colors, sizes).

Note

Always use PushStyleColor, PushStyleVar to modify style mid-frame.

CImGui.GetTexDataAsAlpha8Function
GetTexDataAsAlpha8(self::Ptr{ImFontAtlas}, out_pixels, out_width, out_height, out_bytes_per_pixel=C_NULL)

1 byte per-pixel.

CImGui.GetTexDataAsRGBA32Function
GetTexDataAsRGBA32(self::Ptr{ImFontAtlas}, out_pixels, out_width, out_height, out_bytes_per_pixel=C_NULL)

4 bytes-per-pixel.

CImGui.GetTextLineHeightWithSpacingMethod
GetTextLineHeightWithSpacing() -> Cfloat

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

CImGui.GetTreeNodeToLabelSpacingMethod
GetTreeNodeToLabelSpacing()

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

CImGui.GetVersionMethod
GetVersion() -> Cstring

Get the compiled version string e.g. "1.23"

CImGui.GetWindowDrawListMethod
GetWindowDrawList() -> Ptr{ImDrawList}

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

CImGui.GetWindowHeightMethod
GetWindowHeight() -> Cfloat

Return current window height (shortcut for GetWindowSize().y).

CImGui.GetWindowPosMethod
GetWindowPos() -> ImVec2

Return current window position in screen space (useful if you want to do your own drawing via the ImDrawList API.

CImGui.GetWindowWidthMethod
GetWindowWidth() -> Cfloat

Return current window width (shortcut for GetWindowSize().x).

CImGui.HSVFunction
HSV(h, s, v, a=1.0) -> ImVec4
CImGui.ImageFunction
Image(user_texture_id, size, uv0=(0,0), uv1=(1,1), tint_col=(1,1,1,1), border_col=(0,0,0,0))
CImGui.ImageButtonFunction
ImageButton(str_id, user_texture_id, size, uv0=(0,0), uv1=(1,1), bg_col=(0,0,0,0), tint_col=(1,1,1,1)) -> Bool
CImGui.IndentFunction
Indent()
Indent(indent_w)

Move content position toward the right, by ImGuiStyle.IndentSpacing or indent_w if indent_w != 0.

CImGui.InputDoubleFunction
InputDouble(label, v, step=0.0, step_fast=0.0, format="%.6f", flags=0) -> Bool
CImGui.InputFloatFunction
InputFloat(label, v, step=0, step_fast=0, format="%.3f", flags=0) -> Bool
CImGui.InputFloat2Function
InputFloat2(label, v, format="%.3f", flags=0) -> Bool

The expected number of elements to be accessible in v is 2.

CImGui.InputFloat3Function
InputFloat3(label, v, format="%.3f", flags=0) -> Bool

The expected number of elements to be accessible in v is 3.

CImGui.InputFloat4Function
InputFloat4(label, v, format="%.3f", flags=0) -> Bool

The expected number of elements to be accessible in v is 4.

CImGui.InputIntFunction
InputInt(label, v, step=1, step_fast=100, flags=0) -> Bool
CImGui.InputInt2Function
InputInt2(label, v, flags=0) -> Bool

The expected number of elements to be accessible in v is 2.

CImGui.InputInt3Function
InputInt3(label, v, flags=0) -> Bool

The expected number of elements to be accessible in v is 3.

CImGui.InputInt4Function
InputInt4(label, v, flags=0) -> Bool

The expected number of elements to be accessible in v is 4.

CImGui.InputScalarFunction
InputScalar(label, data_type, v, step=C_NULL, step_fast=C_NULL, format=C_NULL, flags=0) -> Bool
CImGui.InputScalarNFunction
InputScalarN(label, data_type, v, components, step=C_NULL, step_fast=C_NULL, format=C_NULL, flags=0) -> Bool
CImGui.InputTextFunction
InputText(label, buf, buf_size, flags=0, callback=C_NULL, user_data=C_NULL) -> Bool
CImGui.InputTextMultilineFunction
InputTextMultiline(label, buf, buf_size, size=(0,0), flags=0, callback=C_NULL, user_data=C_NULL) -> Bool
CImGui.InputTextWithHintFunction
InputTextWithHint(label, hint, buf, buf_size, flags=0, callback=C_NULL, user_data=C_NULL) -> Bool
CImGui.InvisibleButtonFunction
InvisibleButton(str_id, size, flag = 0) -> Bool

Return true when the value has been changed or when pressed/selected. Flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api along with IsItemActive, IsItemHovered, etc.

CImGui.IsAnyItemActiveMethod
IsAnyItemActive() -> Bool

See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.IsAnyItemFocusedMethod
 IsAnyItemFocused() -> Bool

See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.IsAnyItemHoveredMethod
IsAnyItemHovered() -> Bool

See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.IsItemActivatedMethod
IsItemActivated() -> Bool

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

CImGui.IsItemActiveMethod
IsItemActive() -> Bool

Is the last item active? (e.g. button being held, text field being edited. This will continuously return true while holding mouse button on an item. Items that don't interact will always return false) See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.IsItemClickedFunction
IsItemClicked() -> Bool
IsItemClicked(mouse_button=0) -> Bool

Is the last item clicked? (e.g. button/node just clicked on) == IsMouseClicked(mouse_button) && IsItemHovered. See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.IsItemDeactivatedMethod
IsItemDeactivated() -> Bool

Was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that requires continuous editing. See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.IsItemDeactivatedAfterEditMethod
IsItemDeactivatedAfterEdit() -> Bool

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). See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.IsItemEditedMethod
IsItemEdited() -> Bool

Did the last item modify its underlying value this frame? or was pressed? This is generally the same as the "bool" return value of many widgets. See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.IsItemFocusedMethod
IsItemFocused() -> Bool

Is the last item focused for keyboard/gamepad navigation? See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.IsItemHoveredFunction
IsItemHovered(flags=ImGuiHoveredFlags_(0)) -> Bool

Is the last item hovered? (and usable, aka not blocked by a popup, etc.). See the output of CImGui.GetFlags(CImGui.ImGuiHoveredFlags_) for options:

using CImGui, Markdown
CImGui.ShowFlags(CImGui.ImGuiHoveredFlags_) |> Markdown.parse

See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.IsItemToggledOpenMethod
IsItemToggledOpen() -> Bool

See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.IsItemVisibleMethod
IsItemVisible() -> Bool

Is the last item visible? (items may be out of sight because of clipping/scrolling). See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.IsKeyDownMethod
IsKeyDown(user_key_index) -> Bool

Is key being held. == io.KeysDown[userkeyindex]. note that imgui doesn't know the semantic of each entry of io.KeysDown[]. Use your own indices/enums according to how your backend/engine stored them into io.KeysDown[]!

CImGui.IsKeyPressedFunction
IsKeyPressed(user_key_index, repeat=true) -> Bool

Was key pressed (went from !Down to Down). If repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate.

CImGui.IsKeyReleasedMethod
IsKeyReleased(user_key_index) -> Bool

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

CImGui.IsMouseClickedFunction
IsMouseClicked(button, repeat=false) -> Bool

Did mouse button clicked (went from !Down to Down) (0=left, 1=right, 2=middle)

CImGui.IsMouseDownMethod
IsMouseDown(button) -> Bool

Is mouse button held (0=left, 1=right, 2=middle).

CImGui.IsMouseDraggingFunction
IsMouseDragging(button=0, lock_threshold=-1.0) -> Bool

Is mouse dragging. If lock_threshold < -1.0f uses io.MouseDraggingThreshold.

CImGui.IsMouseHoveringRectFunction
IsMouseHoveringRect(r_min, r_max, clip=true) -> Bool

Is mouse hovering given bounding rect (in screen space). Clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block.

CImGui.IsMouseReleasedMethod
IsMouseReleased(button) -> Bool

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

CImGui.IsRectVisibleMethod
IsRectVisible(size) -> Bool
IsRectVisible(x, y) -> Bool

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

CImGui.IsRectVisibleVec2Method
IsRectVisibleVec2(rect_min::ImVec2, rect_max::ImVec2) -> Bool
IsRectVisibleVec2(rect_min::NTuple{2}, rect_max::NTuple{2}) -> Bool

Test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side.

CImGui.IsWindowFocusedFunction
IsWindowFocused(flags=0) -> Bool

Is current window focused? or its root/child, depending on flags. See the output of CImGui.GetFlags(CImGui.ImGuiFocusedFlags_) for options:

using CImGui, Markdown
CImGui.ShowFlags(CImGui.ImGuiFocusedFlags_) |> Markdown.parse
CImGui.IsWindowHoveredFunction
IsWindowHovered(flags=0) -> Bool

Is current window hovered (and typically: not blocked by a popup/modal)? See the output of CImGui.GetFlags(CImGui.ImGuiHoveredFlags_) for options:

using CImGui, Markdown
CImGui.ShowFlags(CImGui.ImGuiHoveredFlags_) |> Markdown.parse
Note

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

FAQ

Q: How can I tell whether to dispatch mouse/keyboard to imgui or to my application?

A: You can read the ImGuiIO.WantCaptureMouse, ImGuiIO.WantCaptureKeyboard and ImGuiIO.WantTextInput flags from the ImGuiIO structure, for example:

if CImGui.Get_WantCaptureMouse(CImGui.GetIO())
    # ...
end
  • When ImGuiIO.WantCaptureMouse is set, imgui wants to use your mouse state, and you may want to discard/hide the inputs from the rest of your application.
  • When ImGuiIO.WantCaptureKeyboard is set, imgui wants to use your keyboard state, and you may want to discard/hide the inputs from the rest of your application.
  • When ImGuiIO.WantTextInput is set to may want to notify your OS to popup an on-screen keyboard, if available (e.g. on a mobile phone, or console OS).
Note
  1. You should always pass your mouse/keyboard inputs to imgui, even when the ImGuiIO.WantCaptureXXX flag are set false. This is because imgui needs to detect that you clicked in the void to unfocus its own windows.
  2. The ImGuiIO.WantCaptureMouse is more accurate that any attempt to "check if the mouse is hovering a window" (don't do that!). It handle mouse dragging correctly (both dragging that started over your application or over an imgui window) and handle e.g. modal windows blocking inputs. Those flags are updated by NewFrame. Preferably read the flags after calling NewFrame if you can afford it, but reading them before is also perfectly fine, as the bool toggle fairly rarely. If you have on a touch device, you might find use for an early call to UpdateHoveredWindowAndCaptureFlags().
  3. Text input widget releases focus on "Return KeyDown", so the subsequent "Return KeyUp" event that your application receive will typically have ImGuiIO.WantCaptureKeyboard=false. Depending on your application logic it may or not be inconvenient. You might want to track which key-downs were targeted for Dear ImGui, e.g. with an array of bool, and filter out the corresponding key-ups.)
CImGui.LabelTextMethod
LabelText(label, formatted_text)

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

Limited support

Formatting is not supported which means you need to pass a formatted string to this function. It's recommended to use Julia stdlib Printf's @sprintf as a workaround when translating C/C++ code to Julia.

CImGui.ListBoxFunction
ListBox(label, current_item, items, items_count, height_in_items=-1)
ListBox(label, current_item, items_getter::Ptr{Cvoid}, data::Ptr{Cvoid}, items_count, height_in_items=-1)
CImGui.LoadIniSettingsFromDiskMethod
LoadIniSettingsFromDisk(ini_filename)

Call after CreateContext and before the first call to NewFrame. NewFrame automatically calls LoadIniSettingsFromDisk(ImGuiIO.IniFilename).

Tip

The disk functions are automatically called if ImGuiIO.IniFilename != CNULL (default is "imgui.ini"). Set ImGuiIO.IniFilename to CNULL to load/save manually. Read ImGuiIO.WantSaveIniSettings description about handling .ini saving manually.

CImGui.LogButtonsMethod
LogButtons()

Display buttons for logging to tty/file/clipboard.

CImGui.LogTextMethod
LogText(formatted_text)

Pass text data straight to log without being displayed.

CImGui.LogToClipboardFunction
LogToClipboard(max_depth=-1)

Start logging to OS clipboard.

All text output from interface is captured to clipboard. By default, tree nodes are automatically opened during logging.

CImGui.LogToFileFunction
LogToFile(max_depth=-1, filename=C_NULL)

Start logging to file.

All text output from interface is captured to file. By default, tree nodes are automatically opened during logging.

CImGui.LogToTTYFunction
LogToTTY(max_depth=-1)

Start logging to tty.

All text output from interface is captured to tty. By default, tree nodes are automatically opened during logging.

CImGui.MenuItemFunction
MenuItem(label, shortcut=C_NULL, selected::Bool=false, enabled::Bool=true) -> Bool
MenuItem(label, shortcut, selected::Ref, enabled::Bool=true) -> Bool

Return true when activated. Shortcuts are displayed for convenience but not processed by ImGui at the moment.

CImGui.NextColumnMethod
NextColumn()

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

CImGui.OpenPopupOnItemClickFunction
OpenPopupOnItemClick(str_id=C_NULL, mouse_button=1) -> Nothing

Helper to open popup when clicked on last item (note: actually triggers on the mouse released event to be consistent with popup behaviors).

CImGui.PathFillConvexMethod
PathFillConvex(handle::Ptr{ImDrawList}, col)
Note

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

CImGui.PathRectFunction
PathRect(handle::Ptr{ImDrawList}, rect_min, rect_max, rounding=0.0, rounding_corners_flags=ImDrawFlags_RoundCornersAll)

Stateful path API, add points then finish with PathFillConvex or PathStroke.

CImGui.PathStrokeFunction
PathStroke(handle::Ptr{ImDrawList}, col, closed, thickness=1.0)
CImGui.PlotHistogramFunction
PlotHistogram(label, values, values_count, values_offset=0, overlay_text=C_NULL, scale_min=FLT_MAX, scale_max=FLT_MAX, graph_size=(0,0), stride=sizeof(Cfloat))
PlotHistogram(label, values_getter::Ptr, data::Ptr, values_count, values_offset=0, overlay_text=C_NULL, scale_min=FLT_MAX, scale_max=FLT_MAX, graph_size=ImVec2(0,0))
CImGui.PlotLinesFunction
PlotLines(label, values, values_count::Integer, values_offset=0, overlay_text=C_NULL, scale_min=FLT_MAX, scale_max=FLT_MAX, graph_size=(0,0), stride=sizeof(Cfloat))
PlotLines(label, values_getter::Ptr, data::Ptr, values_count, values_offset=0, overlay_text=C_NULL, scale_min=FLT_MAX, scale_max=FLT_MAX, graph_size=(0,0))
CImGui.PrimQuadUVMethod
PrimQuadUV(handle::Ptr{ImDrawList}, a, b, c, d, uv_a, uv_b, uv_c, uv_d, col)
Note

All primitives needs to be reserved via PrimReserve beforehand!

CImGui.PrimRectMethod
PrimRect(handle::Ptr{ImDrawList}, a, b, col)

Axis aligned rectangle (composed of two triangles).

Note

All primitives needs to be reserved via PrimReserve beforehand!

CImGui.PrimRectUVMethod
PrimRectUV(handle::Ptr{ImDrawList}, a, b, uv_a, uv_b, col)
Note

All primitives needs to be reserved via PrimReserve beforehand!

CImGui.PrimReserveMethod
PrimReserve(handle::Ptr{ImDrawList}, idx_count, vtx_count)
Note

All primitives needs to be reserved via PrimReserve beforehand!

CImGui.PrimVtxMethod
PrimVtx(handle::Ptr{ImDrawList}, pos, uv, col)
Note

All primitives needs to be reserved via PrimReserve beforehand!

CImGui.PushButtonRepeatMethod
PushButtonRepeat(repeat)

In "repeat" mode, Button*() functions return repeated true in a typematic manner (using ImGuiIO.KeyRepeatDelay/ImGuiIO.KeyRepeatRate setting). Note that you can call IsItemActive after any Button() to tell if the button is held in the current frame.

CImGui.PushClipRectMethod
PushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect)
CImGui.PushClipRectMethod
PushClipRect(handle::Ptr{ImDrawList}, clip_rect_min, clip_rect_max, intersect_with_current_clip_rect)

Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level PushClipRect to affect logic (hit-testing and widget culling).

CImGui.PushFontMethod
PushFont(font)

Use C_NULL as a shortcut to push default font.

CImGui.PushIDMethod
PushID(ptr_id::Ptr)
PushID(int_id::Integer)
PushID(str_id::AbstractString)
PushID(str_id_begin::AbstractString, str_id_end::AbstractString)

Push identifier into the ID stack. IDs are hash of the entire stack!

Note

Read the FAQ for more details about how ID are handled in dear imgui. If you are creating widgets in a loop you most likely want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them. You can also use the "##foobar" syntax within widget label to distinguish them from each others.

FAQ

Q: How can I have multiple widgets with the same label or without a label?

Q: I have multiple widgets with the same label, and only the first one works. Why is that?

A: A primer on labels and the ID Stack...

Dear ImGui internally need to uniquely identify UI elements. Elements that are typically not clickable (such as calls to the Text functions) don't need an ID. Interactive widgets (such as calls to Button buttons) need a unique ID. Unique ID are used internally to track active widgets and occasionally associate state to widgets. Unique ID are implicitly built from the hash of multiple elements that identify the "path" to the UI element.

  • Unique ID are often derived from a string label:
CImGui.Button("OK")          # Label = "OK",     ID = hash of (..., "OK")
CImGui.Button("Cancel")      # Label = "Cancel", ID = hash of (..., "Cancel")
  • ID are uniquely scoped within windows, tree nodes, etc. which all pushes to the ID stack. Having two buttons labeled "OK" in different windows or different tree locations is fine. We used "..." above to signify whatever was already pushed to the ID stack previously:
CImGui.Begin("MyWindow")
CImGui.Button("OK")          # Label = "OK",     ID = hash of ("MyWindow", "OK")
CImGui.End()
  • If you have a same ID twice in the same location, you'll have a conflict:
CImGui.Button("OK")
CImGui.Button("OK")          # ID collision! Interacting with either button will trigger the first one.

Fear not! this is easy to solve and there are many ways to solve it!

  • Solving ID conflict in a simple/local context: When passing a label you can optionally specify extra ID information within string itself. Use ## to pass a complement to the ID that won't be visible to the end-user. This helps solving the simple collision cases when you know e.g. at compilation time which items are going to be created:
CImGui.Begin("MyWindow")
CImGui.Button("Play")        # Label = "Play",   ID = hash of ("MyWindow", "Play")
CImGui.Button("Play##foo1")  # Label = "Play",   ID = hash of ("MyWindow", "Play##foo1")  # Different from above
CImGui.Button("Play##foo2")  # Label = "Play",   ID = hash of ("MyWindow", "Play##foo2")  # Different from above
CImGui.End()
  • If you want to completely hide the label, but still need an ID:
CImGui.Checkbox("##On", &b)  # Label = "", ID = hash of (..., "##On") # No visible label, just a checkbox!
  • Occasionally/rarely you might want change a label while preserving a constant ID. This allows

you to animate labels. For example you may want to include varying information in a window title bar, but windows are uniquely identified by their ID. Use ### to pass a label that isn't part of ID:

CImGui.Button("Hello###ID")  # Label = "Hello",  ID = hash of (..., "ID")
CImGui.Button("World###ID")  # Label = "World",  ID = hash of (..., "ID") # Same as above, even though the label looks different
buf = @sprintf("My game (%f FPS)###MyGame", fps)
CImGui.Begin(buf)            # Variable title,   ID = hash of "MyGame"
  • Solving ID conflict in a more general manner:

Use PushID() / PopID() to create scopes and manipulate the ID stack, as to avoid ID conflicts within the same window. This is the most convenient way of distinguishing ID when iterating and creating many UI elements programmatically. You can push a pointer, a string or an integer value into the ID stack. Remember that ID are formed from the concatenation of everything in the ID stack!

CImGui.Begin("Window")
for i = 0:100-1
    CImGui.PushID(i)         # Push i to the id tack
    CImGui.Button("Click")   # Label = "Click",  ID = Hash of ("Window", i, "Click")
    CImGui.PopID()
end
End()
  • More example showing that you can stack multiple prefixes into the ID stack:
CImGui.Button("Click")       # Label = "Click",  ID = hash of (..., "Click")
CImGui.PushID("node")
CImGui.Button("Click")       # Label = "Click",  ID = hash of (..., "node", "Click")
    CImGui.PushID(my_ptr)
    CImGui.Button("Click") # Label = "Click",  ID = hash of (..., "node", my_ptr, "Click")
    CImGui.PopID()
CImGui.PopID()
  • Tree nodes implicitly creates a scope for you by calling PushID().
CImGui.Button("Click")     # Label = "Click",  ID = hash of (..., "Click")
if CImGui.TreeNode("node")
    CImGui.Button("Click") # Label = "Click",  ID = hash of (..., "node", "Click")
    CImGui.TreePop()
end
  • When working with trees, ID are used to preserve the open/close state of each tree node. Depending on your use cases you may want to use strings, indices or pointers as ID.
    • e.g. when following a single pointer that may change over time, using a static string as ID will preserve your node open/closed state when the targeted object change.
    • e.g. when displaying a list of objects, using indices or pointers as ID will preserve the node open/closed state differently. See what makes more sense in your situation!
CImGui.PushItemWidthMethod
PushItemWidth(item_width)

Push width of items for the common item+label case, pixels:

  • item_width == 0: default to ~2/3 of windows width
  • item_width > 0: width in pixels
  • item_width < 0: align xx pixels to the right of window (so -1.0 always align width to the right side)
CImGui.PushTabStopMethod
PushTabStop(allow_keyboard_focus)

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

CImGui.PushTextWrapPosFunction
PushTextWrapPos(wrap_pos_x=0.0)

Word-wrapping for Text*() commands:

  • wrap_pos_x < 0: no wrapping
  • wrap_pos_x == 0: wrap to end of window (or column)
  • wrap_pos_x > 0: wrap at wrap_pos_x position in window local space
CImGui.RadioButtonMethod
RadioButton(label, active::Bool) -> Bool
RadioButton(label, v::Ref, v_button::Integer) -> Bool

Return true when the value has been changed or when pressed/selected.

Example

if RadioButton("one", my_value==1)
    my_value = 1
end
CImGui.RenderMethod
Render()

Calling this function ends the ImGui frame. This function finalizes the draw data.

Obsolete

Optionally call ImGuiIO.RenderDrawListsFn if set. Nowadays, prefer calling your render function yourself.

CImGui.SameLineFunction
SameLine(local_pos_x=0.0, spacing_w=-1.0)

Call this function between widgets or groups to layout them horizontally.

CImGui.SaveIniSettingsToMemoryFunction
SaveIniSettingsToMemory(out_ini_size=C_NULL)

Return a zero-terminated string with the .ini data which you can save by your own mean. Call when ImGuiIO.WantSaveIniSettings is set, then save data by your own mean and clear ImGuiIO.WantSaveIniSettings.

CImGui.SelectableFunction
Selectable(label, selected::Bool=false, flags=0, size=(0,0)) -> Bool
Selectable(label, p_selected::Ref, flags=0, sizeImVec2(0,0)) -> Bool

Return true if is clicked, 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
CImGui.SeparatorMethod
Separator()

Separator, generally horizontal. But inside a menu bar or in horizontal layout mode, it becomes a vertical separator.

CImGui.SetColorEditOptionsMethod
SetColorEditOptions(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.

CImGui.SetColumnOffsetMethod
SetColumnOffset(column_index, offset_x)

Set position of column line (in pixels, from the left side of the contents region). Pass -1 to use current column.

CImGui.SetColumnWidthMethod
SetColumnWidth(column_index, width)

Set column width (in pixels). Pass -1 to use current column.

CImGui.SetCursorScreenPosMethod
SetCursorScreenPos(pos)
SetCursorScreenPos(x, y)

Set cursor position in absolute screen coordinates [0..io.DisplaySize].

CImGui.SetDragDropPayloadFunction
SetDragDropPayload(type, data, size, cond=ImGuiCond_(1)) -> bool

type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.

BETA API

Missing Demo code. API may evolve.

CImGui.SetItemAllowOverlapMethod
SetItemAllowOverlap()

Allow last item to be overlapped by a subsequent item. Sometimes useful with invisible buttons, selectables, etc. to catch unused area. See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.

CImGui.SetItemDefaultFocusMethod
SetItemDefaultFocus()

Make last item the default focused item of a window.

Tip

Prefer using SetItemDefaultFocus over if (IsWindowAppearing()) SetScrollHereY() when applicable to signify "this is the default item").

CImGui.SetKeyboardFocusHereFunction
SetKeyboardFocusHere(offset=0)

Focus keyboard on the next widget. Use positive offset to access sub components of a multiple component widget. Use -1 to access previous widget.

Tip

Prefer using SetItemDefaultFocus over if (IsWindowAppearing()) SetScrollHereY() when applicable to signify "this is the default item").

CImGui.SetNextFrameWantCaptureKeyboardFunction
SetNextFrameWantCaptureKeyboard(capture=true)

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.

CImGui.SetNextFrameWantCaptureMouseFunction
CaptureMouseFromApp(capture=true)

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

CImGui.SetNextItemOpenFunction
SetNextItemOpen(is_open, cond=0)

Set next TreeNode/CollapsingHeader open state.

CImGui.SetNextItemWidthMethod
SetNextItemWidth(item_width)

Set width of the next common large "item+label" widget.

  • item_width > 0.0: width in pixels
  • item_width < 0.0: align xx pixels to the right of window (so -1.0 always align width to the right side)
CImGui.SetNextWindowBgAlphaMethod
SetNextWindowBgAlpha(alpha)

Set next window background color alpha. Helper to easily modify ImGuiCol_WindowBg/ChildBg/PopupBg. You may also use ImGuiWindowFlags_NoBackground.

CImGui.SetNextWindowContentSizeMethod
SetNextWindowContentSize(size)
SetNextWindowContentSize(x, y)

Set next window content size (~ enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.). Set an axis to 0.0 to leave it automatic. Call before Begin.

CImGui.SetNextWindowPosFunction
SetNextWindowPos(pos, cond=0, pivot=(0,0))

Set next window position. Call before Begin. use pivot=(0.5,0.5) to center on given point, etc.

CImGui.SetNextWindowSizeFunction
SetNextWindowSize(size, cond=0)

Set next window size. Set axis to 0.0 to force an auto-fit on this axis. Call before Begin.

CImGui.SetNextWindowSizeConstraintsFunction
SetNextWindowSizeConstraints(size_min, size_max, custom_callback=C_NULL, custom_callback_data=C_NULL)

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.

CImGui.SetScrollHereYFunction
SetScrollHereY(center_y_ratio=0.5)

Adjust scrolling amount to make current cursor position visible.

  • center_y_ratio == 0.0: top
  • center_y_ratio == 0.5: center
  • center_y_ratio == 1.0: bottom

When using to make a "default/current item" visible, consider using SetItemDefaultFocus instead.

CImGui.SetScrollXMethod
SetScrollX(scroll_x)

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

CImGui.SetScrollYMethod
SetScrollY(scroll_y)

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

CImGui.SetStateStorageMethod
SetStateStorage(storage)

Replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it)

CImGui.SetTabItemClosedMethod
SetTabItemClosed(tab_or_docked_window_label)

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.

BETA API

API may evolve!

CImGui.SetTooltipMethod
SetTooltip(formatted_text)

Set a text-only tooltip, typically use with IsItemHovered. Overidde any previous call to SetTooltip.

Limited support

Formatting is not supported which means you need to pass a formatted string to this function. It's recommended to use Julia stdlib Printf's @sprintf as a workaround when translating C/C++ code to Julia.

CImGui.SetWindowCollapsedFunction
SetWindowCollapsed(name::AbstractString, collapsed, cond=0)

Set named window collapsed state.

CImGui.SetWindowFocusMethod
SetWindowFocus(name::Ptr{Cvoid})
SetWindowFocus(name::AbstractString)

Set named window to be focused / front-most. Use C_NULL to remove focus.

CImGui.SetWindowFontScaleMethod
SetWindowFontScale(scale)

Set font scale. Adjust ImGuiIO.FontGlobalScale if you want to scale all windows.

CImGui.SetWindowPosFunction
SetWindowPosStr(name::AbstractString, pos, cond=0)

Set named window position.

CImGui.SetWindowPosFunction
SetWindowPos(pos, cond=0)

Set current window position - call within Begin/End.

Not recommended!

This function is not recommended! Prefer using SetNextWindowPos, as this may incur tearing and side-effects.

CImGui.SetWindowSizeFunction
SetWindowSizeStr(name::AbstractString, size, cond=0)

Set named window size. Set axis to 0.0 to force an auto-fit on this axis.

CImGui.SetWindowSizeFunction
SetWindowSize(size, cond=0)

Set current window size - call within Begin/End. Set to (0,0) to force an auto-fit.

Not recommended!

This function is not recommended! Prefer using SetNextWindowSize, as this may incur tearing and minor side-effects.

CImGui.ShowAboutWindowFunction
ShowAboutWindow()
ShowAboutWindow(p_open=C_NULL)

Create about window. Display Dear ImGui version, credits and build/system information.

CImGui.ShowDemoWindowFunction
ShowDemoWindow()
ShowDemoWindow(p_open=C_NULL)

Create demo/test window. Demonstrate most ImGui features.

CImGui.ShowFontSelectorMethod
ShowFontSelector(label)

Add font selector block (not a window), essentially a combo listing the loaded fonts.

CImGui.ShowMetricsWindowFunction
ShowMetricsWindow()
ShowMetricsWindow(p_open=C_NULL)

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

CImGui.ShowStyleEditorFunction
ShowStyleEditor()
ShowStyleEditor(ref=C_NULL)

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).

CImGui.ShowStyleSelectorMethod
ShowStyleSelector()
ShowStyleSelector(label)

Add style selector block (not a window), essentially a combo listing the default styles.

CImGui.ShowUserGuideMethod
ShowUserGuide()

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

CImGui.SizeMethod
Size(handle::Ptr{ImGuiTextBuffer}) -> Cint
CImGui.SliderAngleFunction
SliderAngle(label, v_rad, v_degrees_min=-360.0, v_degrees_max=360.0, format="%.0f deg", flags=0) -> Bool
CImGui.SliderFloatFunction
SliderFloat(label, v, v_min, v_max, format="%.3f", flag=0) -> Bool

Create a slider widget.

Tip

ctrl+click on a slider to input with keyboard. manually input values aren't clamped, can go off-bounds.

Arguments

  • format: adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display
    • "%.3f" -> 1.234
    • "%5.2f secs" -> 01.23 secs
    • "Biscuit: %.0f" -> Biscuit: 1
CImGui.SliderFloat2Function
SliderFloat2(label, v, v_min, v_max, format="%.3f", flag=0) -> Bool

The expected number of elements to be accessible in v is 2.

CImGui.SliderFloat3Function
SliderFloat3(label, v, v_min, v_max, format="%.3f", flag=0) -> Bool

The expected number of elements to be accessible in v is 3.

CImGui.SliderFloat4Function
SliderFloat4(label, v, v_min, v_max, format="%.3f", flag=0) -> Bool

The expected number of elements to be accessible in v is 4.

CImGui.SliderIntFunction
SliderInt(label, v, v_min, v_max, format="%d", flags=0) -> Bool
CImGui.SliderInt2Function
SliderInt2(label, v, v_min, v_max, format="%d", flags=0) -> Bool

The expected number of elements to be accessible in v is 2.

CImGui.SliderInt3Function
SliderInt3(label, v, v_min, v_max, format="%d", flags=0) -> Bool

The expected number of elements to be accessible in v is 3.

CImGui.SliderInt4Function
SliderInt4(label, v, v_min, v_max, format="%d", flags=0) -> Bool

The expected number of elements to be accessible in v is 4.

CImGui.SliderScalarFunction
SliderScalar(label, data_type, v, v_min, v_max, format=C_NULL, flag=0) -> Bool
CImGui.SliderScalarNFunction
SliderScalarN(label, data_type, v, components, v_min, v_max, format=C_NULL, flag=0) -> Bool
CImGui.SmallButtonMethod
SmallButton(label) -> Bool

Return true when the value has been changed or when pressed/selected. It creates a button with FramePadding=(0,0) to easily embed within text.

CImGui.StepMethod
Step(handle::Ptr{ImGuiListClipper}) -> Bool

Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items.

CImGui.StyleColorsDarkMethod
StyleColorsDark()

Use the new, recommended style. This is also the default style.

CImGui.StyleColorsLightMethod
StyleColorsLight()

This style is best used with borders and a custom, thicker font.

CImGui.TableGetColumnFlagsFunction
TableGetColumnFlags(column_n = -1) -> ImGuiTableColumnFlags

Return column flags so you can query their Enabled/Visible/Sorted/Hovered status flags. Pass -1 to use current column.

CImGui.TableGetColumnNameFunction
TableGetColumnName(column_n = -1) -> String

return "" if column didn't have a name declared by TableSetupColumn(). Pass -1 to use current column.

CImGui.TableGetSortSpecsMethod
TableGetSortSpecs() -> Ptr{ImGuiTableSortSpecs}

get latest sort specs for the table (NULL if not sorting).

CImGui.TableHeaderMethod
TableHeader(label)

Submit one header cell manually (rarely used)

CImGui.TableHeadersRowMethod
TableHeadersRow()

Submit all headers cells based on data provided to TableSetupColumn() + submit context menu

CImGui.TableNextColumnMethod
TableNextColumn() -> Bool

Append into the next column (or first column of next row if currently in last column). Return true when column is visible.

CImGui.TableNextRowFunction
TableNextRow(row_flags = ImGuiTableRowFlags_(0), min_row_height = 0.0)

Append into the first cell of a new row.

CImGui.TableSetBgColorFunction
TableSetBgColor(bg_target, color, column_n = -1)

Change the color of a cell, row, or column. See ImGuiTableBgTarget_ flags for details.

CImGui.TableSetColumnIndexMethod
TableSetColumnIndex(column_n) -> Bool

Append into the specified column. Return true when column is visible.

CImGui.TableSetupColumnFunction
TableSetupColumn(label, flags = ImGuiTableColumnFlags_(0), init_width_or_weight = 0.0, user_id = ImGuiID(0))

Specify label, resizing policy, default width/weight, id, various other flags etc.

CImGui.TextMethod
Text(formatted_text)

Create a text widget.

Limited support

Formatting is not supported which means you need to pass a formatted string to this function. It's recommended to use Julia stdlib Printf's @sprintf as a workaround when translating C/C++ code to Julia.

CImGui.TextBufferMethod
TextBuffer() -> Ptr{ImGuiTextBuffer}

Helper: Growable text buffer for logging/accumulating text

CImGui.TextColoredMethod
TextColored(col, formatted_text)

Shortcut for PushStyleColor(ImGuiCol_Text, col); Text(text); PopStyleColor();.

Limited support

Formatting is not supported which means you need to pass a formatted string to this function. It's recommended to use Julia stdlib Printf's @sprintf as a workaround when translating C/C++ code to Julia.

CImGui.TextDisabledMethod
TextDisabled(formatted_text)

Shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); Text(text); PopStyleColor();.

Limited support

Formatting is not supported which means you need to pass a formatted string to this function. It's recommended to use Julia stdlib Printf's @sprintf as a workaround when translating C/C++ code to Julia.

CImGui.TextUnformattedFunction
TextUnformatted(text, text_end=C_NULL)

Raw text without formatting. Roughly equivalent to Text("%s", text) but:

  1. doesn't require null terminated string if text_end is specified;
  2. it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text.
CImGui.TextWrappedMethod
TextWrapped(formatted_text)

Shortcut for PushTextWrapPos(0.0f); Text(text); PopTextWrapPos();. Note that this won't work on an auto-resizing window if there's no other widgets to extend the window width, yoy may need to set a size using SetNextWindowSize.

Limited support

Formatting is not supported which means you need to pass a formatted string to this function. It's recommended to use Julia stdlib Printf's @sprintf as a workaround when translating C/C++ code to Julia.

CImGui.TreeNodeMethod
TreeNode(label::AbstractString) -> Bool

TreeNode functions return true when the node is open, in which case you need to also call TreePop when you are finished displaying the tree node contents.

CImGui.TreeNodeMethod
TreeNode(str_id, formatted_text) -> Bool

Helper variation to completely decorelate the id from the displayed string. Read the FAQ in PushID's' doc about why and how to use ID. To align arbitrary text at the same level as a TreeNode you can use Bullet.

Limited support

Formatting is not supported which means you need to pass a formatted string to this function. It's recommended to use Julia stdlib Printf's @sprintf as a workaround when translating C/C++ code to Julia.

CImGui.TreeNodeMethod
TreeNodePtr(ptr_id::Ptr, formatted_text) -> Bool

Helper variation to completely decorelate the id from the displayed string. Read the FAQ in PushID's' doc about why and how to use ID. To align arbitrary text at the same level as a TreeNode you can use Bullet.

Limited support

Formatting is not supported which means you need to pass a formatted string to this function. It's recommended to use Julia stdlib Printf's @sprintf as a workaround when translating C/C++ code to Julia.

CImGui.TreeNodeExMethod
TreeNodeEx(str_id, flags, formatted_text) -> Bool
Limited support

Formatting is not supported which means you need to pass a formatted string to this function. It's recommended to use Julia stdlib Printf's @sprintf as a workaround when translating C/C++ code to Julia.

CImGui.TreeNodeExMethod
TreeNodeEx(ptr_id::Ptr, flags, formatted_text) -> Bool
Limited support

Formatting is not supported which means you need to pass a formatted string to this function. It's recommended to use Julia stdlib Printf's @sprintf as a workaround when translating C/C++ code to Julia.

CImGui.UnindentFunction
Unindent()
Unindent(indent_w)

Move content position back to the left, by ImGuiStyle.IndentSpacing or indent_w if indent_w != 0.

CImGui.VSliderFloatFunction
VSliderFloat(label, size, v, v_min, v_max, format="%.3f", flag=0) -> Bool
CImGui.VSliderIntFunction
VSliderInt(label, size, v, v_min, v_max, format="%d", flag=0) -> Bool
CImGui.VSliderScalarFunction
VSliderScalar(label, size, data_type, v, v_min, v_max, format=C_NULL, flag=0) -> Bool
CImGui.ValueBoolMethod
ValueBool(prefix, b)

Output single value in "name: value" format.

CImGui.ValueFloatFunction
ValueFloat(prefix, v, float_format=C_NULL)

Output single value in "name: value" format.

CImGui.ValueIntMethod
ValueInt(prefix, v)

Output single value in "name: value" format.

CImGui.ValueUintMethod
ValueUint(prefix, v)

Output single value in "name: value" format.