UNPKG

@mori2003/jsimgui

Version:

JavaScript bindings for Dear ImGui.

1,359 lines 363 kB
/* @ts-self-types="./mod.d.ts" */ /** biome-ignore-all assist/source/organizeImports: . */ /** biome-ignore-all lint/correctness/noUnusedVariables: . */ /** biome-ignore-all lint/suspicious/noExplicitAny: . */ /** * Object wrapping the exported Emscripten module. Used to access any of the exported functions * or runtime methods. */ const Mod = { /** * The Emscripten module exports. */ _export: null, /** * Initialize the Emscripten module by loading and instantiating it. Make it's exports * available through {@linkcode Mod.export}. Will be called by {@linkcode ImGuiImplWeb.Init}. * @throws {Error} Throws error if the module is already initialized. */ async init(loaderPath, customLoaderPath) { if (Mod._export) { throw new Error("jsimgui: Emscripten module is already initialized."); } let MainExport; if (customLoaderPath) { MainExport = await import(`${customLoaderPath}`); } else { switch (loaderPath) { case "./jsimgui-webgl-tt.js": // @ts-ignore MainExport = await import("./jsimgui-webgl-tt.js"); break; case "./jsimgui-webgl-tt-demos.js": // @ts-ignore MainExport = await import("./jsimgui-webgl-tt-demos.js"); break; case "./jsimgui-webgl-ft.js": // @ts-ignore MainExport = await import("./jsimgui-webgl-ft.js"); break; case "./jsimgui-webgl-ft-demos.js": // @ts-ignore MainExport = await import("./jsimgui-webgl-ft-demos.js"); break; case "./jsimgui-webgl2-tt.js": // @ts-ignore MainExport = await import("./jsimgui-webgl2-tt.js"); break; case "./jsimgui-webgl2-tt-demos.js": // @ts-ignore MainExport = await import("./jsimgui-webgl2-tt-demos.js"); break; case "./jsimgui-webgl2-ft.js": // @ts-ignore MainExport = await import("./jsimgui-webgl2-ft.js"); break; case "./jsimgui-webgl2-ft-demos.js": // @ts-ignore MainExport = await import("./jsimgui-webgl2-ft-demos.js"); break; case "./jsimgui-webgpu-tt.js": // @ts-ignore MainExport = await import("./jsimgui-webgpu-tt.js"); break; case "./jsimgui-webgpu-tt-demos.js": // @ts-ignore MainExport = await import("./jsimgui-webgpu-tt-demos.js"); break; case "./jsimgui-webgpu-ft.js": // @ts-ignore MainExport = await import("./jsimgui-webgpu-ft.js"); break; case "./jsimgui-webgpu-ft-demos.js": // @ts-ignore MainExport = await import("./jsimgui-webgpu-ft-demos.js"); break; } } const module = await MainExport.default(); Mod._export = module; }, /** * Access to the Emscripten module exports. * @throws {Error} Throws error if the module hasn't been initialized by {@linkcode Mod.init}. */ get export() { if (!Mod._export) { throw new Error( "jsimgui: Emscripten module is not initialized. Did you call ImGuiImplWeb.Init()?", ); } return this._export; }, }; /** * Base class for all struct bindings (except for ImVec2, ImVec4 and ImTextureRef). */ class StructBinding { /** * The native pointer to the struct. */ ptr = null; /** * Construct a new JavaScript class instance and allocate native memory. */ static New() { // biome-ignore lint/complexity/noThisInStatic: ... const obj = new this(); // biome-ignore lint/complexity/noThisInStatic: ... obj.ptr = new Mod.export[this.name](); return obj; } /** * Create a JavaScript class instance from a native pointer. */ static From(ptr) { // biome-ignore lint/complexity/noThisInStatic: ... const obj = new this(); obj.ptr = ptr; return obj; } /** * Free the struct's native allocated memory. */ Drop() { this.ptr?.delete(); } } /** * 2D vector used to store positions, sizes etc. */ export class ImVec2 { x; y; constructor(x = 0, y = 0) { this.x = x; this.y = y; } static From(obj) { return new ImVec2(obj.x, obj.y); } } /** * 4D vector used to store clipping rectangles, colors etc. */ export class ImVec4 { x; y; z; w; constructor(x = 0, y = 0, z = 0, w = 0) { this.x = x; this.y = y; this.z = z; this.w = w; } static From(obj) { return new ImVec4(obj.x, obj.y, obj.z, obj.w); } } /** * ImTextureRef = higher-level identifier for a texture. * The identifier is valid even before the texture has been uploaded to the GPU/graphics system. * This is what gets passed to functions such as ImGui::Image(), ImDrawList::AddImage(). * This is what gets stored in draw commands (ImDrawCmd) to identify a texture during rendering. */ export class ImTextureRef { _TexID; constructor(id) { this._TexID = id; } static From(obj) { return new ImTextureRef(obj._TexID); } } const IM_COL32_WHITE = 0xffffffff; /** * Data shared among multiple draw lists (typically owned by parent ImGui context, but you may create one yourself) */ export class ImDrawListSharedData extends StructBinding {} /** * Opaque storage for building a ImFontAtlas */ export class ImFontAtlasBuilder extends StructBinding {} /** * Opaque interface to a font loading backend (stb_truetype, FreeType etc.). */ export class ImFontLoader extends StructBinding {} // Forward declarations: ImGui layer /** * Dear ImGui context (opaque structure, unless including imgui_internal.h) */ export class ImGuiContext extends StructBinding {} /** * Sorting specifications for a table (often handling sort specs for a single column, occasionally more) * Obtained by calling TableGetSortSpecs(). * When 'SpecsDirty == true' you can sort your data. It will be true with sorting specs have changed since last call, or the first time. * Make sure to set 'SpecsDirty = false' after sorting, else you may wastefully sort your data every frame! */ export class ImGuiTableSortSpecs extends StructBinding { /** * Pointer to sort spec array. */ get Specs() { return ImGuiTableColumnSortSpecs.From(this.ptr.get_Specs()); } set Specs(v) { this.ptr.set_Specs(v); } /** * Sort spec count. Most often 1. May be > 1 when ImGuiTableFlags_SortMulti is enabled. May be == 0 when ImGuiTableFlags_SortTristate is enabled. */ get SpecsCount() { return this.ptr.get_SpecsCount(); } set SpecsCount(v) { this.ptr.set_SpecsCount(v); } /** * Set to true when specs have changed since last time! Use this to sort again, then clear the flag. */ get SpecsDirty() { return this.ptr.get_SpecsDirty(); } set SpecsDirty(v) { this.ptr.set_SpecsDirty(v); } } /** * Sorting specification for one column of a table (sizeof == 12 bytes) */ export class ImGuiTableColumnSortSpecs extends StructBinding { /** * User id of the column (if specified by a TableSetupColumn() call) */ get ColumnUserID() { return this.ptr.get_ColumnUserID(); } set ColumnUserID(v) { this.ptr.set_ColumnUserID(v); } /** * Index of the column */ get ColumnIndex() { return this.ptr.get_ColumnIndex(); } set ColumnIndex(v) { this.ptr.set_ColumnIndex(v); } /** * Index within parent ImGuiTableSortSpecs (always stored in order starting from 0, tables sorted on a single criteria will always have a 0 here) */ get SortOrder() { return this.ptr.get_SortOrder(); } set SortOrder(v) { this.ptr.set_SortOrder(v); } /** * ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending */ get SortDirection() { return this.ptr.get_SortDirection(); } set SortDirection(v) { this.ptr.set_SortDirection(v); } } export class ImGuiStyle extends StructBinding { // Font scaling // - recap: ImGui::GetFontSize() == FontSizeBase * (FontScaleMain * FontScaleDpi * other_scaling_factors) /** * Current base font size before external global factors are applied. Use PushFont(NULL, size) to modify. Use ImGui::GetFontSize() to obtain scaled value. */ get FontSizeBase() { return this.ptr.get_FontSizeBase(); } set FontSizeBase(v) { this.ptr.set_FontSizeBase(v); } /** * Main global scale factor. May be set by application once, or exposed to end-user. */ get FontScaleMain() { return this.ptr.get_FontScaleMain(); } set FontScaleMain(v) { this.ptr.set_FontScaleMain(v); } /** * Additional global scale factor from viewport\/monitor contents scale. When io.ConfigDpiScaleFonts is enabled, this is automatically overwritten when changing monitor DPI. */ get FontScaleDpi() { return this.ptr.get_FontScaleDpi(); } set FontScaleDpi(v) { this.ptr.set_FontScaleDpi(v); } /** * Global alpha applies to everything in Dear ImGui. */ get Alpha() { return this.ptr.get_Alpha(); } set Alpha(v) { this.ptr.set_Alpha(v); } /** * Additional alpha multiplier applied by BeginDisabled(). Multiply over current value of Alpha. */ get DisabledAlpha() { return this.ptr.get_DisabledAlpha(); } set DisabledAlpha(v) { this.ptr.set_DisabledAlpha(v); } /** * Padding within a window. */ get WindowPadding() { return ImVec2.From(this.ptr.get_WindowPadding()); } set WindowPadding(v) { this.ptr.set_WindowPadding(v); } /** * Radius of window corners rounding. Set to 0.0f to have rectangular windows. Large values tend to lead to variety of artifacts and are not recommended. */ get WindowRounding() { return this.ptr.get_WindowRounding(); } set WindowRounding(v) { this.ptr.set_WindowRounding(v); } /** * Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU\/GPU costly). */ get WindowBorderSize() { return this.ptr.get_WindowBorderSize(); } set WindowBorderSize(v) { this.ptr.set_WindowBorderSize(v); } /** * Hit-testing extent outside\/inside resizing border. Also extend determination of hovered window. Generally meaningfully larger than WindowBorderSize to make it easy to reach borders. */ get WindowBorderHoverPadding() { return this.ptr.get_WindowBorderHoverPadding(); } set WindowBorderHoverPadding(v) { this.ptr.set_WindowBorderHoverPadding(v); } /** * Minimum window size. This is a global setting. If you want to constrain individual windows, use SetNextWindowSizeConstraints(). */ get WindowMinSize() { return ImVec2.From(this.ptr.get_WindowMinSize()); } set WindowMinSize(v) { this.ptr.set_WindowMinSize(v); } /** * Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered. */ get WindowTitleAlign() { return ImVec2.From(this.ptr.get_WindowTitleAlign()); } set WindowTitleAlign(v) { this.ptr.set_WindowTitleAlign(v); } /** * Side of the collapsing\/docking button in the title bar (None\/Left\/Right). Defaults to ImGuiDir_Left. */ get WindowMenuButtonPosition() { return this.ptr.get_WindowMenuButtonPosition(); } set WindowMenuButtonPosition(v) { this.ptr.set_WindowMenuButtonPosition(v); } /** * Radius of child window corners rounding. Set to 0.0f to have rectangular windows. */ get ChildRounding() { return this.ptr.get_ChildRounding(); } set ChildRounding(v) { this.ptr.set_ChildRounding(v); } /** * Thickness of border around child windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU\/GPU costly). */ get ChildBorderSize() { return this.ptr.get_ChildBorderSize(); } set ChildBorderSize(v) { this.ptr.set_ChildBorderSize(v); } /** * Radius of popup window corners rounding. (Note that tooltip windows use WindowRounding) */ get PopupRounding() { return this.ptr.get_PopupRounding(); } set PopupRounding(v) { this.ptr.set_PopupRounding(v); } /** * Thickness of border around popup\/tooltip windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU\/GPU costly). */ get PopupBorderSize() { return this.ptr.get_PopupBorderSize(); } set PopupBorderSize(v) { this.ptr.set_PopupBorderSize(v); } /** * Padding within a framed rectangle (used by most widgets). */ get FramePadding() { return ImVec2.From(this.ptr.get_FramePadding()); } set FramePadding(v) { this.ptr.set_FramePadding(v); } /** * Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets). */ get FrameRounding() { return this.ptr.get_FrameRounding(); } set FrameRounding(v) { this.ptr.set_FrameRounding(v); } /** * Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU\/GPU costly). */ get FrameBorderSize() { return this.ptr.get_FrameBorderSize(); } set FrameBorderSize(v) { this.ptr.set_FrameBorderSize(v); } /** * Horizontal and vertical spacing between widgets\/lines. */ get ItemSpacing() { return ImVec2.From(this.ptr.get_ItemSpacing()); } set ItemSpacing(v) { this.ptr.set_ItemSpacing(v); } /** * Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label). */ get ItemInnerSpacing() { return ImVec2.From(this.ptr.get_ItemInnerSpacing()); } set ItemInnerSpacing(v) { this.ptr.set_ItemInnerSpacing(v); } /** * Padding within a table cell. Cellpadding.x is locked for entire table. CellPadding.y may be altered between different rows. */ get CellPadding() { return ImVec2.From(this.ptr.get_CellPadding()); } set CellPadding(v) { this.ptr.set_CellPadding(v); } /** * Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much! */ get TouchExtraPadding() { return ImVec2.From(this.ptr.get_TouchExtraPadding()); } set TouchExtraPadding(v) { this.ptr.set_TouchExtraPadding(v); } /** * Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). */ get IndentSpacing() { return this.ptr.get_IndentSpacing(); } set IndentSpacing(v) { this.ptr.set_IndentSpacing(v); } /** * Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1). */ get ColumnsMinSpacing() { return this.ptr.get_ColumnsMinSpacing(); } set ColumnsMinSpacing(v) { this.ptr.set_ColumnsMinSpacing(v); } /** * Width of the vertical scrollbar, Height of the horizontal scrollbar. */ get ScrollbarSize() { return this.ptr.get_ScrollbarSize(); } set ScrollbarSize(v) { this.ptr.set_ScrollbarSize(v); } /** * Radius of grab corners for scrollbar. */ get ScrollbarRounding() { return this.ptr.get_ScrollbarRounding(); } set ScrollbarRounding(v) { this.ptr.set_ScrollbarRounding(v); } /** * Padding of scrollbar grab within its frame (same for both axises). */ get ScrollbarPadding() { return this.ptr.get_ScrollbarPadding(); } set ScrollbarPadding(v) { this.ptr.set_ScrollbarPadding(v); } /** * Minimum width\/height of a grab box for slider\/scrollbar. */ get GrabMinSize() { return this.ptr.get_GrabMinSize(); } set GrabMinSize(v) { this.ptr.set_GrabMinSize(v); } /** * Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. */ get GrabRounding() { return this.ptr.get_GrabRounding(); } set GrabRounding(v) { this.ptr.set_GrabRounding(v); } /** * The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero. */ get LogSliderDeadzone() { return this.ptr.get_LogSliderDeadzone(); } set LogSliderDeadzone(v) { this.ptr.set_LogSliderDeadzone(v); } /** * Thickness of border around Image() calls. */ get ImageBorderSize() { return this.ptr.get_ImageBorderSize(); } set ImageBorderSize(v) { this.ptr.set_ImageBorderSize(v); } /** * Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs. */ get TabRounding() { return this.ptr.get_TabRounding(); } set TabRounding(v) { this.ptr.set_TabRounding(v); } /** * Thickness of border around tabs. */ get TabBorderSize() { return this.ptr.get_TabBorderSize(); } set TabBorderSize(v) { this.ptr.set_TabBorderSize(v); } /** * Minimum tab width, to make tabs larger than their contents. TabBar buttons are not affected. */ get TabMinWidthBase() { return this.ptr.get_TabMinWidthBase(); } set TabMinWidthBase(v) { this.ptr.set_TabMinWidthBase(v); } /** * Minimum tab width after shrinking, when using ImGuiTabBarFlags_FittingPolicyMixed policy. */ get TabMinWidthShrink() { return this.ptr.get_TabMinWidthShrink(); } set TabMinWidthShrink(v) { this.ptr.set_TabMinWidthShrink(v); } /** * -1: always visible. 0.0f: visible when hovered. >0.0f: visible when hovered if minimum width. */ get TabCloseButtonMinWidthSelected() { return this.ptr.get_TabCloseButtonMinWidthSelected(); } set TabCloseButtonMinWidthSelected(v) { this.ptr.set_TabCloseButtonMinWidthSelected(v); } /** * -1: always visible. 0.0f: visible when hovered. >0.0f: visible when hovered if minimum width. FLT_MAX: never show close button when unselected. */ get TabCloseButtonMinWidthUnselected() { return this.ptr.get_TabCloseButtonMinWidthUnselected(); } set TabCloseButtonMinWidthUnselected(v) { this.ptr.set_TabCloseButtonMinWidthUnselected(v); } /** * Thickness of tab-bar separator, which takes on the tab active color to denote focus. */ get TabBarBorderSize() { return this.ptr.get_TabBarBorderSize(); } set TabBarBorderSize(v) { this.ptr.set_TabBarBorderSize(v); } /** * Thickness of tab-bar overline, which highlights the selected tab-bar. */ get TabBarOverlineSize() { return this.ptr.get_TabBarOverlineSize(); } set TabBarOverlineSize(v) { this.ptr.set_TabBarOverlineSize(v); } /** * Angle of angled headers (supported values range from -50.0f degrees to +50.0f degrees). */ get TableAngledHeadersAngle() { return this.ptr.get_TableAngledHeadersAngle(); } set TableAngledHeadersAngle(v) { this.ptr.set_TableAngledHeadersAngle(v); } /** * Alignment of angled headers within the cell */ get TableAngledHeadersTextAlign() { return ImVec2.From(this.ptr.get_TableAngledHeadersTextAlign()); } set TableAngledHeadersTextAlign(v) { this.ptr.set_TableAngledHeadersTextAlign(v); } /** * Default way to draw lines connecting TreeNode hierarchy. ImGuiTreeNodeFlags_DrawLinesNone or ImGuiTreeNodeFlags_DrawLinesFull or ImGuiTreeNodeFlags_DrawLinesToNodes. */ get TreeLinesFlags() { return this.ptr.get_TreeLinesFlags(); } set TreeLinesFlags(v) { this.ptr.set_TreeLinesFlags(v); } /** * Thickness of outlines when using ImGuiTreeNodeFlags_DrawLines. */ get TreeLinesSize() { return this.ptr.get_TreeLinesSize(); } set TreeLinesSize(v) { this.ptr.set_TreeLinesSize(v); } /** * Radius of lines connecting child nodes to the vertical line. */ get TreeLinesRounding() { return this.ptr.get_TreeLinesRounding(); } set TreeLinesRounding(v) { this.ptr.set_TreeLinesRounding(v); } /** * Side of the color button in the ColorEdit4 widget (left\/right). Defaults to ImGuiDir_Right. */ get ColorButtonPosition() { return this.ptr.get_ColorButtonPosition(); } set ColorButtonPosition(v) { this.ptr.set_ColorButtonPosition(v); } /** * Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered). */ get ButtonTextAlign() { return ImVec2.From(this.ptr.get_ButtonTextAlign()); } set ButtonTextAlign(v) { this.ptr.set_ButtonTextAlign(v); } /** * Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line. */ get SelectableTextAlign() { return ImVec2.From(this.ptr.get_SelectableTextAlign()); } set SelectableTextAlign(v) { this.ptr.set_SelectableTextAlign(v); } /** * Thickness of border in SeparatorText() */ get SeparatorTextBorderSize() { return this.ptr.get_SeparatorTextBorderSize(); } set SeparatorTextBorderSize(v) { this.ptr.set_SeparatorTextBorderSize(v); } /** * Alignment of text within the separator. Defaults to (0.0f, 0.5f) (left aligned, center). */ get SeparatorTextAlign() { return ImVec2.From(this.ptr.get_SeparatorTextAlign()); } set SeparatorTextAlign(v) { this.ptr.set_SeparatorTextAlign(v); } /** * Horizontal offset of text from each edge of the separator + spacing on other axis. Generally small values. .y is recommended to be == FramePadding.y. */ get SeparatorTextPadding() { return ImVec2.From(this.ptr.get_SeparatorTextPadding()); } set SeparatorTextPadding(v) { this.ptr.set_SeparatorTextPadding(v); } /** * Apply to regular windows: amount which we enforce to keep visible when moving near edges of your screen. */ get DisplayWindowPadding() { return ImVec2.From(this.ptr.get_DisplayWindowPadding()); } set DisplayWindowPadding(v) { this.ptr.set_DisplayWindowPadding(v); } /** * Apply to every windows, menus, popups, tooltips: amount where we avoid displaying contents. Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured). */ get DisplaySafeAreaPadding() { return ImVec2.From(this.ptr.get_DisplaySafeAreaPadding()); } set DisplaySafeAreaPadding(v) { this.ptr.set_DisplaySafeAreaPadding(v); } /** * Docking node has their own CloseButton() to close all docked windows. */ get DockingNodeHasCloseButton() { return this.ptr.get_DockingNodeHasCloseButton(); } set DockingNodeHasCloseButton(v) { this.ptr.set_DockingNodeHasCloseButton(v); } /** * Thickness of resizing border between docked windows */ get DockingSeparatorSize() { return this.ptr.get_DockingSeparatorSize(); } set DockingSeparatorSize(v) { this.ptr.set_DockingSeparatorSize(v); } /** * Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). We apply per-monitor DPI scaling over this scale. May be removed later. */ get MouseCursorScale() { return this.ptr.get_MouseCursorScale(); } set MouseCursorScale(v) { this.ptr.set_MouseCursorScale(v); } /** * Enable anti-aliased lines\/borders. Disable if you are really tight on CPU\/GPU. Latched at the beginning of the frame (copied to ImDrawList). */ get AntiAliasedLines() { return this.ptr.get_AntiAliasedLines(); } set AntiAliasedLines(v) { this.ptr.set_AntiAliasedLines(v); } /** * Enable anti-aliased lines\/borders using textures where possible. Require backend to render with bilinear filtering (NOT point\/nearest filtering). Latched at the beginning of the frame (copied to ImDrawList). */ get AntiAliasedLinesUseTex() { return this.ptr.get_AntiAliasedLinesUseTex(); } set AntiAliasedLinesUseTex(v) { this.ptr.set_AntiAliasedLinesUseTex(v); } /** * Enable anti-aliased edges around filled shapes (rounded rectangles, circles, etc.). Disable if you are really tight on CPU\/GPU. Latched at the beginning of the frame (copied to ImDrawList). */ get AntiAliasedFill() { return this.ptr.get_AntiAliasedFill(); } set AntiAliasedFill(v) { this.ptr.set_AntiAliasedFill(v); } /** * Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. */ get CurveTessellationTol() { return this.ptr.get_CurveTessellationTol(); } set CurveTessellationTol(v) { this.ptr.set_CurveTessellationTol(v); } /** * Maximum error (in pixels) allowed when using AddCircle()\/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry. */ get CircleTessellationMaxError() { return this.ptr.get_CircleTessellationMaxError(); } set CircleTessellationMaxError(v) { this.ptr.set_CircleTessellationMaxError(v); } get Colors() { return this.ptr.get_Colors(); } set Colors(v) { this.ptr.set_Colors(v); } // Behaviors // (It is possible to modify those fields mid-frame if specific behavior need it, unlike e.g. configuration fields in ImGuiIO) /** * Delay for IsItemHovered(ImGuiHoveredFlags_Stationary). Time required to consider mouse stationary. */ get HoverStationaryDelay() { return this.ptr.get_HoverStationaryDelay(); } set HoverStationaryDelay(v) { this.ptr.set_HoverStationaryDelay(v); } /** * Delay for IsItemHovered(ImGuiHoveredFlags_DelayShort). Usually used along with HoverStationaryDelay. */ get HoverDelayShort() { return this.ptr.get_HoverDelayShort(); } set HoverDelayShort(v) { this.ptr.set_HoverDelayShort(v); } /** * Delay for IsItemHovered(ImGuiHoveredFlags_DelayNormal). " */ get HoverDelayNormal() { return this.ptr.get_HoverDelayNormal(); } set HoverDelayNormal(v) { this.ptr.set_HoverDelayNormal(v); } /** * Default flags when using IsItemHovered(ImGuiHoveredFlags_ForTooltip) or BeginItemTooltip()\/SetItemTooltip() while using mouse. */ get HoverFlagsForTooltipMouse() { return this.ptr.get_HoverFlagsForTooltipMouse(); } set HoverFlagsForTooltipMouse(v) { this.ptr.set_HoverFlagsForTooltipMouse(v); } /** * Default flags when using IsItemHovered(ImGuiHoveredFlags_ForTooltip) or BeginItemTooltip()\/SetItemTooltip() while using keyboard\/gamepad. */ get HoverFlagsForTooltipNav() { return this.ptr.get_HoverFlagsForTooltipNav(); } set HoverFlagsForTooltipNav(v) { this.ptr.set_HoverFlagsForTooltipNav(v); } /** * Scale all spacing\/padding\/thickness values. Do not scale fonts. */ ScaleAllSizes(scale_factor) { this.ptr.ImGuiStyle_ScaleAllSizes(scale_factor); } } export class ImGuiIO extends StructBinding { /** * = 0 \/\/ See ImGuiConfigFlags_ enum. Set by user\/application. Keyboard\/Gamepad navigation options, etc. */ get ConfigFlags() { return this.ptr.get_ConfigFlags(); } set ConfigFlags(v) { this.ptr.set_ConfigFlags(v); } /** * = 0 \/\/ See ImGuiBackendFlags_ enum. Set by backend (imgui_impl_xxx files or custom backend) to communicate features supported by the backend. */ get BackendFlags() { return this.ptr.get_BackendFlags(); } set BackendFlags(v) { this.ptr.set_BackendFlags(v); } /** * <unset> \/\/ Main display size, in pixels (== GetMainViewport()->Size). May change every frame. */ get DisplaySize() { return ImVec2.From(this.ptr.get_DisplaySize()); } set DisplaySize(v) { this.ptr.set_DisplaySize(v); } /** * = (1, 1) \/\/ Main display density. For retina display where window coordinates are different from framebuffer coordinates. This will affect font density + will end up in ImDrawData::FramebufferScale. */ get DisplayFramebufferScale() { return ImVec2.From(this.ptr.get_DisplayFramebufferScale()); } set DisplayFramebufferScale(v) { this.ptr.set_DisplayFramebufferScale(v); } /** * = 1.0f\/60.0f \/\/ Time elapsed since last frame, in seconds. May change every frame. */ get DeltaTime() { return this.ptr.get_DeltaTime(); } set DeltaTime(v) { this.ptr.set_DeltaTime(v); } /** * = 5.0f \/\/ Minimum time between saving positions\/sizes to .ini file, in seconds. */ get IniSavingRate() { return this.ptr.get_IniSavingRate(); } set IniSavingRate(v) { this.ptr.set_IniSavingRate(v); } /** * = "imgui.ini" \/\/ Path to .ini file (important: default "imgui.ini" is relative to current working dir!). Set NULL to disable automatic .ini loading\/saving or if you want to manually call LoadIniSettingsXXX() \/ SaveIniSettingsXXX() functions. */ get IniFilename() { return this.ptr.get_IniFilename(); } set IniFilename(v) { this.ptr.set_IniFilename(v); } /** * = "imgui_log.txt"\/\/ Path to .log file (default parameter to ImGui::LogToFile when no file is specified). */ get LogFilename() { return this.ptr.get_LogFilename(); } set LogFilename(v) { this.ptr.set_LogFilename(v); } /** * = NULL \/\/ Store your own data. */ get UserData() { return this.ptr.get_UserData(); } set UserData(v) { this.ptr.set_UserData(v); } // Font system /** * <auto> \/\/ Font atlas: load, rasterize and pack one or more fonts into a single texture. */ get Fonts() { return ImFontAtlas.From(this.ptr.get_Fonts()); } set Fonts(v) { this.ptr.set_Fonts(v); } /** * = NULL \/\/ Font to use on NewFrame(). Use NULL to uses Fonts->Fonts[0]. */ get FontDefault() { return ImFont.From(this.ptr.get_FontDefault()); } set FontDefault(v) { this.ptr.set_FontDefault(v); } /** * = false \/\/ [OBSOLETE] Allow user scaling text of individual window with CTRL+Wheel. */ get FontAllowUserScaling() { return this.ptr.get_FontAllowUserScaling(); } set FontAllowUserScaling(v) { this.ptr.set_FontAllowUserScaling(v); } // Keyboard\/Gamepad Navigation options /** * = false \/\/ Swap Activate<>Cancel (A<>B) buttons, matching typical "Nintendo\/Japanese style" gamepad layout. */ get ConfigNavSwapGamepadButtons() { return this.ptr.get_ConfigNavSwapGamepadButtons(); } set ConfigNavSwapGamepadButtons(v) { this.ptr.set_ConfigNavSwapGamepadButtons(v); } /** * = false \/\/ Directional\/tabbing navigation teleports the mouse cursor. May be useful on TV\/console systems where moving a virtual mouse is difficult. Will update io.MousePos and set io.WantSetMousePos=true. */ get ConfigNavMoveSetMousePos() { return this.ptr.get_ConfigNavMoveSetMousePos(); } set ConfigNavMoveSetMousePos(v) { this.ptr.set_ConfigNavMoveSetMousePos(v); } /** * = true \/\/ Sets io.WantCaptureKeyboard when io.NavActive is set. */ get ConfigNavCaptureKeyboard() { return this.ptr.get_ConfigNavCaptureKeyboard(); } set ConfigNavCaptureKeyboard(v) { this.ptr.set_ConfigNavCaptureKeyboard(v); } /** * = true \/\/ Pressing Escape can clear focused item + navigation id\/highlight. Set to false if you want to always keep highlight on. */ get ConfigNavEscapeClearFocusItem() { return this.ptr.get_ConfigNavEscapeClearFocusItem(); } set ConfigNavEscapeClearFocusItem(v) { this.ptr.set_ConfigNavEscapeClearFocusItem(v); } /** * = false \/\/ Pressing Escape can clear focused window as well (super set of io.ConfigNavEscapeClearFocusItem). */ get ConfigNavEscapeClearFocusWindow() { return this.ptr.get_ConfigNavEscapeClearFocusWindow(); } set ConfigNavEscapeClearFocusWindow(v) { this.ptr.set_ConfigNavEscapeClearFocusWindow(v); } /** * = true \/\/ Using directional navigation key makes the cursor visible. Mouse click hides the cursor. */ get ConfigNavCursorVisibleAuto() { return this.ptr.get_ConfigNavCursorVisibleAuto(); } set ConfigNavCursorVisibleAuto(v) { this.ptr.set_ConfigNavCursorVisibleAuto(v); } /** * = false \/\/ Navigation cursor is always visible. */ get ConfigNavCursorVisibleAlways() { return this.ptr.get_ConfigNavCursorVisibleAlways(); } set ConfigNavCursorVisibleAlways(v) { this.ptr.set_ConfigNavCursorVisibleAlways(v); } // Docking options (when ImGuiConfigFlags_DockingEnable is set) /** * = false \/\/ Simplified docking mode: disable window splitting, so docking is limited to merging multiple windows together into tab-bars. */ get ConfigDockingNoSplit() { return this.ptr.get_ConfigDockingNoSplit(); } set ConfigDockingNoSplit(v) { this.ptr.set_ConfigDockingNoSplit(v); } /** * = false \/\/ Enable docking with holding Shift key (reduce visual noise, allows dropping in wider space) */ get ConfigDockingWithShift() { return this.ptr.get_ConfigDockingWithShift(); } set ConfigDockingWithShift(v) { this.ptr.set_ConfigDockingWithShift(v); } /** * = false \/\/ [BETA] [FIXME: This currently creates regression with auto-sizing and general overhead] Make every single floating window display within a docking node. */ get ConfigDockingAlwaysTabBar() { return this.ptr.get_ConfigDockingAlwaysTabBar(); } set ConfigDockingAlwaysTabBar(v) { this.ptr.set_ConfigDockingAlwaysTabBar(v); } /** * = false \/\/ [BETA] Make window or viewport transparent when docking and only display docking boxes on the target viewport. Useful if rendering of multiple viewport cannot be synced. Best used with ConfigViewportsNoAutoMerge. */ get ConfigDockingTransparentPayload() { return this.ptr.get_ConfigDockingTransparentPayload(); } set ConfigDockingTransparentPayload(v) { this.ptr.set_ConfigDockingTransparentPayload(v); } // Viewport options (when ImGuiConfigFlags_ViewportsEnable is set) /** * = false; \/\/ Set to make all floating imgui windows always create their own viewport. Otherwise, they are merged into the main host viewports when overlapping it. May also set ImGuiViewportFlags_NoAutoMerge on individual viewport. */ get ConfigViewportsNoAutoMerge() { return this.ptr.get_ConfigViewportsNoAutoMerge(); } set ConfigViewportsNoAutoMerge(v) { this.ptr.set_ConfigViewportsNoAutoMerge(v); } /** * = false \/\/ Disable default OS task bar icon flag for secondary viewports. When a viewport doesn't want a task bar icon, ImGuiViewportFlags_NoTaskBarIcon will be set on it. */ get ConfigViewportsNoTaskBarIcon() { return this.ptr.get_ConfigViewportsNoTaskBarIcon(); } set ConfigViewportsNoTaskBarIcon(v) { this.ptr.set_ConfigViewportsNoTaskBarIcon(v); } /** * = true \/\/ Disable default OS window decoration flag for secondary viewports. When a viewport doesn't want window decorations, ImGuiViewportFlags_NoDecoration will be set on it. Enabling decoration can create subsequent issues at OS levels (e.g. minimum window size). */ get ConfigViewportsNoDecoration() { return this.ptr.get_ConfigViewportsNoDecoration(); } set ConfigViewportsNoDecoration(v) { this.ptr.set_ConfigViewportsNoDecoration(v); } /** * = true \/\/ When false: set secondary viewports' ParentViewportId to main viewport ID by default. Expects the platform backend to setup a parent\/child relationship between the OS windows based on this value. Some backend may ignore this. Set to true if you want viewports to automatically be parent of main viewport, otherwise all viewports will be top-level OS windows. */ get ConfigViewportsNoDefaultParent() { return this.ptr.get_ConfigViewportsNoDefaultParent(); } set ConfigViewportsNoDefaultParent(v) { this.ptr.set_ConfigViewportsNoDefaultParent(v); } /** * true \/\/ When a platform window is focused (e.g. using Alt+Tab, clicking Platform Title Bar), apply corresponding focus on imgui windows (may clear focus\/active id from imgui windows location in other platform windows). In principle this is better enabled but we provide an opt-out, because some Linux window managers tend to eagerly focus windows (e.g. on mouse hover, or even a simple window pos\/size change). */ get ConfigViewportsPlatformFocusSetsImGuiFocus() { return this.ptr.get_ConfigViewportsPlatformFocusSetsImGuiFocus(); } set ConfigViewportsPlatformFocusSetsImGuiFocus(v) { this.ptr.set_ConfigViewportsPlatformFocusSetsImGuiFocus(v); } // DPI\/Scaling options // This may keep evolving during 1.92.x releases. Expect some turbulence. /** * = false \/\/ [EXPERIMENTAL] Automatically overwrite style.FontScaleDpi when Monitor DPI changes. This will scale fonts but _NOT_ scale sizes\/padding for now. */ get ConfigDpiScaleFonts() { return this.ptr.get_ConfigDpiScaleFonts(); } set ConfigDpiScaleFonts(v) { this.ptr.set_ConfigDpiScaleFonts(v); } /** * = false \/\/ [EXPERIMENTAL] Scale Dear ImGui and Platform Windows when Monitor DPI changes. */ get ConfigDpiScaleViewports() { return this.ptr.get_ConfigDpiScaleViewports(); } set ConfigDpiScaleViewports(v) { this.ptr.set_ConfigDpiScaleViewports(v); } // Miscellaneous options // (you can visualize and interact with all options in 'Demo->Configuration') /** * = false \/\/ Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by backend implementations. */ get MouseDrawCursor() { return this.ptr.get_MouseDrawCursor(); } set MouseDrawCursor(v) { this.ptr.set_MouseDrawCursor(v); } /** * = defined(__APPLE__) \/\/ Swap Cmd<>Ctrl keys + OS X style text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd\/Super instead of Ctrl, Line\/Text Start and End using Cmd+Arrows instead of Home\/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd\/Super instead of Ctrl. */ get ConfigMacOSXBehaviors() { return this.ptr.get_ConfigMacOSXBehaviors(); } set ConfigMacOSXBehaviors(v) { this.ptr.set_ConfigMacOSXBehaviors(v); } /** * = true \/\/ Enable input queue trickling: some types of events submitted during the same frame (e.g. button down + up) will be spread over multiple frames, improving interactions with low framerates. */ get ConfigInputTrickleEventQueue() { return this.ptr.get_ConfigInputTrickleEventQueue(); } set ConfigInputTrickleEventQueue(v) { this.ptr.set_ConfigInputTrickleEventQueue(v); } /** * = true \/\/ Enable blinking cursor (optional as some users consider it to be distracting). */ get ConfigInputTextCursorBlink() { return this.ptr.get_ConfigInputTextCursorBlink(); } set ConfigInputTextCursorBlink(v) { this.ptr.set_ConfigInputTextCursorBlink(v); } /** * = false \/\/ [BETA] Pressing Enter will keep item active and select contents (single-line only). */ get ConfigInputTextEnterKeepActive() { return this.ptr.get_ConfigInputTextEnterKeepActive(); } set ConfigInputTextEnterKeepActive(v) { this.ptr.set_ConfigInputTextEnterKeepActive(v); } /** * = false \/\/ [BETA] Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving). Not desirable on devices without a keyboard. */ get ConfigDragClickToInputText() { return this.ptr.get_ConfigDragClickToInputText(); } set ConfigDragClickToInputText(v) { this.ptr.set_ConfigDragClickToInputText(v); } /** * = true \/\/ Enable resizing of windows from their edges and from the lower-left corner. This requires ImGuiBackendFlags_HasMouseCursors for better mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag) */ get ConfigWindowsResizeFromEdges() { return this.ptr.get_ConfigWindowsResizeFromEdges(); } set ConfigWindowsResizeFromEdges(v) { this.ptr.set_ConfigWindowsResizeFromEdges(v); } /** * = false \/\/ Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar. */ get ConfigWindowsMoveFromTitleBarOnly() { return this.ptr.get_ConfigWindowsMoveFromTitleBarOnly(); } set ConfigWindowsMoveFromTitleBarOnly(v) { this.ptr.set_ConfigWindowsMoveFromTitleBarOnly(v); } /** * = false \/\/ [EXPERIMENTAL] CTRL+C copy the contents of focused window into the clipboard. Experimental because: (1) has known issues with nested Begin\/End pairs (2) text output quality varies (3) text output is in submission order rather than spatial order. */ get ConfigWindowsCopyContentsWithCtrlC() { return this.ptr.get_ConfigWindowsCopyContentsWithCtrlC(); } set ConfigWindowsCopyContentsWithCtrlC(v) { this.ptr.set_ConfigWindowsCopyContentsWithCtrlC(v); } /** * = true \/\/ Enable scrolling page by page when clicking outside the scrollbar grab. When disabled, always scroll to clicked location. When enabled, Shift+Click scrolls to clicked location. */ get ConfigScrollbarScrollByPage() { return this.ptr.get_ConfigScrollbarScrollByPage(); } set ConfigScrollbarScrollByPage(v) { this.ptr.set_ConfigScrollbarScrollByPage(v); } /** * = 60.0f \/\/ Timer (in seconds) to free transient windows\/tables memory buffers when unused. Set to -1.0f to disable. */ get ConfigMemoryCompactTimer() { return this.ptr.get_ConfigMemoryCompactTimer(); } set ConfigMemoryCompactTimer(v) { this.ptr.set_ConfigMemoryCompactTimer(v); } // Inputs Behaviors // (other variables, ones which are expected to be tweaked within UI code, are exposed in ImGuiStyle) /** * = 0.30f \/\/ Time for a double-click, in seconds. */ get MouseDoubleClickTime() { return this.ptr.get_MouseDoubleClickTime(); } set MouseDoubleClickTime(v) { this.ptr.set_MouseDoubleClickTime(v); } /** * = 6.0f \/\/ Distance threshold to stay in to validate a double-click, in pixels. */ get MouseDoubleClickMaxDist() { return this.ptr.get_MouseDoubleClickMaxDist(); } set MouseDoubleClickMaxDist(v) { this.ptr.set_MouseDoubleClickMaxDist(v); } /** * = 6.0f \/\/ Distance threshold before considering we are dragging. */ get MouseDragThreshold() { return this.ptr.get_MouseDragThreshold(); } set MouseDragThreshold(v) { this.ptr.set_MouseDragThreshold(v); } /** * = 0.275f \/\/ When holding a key\/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.). */ get KeyRepeatDelay() { return this.ptr.get_KeyRepeatDelay(); } set KeyRepeatDelay(v) { this.ptr.set_KeyRepeatDelay(v); } /** * = 0.050f \/\/ When holding a key\/button, rate at which it repeats, in seconds. */ get KeyRepeatRate() { return this.ptr.get_KeyRepeatRate(); } set KeyRepeatRate(v) { this.ptr.set_KeyRepeatRate(v); } // Options to configure Error Handling and how we handle recoverable errors [EXPERIMENTAL] // - Error recovery is provided as a way to facilitate: // - Recovery after a programming error (native code or scripting language - the later tends to facilitate iterating on code while running). // - Recovery after running an exception handler or any error processing which may skip code after an error has been detected. // - Error recovery is not perfect nor guaranteed! It is a feature to ease development. // You not are not supposed to rely on it in the course of a normal application run. // - Functions that support error recovery are using IM_ASSERT_USER_ERROR() instead of IM_ASSERT(). // - By design, we do NOT allow error recovery to be 100% silent. One of the three options needs to be checked! // - Always ensure that on programmers seats you have at minimum Asserts or Tooltips enabled when making direct imgui API calls! // Otherwise it would severely hinder your ability to catch and correct mistakes! // Read https:\/\/github.com\/ocornut\/imgui\/wiki\/Error-Handling for details. // - Programmer seats: keep asserts (default), or disable asserts and keep error tooltips (new and nice!) // - Non-programmer seats: maybe disable asserts, but make sure errors are resurfaced (tooltips, visible log entries, use callback etc.) // - Recovery after error\/exception: record stack sizes with ErrorRecoveryStoreState(), disable assert, set log callback (to e.g. trigger high-level breakpoint), recover with ErrorRecoveryTryToRecoverState(), restore settings. /** * = true \/\/ Enable error recovery support. Some errors won't be detected and lead to direct crashes if recovery is disabled. */ get ConfigErrorRecovery() { return this.ptr.get_ConfigErrorRecovery(); } set ConfigErrorRecovery(v) { this.ptr.set_ConfigErrorRecovery(v); } /** * = true \/\/ Enable asserts on recoverable error. By default call IM_ASSERT() when returning from a failing IM_ASSERT_USER_ERROR() */ get ConfigErrorRecoveryEnableAssert() { return this.ptr.get_ConfigErrorRecoveryEnableAssert(); } set ConfigErrorRecoveryEnableAssert(v) { this.ptr.set_ConfigErrorRecoveryEnableAssert(v); } /** * = true \/\/ Enable debug log output on recoverable errors. */ get ConfigErrorRecoveryEnableDebugLog() { return this.ptr.get_ConfigErrorRecoveryEnableDebugLog(); } set ConfigErrorRecoveryEnableDebugLog(v) { this.ptr.set_ConfigErrorRecoveryEnableDebugLog(v); } /** * = true \/\/ Enable tooltip on recoverable errors. The tooltip include a way to enable asserts if they were disabled. */ get ConfigErrorRecoveryEnableTooltip() { return this.ptr.get_ConfigErrorRecoveryEnableTooltip(); } set ConfigErrorRecoveryEnableTooltip(v) { this.ptr.set_ConfigErrorRecoveryEnableTooltip(v); } // Option to enable various debug tools showing buttons that will call the IM_DEBUG_BREAK() macro. // - The Item Picker tool will be available regardless of this being enabled, in order to maximize its discoverability. // - Requires a debugger being attached, otherwise IM_DEBUG_BREAK() options will appear to crash your application. // e.g. io.ConfigDebugIsDebuggerPresent = ::IsDebuggerPresent() on Win32, or refer to ImOsIsDebuggerPresent() imgui_test_engine\/imgui_te_utils.cpp for a U