mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Update imgui to f87e891f.
This commit is contained in:
parent
f25c43462a
commit
27ab25709d
1156
imgui/imgui.cpp
1156
imgui/imgui.cpp
File diff suppressed because it is too large
Load Diff
422
imgui/imgui.h
422
imgui/imgui.h
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.88
|
// dear imgui, v1.89 WIP
|
||||||
// (headers)
|
// (headers)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
@ -20,6 +20,14 @@
|
|||||||
// - For first-time users having issues compiling/linking/running or issues loading fonts:
|
// - For first-time users having issues compiling/linking/running or issues loading fonts:
|
||||||
// please post in https://github.com/ocornut/imgui/discussions if you cannot find a solution in resources above.
|
// please post in https://github.com/ocornut/imgui/discussions if you cannot find a solution in resources above.
|
||||||
|
|
||||||
|
// Library Version
|
||||||
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345')
|
||||||
|
#define IMGUI_VERSION "1.89 WIP"
|
||||||
|
#define IMGUI_VERSION_NUM 18832
|
||||||
|
#define IMGUI_HAS_TABLE
|
||||||
|
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
||||||
|
#define IMGUI_HAS_DOCK // Docking WIP branch
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Index of this file:
|
Index of this file:
|
||||||
@ -42,13 +50,12 @@ Index of this file:
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// Configuration file with compile-time options (edit imconfig.h or '#define IMGUI_USER_CONFIG "myfilename.h" from your build system')
|
// Configuration file with compile-time options
|
||||||
|
// (edit imconfig.h or '#define IMGUI_USER_CONFIG "myfilename.h" from your build system')
|
||||||
#ifdef IMGUI_USER_CONFIG
|
#ifdef IMGUI_USER_CONFIG
|
||||||
#include IMGUI_USER_CONFIG
|
#include IMGUI_USER_CONFIG
|
||||||
#endif
|
#endif
|
||||||
#if !defined(IMGUI_DISABLE_INCLUDE_IMCONFIG_H) || defined(IMGUI_INCLUDE_IMCONFIG_H)
|
|
||||||
#include "imconfig.h"
|
#include "imconfig.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE
|
#ifndef IMGUI_DISABLE
|
||||||
|
|
||||||
@ -62,15 +69,6 @@ Index of this file:
|
|||||||
#include <stddef.h> // ptrdiff_t, NULL
|
#include <stddef.h> // ptrdiff_t, NULL
|
||||||
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
|
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
|
||||||
|
|
||||||
// Version
|
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
|
||||||
#define IMGUI_VERSION "1.88"
|
|
||||||
#define IMGUI_VERSION_NUM 18800
|
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
|
||||||
#define IMGUI_HAS_TABLE
|
|
||||||
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
|
||||||
#define IMGUI_HAS_DOCK // Docking WIP branch
|
|
||||||
|
|
||||||
// Define attributes of all API symbols declarations (e.g. for DLL under Windows)
|
// Define attributes of all API symbols declarations (e.g. for DLL under Windows)
|
||||||
// IMGUI_API is used for core imgui functions, IMGUI_IMPL_API is used for the default backends files (imgui_impl_xxx.h)
|
// IMGUI_API is used for core imgui functions, IMGUI_IMPL_API is used for the default backends files (imgui_impl_xxx.h)
|
||||||
// Using dear imgui via a shared library is not recommended, because we don't guarantee backward nor forward ABI compatibility (also function call overhead, as dear imgui is a call-heavy API)
|
// Using dear imgui via a shared library is not recommended, because we don't guarantee backward nor forward ABI compatibility (also function call overhead, as dear imgui is a call-heavy API)
|
||||||
@ -89,6 +87,7 @@ Index of this file:
|
|||||||
#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*(_ARR)))) // Size of a static C-style array. Don't use on pointers!
|
#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*(_ARR)))) // Size of a static C-style array. Don't use on pointers!
|
||||||
#define IM_UNUSED(_VAR) ((void)(_VAR)) // Used to silence "unused variable warnings". Often useful as asserts may be stripped out from final builds.
|
#define IM_UNUSED(_VAR) ((void)(_VAR)) // Used to silence "unused variable warnings". Often useful as asserts may be stripped out from final builds.
|
||||||
#define IM_OFFSETOF(_TYPE,_MEMBER) offsetof(_TYPE, _MEMBER) // Offset of _MEMBER within _TYPE. Standardized as offsetof() in C++11
|
#define IM_OFFSETOF(_TYPE,_MEMBER) offsetof(_TYPE, _MEMBER) // Offset of _MEMBER within _TYPE. Standardized as offsetof() in C++11
|
||||||
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
|
|
||||||
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions.
|
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions.
|
||||||
#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && !defined(__clang__)
|
#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && !defined(__clang__)
|
||||||
@ -167,21 +166,26 @@ struct ImGuiTextFilter; // Helper to parse and apply text filters (e
|
|||||||
struct ImGuiViewport; // A Platform Window (always 1 unless multi-viewport are enabled. One per platform window to output to). In the future may represent Platform Monitor
|
struct ImGuiViewport; // A Platform Window (always 1 unless multi-viewport are enabled. One per platform window to output to). In the future may represent Platform Monitor
|
||||||
struct ImGuiWindowClass; // Window class (rare/advanced uses: provide hints to the platform backend via altered viewport flags and parent/child info)
|
struct ImGuiWindowClass; // Window class (rare/advanced uses: provide hints to the platform backend via altered viewport flags and parent/child info)
|
||||||
|
|
||||||
// Enums/Flags (declared as int for compatibility with old C++, to allow using as flags without overhead, and to not pollute the top of this file)
|
// Enumerations
|
||||||
|
// - We don't use strongly typed enums much because they add constraints (can't extend in private code, can't store typed in bit fields, extra casting on iteration)
|
||||||
// - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists!
|
// - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists!
|
||||||
// In Visual Studio IDE: CTRL+comma ("Edit.GoToAll") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
|
// In Visual Studio IDE: CTRL+comma ("Edit.GoToAll") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
|
||||||
// With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments.
|
// With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments.
|
||||||
|
enum ImGuiKey : int; // -> enum ImGuiKey // Enum: A key identifier (ImGuiKey_XXX or ImGuiMod_XXX value)
|
||||||
typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color identifier for styling
|
typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color identifier for styling
|
||||||
typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A condition for many Set*() functions
|
typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A condition for many Set*() functions
|
||||||
typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type
|
typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type
|
||||||
typedef int ImGuiDir; // -> enum ImGuiDir_ // Enum: A cardinal direction
|
typedef int ImGuiDir; // -> enum ImGuiDir_ // Enum: A cardinal direction
|
||||||
typedef int ImGuiKey; // -> enum ImGuiKey_ // Enum: A key identifier
|
|
||||||
typedef int ImGuiNavInput; // -> enum ImGuiNavInput_ // Enum: An input identifier for navigation
|
|
||||||
typedef int ImGuiMouseButton; // -> enum ImGuiMouseButton_ // Enum: A mouse button identifier (0=left, 1=right, 2=middle)
|
typedef int ImGuiMouseButton; // -> enum ImGuiMouseButton_ // Enum: A mouse button identifier (0=left, 1=right, 2=middle)
|
||||||
typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse cursor identifier
|
typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse cursor identifier
|
||||||
typedef int ImGuiSortDirection; // -> enum ImGuiSortDirection_ // Enum: A sorting direction (ascending or descending)
|
typedef int ImGuiSortDirection; // -> enum ImGuiSortDirection_ // Enum: A sorting direction (ascending or descending)
|
||||||
typedef int ImGuiStyleVar; // -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling
|
typedef int ImGuiStyleVar; // -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling
|
||||||
typedef int ImGuiTableBgTarget; // -> enum ImGuiTableBgTarget_ // Enum: A color target for TableSetBgColor()
|
typedef int ImGuiTableBgTarget; // -> enum ImGuiTableBgTarget_ // Enum: A color target for TableSetBgColor()
|
||||||
|
|
||||||
|
// Flags (declared as int for compatibility with old C++, to allow using as flags without overhead, and to not pollute the top of this file)
|
||||||
|
// - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists!
|
||||||
|
// In Visual Studio IDE: CTRL+comma ("Edit.GoToAll") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
|
||||||
|
// With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments.
|
||||||
typedef int ImDrawFlags; // -> enum ImDrawFlags_ // Flags: for ImDrawList functions
|
typedef int ImDrawFlags; // -> enum ImDrawFlags_ // Flags: for ImDrawList functions
|
||||||
typedef int ImDrawListFlags; // -> enum ImDrawListFlags_ // Flags: for ImDrawList instance
|
typedef int ImDrawListFlags; // -> enum ImDrawListFlags_ // Flags: for ImDrawList instance
|
||||||
typedef int ImFontAtlasFlags; // -> enum ImFontAtlasFlags_ // Flags: for ImFontAtlas build
|
typedef int ImFontAtlasFlags; // -> enum ImFontAtlasFlags_ // Flags: for ImFontAtlas build
|
||||||
@ -195,7 +199,7 @@ typedef int ImGuiDragDropFlags; // -> enum ImGuiDragDropFlags_ // Flags: f
|
|||||||
typedef int ImGuiFocusedFlags; // -> enum ImGuiFocusedFlags_ // Flags: for IsWindowFocused()
|
typedef int ImGuiFocusedFlags; // -> enum ImGuiFocusedFlags_ // Flags: for IsWindowFocused()
|
||||||
typedef int ImGuiHoveredFlags; // -> enum ImGuiHoveredFlags_ // Flags: for IsItemHovered(), IsWindowHovered() etc.
|
typedef int ImGuiHoveredFlags; // -> enum ImGuiHoveredFlags_ // Flags: for IsItemHovered(), IsWindowHovered() etc.
|
||||||
typedef int ImGuiInputTextFlags; // -> enum ImGuiInputTextFlags_ // Flags: for InputText(), InputTextMultiline()
|
typedef int ImGuiInputTextFlags; // -> enum ImGuiInputTextFlags_ // Flags: for InputText(), InputTextMultiline()
|
||||||
typedef int ImGuiModFlags; // -> enum ImGuiModFlags_ // Flags: for io.KeyMods (Ctrl/Shift/Alt/Super)
|
typedef int ImGuiKeyChord; // -> ImGuiKey | ImGuiMod_XXX // Flags: for storage only for now: an ImGuiKey optionally OR-ed with one or more ImGuiMod_XXX values.
|
||||||
typedef int ImGuiPopupFlags; // -> enum ImGuiPopupFlags_ // Flags: for OpenPopup*(), BeginPopupContext*(), IsPopupOpen()
|
typedef int ImGuiPopupFlags; // -> enum ImGuiPopupFlags_ // Flags: for OpenPopup*(), BeginPopupContext*(), IsPopupOpen()
|
||||||
typedef int ImGuiSelectableFlags; // -> enum ImGuiSelectableFlags_ // Flags: for Selectable()
|
typedef int ImGuiSelectableFlags; // -> enum ImGuiSelectableFlags_ // Flags: for Selectable()
|
||||||
typedef int ImGuiSliderFlags; // -> enum ImGuiSliderFlags_ // Flags: for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc.
|
typedef int ImGuiSliderFlags; // -> enum ImGuiSliderFlags_ // Flags: for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc.
|
||||||
@ -309,7 +313,7 @@ namespace ImGui
|
|||||||
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = 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)
|
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = 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)
|
||||||
IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles.
|
IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles.
|
||||||
IMGUI_API void ShowFontSelector(const char* label); // add font selector block (not a window), essentially a combo listing the loaded fonts.
|
IMGUI_API void ShowFontSelector(const char* label); // add font selector block (not a window), essentially a combo listing the loaded fonts.
|
||||||
IMGUI_API void ShowUserGuide(); // add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls).
|
IMGUI_API void ShowUserGuide(); // add basic help/info block (not a window): how to manipulate ImGui as an end-user (mouse/keyboard controls).
|
||||||
IMGUI_API const char* GetVersion(); // get the compiled version string e.g. "1.80 WIP" (essentially the value for IMGUI_VERSION from the compiled version of imgui.cpp)
|
IMGUI_API const char* GetVersion(); // get the compiled version string e.g. "1.80 WIP" (essentially the value for IMGUI_VERSION from the compiled version of imgui.cpp)
|
||||||
|
|
||||||
// Styles
|
// Styles
|
||||||
@ -384,7 +388,7 @@ namespace ImGui
|
|||||||
IMGUI_API ImVec2 GetContentRegionAvail(); // == GetContentRegionMax() - GetCursorPos()
|
IMGUI_API ImVec2 GetContentRegionAvail(); // == GetContentRegionMax() - GetCursorPos()
|
||||||
IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
|
IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
|
||||||
IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min for the full window (roughly (0,0)-Scroll), in window coordinates
|
IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min for the full window (roughly (0,0)-Scroll), in window coordinates
|
||||||
IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max for the full window (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates
|
IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max for the full window (roughly (0,0)+Size-Scroll) where Size can be overridden with SetNextWindowContentSize(), in window coordinates
|
||||||
|
|
||||||
// Windows Scrolling
|
// Windows Scrolling
|
||||||
IMGUI_API float GetScrollX(); // get scrolling amount [0 .. GetScrollMaxX()]
|
IMGUI_API float GetScrollX(); // get scrolling amount [0 .. GetScrollMaxX()]
|
||||||
@ -439,7 +443,7 @@ namespace ImGui
|
|||||||
// Absolute coordinate: GetCursorScreenPos(), SetCursorScreenPos(), all ImDrawList:: functions.
|
// Absolute coordinate: GetCursorScreenPos(), SetCursorScreenPos(), all ImDrawList:: functions.
|
||||||
IMGUI_API void Separator(); // separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator.
|
IMGUI_API void Separator(); // separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator.
|
||||||
IMGUI_API void SameLine(float offset_from_start_x=0.0f, float spacing=-1.0f); // call between widgets or groups to layout them horizontally. X position given in window coordinates.
|
IMGUI_API void SameLine(float offset_from_start_x=0.0f, float spacing=-1.0f); // call between widgets or groups to layout them horizontally. X position given in window coordinates.
|
||||||
IMGUI_API void NewLine(); // undo a SameLine() or force a new line when in an horizontal-layout context.
|
IMGUI_API void NewLine(); // undo a SameLine() or force a new line when in a horizontal-layout context.
|
||||||
IMGUI_API void Spacing(); // add vertical spacing.
|
IMGUI_API void Spacing(); // add vertical spacing.
|
||||||
IMGUI_API void Dummy(const ImVec2& size); // add a dummy item of given size. unlike InvisibleButton(), Dummy() won't take the mouse click or be navigable into.
|
IMGUI_API void Dummy(const ImVec2& size); // add a dummy item of given size. unlike InvisibleButton(), Dummy() won't take the mouse click or be navigable into.
|
||||||
IMGUI_API void Indent(float indent_w = 0.0f); // move content position toward the right, by indent_w, or style.IndentSpacing if indent_w <= 0
|
IMGUI_API void Indent(float indent_w = 0.0f); // move content position toward the right, by indent_w, or style.IndentSpacing if indent_w <= 0
|
||||||
@ -503,8 +507,6 @@ namespace ImGui
|
|||||||
IMGUI_API bool SmallButton(const char* label); // button with FramePadding=(0,0) to easily embed within text
|
IMGUI_API bool SmallButton(const char* label); // button with FramePadding=(0,0) to easily embed within text
|
||||||
IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size, ImGuiButtonFlags flags = 0); // flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.)
|
IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size, ImGuiButtonFlags flags = 0); // flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.)
|
||||||
IMGUI_API bool ArrowButton(const char* str_id, ImGuiDir dir); // square button with an arrow shape
|
IMGUI_API bool ArrowButton(const char* str_id, ImGuiDir dir); // square button with an arrow shape
|
||||||
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0));
|
|
||||||
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,0), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no padding
|
|
||||||
IMGUI_API bool Checkbox(const char* label, bool* v);
|
IMGUI_API bool Checkbox(const char* label, bool* v);
|
||||||
IMGUI_API bool CheckboxFlags(const char* label, int* flags, int flags_value);
|
IMGUI_API bool CheckboxFlags(const char* label, int* flags, int flags_value);
|
||||||
IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
||||||
@ -513,6 +515,11 @@ namespace ImGui
|
|||||||
IMGUI_API void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-FLT_MIN, 0), const char* overlay = NULL);
|
IMGUI_API void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-FLT_MIN, 0), const char* overlay = NULL);
|
||||||
IMGUI_API void Bullet(); // draw a small circle + keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses
|
IMGUI_API void Bullet(); // draw a small circle + keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses
|
||||||
|
|
||||||
|
// Widgets: Images
|
||||||
|
// - Read about ImTextureID here: https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples
|
||||||
|
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec4& border_col = ImVec4(0, 0, 0, 0));
|
||||||
|
IMGUI_API bool ImageButton(const char* str_id, ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1));
|
||||||
|
|
||||||
// Widgets: Combo Box
|
// Widgets: Combo Box
|
||||||
// - The BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items.
|
// - The BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items.
|
||||||
// - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. This is analogous to how ListBox are created.
|
// - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. This is analogous to how ListBox are created.
|
||||||
@ -524,7 +531,7 @@ namespace ImGui
|
|||||||
|
|
||||||
// Widgets: Drag Sliders
|
// Widgets: Drag Sliders
|
||||||
// - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp.
|
// - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp.
|
||||||
// - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v',
|
// - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every function, note that a 'float v[X]' function argument is the same as 'float* v',
|
||||||
// the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
// the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
||||||
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
||||||
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
||||||
@ -532,7 +539,7 @@ namespace ImGui
|
|||||||
// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits if ImGuiSliderFlags_AlwaysClamp is not used.
|
// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits if ImGuiSliderFlags_AlwaysClamp is not used.
|
||||||
// - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.
|
// - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.
|
||||||
// - We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.
|
// - We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.
|
||||||
// - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
// - Legacy: Pre-1.78 there are DragXXX() function signatures that take a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
||||||
// If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361
|
// If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361
|
||||||
IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0); // If v_min >= v_max we have no bound
|
IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0); // If v_min >= v_max we have no bound
|
||||||
IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
||||||
@ -551,7 +558,7 @@ namespace ImGui
|
|||||||
// - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp.
|
// - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp.
|
||||||
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
||||||
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
||||||
// - Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
// - Legacy: Pre-1.78 there are SliderXXX() function signatures that take a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
||||||
// If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361
|
// If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361
|
||||||
IMGUI_API bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0); // adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display.
|
IMGUI_API bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0); // adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display.
|
||||||
IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
||||||
@ -609,7 +616,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3);
|
IMGUI_API bool TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3);
|
||||||
IMGUI_API bool TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3);
|
IMGUI_API bool TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3);
|
||||||
IMGUI_API void TreePush(const char* str_id); // ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call TreePush/TreePop yourself if desired.
|
IMGUI_API void TreePush(const char* str_id); // ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call TreePush/TreePop yourself if desired.
|
||||||
IMGUI_API void TreePush(const void* ptr_id = NULL); // "
|
IMGUI_API void TreePush(const void* ptr_id); // "
|
||||||
IMGUI_API void TreePop(); // ~ Unindent()+PopId()
|
IMGUI_API void TreePop(); // ~ Unindent()+PopId()
|
||||||
IMGUI_API float GetTreeNodeToLabelSpacing(); // horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode
|
IMGUI_API float GetTreeNodeToLabelSpacing(); // horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode
|
||||||
IMGUI_API bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0); // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop().
|
IMGUI_API bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0); // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop().
|
||||||
@ -679,7 +686,7 @@ namespace ImGui
|
|||||||
|
|
||||||
// Popups: begin/end functions
|
// Popups: begin/end functions
|
||||||
// - BeginPopup(): query popup state, if open start appending into the window. Call EndPopup() afterwards. ImGuiWindowFlags are forwarded to the window.
|
// - BeginPopup(): query popup state, if open start appending into the window. Call EndPopup() afterwards. ImGuiWindowFlags are forwarded to the window.
|
||||||
// - BeginPopupModal(): block every interactions behind the window, cannot be closed by user, add a dimming background, has a title bar.
|
// - BeginPopupModal(): block every interaction behind the window, cannot be closed by user, add a dimming background, has a title bar.
|
||||||
IMGUI_API bool BeginPopup(const char* str_id, ImGuiWindowFlags flags = 0); // return true if the popup is open, and you can start outputting to it.
|
IMGUI_API bool BeginPopup(const char* str_id, ImGuiWindowFlags flags = 0); // return true if the popup is open, and you can start outputting to it.
|
||||||
IMGUI_API bool BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); // return true if the modal is open, and you can start outputting to it.
|
IMGUI_API bool BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); // return true if the modal is open, and you can start outputting to it.
|
||||||
IMGUI_API void EndPopup(); // only call EndPopup() if BeginPopupXXX() returns true!
|
IMGUI_API void EndPopup(); // only call EndPopup() if BeginPopupXXX() returns true!
|
||||||
@ -723,7 +730,7 @@ namespace ImGui
|
|||||||
// - 4. Optionally call TableHeadersRow() to submit a header row. Names are pulled from TableSetupColumn() data.
|
// - 4. Optionally call TableHeadersRow() to submit a header row. Names are pulled from TableSetupColumn() data.
|
||||||
// - 5. Populate contents:
|
// - 5. Populate contents:
|
||||||
// - In most situations you can use TableNextRow() + TableSetColumnIndex(N) to start appending into a column.
|
// - In most situations you can use TableNextRow() + TableSetColumnIndex(N) to start appending into a column.
|
||||||
// - If you are using tables as a sort of grid, where every columns is holding the same type of contents,
|
// - If you are using tables as a sort of grid, where every column is holding the same type of contents,
|
||||||
// you may prefer using TableNextColumn() instead of TableNextRow() + TableSetColumnIndex().
|
// you may prefer using TableNextColumn() instead of TableNextRow() + TableSetColumnIndex().
|
||||||
// TableNextColumn() will automatically wrap-around into the next row if needed.
|
// TableNextColumn() will automatically wrap-around into the next row if needed.
|
||||||
// - IMPORTANT: Comparatively to the old Columns() API, we need to call TableNextColumn() for the first column!
|
// - IMPORTANT: Comparatively to the old Columns() API, we need to call TableNextColumn() for the first column!
|
||||||
@ -855,12 +862,12 @@ namespace ImGui
|
|||||||
IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags = 0); // is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options.
|
IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags = 0); // is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options.
|
||||||
IMGUI_API bool IsItemActive(); // 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)
|
IMGUI_API bool IsItemActive(); // 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)
|
||||||
IMGUI_API bool IsItemFocused(); // is the last item focused for keyboard/gamepad navigation?
|
IMGUI_API bool IsItemFocused(); // is the last item focused for keyboard/gamepad navigation?
|
||||||
IMGUI_API bool IsItemClicked(ImGuiMouseButton mouse_button = 0); // is the last item hovered and mouse clicked on? (**) == IsMouseClicked(mouse_button) && IsItemHovered()Important. (**) this it NOT equivalent to the behavior of e.g. Button(). Read comments in function definition.
|
IMGUI_API bool IsItemClicked(ImGuiMouseButton mouse_button = 0); // is the last item hovered and mouse clicked on? (**) == IsMouseClicked(mouse_button) && IsItemHovered()Important. (**) this is NOT equivalent to the behavior of e.g. Button(). Read comments in function definition.
|
||||||
IMGUI_API bool IsItemVisible(); // is the last item visible? (items may be out of sight because of clipping/scrolling)
|
IMGUI_API bool IsItemVisible(); // is the last item visible? (items may be out of sight because of clipping/scrolling)
|
||||||
IMGUI_API bool IsItemEdited(); // 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.
|
IMGUI_API bool IsItemEdited(); // 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.
|
||||||
IMGUI_API bool IsItemActivated(); // was the last item just made active (item was previously inactive).
|
IMGUI_API bool IsItemActivated(); // was the last item just made active (item was previously inactive).
|
||||||
IMGUI_API bool IsItemDeactivated(); // was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that requires continuous editing.
|
IMGUI_API bool IsItemDeactivated(); // was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that require continuous editing.
|
||||||
IMGUI_API bool IsItemDeactivatedAfterEdit(); // was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that requires continuous editing. Note that you may get false positives (some widgets such as Combo()/ListBox()/Selectable() will return true even when clicking an already selected item).
|
IMGUI_API bool IsItemDeactivatedAfterEdit(); // was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that require 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).
|
||||||
IMGUI_API bool IsItemToggledOpen(); // was the last item open state toggled? set by TreeNode().
|
IMGUI_API bool IsItemToggledOpen(); // was the last item open state toggled? set by TreeNode().
|
||||||
IMGUI_API bool IsAnyItemHovered(); // is any item hovered?
|
IMGUI_API bool IsAnyItemHovered(); // is any item hovered?
|
||||||
IMGUI_API bool IsAnyItemActive(); // is any item active?
|
IMGUI_API bool IsAnyItemActive(); // is any item active?
|
||||||
@ -981,6 +988,7 @@ namespace ImGui
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Flags for ImGui::Begin()
|
// Flags for ImGui::Begin()
|
||||||
|
// (Those are per-window flags. There are shared flags in ImGuiIO: io.ConfigWindowsResizeFromEdges and io.ConfigWindowsMoveFromTitleBarOnly)
|
||||||
enum ImGuiWindowFlags_
|
enum ImGuiWindowFlags_
|
||||||
{
|
{
|
||||||
ImGuiWindowFlags_None = 0,
|
ImGuiWindowFlags_None = 0,
|
||||||
@ -1017,13 +1025,11 @@ enum ImGuiWindowFlags_
|
|||||||
ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For internal use by BeginPopup()
|
ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For internal use by BeginPopup()
|
||||||
ImGuiWindowFlags_Modal = 1 << 27, // Don't use! For internal use by BeginPopupModal()
|
ImGuiWindowFlags_Modal = 1 << 27, // Don't use! For internal use by BeginPopupModal()
|
||||||
ImGuiWindowFlags_ChildMenu = 1 << 28, // Don't use! For internal use by BeginMenu()
|
ImGuiWindowFlags_ChildMenu = 1 << 28, // Don't use! For internal use by BeginMenu()
|
||||||
ImGuiWindowFlags_DockNodeHost = 1 << 29 // Don't use! For internal use by Begin()/NewFrame()
|
ImGuiWindowFlags_DockNodeHost = 1 << 29, // Don't use! For internal use by Begin()/NewFrame()
|
||||||
|
|
||||||
// [Obsolete]
|
|
||||||
//ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // [Obsolete] --> Set io.ConfigWindowsResizeFromEdges=true and make sure mouse cursors are supported by backend (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::InputText()
|
// Flags for ImGui::InputText()
|
||||||
|
// (Those are per-item flags. There are shared flags in ImGuiIO: io.ConfigInputTextCursorBlink and io.ConfigInputTextEnterKeepActive)
|
||||||
enum ImGuiInputTextFlags_
|
enum ImGuiInputTextFlags_
|
||||||
{
|
{
|
||||||
ImGuiInputTextFlags_None = 0,
|
ImGuiInputTextFlags_None = 0,
|
||||||
@ -1046,11 +1052,12 @@ enum ImGuiInputTextFlags_
|
|||||||
ImGuiInputTextFlags_NoUndoRedo = 1 << 16, // Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().
|
ImGuiInputTextFlags_NoUndoRedo = 1 << 16, // Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().
|
||||||
ImGuiInputTextFlags_CharsScientific = 1 << 17, // Allow 0123456789.+-*/eE (Scientific notation input)
|
ImGuiInputTextFlags_CharsScientific = 1 << 17, // Allow 0123456789.+-*/eE (Scientific notation input)
|
||||||
ImGuiInputTextFlags_CallbackResize = 1 << 18, // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)
|
ImGuiInputTextFlags_CallbackResize = 1 << 18, // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)
|
||||||
ImGuiInputTextFlags_CallbackEdit = 1 << 19 // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)
|
ImGuiInputTextFlags_CallbackEdit = 1 << 19, // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)
|
||||||
|
ImGuiInputTextFlags_EscapeClearsAll = 1 << 20, // Escape key clears content if not empty, and deactivate otherwise (constrast to default behavior of Escape to revert)
|
||||||
|
|
||||||
// Obsolete names (will be removed soon)
|
// Obsolete names (will be removed soon)
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
, ImGuiInputTextFlags_AlwaysInsertMode = ImGuiInputTextFlags_AlwaysOverwrite // [renamed in 1.82] name was not matching behavior
|
ImGuiInputTextFlags_AlwaysInsertMode = ImGuiInputTextFlags_AlwaysOverwrite // [renamed in 1.82] name was not matching behavior
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1073,7 +1080,7 @@ enum ImGuiTreeNodeFlags_
|
|||||||
ImGuiTreeNodeFlags_SpanFullWidth = 1 << 12, // Extend hit box to the left-most and right-most edges (bypass the indented area).
|
ImGuiTreeNodeFlags_SpanFullWidth = 1 << 12, // Extend hit box to the left-most and right-most edges (bypass the indented area).
|
||||||
ImGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 13, // (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop)
|
ImGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 13, // (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop)
|
||||||
//ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 14, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible
|
//ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 14, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible
|
||||||
ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_NoAutoOpenOnLog
|
ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_NoAutoOpenOnLog,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for OpenPopup*(), BeginPopupContext*(), IsPopupOpen() functions.
|
// Flags for OpenPopup*(), BeginPopupContext*(), IsPopupOpen() functions.
|
||||||
@ -1082,7 +1089,7 @@ enum ImGuiTreeNodeFlags_
|
|||||||
// It is therefore guaranteed to be legal to pass a mouse button index in ImGuiPopupFlags.
|
// It is therefore guaranteed to be legal to pass a mouse button index in ImGuiPopupFlags.
|
||||||
// - For the same reason, we exceptionally default the ImGuiPopupFlags argument of BeginPopupContextXXX functions to 1 instead of 0.
|
// - For the same reason, we exceptionally default the ImGuiPopupFlags argument of BeginPopupContextXXX functions to 1 instead of 0.
|
||||||
// IMPORTANT: because the default parameter is 1 (==ImGuiPopupFlags_MouseButtonRight), if you rely on the default parameter
|
// IMPORTANT: because the default parameter is 1 (==ImGuiPopupFlags_MouseButtonRight), if you rely on the default parameter
|
||||||
// and want to another another flag, you need to pass in the ImGuiPopupFlags_MouseButtonRight flag.
|
// and want to use another flag, you need to pass in the ImGuiPopupFlags_MouseButtonRight flag explicitly.
|
||||||
// - Multiple buttons currently cannot be combined/or-ed in those functions (we could allow it later).
|
// - Multiple buttons currently cannot be combined/or-ed in those functions (we could allow it later).
|
||||||
enum ImGuiPopupFlags_
|
enum ImGuiPopupFlags_
|
||||||
{
|
{
|
||||||
@ -1096,18 +1103,18 @@ enum ImGuiPopupFlags_
|
|||||||
ImGuiPopupFlags_NoOpenOverItems = 1 << 6, // For BeginPopupContextWindow(): don't return true when hovering items, only when hovering empty space
|
ImGuiPopupFlags_NoOpenOverItems = 1 << 6, // For BeginPopupContextWindow(): don't return true when hovering items, only when hovering empty space
|
||||||
ImGuiPopupFlags_AnyPopupId = 1 << 7, // For IsPopupOpen(): ignore the ImGuiID parameter and test for any popup.
|
ImGuiPopupFlags_AnyPopupId = 1 << 7, // For IsPopupOpen(): ignore the ImGuiID parameter and test for any popup.
|
||||||
ImGuiPopupFlags_AnyPopupLevel = 1 << 8, // For IsPopupOpen(): search/test at any level of the popup stack (default test in the current level)
|
ImGuiPopupFlags_AnyPopupLevel = 1 << 8, // For IsPopupOpen(): search/test at any level of the popup stack (default test in the current level)
|
||||||
ImGuiPopupFlags_AnyPopup = ImGuiPopupFlags_AnyPopupId | ImGuiPopupFlags_AnyPopupLevel
|
ImGuiPopupFlags_AnyPopup = ImGuiPopupFlags_AnyPopupId | ImGuiPopupFlags_AnyPopupLevel,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::Selectable()
|
// Flags for ImGui::Selectable()
|
||||||
enum ImGuiSelectableFlags_
|
enum ImGuiSelectableFlags_
|
||||||
{
|
{
|
||||||
ImGuiSelectableFlags_None = 0,
|
ImGuiSelectableFlags_None = 0,
|
||||||
ImGuiSelectableFlags_DontClosePopups = 1 << 0, // Clicking this don't close parent popup window
|
ImGuiSelectableFlags_DontClosePopups = 1 << 0, // Clicking this doesn't close parent popup window
|
||||||
ImGuiSelectableFlags_SpanAllColumns = 1 << 1, // Selectable frame can span all columns (text will still fit in current column)
|
ImGuiSelectableFlags_SpanAllColumns = 1 << 1, // Selectable frame can span all columns (text will still fit in current column)
|
||||||
ImGuiSelectableFlags_AllowDoubleClick = 1 << 2, // Generate press events on double clicks too
|
ImGuiSelectableFlags_AllowDoubleClick = 1 << 2, // Generate press events on double clicks too
|
||||||
ImGuiSelectableFlags_Disabled = 1 << 3, // Cannot be selected, display grayed out text
|
ImGuiSelectableFlags_Disabled = 1 << 3, // Cannot be selected, display grayed out text
|
||||||
ImGuiSelectableFlags_AllowItemOverlap = 1 << 4 // (WIP) Hit testing to allow subsequent widgets to overlap this one
|
ImGuiSelectableFlags_AllowItemOverlap = 1 << 4, // (WIP) Hit testing to allow subsequent widgets to overlap this one
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::BeginCombo()
|
// Flags for ImGui::BeginCombo()
|
||||||
@ -1121,7 +1128,7 @@ enum ImGuiComboFlags_
|
|||||||
ImGuiComboFlags_HeightLargest = 1 << 4, // As many fitting items as possible
|
ImGuiComboFlags_HeightLargest = 1 << 4, // As many fitting items as possible
|
||||||
ImGuiComboFlags_NoArrowButton = 1 << 5, // Display on the preview box without the square arrow button
|
ImGuiComboFlags_NoArrowButton = 1 << 5, // Display on the preview box without the square arrow button
|
||||||
ImGuiComboFlags_NoPreview = 1 << 6, // Display only a square arrow button
|
ImGuiComboFlags_NoPreview = 1 << 6, // Display only a square arrow button
|
||||||
ImGuiComboFlags_HeightMask_ = ImGuiComboFlags_HeightSmall | ImGuiComboFlags_HeightRegular | ImGuiComboFlags_HeightLarge | ImGuiComboFlags_HeightLargest
|
ImGuiComboFlags_HeightMask_ = ImGuiComboFlags_HeightSmall | ImGuiComboFlags_HeightRegular | ImGuiComboFlags_HeightLarge | ImGuiComboFlags_HeightLargest,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::BeginTabBar()
|
// Flags for ImGui::BeginTabBar()
|
||||||
@ -1137,7 +1144,7 @@ enum ImGuiTabBarFlags_
|
|||||||
ImGuiTabBarFlags_FittingPolicyResizeDown = 1 << 6, // Resize tabs when they don't fit
|
ImGuiTabBarFlags_FittingPolicyResizeDown = 1 << 6, // Resize tabs when they don't fit
|
||||||
ImGuiTabBarFlags_FittingPolicyScroll = 1 << 7, // Add scroll buttons when tabs don't fit
|
ImGuiTabBarFlags_FittingPolicyScroll = 1 << 7, // Add scroll buttons when tabs don't fit
|
||||||
ImGuiTabBarFlags_FittingPolicyMask_ = ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_FittingPolicyScroll,
|
ImGuiTabBarFlags_FittingPolicyMask_ = ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_FittingPolicyScroll,
|
||||||
ImGuiTabBarFlags_FittingPolicyDefault_ = ImGuiTabBarFlags_FittingPolicyResizeDown
|
ImGuiTabBarFlags_FittingPolicyDefault_ = ImGuiTabBarFlags_FittingPolicyResizeDown,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::BeginTabItem()
|
// Flags for ImGui::BeginTabItem()
|
||||||
@ -1151,7 +1158,7 @@ enum ImGuiTabItemFlags_
|
|||||||
ImGuiTabItemFlags_NoTooltip = 1 << 4, // Disable tooltip for the given tab
|
ImGuiTabItemFlags_NoTooltip = 1 << 4, // Disable tooltip for the given tab
|
||||||
ImGuiTabItemFlags_NoReorder = 1 << 5, // Disable reordering this tab or having another tab cross over this tab
|
ImGuiTabItemFlags_NoReorder = 1 << 5, // Disable reordering this tab or having another tab cross over this tab
|
||||||
ImGuiTabItemFlags_Leading = 1 << 6, // Enforce the tab position to the left of the tab bar (after the tab list popup button)
|
ImGuiTabItemFlags_Leading = 1 << 6, // Enforce the tab position to the left of the tab bar (after the tab list popup button)
|
||||||
ImGuiTabItemFlags_Trailing = 1 << 7 // Enforce the tab position to the right of the tab bar (before the scrolling buttons)
|
ImGuiTabItemFlags_Trailing = 1 << 7, // Enforce the tab position to the right of the tab bar (before the scrolling buttons)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::BeginTable()
|
// Flags for ImGui::BeginTable()
|
||||||
@ -1171,7 +1178,7 @@ enum ImGuiTabItemFlags_
|
|||||||
// - When ScrollX is on:
|
// - When ScrollX is on:
|
||||||
// - Table defaults to ImGuiTableFlags_SizingFixedFit -> all Columns defaults to ImGuiTableColumnFlags_WidthFixed
|
// - Table defaults to ImGuiTableFlags_SizingFixedFit -> all Columns defaults to ImGuiTableColumnFlags_WidthFixed
|
||||||
// - Columns sizing policy allowed: Fixed/Auto mostly.
|
// - Columns sizing policy allowed: Fixed/Auto mostly.
|
||||||
// - Fixed Columns can be enlarged as needed. Table will show an horizontal scrollbar if needed.
|
// - Fixed Columns can be enlarged as needed. Table will show a horizontal scrollbar if needed.
|
||||||
// - When using auto-resizing (non-resizable) fixed columns, querying the content width to use item right-alignment e.g. SetNextItemWidth(-FLT_MIN) doesn't make sense, would create a feedback loop.
|
// - When using auto-resizing (non-resizable) fixed columns, querying the content width to use item right-alignment e.g. SetNextItemWidth(-FLT_MIN) doesn't make sense, would create a feedback loop.
|
||||||
// - Using Stretch columns OFTEN DOES NOT MAKE SENSE if ScrollX is on, UNLESS you have specified a value for 'inner_width' in BeginTable().
|
// - Using Stretch columns OFTEN DOES NOT MAKE SENSE if ScrollX is on, UNLESS you have specified a value for 'inner_width' in BeginTable().
|
||||||
// If you specify a value for 'inner_width' then effectively the scrolling space is known and Stretch or mixed Fixed/Stretch columns become meaningful again.
|
// If you specify a value for 'inner_width' then effectively the scrolling space is known and Stretch or mixed Fixed/Stretch columns become meaningful again.
|
||||||
@ -1197,8 +1204,8 @@ enum ImGuiTableFlags_
|
|||||||
ImGuiTableFlags_BordersInner = ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_BordersInnerH, // Draw inner borders.
|
ImGuiTableFlags_BordersInner = ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_BordersInnerH, // Draw inner borders.
|
||||||
ImGuiTableFlags_BordersOuter = ImGuiTableFlags_BordersOuterV | ImGuiTableFlags_BordersOuterH, // Draw outer borders.
|
ImGuiTableFlags_BordersOuter = ImGuiTableFlags_BordersOuterV | ImGuiTableFlags_BordersOuterH, // Draw outer borders.
|
||||||
ImGuiTableFlags_Borders = ImGuiTableFlags_BordersInner | ImGuiTableFlags_BordersOuter, // Draw all borders.
|
ImGuiTableFlags_Borders = ImGuiTableFlags_BordersInner | ImGuiTableFlags_BordersOuter, // Draw all borders.
|
||||||
ImGuiTableFlags_NoBordersInBody = 1 << 11, // [ALPHA] Disable vertical borders in columns Body (borders will always appears in Headers). -> May move to style
|
ImGuiTableFlags_NoBordersInBody = 1 << 11, // [ALPHA] Disable vertical borders in columns Body (borders will always appear in Headers). -> May move to style
|
||||||
ImGuiTableFlags_NoBordersInBodyUntilResize = 1 << 12, // [ALPHA] Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers). -> May move to style
|
ImGuiTableFlags_NoBordersInBodyUntilResize = 1 << 12, // [ALPHA] Disable vertical borders in columns Body until hovered for resize (borders will always appear in Headers). -> May move to style
|
||||||
// Sizing Policy (read above for defaults)
|
// Sizing Policy (read above for defaults)
|
||||||
ImGuiTableFlags_SizingFixedFit = 1 << 13, // Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching contents width.
|
ImGuiTableFlags_SizingFixedFit = 1 << 13, // Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching contents width.
|
||||||
ImGuiTableFlags_SizingFixedSame = 2 << 13, // Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching the maximum contents width of all columns. Implicitly enable ImGuiTableFlags_NoKeepColumnsVisible.
|
ImGuiTableFlags_SizingFixedSame = 2 << 13, // Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching the maximum contents width of all columns. Implicitly enable ImGuiTableFlags_NoKeepColumnsVisible.
|
||||||
@ -1212,24 +1219,18 @@ enum ImGuiTableFlags_
|
|||||||
// Clipping
|
// Clipping
|
||||||
ImGuiTableFlags_NoClip = 1 << 20, // Disable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with TableSetupScrollFreeze().
|
ImGuiTableFlags_NoClip = 1 << 20, // Disable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with TableSetupScrollFreeze().
|
||||||
// Padding
|
// Padding
|
||||||
ImGuiTableFlags_PadOuterX = 1 << 21, // Default if BordersOuterV is on. Enable outer-most padding. Generally desirable if you have headers.
|
ImGuiTableFlags_PadOuterX = 1 << 21, // Default if BordersOuterV is on. Enable outermost padding. Generally desirable if you have headers.
|
||||||
ImGuiTableFlags_NoPadOuterX = 1 << 22, // Default if BordersOuterV is off. Disable outer-most padding.
|
ImGuiTableFlags_NoPadOuterX = 1 << 22, // Default if BordersOuterV is off. Disable outermost padding.
|
||||||
ImGuiTableFlags_NoPadInnerX = 1 << 23, // Disable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off).
|
ImGuiTableFlags_NoPadInnerX = 1 << 23, // Disable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off).
|
||||||
// Scrolling
|
// Scrolling
|
||||||
ImGuiTableFlags_ScrollX = 1 << 24, // Enable horizontal scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. Changes default sizing policy. Because this create a child window, ScrollY is currently generally recommended when using ScrollX.
|
ImGuiTableFlags_ScrollX = 1 << 24, // Enable horizontal scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. Changes default sizing policy. Because this creates a child window, ScrollY is currently generally recommended when using ScrollX.
|
||||||
ImGuiTableFlags_ScrollY = 1 << 25, // Enable vertical scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size.
|
ImGuiTableFlags_ScrollY = 1 << 25, // Enable vertical scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size.
|
||||||
// Sorting
|
// Sorting
|
||||||
ImGuiTableFlags_SortMulti = 1 << 26, // Hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1).
|
ImGuiTableFlags_SortMulti = 1 << 26, // Hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1).
|
||||||
ImGuiTableFlags_SortTristate = 1 << 27, // Allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0).
|
ImGuiTableFlags_SortTristate = 1 << 27, // Allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0).
|
||||||
|
|
||||||
// [Internal] Combinations and masks
|
// [Internal] Combinations and masks
|
||||||
ImGuiTableFlags_SizingMask_ = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_SizingFixedSame | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_SizingStretchSame
|
ImGuiTableFlags_SizingMask_ = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_SizingFixedSame | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_SizingStretchSame,
|
||||||
|
|
||||||
// Obsolete names (will be removed soon)
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
||||||
//, ImGuiTableFlags_ColumnsWidthFixed = ImGuiTableFlags_SizingFixedFit, ImGuiTableFlags_ColumnsWidthStretch = ImGuiTableFlags_SizingStretchSame // WIP Tables 2020/12
|
|
||||||
//, ImGuiTableFlags_SizingPolicyFixed = ImGuiTableFlags_SizingFixedFit, ImGuiTableFlags_SizingPolicyStretch = ImGuiTableFlags_SizingStretchSame // WIP Tables 2021/01
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::TableSetupColumn()
|
// Flags for ImGui::TableSetupColumn()
|
||||||
@ -1266,19 +1267,14 @@ enum ImGuiTableColumnFlags_
|
|||||||
ImGuiTableColumnFlags_WidthMask_ = ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_WidthFixed,
|
ImGuiTableColumnFlags_WidthMask_ = ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_WidthFixed,
|
||||||
ImGuiTableColumnFlags_IndentMask_ = ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_IndentDisable,
|
ImGuiTableColumnFlags_IndentMask_ = ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_IndentDisable,
|
||||||
ImGuiTableColumnFlags_StatusMask_ = ImGuiTableColumnFlags_IsEnabled | ImGuiTableColumnFlags_IsVisible | ImGuiTableColumnFlags_IsSorted | ImGuiTableColumnFlags_IsHovered,
|
ImGuiTableColumnFlags_StatusMask_ = ImGuiTableColumnFlags_IsEnabled | ImGuiTableColumnFlags_IsVisible | ImGuiTableColumnFlags_IsSorted | ImGuiTableColumnFlags_IsHovered,
|
||||||
ImGuiTableColumnFlags_NoDirectResize_ = 1 << 30 // [Internal] Disable user resizing this column directly (it may however we resized indirectly from its left edge)
|
ImGuiTableColumnFlags_NoDirectResize_ = 1 << 30, // [Internal] Disable user resizing this column directly (it may however we resized indirectly from its left edge)
|
||||||
|
|
||||||
// Obsolete names (will be removed soon)
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
||||||
//ImGuiTableColumnFlags_WidthAuto = ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoResize, // Column will not stretch and keep resizing based on submitted contents.
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::TableNextRow()
|
// Flags for ImGui::TableNextRow()
|
||||||
enum ImGuiTableRowFlags_
|
enum ImGuiTableRowFlags_
|
||||||
{
|
{
|
||||||
ImGuiTableRowFlags_None = 0,
|
ImGuiTableRowFlags_None = 0,
|
||||||
ImGuiTableRowFlags_Headers = 1 << 0 // Identify header row (set default background color + width of its contents accounted differently for auto column width)
|
ImGuiTableRowFlags_Headers = 1 << 0, // Identify header row (set default background color + width of its contents accounted differently for auto column width)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Enum for ImGui::TableSetBgColor()
|
// Enum for ImGui::TableSetBgColor()
|
||||||
@ -1286,7 +1282,7 @@ enum ImGuiTableRowFlags_
|
|||||||
// - Layer 0: draw with RowBg0 color if set, otherwise draw with ColumnBg0 if set.
|
// - Layer 0: draw with RowBg0 color if set, otherwise draw with ColumnBg0 if set.
|
||||||
// - Layer 1: draw with RowBg1 color if set, otherwise draw with ColumnBg1 if set.
|
// - Layer 1: draw with RowBg1 color if set, otherwise draw with ColumnBg1 if set.
|
||||||
// - Layer 2: draw with CellBg color if set.
|
// - Layer 2: draw with CellBg color if set.
|
||||||
// The purpose of the two row/columns layers is to let you decide if a background color changes should override or blend with the existing color.
|
// The purpose of the two row/columns layers is to let you decide if a background color change should override or blend with the existing color.
|
||||||
// When using ImGuiTableFlags_RowBg on the table, each row has the RowBg0 color automatically set for odd/even rows.
|
// When using ImGuiTableFlags_RowBg on the table, each row has the RowBg0 color automatically set for odd/even rows.
|
||||||
// If you set the color of RowBg0 target, your color will override the existing RowBg0 color.
|
// If you set the color of RowBg0 target, your color will override the existing RowBg0 color.
|
||||||
// If you set the color of RowBg1 or ColumnBg1 target, your color will blend over the RowBg0 color.
|
// If you set the color of RowBg1 or ColumnBg1 target, your color will blend over the RowBg0 color.
|
||||||
@ -1295,7 +1291,7 @@ enum ImGuiTableBgTarget_
|
|||||||
ImGuiTableBgTarget_None = 0,
|
ImGuiTableBgTarget_None = 0,
|
||||||
ImGuiTableBgTarget_RowBg0 = 1, // Set row background color 0 (generally used for background, automatically set when ImGuiTableFlags_RowBg is used)
|
ImGuiTableBgTarget_RowBg0 = 1, // Set row background color 0 (generally used for background, automatically set when ImGuiTableFlags_RowBg is used)
|
||||||
ImGuiTableBgTarget_RowBg1 = 2, // Set row background color 1 (generally used for selection marking)
|
ImGuiTableBgTarget_RowBg1 = 2, // Set row background color 1 (generally used for selection marking)
|
||||||
ImGuiTableBgTarget_CellBg = 3 // Set cell background color (top-most color)
|
ImGuiTableBgTarget_CellBg = 3, // Set cell background color (top-most color)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::IsWindowFocused()
|
// Flags for ImGui::IsWindowFocused()
|
||||||
@ -1307,7 +1303,7 @@ enum ImGuiFocusedFlags_
|
|||||||
ImGuiFocusedFlags_AnyWindow = 1 << 2, // Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ!
|
ImGuiFocusedFlags_AnyWindow = 1 << 2, // Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ!
|
||||||
ImGuiFocusedFlags_NoPopupHierarchy = 1 << 3, // Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow)
|
ImGuiFocusedFlags_NoPopupHierarchy = 1 << 3, // Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow)
|
||||||
ImGuiFocusedFlags_DockHierarchy = 1 << 4, // Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow)
|
ImGuiFocusedFlags_DockHierarchy = 1 << 4, // Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow)
|
||||||
ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows
|
ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered()
|
// Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered()
|
||||||
@ -1328,7 +1324,12 @@ enum ImGuiHoveredFlags_
|
|||||||
ImGuiHoveredFlags_AllowWhenDisabled = 1 << 9, // IsItemHovered() only: Return true even if the item is disabled
|
ImGuiHoveredFlags_AllowWhenDisabled = 1 << 9, // IsItemHovered() only: Return true even if the item is disabled
|
||||||
ImGuiHoveredFlags_NoNavOverride = 1 << 10, // Disable using gamepad/keyboard navigation state when active, always query mouse.
|
ImGuiHoveredFlags_NoNavOverride = 1 << 10, // Disable using gamepad/keyboard navigation state when active, always query mouse.
|
||||||
ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped,
|
ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped,
|
||||||
ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows
|
ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows,
|
||||||
|
|
||||||
|
// Hovering delays (for tooltips)
|
||||||
|
ImGuiHoveredFlags_DelayNormal = 1 << 11, // Return true after io.HoverDelayNormal elapsed (~0.30 sec)
|
||||||
|
ImGuiHoveredFlags_DelayShort = 1 << 12, // Return true after io.HoverDelayShort elapsed (~0.10 sec)
|
||||||
|
ImGuiHoveredFlags_NoSharedDelay = 1 << 13, // Disable shared delay system where moving from one item to the next keeps the previous timer for a short time (standard for tooltips with long delays)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::DockSpace(), shared/inherited by child nodes.
|
// Flags for ImGui::DockSpace(), shared/inherited by child nodes.
|
||||||
@ -1343,7 +1344,7 @@ enum ImGuiDockNodeFlags_
|
|||||||
ImGuiDockNodeFlags_PassthruCentralNode = 1 << 3, // Shared // Enable passthru dockspace: 1) DockSpace() will render a ImGuiCol_WindowBg background covering everything excepted the Central Node when empty. Meaning the host window should probably use SetNextWindowBgAlpha(0.0f) prior to Begin() when using this. 2) When Central Node is empty: let inputs pass-through + won't display a DockingEmptyBg background. See demo for details.
|
ImGuiDockNodeFlags_PassthruCentralNode = 1 << 3, // Shared // Enable passthru dockspace: 1) DockSpace() will render a ImGuiCol_WindowBg background covering everything excepted the Central Node when empty. Meaning the host window should probably use SetNextWindowBgAlpha(0.0f) prior to Begin() when using this. 2) When Central Node is empty: let inputs pass-through + won't display a DockingEmptyBg background. See demo for details.
|
||||||
ImGuiDockNodeFlags_NoSplit = 1 << 4, // Shared/Local // Disable splitting the node into smaller nodes. Useful e.g. when embedding dockspaces into a main root one (the root one may have splitting disabled to reduce confusion). Note: when turned off, existing splits will be preserved.
|
ImGuiDockNodeFlags_NoSplit = 1 << 4, // Shared/Local // Disable splitting the node into smaller nodes. Useful e.g. when embedding dockspaces into a main root one (the root one may have splitting disabled to reduce confusion). Note: when turned off, existing splits will be preserved.
|
||||||
ImGuiDockNodeFlags_NoResize = 1 << 5, // Shared/Local // Disable resizing node using the splitter/separators. Useful with programmatically setup dockspaces.
|
ImGuiDockNodeFlags_NoResize = 1 << 5, // Shared/Local // Disable resizing node using the splitter/separators. Useful with programmatically setup dockspaces.
|
||||||
ImGuiDockNodeFlags_AutoHideTabBar = 1 << 6 // Shared/Local // Tab bar will automatically hide when there is a single window in the dock node.
|
ImGuiDockNodeFlags_AutoHideTabBar = 1 << 6, // Shared/Local // Tab bar will automatically hide when there is a single window in the dock node.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::BeginDragDropSource(), ImGui::AcceptDragDropPayload()
|
// Flags for ImGui::BeginDragDropSource(), ImGui::AcceptDragDropPayload()
|
||||||
@ -1351,8 +1352,8 @@ enum ImGuiDragDropFlags_
|
|||||||
{
|
{
|
||||||
ImGuiDragDropFlags_None = 0,
|
ImGuiDragDropFlags_None = 0,
|
||||||
// BeginDragDropSource() flags
|
// BeginDragDropSource() flags
|
||||||
ImGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0, // By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disable this behavior.
|
ImGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0, // By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disables this behavior.
|
||||||
ImGuiDragDropFlags_SourceNoDisableHover = 1 << 1, // By default, when dragging we clear data so that IsItemHovered() will return false, to avoid subsequent user code submitting tooltips. This flag disable this behavior so you can still call IsItemHovered() on the source item.
|
ImGuiDragDropFlags_SourceNoDisableHover = 1 << 1, // By default, when dragging we clear data so that IsItemHovered() will return false, to avoid subsequent user code submitting tooltips. This flag disables this behavior so you can still call IsItemHovered() on the source item.
|
||||||
ImGuiDragDropFlags_SourceNoHoldToOpenOthers = 1 << 2, // Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item.
|
ImGuiDragDropFlags_SourceNoHoldToOpenOthers = 1 << 2, // Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item.
|
||||||
ImGuiDragDropFlags_SourceAllowNullID = 1 << 3, // Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit.
|
ImGuiDragDropFlags_SourceAllowNullID = 1 << 3, // Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit.
|
||||||
ImGuiDragDropFlags_SourceExtern = 1 << 4, // External source (from outside of dear imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously.
|
ImGuiDragDropFlags_SourceExtern = 1 << 4, // External source (from outside of dear imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously.
|
||||||
@ -1361,7 +1362,7 @@ enum ImGuiDragDropFlags_
|
|||||||
ImGuiDragDropFlags_AcceptBeforeDelivery = 1 << 10, // AcceptDragDropPayload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered.
|
ImGuiDragDropFlags_AcceptBeforeDelivery = 1 << 10, // AcceptDragDropPayload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered.
|
||||||
ImGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 11, // Do not draw the default highlight rectangle when hovering over target.
|
ImGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 11, // Do not draw the default highlight rectangle when hovering over target.
|
||||||
ImGuiDragDropFlags_AcceptNoPreviewTooltip = 1 << 12, // Request hiding the BeginDragDropSource tooltip from the BeginDragDropTarget site.
|
ImGuiDragDropFlags_AcceptNoPreviewTooltip = 1 << 12, // Request hiding the BeginDragDropSource tooltip from the BeginDragDropTarget site.
|
||||||
ImGuiDragDropFlags_AcceptPeekOnly = ImGuiDragDropFlags_AcceptBeforeDelivery | ImGuiDragDropFlags_AcceptNoDrawDefaultRect // For peeking ahead and inspecting the payload before delivery.
|
ImGuiDragDropFlags_AcceptPeekOnly = ImGuiDragDropFlags_AcceptBeforeDelivery | ImGuiDragDropFlags_AcceptNoDrawDefaultRect, // For peeking ahead and inspecting the payload before delivery.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Standard Drag and Drop payload types. You can define you own payload types using short strings. Types starting with '_' are defined by Dear ImGui.
|
// Standard Drag and Drop payload types. You can define you own payload types using short strings. Types starting with '_' are defined by Dear ImGui.
|
||||||
@ -1405,7 +1406,7 @@ enum ImGuiSortDirection_
|
|||||||
|
|
||||||
// Keys value 0 to 511 are left unused as legacy native/opaque key values (< 1.87)
|
// Keys value 0 to 511 are left unused as legacy native/opaque key values (< 1.87)
|
||||||
// Keys value >= 512 are named keys (>= 1.87)
|
// Keys value >= 512 are named keys (>= 1.87)
|
||||||
enum ImGuiKey_
|
enum ImGuiKey : int
|
||||||
{
|
{
|
||||||
// Keyboard
|
// Keyboard
|
||||||
ImGuiKey_None = 0,
|
ImGuiKey_None = 0,
|
||||||
@ -1459,113 +1460,98 @@ enum ImGuiKey_
|
|||||||
ImGuiKey_KeypadEnter,
|
ImGuiKey_KeypadEnter,
|
||||||
ImGuiKey_KeypadEqual,
|
ImGuiKey_KeypadEqual,
|
||||||
|
|
||||||
// Gamepad (some of those are analog values, 0.0f to 1.0f) // NAVIGATION action
|
// Gamepad (some of those are analog values, 0.0f to 1.0f) // GAME NAVIGATION ACTION
|
||||||
ImGuiKey_GamepadStart, // Menu (Xbox) + (Switch) Start/Options (PS) // --
|
// (download controller mapping PNG/PSD at http://dearimgui.org/controls_sheets)
|
||||||
ImGuiKey_GamepadBack, // View (Xbox) - (Switch) Share (PS) // --
|
ImGuiKey_GamepadStart, // Menu (Xbox) + (Switch) Start/Options (PS)
|
||||||
ImGuiKey_GamepadFaceUp, // Y (Xbox) X (Switch) Triangle (PS) // -> ImGuiNavInput_Input
|
ImGuiKey_GamepadBack, // View (Xbox) - (Switch) Share (PS)
|
||||||
ImGuiKey_GamepadFaceDown, // A (Xbox) B (Switch) Cross (PS) // -> ImGuiNavInput_Activate
|
ImGuiKey_GamepadFaceLeft, // X (Xbox) Y (Switch) Square (PS) // Tap: Toggle Menu. Hold: Windowing mode (Focus/Move/Resize windows)
|
||||||
ImGuiKey_GamepadFaceLeft, // X (Xbox) Y (Switch) Square (PS) // -> ImGuiNavInput_Menu
|
ImGuiKey_GamepadFaceRight, // B (Xbox) A (Switch) Circle (PS) // Cancel / Close / Exit
|
||||||
ImGuiKey_GamepadFaceRight, // B (Xbox) A (Switch) Circle (PS) // -> ImGuiNavInput_Cancel
|
ImGuiKey_GamepadFaceUp, // Y (Xbox) X (Switch) Triangle (PS) // Text Input / On-screen Keyboard
|
||||||
ImGuiKey_GamepadDpadUp, // D-pad Up // -> ImGuiNavInput_DpadUp
|
ImGuiKey_GamepadFaceDown, // A (Xbox) B (Switch) Cross (PS) // Activate / Open / Toggle / Tweak
|
||||||
ImGuiKey_GamepadDpadDown, // D-pad Down // -> ImGuiNavInput_DpadDown
|
ImGuiKey_GamepadDpadLeft, // D-pad Left // Move / Tweak / Resize Window (in Windowing mode)
|
||||||
ImGuiKey_GamepadDpadLeft, // D-pad Left // -> ImGuiNavInput_DpadLeft
|
ImGuiKey_GamepadDpadRight, // D-pad Right // Move / Tweak / Resize Window (in Windowing mode)
|
||||||
ImGuiKey_GamepadDpadRight, // D-pad Right // -> ImGuiNavInput_DpadRight
|
ImGuiKey_GamepadDpadUp, // D-pad Up // Move / Tweak / Resize Window (in Windowing mode)
|
||||||
ImGuiKey_GamepadL1, // L Bumper (Xbox) L (Switch) L1 (PS) // -> ImGuiNavInput_FocusPrev + ImGuiNavInput_TweakSlow
|
ImGuiKey_GamepadDpadDown, // D-pad Down // Move / Tweak / Resize Window (in Windowing mode)
|
||||||
ImGuiKey_GamepadR1, // R Bumper (Xbox) R (Switch) R1 (PS) // -> ImGuiNavInput_FocusNext + ImGuiNavInput_TweakFast
|
ImGuiKey_GamepadL1, // L Bumper (Xbox) L (Switch) L1 (PS) // Tweak Slower / Focus Previous (in Windowing mode)
|
||||||
ImGuiKey_GamepadL2, // L Trigger (Xbox) ZL (Switch) L2 (PS) [Analog]
|
ImGuiKey_GamepadR1, // R Bumper (Xbox) R (Switch) R1 (PS) // Tweak Faster / Focus Next (in Windowing mode)
|
||||||
ImGuiKey_GamepadR2, // R Trigger (Xbox) ZR (Switch) R2 (PS) [Analog]
|
ImGuiKey_GamepadL2, // L Trig. (Xbox) ZL (Switch) L2 (PS) [Analog]
|
||||||
ImGuiKey_GamepadL3, // L Thumbstick (Xbox) L3 (Switch) L3 (PS)
|
ImGuiKey_GamepadR2, // R Trig. (Xbox) ZR (Switch) R2 (PS) [Analog]
|
||||||
ImGuiKey_GamepadR3, // R Thumbstick (Xbox) R3 (Switch) R3 (PS)
|
ImGuiKey_GamepadL3, // L Stick (Xbox) L3 (Switch) L3 (PS)
|
||||||
ImGuiKey_GamepadLStickUp, // [Analog] // -> ImGuiNavInput_LStickUp
|
ImGuiKey_GamepadR3, // R Stick (Xbox) R3 (Switch) R3 (PS)
|
||||||
ImGuiKey_GamepadLStickDown, // [Analog] // -> ImGuiNavInput_LStickDown
|
ImGuiKey_GamepadLStickLeft, // [Analog] // Move Window (in Windowing mode)
|
||||||
ImGuiKey_GamepadLStickLeft, // [Analog] // -> ImGuiNavInput_LStickLeft
|
ImGuiKey_GamepadLStickRight, // [Analog] // Move Window (in Windowing mode)
|
||||||
ImGuiKey_GamepadLStickRight, // [Analog] // -> ImGuiNavInput_LStickRight
|
ImGuiKey_GamepadLStickUp, // [Analog] // Move Window (in Windowing mode)
|
||||||
ImGuiKey_GamepadRStickUp, // [Analog]
|
ImGuiKey_GamepadLStickDown, // [Analog] // Move Window (in Windowing mode)
|
||||||
ImGuiKey_GamepadRStickDown, // [Analog]
|
|
||||||
ImGuiKey_GamepadRStickLeft, // [Analog]
|
ImGuiKey_GamepadRStickLeft, // [Analog]
|
||||||
ImGuiKey_GamepadRStickRight, // [Analog]
|
ImGuiKey_GamepadRStickRight, // [Analog]
|
||||||
|
ImGuiKey_GamepadRStickUp, // [Analog]
|
||||||
|
ImGuiKey_GamepadRStickDown, // [Analog]
|
||||||
|
|
||||||
|
// Mouse Buttons (auto-submitted from AddMouseButtonEvent() calls)
|
||||||
|
// - This is mirroring the data also written to io.MouseDown[], io.MouseWheel, in a format allowing them to be accessed via standard key API.
|
||||||
|
ImGuiKey_MouseLeft, ImGuiKey_MouseRight, ImGuiKey_MouseMiddle, ImGuiKey_MouseX1, ImGuiKey_MouseX2, ImGuiKey_MouseWheelX, ImGuiKey_MouseWheelY,
|
||||||
|
|
||||||
|
// [Internal] Reserved for mod storage
|
||||||
|
ImGuiKey_ReservedForModCtrl, ImGuiKey_ReservedForModShift, ImGuiKey_ReservedForModAlt, ImGuiKey_ReservedForModSuper,
|
||||||
|
ImGuiKey_COUNT,
|
||||||
|
|
||||||
// Keyboard Modifiers (explicitly submitted by backend via AddKeyEvent() calls)
|
// Keyboard Modifiers (explicitly submitted by backend via AddKeyEvent() calls)
|
||||||
// - This is mirroring the data also written to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper, in a format allowing
|
// - This is mirroring the data also written to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper, in a format allowing
|
||||||
// them to be accessed via standard key API, allowing calls such as IsKeyPressed(), IsKeyReleased(), querying duration etc.
|
// them to be accessed via standard key API, allowing calls such as IsKeyPressed(), IsKeyReleased(), querying duration etc.
|
||||||
// - Code polling every keys (e.g. an interface to detect a key press for input mapping) might want to ignore those
|
// - Code polling every key (e.g. an interface to detect a key press for input mapping) might want to ignore those
|
||||||
// and prefer using the real keys (e.g. ImGuiKey_LeftCtrl, ImGuiKey_RightCtrl instead of ImGuiKey_ModCtrl).
|
// and prefer using the real keys (e.g. ImGuiKey_LeftCtrl, ImGuiKey_RightCtrl instead of ImGuiMod_Ctrl).
|
||||||
// - In theory the value of keyboard modifiers should be roughly equivalent to a logical or of the equivalent left/right keys.
|
// - In theory the value of keyboard modifiers should be roughly equivalent to a logical or of the equivalent left/right keys.
|
||||||
// In practice: it's complicated; mods are often provided from different sources. Keyboard layout, IME, sticky keys and
|
// In practice: it's complicated; mods are often provided from different sources. Keyboard layout, IME, sticky keys and
|
||||||
// backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user...
|
// backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user...
|
||||||
ImGuiKey_ModCtrl, ImGuiKey_ModShift, ImGuiKey_ModAlt, ImGuiKey_ModSuper,
|
ImGuiMod_None = 0,
|
||||||
|
ImGuiMod_Ctrl = 1 << 12,
|
||||||
|
ImGuiMod_Shift = 1 << 13,
|
||||||
|
ImGuiMod_Alt = 1 << 14, // Option/Menu
|
||||||
|
ImGuiMod_Super = 1 << 15, // Cmd/Super/Windows
|
||||||
|
ImGuiMod_Mask_ = 0xF000,
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
ImGuiMod_Shortcut = ImGuiMod_Super,
|
||||||
|
#else
|
||||||
|
ImGuiMod_Shortcut = ImGuiMod_Ctrl,
|
||||||
|
#endif
|
||||||
|
|
||||||
// End of list
|
// [Internal] Prior to 1.87 we required user to fill io.KeysDown[512] using their own native index + the io.KeyMap[] array.
|
||||||
ImGuiKey_COUNT, // No valid ImGuiKey is ever greater than this value
|
|
||||||
|
|
||||||
// [Internal] Prior to 1.87 we required user to fill io.KeysDown[512] using their own native index + a io.KeyMap[] array.
|
|
||||||
// We are ditching this method but keeping a legacy path for user code doing e.g. IsKeyPressed(MY_NATIVE_KEY_CODE)
|
// We are ditching this method but keeping a legacy path for user code doing e.g. IsKeyPressed(MY_NATIVE_KEY_CODE)
|
||||||
ImGuiKey_NamedKey_BEGIN = 512,
|
ImGuiKey_NamedKey_BEGIN = 512,
|
||||||
ImGuiKey_NamedKey_END = ImGuiKey_COUNT,
|
ImGuiKey_NamedKey_END = ImGuiKey_COUNT,
|
||||||
ImGuiKey_NamedKey_COUNT = ImGuiKey_NamedKey_END - ImGuiKey_NamedKey_BEGIN,
|
ImGuiKey_NamedKey_COUNT = ImGuiKey_NamedKey_END - ImGuiKey_NamedKey_BEGIN,
|
||||||
#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO
|
#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
ImGuiKey_KeysData_SIZE = ImGuiKey_NamedKey_COUNT, // Size of KeysData[]: only hold named keys
|
ImGuiKey_KeysData_SIZE = ImGuiKey_NamedKey_COUNT, // Size of KeysData[]: only hold named keys
|
||||||
ImGuiKey_KeysData_OFFSET = ImGuiKey_NamedKey_BEGIN // First key stored in io.KeysData[0]. Accesses to io.KeysData[] must use (key - ImGuiKey_KeysData_OFFSET).
|
ImGuiKey_KeysData_OFFSET = ImGuiKey_NamedKey_BEGIN, // First key stored in io.KeysData[0]. Accesses to io.KeysData[] must use (key - ImGuiKey_KeysData_OFFSET).
|
||||||
#else
|
#else
|
||||||
ImGuiKey_KeysData_SIZE = ImGuiKey_COUNT, // Size of KeysData[]: hold legacy 0..512 keycodes + named keys
|
ImGuiKey_KeysData_SIZE = ImGuiKey_COUNT, // Size of KeysData[]: hold legacy 0..512 keycodes + named keys
|
||||||
ImGuiKey_KeysData_OFFSET = 0 // First key stored in io.KeysData[0]. Accesses to io.KeysData[] must use (key - ImGuiKey_KeysData_OFFSET).
|
ImGuiKey_KeysData_OFFSET = 0, // First key stored in io.KeysData[0]. Accesses to io.KeysData[] must use (key - ImGuiKey_KeysData_OFFSET).
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
, ImGuiKey_KeyPadEnter = ImGuiKey_KeypadEnter // Renamed in 1.87
|
ImGuiKey_ModCtrl = ImGuiMod_Ctrl, ImGuiKey_ModShift = ImGuiMod_Shift, ImGuiKey_ModAlt = ImGuiMod_Alt, ImGuiKey_ModSuper = ImGuiMod_Super, // Renamed in 1.89
|
||||||
|
ImGuiKey_KeyPadEnter = ImGuiKey_KeypadEnter, // Renamed in 1.87
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper "flags" version of key-mods to store and compare multiple key-mods easily. Sometimes used for storage (e.g. io.KeyMods) but otherwise not much used in public API.
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
enum ImGuiModFlags_
|
// OBSOLETED in 1.88 (from July 2022): ImGuiNavInput and io.NavInputs[].
|
||||||
|
// Official backends between 1.60 and 1.86: will keep working and feed gamepad inputs as long as IMGUI_DISABLE_OBSOLETE_KEYIO is not set.
|
||||||
|
// Custom backends: feed gamepad inputs via io.AddKeyEvent() and ImGuiKey_GamepadXXX enums.
|
||||||
|
enum ImGuiNavInput
|
||||||
{
|
{
|
||||||
ImGuiModFlags_None = 0,
|
ImGuiNavInput_Activate, ImGuiNavInput_Cancel, ImGuiNavInput_Input, ImGuiNavInput_Menu, ImGuiNavInput_DpadLeft, ImGuiNavInput_DpadRight, ImGuiNavInput_DpadUp, ImGuiNavInput_DpadDown,
|
||||||
ImGuiModFlags_Ctrl = 1 << 0,
|
ImGuiNavInput_LStickLeft, ImGuiNavInput_LStickRight, ImGuiNavInput_LStickUp, ImGuiNavInput_LStickDown, ImGuiNavInput_FocusPrev, ImGuiNavInput_FocusNext, ImGuiNavInput_TweakSlow, ImGuiNavInput_TweakFast,
|
||||||
ImGuiModFlags_Shift = 1 << 1,
|
ImGuiNavInput_COUNT,
|
||||||
ImGuiModFlags_Alt = 1 << 2, // Menu
|
|
||||||
ImGuiModFlags_Super = 1 << 3 // Cmd/Super/Windows key
|
|
||||||
};
|
|
||||||
|
|
||||||
// Gamepad/Keyboard navigation
|
|
||||||
// Since >= 1.87 backends you generally don't need to care about this enum since io.NavInputs[] is setup automatically. This might become private/internal some day.
|
|
||||||
// Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.AddKeyEvent() calls.
|
|
||||||
// Gamepad: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. Backend: set ImGuiBackendFlags_HasGamepad and fill the io.NavInputs[] fields before calling NewFrame(). Note that io.NavInputs[] is cleared by EndFrame().
|
|
||||||
// Read instructions in imgui.cpp for more details. Download PNG/PSD at http://dearimgui.org/controls_sheets.
|
|
||||||
enum ImGuiNavInput_
|
|
||||||
{
|
|
||||||
// Gamepad Mapping
|
|
||||||
ImGuiNavInput_Activate, // Activate / Open / Toggle / Tweak value // e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard)
|
|
||||||
ImGuiNavInput_Cancel, // Cancel / Close / Exit // e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard)
|
|
||||||
ImGuiNavInput_Input, // Text input / On-Screen keyboard // e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard)
|
|
||||||
ImGuiNavInput_Menu, // Tap: Toggle menu / Hold: Focus, Move, Resize // e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard)
|
|
||||||
ImGuiNavInput_DpadLeft, // Move / Tweak / Resize window (w/ PadMenu) // e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard)
|
|
||||||
ImGuiNavInput_DpadRight, //
|
|
||||||
ImGuiNavInput_DpadUp, //
|
|
||||||
ImGuiNavInput_DpadDown, //
|
|
||||||
ImGuiNavInput_LStickLeft, // Scroll / Move window (w/ PadMenu) // e.g. Left Analog Stick Left/Right/Up/Down
|
|
||||||
ImGuiNavInput_LStickRight, //
|
|
||||||
ImGuiNavInput_LStickUp, //
|
|
||||||
ImGuiNavInput_LStickDown, //
|
|
||||||
ImGuiNavInput_FocusPrev, // Focus Next window (w/ PadMenu) // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)
|
|
||||||
ImGuiNavInput_FocusNext, // Focus Prev window (w/ PadMenu) // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
|
|
||||||
ImGuiNavInput_TweakSlow, // Slower tweaks // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)
|
|
||||||
ImGuiNavInput_TweakFast, // Faster tweaks // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
|
|
||||||
|
|
||||||
// [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them.
|
|
||||||
// Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) will be directly reading from keyboard keys instead of io.NavInputs[].
|
|
||||||
ImGuiNavInput_KeyLeft_, // Move left // = Arrow keys
|
|
||||||
ImGuiNavInput_KeyRight_, // Move right
|
|
||||||
ImGuiNavInput_KeyUp_, // Move up
|
|
||||||
ImGuiNavInput_KeyDown_, // Move down
|
|
||||||
ImGuiNavInput_COUNT
|
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
// Configuration flags stored in io.ConfigFlags. Set by user/application.
|
// Configuration flags stored in io.ConfigFlags. Set by user/application.
|
||||||
enum ImGuiConfigFlags_
|
enum ImGuiConfigFlags_
|
||||||
{
|
{
|
||||||
ImGuiConfigFlags_None = 0,
|
ImGuiConfigFlags_None = 0,
|
||||||
ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.AddKeyEvent() calls
|
ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navigation enable flag.
|
||||||
ImGuiConfigFlags_NavEnableGamepad = 1 << 1, // Master gamepad navigation enable flag. This is mostly to instruct your imgui backend to fill io.NavInputs[]. Backend also needs to set ImGuiBackendFlags_HasGamepad.
|
ImGuiConfigFlags_NavEnableGamepad = 1 << 1, // Master gamepad navigation enable flag. Backend also needs to set ImGuiBackendFlags_HasGamepad.
|
||||||
ImGuiConfigFlags_NavEnableSetMousePos = 1 << 2, // Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you MUST honor io.WantSetMousePos requests in your backend, otherwise ImGui will react as if the mouse is jumping around back and forth.
|
ImGuiConfigFlags_NavEnableSetMousePos = 1 << 2, // Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you MUST honor io.WantSetMousePos requests in your backend, otherwise ImGui will react as if the mouse is jumping around back and forth.
|
||||||
ImGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3, // Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set.
|
ImGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3, // Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set.
|
||||||
ImGuiConfigFlags_NoMouse = 1 << 4, // Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information set by the backend.
|
ImGuiConfigFlags_NoMouse = 1 << 4, // Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information set by the backend.
|
||||||
@ -1582,7 +1568,7 @@ enum ImGuiConfigFlags_
|
|||||||
|
|
||||||
// User storage (to allow your backend/engine to communicate to code that may be shared between multiple projects. Those flags are NOT used by core Dear ImGui)
|
// User storage (to allow your backend/engine to communicate to code that may be shared between multiple projects. Those flags are NOT used by core Dear ImGui)
|
||||||
ImGuiConfigFlags_IsSRGB = 1 << 20, // Application is SRGB-aware.
|
ImGuiConfigFlags_IsSRGB = 1 << 20, // Application is SRGB-aware.
|
||||||
ImGuiConfigFlags_IsTouchScreen = 1 << 21 // Application is using a touch screen instead of a mouse.
|
ImGuiConfigFlags_IsTouchScreen = 1 << 21, // Application is using a touch screen instead of a mouse.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Backend capabilities flags stored in io.BackendFlags. Set by imgui_impl_xxx or custom backend.
|
// Backend capabilities flags stored in io.BackendFlags. Set by imgui_impl_xxx or custom backend.
|
||||||
@ -1597,7 +1583,7 @@ enum ImGuiBackendFlags_
|
|||||||
// [BETA] Viewports
|
// [BETA] Viewports
|
||||||
ImGuiBackendFlags_PlatformHasViewports = 1 << 10, // Backend Platform supports multiple viewports.
|
ImGuiBackendFlags_PlatformHasViewports = 1 << 10, // Backend Platform supports multiple viewports.
|
||||||
ImGuiBackendFlags_HasMouseHoveredViewport=1 << 11, // Backend Platform supports calling io.AddMouseViewportEvent() with the viewport under the mouse. IF POSSIBLE, ignore viewports with the ImGuiViewportFlags_NoInputs flag (Win32 backend, GLFW 3.30+ backend can do this, SDL backend cannot). If this cannot be done, Dear ImGui needs to use a flawed heuristic to find the viewport under.
|
ImGuiBackendFlags_HasMouseHoveredViewport=1 << 11, // Backend Platform supports calling io.AddMouseViewportEvent() with the viewport under the mouse. IF POSSIBLE, ignore viewports with the ImGuiViewportFlags_NoInputs flag (Win32 backend, GLFW 3.30+ backend can do this, SDL backend cannot). If this cannot be done, Dear ImGui needs to use a flawed heuristic to find the viewport under.
|
||||||
ImGuiBackendFlags_RendererHasViewports = 1 << 12 // Backend Renderer supports multiple viewports.
|
ImGuiBackendFlags_RendererHasViewports = 1 << 12, // Backend Renderer supports multiple viewports.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Enumeration for PushStyleColor() / PopStyleColor()
|
// Enumeration for PushStyleColor() / PopStyleColor()
|
||||||
@ -1709,7 +1695,7 @@ enum ImGuiButtonFlags_
|
|||||||
|
|
||||||
// [Internal]
|
// [Internal]
|
||||||
ImGuiButtonFlags_MouseButtonMask_ = ImGuiButtonFlags_MouseButtonLeft | ImGuiButtonFlags_MouseButtonRight | ImGuiButtonFlags_MouseButtonMiddle,
|
ImGuiButtonFlags_MouseButtonMask_ = ImGuiButtonFlags_MouseButtonLeft | ImGuiButtonFlags_MouseButtonRight | ImGuiButtonFlags_MouseButtonMiddle,
|
||||||
ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft
|
ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton()
|
// Flags for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton()
|
||||||
@ -1750,7 +1736,7 @@ enum ImGuiColorEditFlags_
|
|||||||
ImGuiColorEditFlags_DisplayMask_ = ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_DisplayHex,
|
ImGuiColorEditFlags_DisplayMask_ = ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_DisplayHex,
|
||||||
ImGuiColorEditFlags_DataTypeMask_ = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_Float,
|
ImGuiColorEditFlags_DataTypeMask_ = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_Float,
|
||||||
ImGuiColorEditFlags_PickerMask_ = ImGuiColorEditFlags_PickerHueWheel | ImGuiColorEditFlags_PickerHueBar,
|
ImGuiColorEditFlags_PickerMask_ = ImGuiColorEditFlags_PickerHueWheel | ImGuiColorEditFlags_PickerHueBar,
|
||||||
ImGuiColorEditFlags_InputMask_ = ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_InputHSV
|
ImGuiColorEditFlags_InputMask_ = ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_InputHSV,
|
||||||
|
|
||||||
// Obsolete names (will be removed)
|
// Obsolete names (will be removed)
|
||||||
// ImGuiColorEditFlags_RGB = ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFlags_HSV = ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_HEX = ImGuiColorEditFlags_DisplayHex // [renamed in 1.69]
|
// ImGuiColorEditFlags_RGB = ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFlags_HSV = ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_HEX = ImGuiColorEditFlags_DisplayHex // [renamed in 1.69]
|
||||||
@ -1758,6 +1744,7 @@ enum ImGuiColorEditFlags_
|
|||||||
|
|
||||||
// Flags for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc.
|
// Flags for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc.
|
||||||
// We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.
|
// We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.
|
||||||
|
// (Those are per-item flags. There are shared flags in ImGuiIO: io.ConfigDragClickToInputText)
|
||||||
enum ImGuiSliderFlags_
|
enum ImGuiSliderFlags_
|
||||||
{
|
{
|
||||||
ImGuiSliderFlags_None = 0,
|
ImGuiSliderFlags_None = 0,
|
||||||
@ -1765,11 +1752,11 @@ enum ImGuiSliderFlags_
|
|||||||
ImGuiSliderFlags_Logarithmic = 1 << 5, // Make the widget logarithmic (linear otherwise). Consider using ImGuiSliderFlags_NoRoundToFormat with this if using a format-string with small amount of digits.
|
ImGuiSliderFlags_Logarithmic = 1 << 5, // Make the widget logarithmic (linear otherwise). Consider using ImGuiSliderFlags_NoRoundToFormat with this if using a format-string with small amount of digits.
|
||||||
ImGuiSliderFlags_NoRoundToFormat = 1 << 6, // Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits)
|
ImGuiSliderFlags_NoRoundToFormat = 1 << 6, // Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits)
|
||||||
ImGuiSliderFlags_NoInput = 1 << 7, // Disable CTRL+Click or Enter key allowing to input text directly into the widget
|
ImGuiSliderFlags_NoInput = 1 << 7, // Disable CTRL+Click or Enter key allowing to input text directly into the widget
|
||||||
ImGuiSliderFlags_InvalidMask_ = 0x7000000F // [Internal] We treat using those bits as being potentially a 'float power' argument from the previous API that has got miscast to this enum, and will trigger an assert if needed.
|
ImGuiSliderFlags_InvalidMask_ = 0x7000000F, // [Internal] We treat using those bits as being potentially a 'float power' argument from the previous API that has got miscast to this enum, and will trigger an assert if needed.
|
||||||
|
|
||||||
// Obsolete names (will be removed)
|
// Obsolete names (will be removed)
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
, ImGuiSliderFlags_ClampOnInput = ImGuiSliderFlags_AlwaysClamp // [renamed in 1.79]
|
ImGuiSliderFlags_ClampOnInput = ImGuiSliderFlags_AlwaysClamp, // [renamed in 1.79]
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1791,7 +1778,7 @@ enum ImGuiMouseCursor_
|
|||||||
ImGuiMouseCursor_Arrow = 0,
|
ImGuiMouseCursor_Arrow = 0,
|
||||||
ImGuiMouseCursor_TextInput, // When hovering over InputText, etc.
|
ImGuiMouseCursor_TextInput, // When hovering over InputText, etc.
|
||||||
ImGuiMouseCursor_ResizeAll, // (Unused by Dear ImGui functions)
|
ImGuiMouseCursor_ResizeAll, // (Unused by Dear ImGui functions)
|
||||||
ImGuiMouseCursor_ResizeNS, // When hovering over an horizontal border
|
ImGuiMouseCursor_ResizeNS, // When hovering over a horizontal border
|
||||||
ImGuiMouseCursor_ResizeEW, // When hovering over a vertical border or a column
|
ImGuiMouseCursor_ResizeEW, // When hovering over a vertical border or a column
|
||||||
ImGuiMouseCursor_ResizeNESW, // When hovering over the bottom-left corner of a window
|
ImGuiMouseCursor_ResizeNESW, // When hovering over the bottom-left corner of a window
|
||||||
ImGuiMouseCursor_ResizeNWSE, // When hovering over the bottom-right corner of a window
|
ImGuiMouseCursor_ResizeNWSE, // When hovering over the bottom-right corner of a window
|
||||||
@ -1806,10 +1793,10 @@ enum ImGuiMouseCursor_
|
|||||||
enum ImGuiCond_
|
enum ImGuiCond_
|
||||||
{
|
{
|
||||||
ImGuiCond_None = 0, // No condition (always set the variable), same as _Always
|
ImGuiCond_None = 0, // No condition (always set the variable), same as _Always
|
||||||
ImGuiCond_Always = 1 << 0, // No condition (always set the variable)
|
ImGuiCond_Always = 1 << 0, // No condition (always set the variable), same as _None
|
||||||
ImGuiCond_Once = 1 << 1, // Set the variable once per runtime session (only the first call will succeed)
|
ImGuiCond_Once = 1 << 1, // Set the variable once per runtime session (only the first call will succeed)
|
||||||
ImGuiCond_FirstUseEver = 1 << 2, // Set the variable if the object/window has no persistently saved data (no entry in .ini file)
|
ImGuiCond_FirstUseEver = 1 << 2, // Set the variable if the object/window has no persistently saved data (no entry in .ini file)
|
||||||
ImGuiCond_Appearing = 1 << 3 // Set the variable if the object/window is appearing after being hidden/inactive (or the first time)
|
ImGuiCond_Appearing = 1 << 3, // Set the variable if the object/window is appearing after being hidden/inactive (or the first time)
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1858,7 +1845,7 @@ struct ImVector
|
|||||||
// Constructors, destructor
|
// Constructors, destructor
|
||||||
inline ImVector() { Size = Capacity = 0; Data = NULL; }
|
inline ImVector() { Size = Capacity = 0; Data = NULL; }
|
||||||
inline ImVector(const ImVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); }
|
inline ImVector(const ImVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); }
|
||||||
inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; }
|
inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); if (src.Data) memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; }
|
||||||
inline ~ImVector() { if (Data) IM_FREE(Data); } // Important: does not destruct anything
|
inline ~ImVector() { if (Data) IM_FREE(Data); } // Important: does not destruct anything
|
||||||
|
|
||||||
inline void clear() { if (Data) { Size = Capacity = 0; IM_FREE(Data); Data = NULL; } } // Important: does not destruct anything
|
inline void clear() { if (Data) { Size = Capacity = 0; IM_FREE(Data); Data = NULL; } } // Important: does not destruct anything
|
||||||
@ -1922,7 +1909,7 @@ struct ImGuiStyle
|
|||||||
ImVec2 WindowPadding; // Padding within a window.
|
ImVec2 WindowPadding; // Padding within a window.
|
||||||
float WindowRounding; // 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.
|
float WindowRounding; // 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.
|
||||||
float WindowBorderSize; // Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).
|
float WindowBorderSize; // Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).
|
||||||
ImVec2 WindowMinSize; // Minimum window size. This is a global setting. If you want to constraint individual windows, use SetNextWindowSizeConstraints().
|
ImVec2 WindowMinSize; // Minimum window size. This is a global setting. If you want to constrain individual windows, use SetNextWindowSizeConstraints().
|
||||||
ImVec2 WindowTitleAlign; // Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered.
|
ImVec2 WindowTitleAlign; // Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered.
|
||||||
ImGuiDir WindowMenuButtonPosition; // Side of the collapsing/docking button in the title bar (None/Left/Right). Defaults to ImGuiDir_Left.
|
ImGuiDir WindowMenuButtonPosition; // Side of the collapsing/docking button in the title bar (None/Left/Right). Defaults to ImGuiDir_Left.
|
||||||
float ChildRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows.
|
float ChildRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows.
|
||||||
@ -1945,7 +1932,7 @@ struct ImGuiStyle
|
|||||||
float LogSliderDeadzone; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
|
float LogSliderDeadzone; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
|
||||||
float TabRounding; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
|
float TabRounding; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
|
||||||
float TabBorderSize; // Thickness of border around tabs.
|
float TabBorderSize; // Thickness of border around tabs.
|
||||||
float TabMinWidthForCloseButton; // Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
|
float TabMinWidthForCloseButton; // Minimum width for close button to appear on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
|
||||||
ImGuiDir ColorButtonPosition; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right.
|
ImGuiDir ColorButtonPosition; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right.
|
||||||
ImVec2 ButtonTextAlign; // Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered).
|
ImVec2 ButtonTextAlign; // Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered).
|
||||||
ImVec2 SelectableTextAlign; // 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.
|
ImVec2 SelectableTextAlign; // 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.
|
||||||
@ -1971,7 +1958,7 @@ struct ImGuiStyle
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// [Internal] Storage used by IsKeyDown(), IsKeyPressed() etc functions.
|
// [Internal] Storage used by IsKeyDown(), IsKeyPressed() etc functions.
|
||||||
// If prior to 1.87 you used io.KeysDownDuration[] (which was marked as internal), you should use GetKeyData(key)->DownDuration and not io.KeysData[key]->DownDuration.
|
// If prior to 1.87 you used io.KeysDownDuration[] (which was marked as internal), you should use GetKeyData(key)->DownDuration and *NOT* io.KeysData[key]->DownDuration.
|
||||||
struct ImGuiKeyData
|
struct ImGuiKeyData
|
||||||
{
|
{
|
||||||
bool Down; // True for if key is down
|
bool Down; // True for if key is down
|
||||||
@ -1996,8 +1983,10 @@ struct ImGuiIO
|
|||||||
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds.
|
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds.
|
||||||
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
||||||
float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging.
|
float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging.
|
||||||
float KeyRepeatDelay; // = 0.250f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.).
|
float KeyRepeatDelay; // = 0.275f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.).
|
||||||
float KeyRepeatRate; // = 0.050f // When holding a key/button, rate at which it repeats, in seconds.
|
float KeyRepeatRate; // = 0.050f // When holding a key/button, rate at which it repeats, in seconds.
|
||||||
|
float HoverDelayNormal; // = 0.30 sec // Delay on hovering before IsItemHovered(ImGuiHoveredFlags_DelayNormal) returns true.
|
||||||
|
float HoverDelayShort; // = 0.10 sec // Delay on hovering before IsItemHovered(ImGuiHoveredFlags_DelayShort) returns true.
|
||||||
void* UserData; // = NULL // Store your own data for retrieval by callbacks.
|
void* UserData; // = NULL // Store your own data for retrieval by callbacks.
|
||||||
|
|
||||||
ImFontAtlas*Fonts; // <auto> // Font atlas: load, rasterize and pack one or more fonts into a single texture.
|
ImFontAtlas*Fonts; // <auto> // Font atlas: load, rasterize and pack one or more fonts into a single texture.
|
||||||
@ -2023,6 +2012,7 @@ struct ImGuiIO
|
|||||||
bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // 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.
|
bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // 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.
|
||||||
bool ConfigInputTrickleEventQueue; // = 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.
|
bool ConfigInputTrickleEventQueue; // = 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.
|
||||||
bool ConfigInputTextCursorBlink; // = true // Enable blinking cursor (optional as some users consider it to be distracting).
|
bool ConfigInputTextCursorBlink; // = true // Enable blinking cursor (optional as some users consider it to be distracting).
|
||||||
|
bool ConfigInputTextEnterKeepActive; // = false // [BETA] Pressing Enter will keep item active and select contents (single-line only).
|
||||||
bool ConfigDragClickToInputText; // = false // [BETA] Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving). Not desirable on devices without a keyboard.
|
bool ConfigDragClickToInputText; // = false // [BETA] Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving). Not desirable on devices without a keyboard.
|
||||||
bool ConfigWindowsResizeFromEdges; // = true // Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag)
|
bool ConfigWindowsResizeFromEdges; // = true // Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag)
|
||||||
bool ConfigWindowsMoveFromTitleBarOnly; // = false // Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar.
|
bool ConfigWindowsMoveFromTitleBarOnly; // = false // Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar.
|
||||||
@ -2068,8 +2058,8 @@ struct ImGuiIO
|
|||||||
IMGUI_API void AddMouseViewportEvent(ImGuiID id); // Queue a mouse hovered viewport. Requires backend to set ImGuiBackendFlags_HasMouseHoveredViewport to call this (for multi-viewport support).
|
IMGUI_API void AddMouseViewportEvent(ImGuiID id); // Queue a mouse hovered viewport. Requires backend to set ImGuiBackendFlags_HasMouseHoveredViewport to call this (for multi-viewport support).
|
||||||
IMGUI_API void AddFocusEvent(bool focused); // Queue a gain/loss of focus for the application (generally based on OS/platform focus of your window)
|
IMGUI_API void AddFocusEvent(bool focused); // Queue a gain/loss of focus for the application (generally based on OS/platform focus of your window)
|
||||||
IMGUI_API void AddInputCharacter(unsigned int c); // Queue a new character input
|
IMGUI_API void AddInputCharacter(unsigned int c); // Queue a new character input
|
||||||
IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue a new character input from an UTF-16 character, it can be a surrogate
|
IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue a new character input from a UTF-16 character, it can be a surrogate
|
||||||
IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue a new characters input from an UTF-8 string
|
IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue a new characters input from a UTF-8 string
|
||||||
|
|
||||||
IMGUI_API void SetKeyEventNativeData(ImGuiKey key, int native_keycode, int native_scancode, int native_legacy_index = -1); // [Optional] Specify index for legacy <1.87 IsKeyXXX() functions with native indices + specify native keycode, scancode.
|
IMGUI_API void SetKeyEventNativeData(ImGuiKey key, int native_keycode, int native_scancode, int native_legacy_index = -1); // [Optional] Specify index for legacy <1.87 IsKeyXXX() functions with native indices + specify native keycode, scancode.
|
||||||
IMGUI_API void SetAppAcceptingEvents(bool accepting_events); // Set master flag for accepting key/mouse/text events (default to true). Useful if you have native dialog boxes that are interrupting your application loop/refresh, and you want to disable events being queued while your app is frozen.
|
IMGUI_API void SetAppAcceptingEvents(bool accepting_events); // Set master flag for accepting key/mouse/text events (default to true). Useful if you have native dialog boxes that are interrupting your application loop/refresh, and you want to disable events being queued while your app is frozen.
|
||||||
@ -2089,7 +2079,7 @@ struct ImGuiIO
|
|||||||
bool WantSaveIniSettings; // When manual .ini load/save is active (io.IniFilename == NULL), this will be set to notify your application that you can call SaveIniSettingsToMemory() and save yourself. Important: clear io.WantSaveIniSettings yourself after saving!
|
bool WantSaveIniSettings; // When manual .ini load/save is active (io.IniFilename == NULL), this will be set to notify your application that you can call SaveIniSettingsToMemory() and save yourself. Important: clear io.WantSaveIniSettings yourself after saving!
|
||||||
bool NavActive; // Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag.
|
bool NavActive; // Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag.
|
||||||
bool NavVisible; // Keyboard/Gamepad navigation is visible and allowed (will handle ImGuiKey_NavXXX events).
|
bool NavVisible; // Keyboard/Gamepad navigation is visible and allowed (will handle ImGuiKey_NavXXX events).
|
||||||
float Framerate; // Rough estimate of application framerate, in frame per second. Solely for convenience. Rolling average estimation based on io.DeltaTime over 120 frames.
|
float Framerate; // Estimate of application framerate (rolling average over 60 frames, based on io.DeltaTime), in frame per second. Solely for convenience. Slow applications may not want to use a moving average or may want to reset underlying buffers occasionally.
|
||||||
int MetricsRenderVertices; // Vertices output during last call to Render()
|
int MetricsRenderVertices; // Vertices output during last call to Render()
|
||||||
int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3
|
int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3
|
||||||
int MetricsRenderWindows; // Number of visible windows
|
int MetricsRenderWindows; // Number of visible windows
|
||||||
@ -2102,6 +2092,7 @@ struct ImGuiIO
|
|||||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
int KeyMap[ImGuiKey_COUNT]; // [LEGACY] Input: map of indices into the KeysDown[512] entries array which represent your "native" keyboard state. The first 512 are now unused and should be kept zero. Legacy backend will write into KeyMap[] using ImGuiKey_ indices which are always >512.
|
int KeyMap[ImGuiKey_COUNT]; // [LEGACY] Input: map of indices into the KeysDown[512] entries array which represent your "native" keyboard state. The first 512 are now unused and should be kept zero. Legacy backend will write into KeyMap[] using ImGuiKey_ indices which are always >512.
|
||||||
bool KeysDown[ImGuiKey_COUNT]; // [LEGACY] Input: Keyboard keys that are pressed (ideally left in the "native" order your engine has access to keyboard keys, so you can use your own defines/enums for keys). This used to be [512] sized. It is now ImGuiKey_COUNT to allow legacy io.KeysDown[GetKeyIndex(...)] to work without an overflow.
|
bool KeysDown[ImGuiKey_COUNT]; // [LEGACY] Input: Keyboard keys that are pressed (ideally left in the "native" order your engine has access to keyboard keys, so you can use your own defines/enums for keys). This used to be [512] sized. It is now ImGuiKey_COUNT to allow legacy io.KeysDown[GetKeyIndex(...)] to work without an overflow.
|
||||||
|
float NavInputs[ImGuiNavInput_COUNT]; // [LEGACY] Since 1.88, NavInputs[] was removed. Backends from 1.60 to 1.86 won't build. Feed gamepad inputs via io.AddKeyEvent() and ImGuiKey_GamepadXXX enums.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
@ -2112,18 +2103,17 @@ struct ImGuiIO
|
|||||||
// (this block used to be written by backend, since 1.87 it is best to NOT write to those directly, call the AddXXX functions above instead)
|
// (this block used to be written by backend, since 1.87 it is best to NOT write to those directly, call the AddXXX functions above instead)
|
||||||
// (reading from those variables is fair game, as they are extremely unlikely to be moving anywhere)
|
// (reading from those variables is fair game, as they are extremely unlikely to be moving anywhere)
|
||||||
ImVec2 MousePos; // Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.)
|
ImVec2 MousePos; // Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.)
|
||||||
bool MouseDown[5]; // Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons. Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
|
bool MouseDown[5]; // Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons. Other buttons allow us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
|
||||||
float MouseWheel; // Mouse wheel Vertical: 1 unit scrolls about 5 lines text.
|
float MouseWheel; // Mouse wheel Vertical: 1 unit scrolls about 5 lines text.
|
||||||
float MouseWheelH; // Mouse wheel Horizontal. Most users don't have a mouse with an horizontal wheel, may not be filled by all backends.
|
float MouseWheelH; // Mouse wheel Horizontal. Most users don't have a mouse with a horizontal wheel, may not be filled by all backends.
|
||||||
ImGuiID MouseHoveredViewport; // (Optional) Modify using io.AddMouseViewportEvent(). With multi-viewports: viewport the OS mouse is hovering. If possible _IGNORING_ viewports with the ImGuiViewportFlags_NoInputs flag is much better (few backends can handle that). Set io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport if you can provide this info. If you don't imgui will infer the value using the rectangles and last focused time of the viewports it knows about (ignoring other OS windows).
|
ImGuiID MouseHoveredViewport; // (Optional) Modify using io.AddMouseViewportEvent(). With multi-viewports: viewport the OS mouse is hovering. If possible _IGNORING_ viewports with the ImGuiViewportFlags_NoInputs flag is much better (few backends can handle that). Set io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport if you can provide this info. If you don't imgui will infer the value using the rectangles and last focused time of the viewports it knows about (ignoring other OS windows).
|
||||||
bool KeyCtrl; // Keyboard modifier down: Control
|
bool KeyCtrl; // Keyboard modifier down: Control
|
||||||
bool KeyShift; // Keyboard modifier down: Shift
|
bool KeyShift; // Keyboard modifier down: Shift
|
||||||
bool KeyAlt; // Keyboard modifier down: Alt
|
bool KeyAlt; // Keyboard modifier down: Alt
|
||||||
bool KeySuper; // Keyboard modifier down: Cmd/Super/Windows
|
bool KeySuper; // Keyboard modifier down: Cmd/Super/Windows
|
||||||
float NavInputs[ImGuiNavInput_COUNT]; // Gamepad inputs. Cleared back to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by NewFrame().
|
|
||||||
|
|
||||||
// Other state maintained from data above + IO function calls
|
// Other state maintained from data above + IO function calls
|
||||||
ImGuiModFlags KeyMods; // Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame()
|
ImGuiKeyChord KeyMods; // Key mods flags (any of ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Alt/ImGuiMod_Super flags, same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags). Read-only, updated by NewFrame()
|
||||||
ImGuiKeyData KeysData[ImGuiKey_KeysData_SIZE]; // Key state for all known keys. Use IsKeyXXX() functions to access this.
|
ImGuiKeyData KeysData[ImGuiKey_KeysData_SIZE]; // Key state for all known keys. Use IsKeyXXX() functions to access this.
|
||||||
bool WantCaptureMouseUnlessPopupClose; // Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup.
|
bool WantCaptureMouseUnlessPopupClose; // Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup.
|
||||||
ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
|
ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
|
||||||
@ -2140,8 +2130,6 @@ struct ImGuiIO
|
|||||||
float MouseDownDurationPrev[5]; // Previous time the mouse button has been down
|
float MouseDownDurationPrev[5]; // Previous time the mouse button has been down
|
||||||
ImVec2 MouseDragMaxDistanceAbs[5]; // Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
|
ImVec2 MouseDragMaxDistanceAbs[5]; // Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
|
||||||
float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the clicking point (used for moving thresholds)
|
float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the clicking point (used for moving thresholds)
|
||||||
float NavInputsDownDuration[ImGuiNavInput_COUNT];
|
|
||||||
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT];
|
|
||||||
float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui.
|
float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui.
|
||||||
bool AppFocusLost; // Only modify via AddFocusEvent()
|
bool AppFocusLost; // Only modify via AddFocusEvent()
|
||||||
bool AppAcceptingEvents; // Only modify via SetAppAcceptingEvents()
|
bool AppAcceptingEvents; // Only modify via SetAppAcceptingEvents()
|
||||||
@ -2199,7 +2187,7 @@ struct ImGuiInputTextCallbackData
|
|||||||
// NB: For basic min/max size constraint on each axis you don't need to use the callback! The SetNextWindowSizeConstraints() parameters are enough.
|
// NB: For basic min/max size constraint on each axis you don't need to use the callback! The SetNextWindowSizeConstraints() parameters are enough.
|
||||||
struct ImGuiSizeCallbackData
|
struct ImGuiSizeCallbackData
|
||||||
{
|
{
|
||||||
void* UserData; // Read-only. What user passed to SetNextWindowSizeConstraints()
|
void* UserData; // Read-only. What user passed to SetNextWindowSizeConstraints(). Generally store an integer or float in here (need reinterpret_cast<>).
|
||||||
ImVec2 Pos; // Read-only. Window position, for reference.
|
ImVec2 Pos; // Read-only. Window position, for reference.
|
||||||
ImVec2 CurrentSize; // Read-only. Current window size.
|
ImVec2 CurrentSize; // Read-only. Current window size.
|
||||||
ImVec2 DesiredSize; // Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing.
|
ImVec2 DesiredSize; // Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing.
|
||||||
@ -2284,7 +2272,7 @@ struct ImGuiTableSortSpecs
|
|||||||
#define IM_UNICODE_CODEPOINT_MAX 0xFFFF // Maximum Unicode code point supported by this build.
|
#define IM_UNICODE_CODEPOINT_MAX 0xFFFF // Maximum Unicode code point supported by this build.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Helper: Execute a block of code at maximum once a frame. Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.
|
// Helper: Execute a block of code at maximum once a frame. Convenient if you want to quickly create a UI within deep-nested code that runs multiple times every frame.
|
||||||
// Usage: static ImGuiOnceUponAFrame oaf; if (oaf) ImGui::Text("This will be called only once per frame");
|
// Usage: static ImGuiOnceUponAFrame oaf; if (oaf) ImGui::Text("This will be called only once per frame");
|
||||||
struct ImGuiOnceUponAFrame
|
struct ImGuiOnceUponAFrame
|
||||||
{
|
{
|
||||||
@ -2392,7 +2380,7 @@ struct ImGuiStorage
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Helper: Manually clip large list of items.
|
// Helper: Manually clip large list of items.
|
||||||
// If you have lots evenly spaced items and you have a random access to the list, you can perform coarse
|
// If you have lots evenly spaced items and you have random access to the list, you can perform coarse
|
||||||
// clipping based on visibility to only submit items that are in view.
|
// clipping based on visibility to only submit items that are in view.
|
||||||
// The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped.
|
// The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped.
|
||||||
// (Dear ImGui already clip items based on their bounds but: it needs to first layout the item to do so, and generally
|
// (Dear ImGui already clip items based on their bounds but: it needs to first layout the item to do so, and generally
|
||||||
@ -2538,7 +2526,7 @@ struct ImDrawVert
|
|||||||
#else
|
#else
|
||||||
// You can override the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h
|
// You can override the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h
|
||||||
// The code expect ImVec2 pos (8 bytes), ImVec2 uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields as needed to simplify integration in your engine.
|
// The code expect ImVec2 pos (8 bytes), ImVec2 uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields as needed to simplify integration in your engine.
|
||||||
// The type has to be described within the macro (you can either declare the struct or use a typedef). This is because ImVec2/ImU32 are likely not declared a the time you'd want to set your type up.
|
// The type has to be described within the macro (you can either declare the struct or use a typedef). This is because ImVec2/ImU32 are likely not declared at the time you'd want to set your type up.
|
||||||
// NOTE: IMGUI DOESN'T CLEAR THE STRUCTURE AND DOESN'T CALL A CONSTRUCTOR SO ANY CUSTOM FIELD WILL BE UNINITIALIZED. IF YOU ADD EXTRA FIELDS (SUCH AS A 'Z' COORDINATES) YOU WILL NEED TO CLEAR THEM DURING RENDER OR TO IGNORE THEM.
|
// NOTE: IMGUI DOESN'T CLEAR THE STRUCTURE AND DOESN'T CALL A CONSTRUCTOR SO ANY CUSTOM FIELD WILL BE UNINITIALIZED. IF YOU ADD EXTRA FIELDS (SUCH AS A 'Z' COORDINATES) YOU WILL NEED TO CLEAR THEM DURING RENDER OR TO IGNORE THEM.
|
||||||
IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
|
IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
|
||||||
#endif
|
#endif
|
||||||
@ -2593,7 +2581,7 @@ enum ImDrawFlags_
|
|||||||
ImDrawFlags_RoundCornersRight = ImDrawFlags_RoundCornersBottomRight | ImDrawFlags_RoundCornersTopRight,
|
ImDrawFlags_RoundCornersRight = ImDrawFlags_RoundCornersBottomRight | ImDrawFlags_RoundCornersTopRight,
|
||||||
ImDrawFlags_RoundCornersAll = ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight | ImDrawFlags_RoundCornersBottomLeft | ImDrawFlags_RoundCornersBottomRight,
|
ImDrawFlags_RoundCornersAll = ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight | ImDrawFlags_RoundCornersBottomLeft | ImDrawFlags_RoundCornersBottomRight,
|
||||||
ImDrawFlags_RoundCornersDefault_ = ImDrawFlags_RoundCornersAll, // Default to ALL corners if none of the _RoundCornersXX flags are specified.
|
ImDrawFlags_RoundCornersDefault_ = ImDrawFlags_RoundCornersAll, // Default to ALL corners if none of the _RoundCornersXX flags are specified.
|
||||||
ImDrawFlags_RoundCornersMask_ = ImDrawFlags_RoundCornersAll | ImDrawFlags_RoundCornersNone
|
ImDrawFlags_RoundCornersMask_ = ImDrawFlags_RoundCornersAll | ImDrawFlags_RoundCornersNone,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImDrawList instance. Those are set automatically by ImGui:: functions from ImGuiIO settings, and generally not manipulated directly.
|
// Flags for ImDrawList instance. Those are set automatically by ImGui:: functions from ImGuiIO settings, and generally not manipulated directly.
|
||||||
@ -2604,7 +2592,7 @@ enum ImDrawListFlags_
|
|||||||
ImDrawListFlags_AntiAliasedLines = 1 << 0, // Enable anti-aliased lines/borders (*2 the number of triangles for 1.0f wide line or lines thin enough to be drawn using textures, otherwise *3 the number of triangles)
|
ImDrawListFlags_AntiAliasedLines = 1 << 0, // Enable anti-aliased lines/borders (*2 the number of triangles for 1.0f wide line or lines thin enough to be drawn using textures, otherwise *3 the number of triangles)
|
||||||
ImDrawListFlags_AntiAliasedLinesUseTex = 1 << 1, // Enable anti-aliased lines/borders using textures when possible. Require backend to render with bilinear filtering (NOT point/nearest filtering).
|
ImDrawListFlags_AntiAliasedLinesUseTex = 1 << 1, // Enable anti-aliased lines/borders using textures when possible. Require backend to render with bilinear filtering (NOT point/nearest filtering).
|
||||||
ImDrawListFlags_AntiAliasedFill = 1 << 2, // Enable anti-aliased edge around filled shapes (rounded rectangles, circles).
|
ImDrawListFlags_AntiAliasedFill = 1 << 2, // Enable anti-aliased edge around filled shapes (rounded rectangles, circles).
|
||||||
ImDrawListFlags_AllowVtxOffset = 1 << 3 // Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled.
|
ImDrawListFlags_AllowVtxOffset = 1 << 3, // Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Draw command list
|
// Draw command list
|
||||||
@ -2626,7 +2614,7 @@ struct ImDrawList
|
|||||||
|
|
||||||
// [Internal, used while building lists]
|
// [Internal, used while building lists]
|
||||||
unsigned int _VtxCurrentIdx; // [Internal] generally == VtxBuffer.Size unless we are past 64K vertices, in which case this gets reset to 0.
|
unsigned int _VtxCurrentIdx; // [Internal] generally == VtxBuffer.Size unless we are past 64K vertices, in which case this gets reset to 0.
|
||||||
const ImDrawListSharedData* _Data; // Pointer to shared draw data (you can use ImGui::GetDrawListSharedData() to get the one from current ImGui context)
|
ImDrawListSharedData* _Data; // Pointer to shared draw data (you can use ImGui::GetDrawListSharedData() to get the one from current ImGui context)
|
||||||
const char* _OwnerName; // Pointer to owner window's name for debugging
|
const char* _OwnerName; // Pointer to owner window's name for debugging
|
||||||
ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
|
ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
|
||||||
ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
|
ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
|
||||||
@ -2638,7 +2626,7 @@ struct ImDrawList
|
|||||||
float _FringeScale; // [Internal] anti-alias fringe is scaled by this value, this helps to keep things sharp while zooming at vertex buffer content
|
float _FringeScale; // [Internal] anti-alias fringe is scaled by this value, this helps to keep things sharp while zooming at vertex buffer content
|
||||||
|
|
||||||
// If you want to create ImDrawList instances, pass them ImGui::GetDrawListSharedData() or create and use your own ImDrawListSharedData (so you can use ImDrawList without ImGui)
|
// If you want to create ImDrawList instances, pass them ImGui::GetDrawListSharedData() or create and use your own ImDrawListSharedData (so you can use ImDrawList without ImGui)
|
||||||
ImDrawList(const ImDrawListSharedData* shared_data) { memset(this, 0, sizeof(*this)); _Data = shared_data; }
|
ImDrawList(ImDrawListSharedData* shared_data) { memset(this, 0, sizeof(*this)); _Data = shared_data; }
|
||||||
|
|
||||||
~ImDrawList() { _ClearFreeMemory(); }
|
~ImDrawList() { _ClearFreeMemory(); }
|
||||||
IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect = false); // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
|
IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect = false); // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
|
||||||
@ -2655,7 +2643,7 @@ struct ImDrawList
|
|||||||
// - For circle primitives, use "num_segments == 0" to automatically calculate tessellation (preferred).
|
// - For circle primitives, use "num_segments == 0" to automatically calculate tessellation (preferred).
|
||||||
// In older versions (until Dear ImGui 1.77) the AddCircle functions defaulted to num_segments == 12.
|
// In older versions (until Dear ImGui 1.77) the AddCircle functions defaulted to num_segments == 12.
|
||||||
// In future versions we will use textures to provide cheaper and higher-quality circles.
|
// In future versions we will use textures to provide cheaper and higher-quality circles.
|
||||||
// Use AddNgon() and AddNgonFilled() functions if you need to guaranteed a specific number of sides.
|
// Use AddNgon() and AddNgonFilled() functions if you need to guarantee a specific number of sides.
|
||||||
IMGUI_API void AddLine(const ImVec2& p1, const ImVec2& p2, ImU32 col, float thickness = 1.0f);
|
IMGUI_API void AddLine(const ImVec2& p1, const ImVec2& p2, ImU32 col, float thickness = 1.0f);
|
||||||
IMGUI_API void AddRect(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding = 0.0f, ImDrawFlags flags = 0, float thickness = 1.0f); // a: upper-left, b: lower-right (== upper-left + size)
|
IMGUI_API void AddRect(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding = 0.0f, ImDrawFlags flags = 0, float thickness = 1.0f); // a: upper-left, b: lower-right (== upper-left + size)
|
||||||
IMGUI_API void AddRectFilled(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding = 0.0f, ImDrawFlags flags = 0); // a: upper-left, b: lower-right (== upper-left + size)
|
IMGUI_API void AddRectFilled(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding = 0.0f, ImDrawFlags flags = 0); // a: upper-left, b: lower-right (== upper-left + size)
|
||||||
@ -2841,7 +2829,7 @@ enum ImFontAtlasFlags_
|
|||||||
ImFontAtlasFlags_None = 0,
|
ImFontAtlasFlags_None = 0,
|
||||||
ImFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0, // Don't round the height to next power of two
|
ImFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0, // Don't round the height to next power of two
|
||||||
ImFontAtlasFlags_NoMouseCursors = 1 << 1, // Don't build software mouse cursors into the atlas (save a little texture memory)
|
ImFontAtlasFlags_NoMouseCursors = 1 << 1, // Don't build software mouse cursors into the atlas (save a little texture memory)
|
||||||
ImFontAtlasFlags_NoBakedLines = 1 << 2 // Don't build thick line textures into the atlas (save a little texture memory, allow support for point/nearest filtering). The AntiAliasedLinesUseTex features uses them, otherwise they will be rendered using polygons (more expensive for CPU/GPU).
|
ImFontAtlasFlags_NoBakedLines = 1 << 2, // Don't build thick line textures into the atlas (save a little texture memory, allow support for point/nearest filtering). The AntiAliasedLinesUseTex features uses them, otherwise they will be rendered using polygons (more expensive for CPU/GPU).
|
||||||
};
|
};
|
||||||
|
|
||||||
// Load and rasterize multiple TTF/OTF fonts into a same texture. The font atlas will build a single texture holding:
|
// Load and rasterize multiple TTF/OTF fonts into a same texture. The font atlas will build a single texture holding:
|
||||||
@ -2860,7 +2848,7 @@ enum ImFontAtlasFlags_
|
|||||||
// - Important: By default, AddFontFromMemoryTTF() takes ownership of the data. Even though we are not writing to it, we will free the pointer on destruction.
|
// - Important: By default, AddFontFromMemoryTTF() takes ownership of the data. Even though we are not writing to it, we will free the pointer on destruction.
|
||||||
// You can set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed,
|
// You can set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed,
|
||||||
// - Even though many functions are suffixed with "TTF", OTF data is supported just as well.
|
// - Even though many functions are suffixed with "TTF", OTF data is supported just as well.
|
||||||
// - This is an old API and it is currently awkward for those and and various other reasons! We will address them in the future!
|
// - This is an old API and it is currently awkward for those and various other reasons! We will address them in the future!
|
||||||
struct ImFontAtlas
|
struct ImFontAtlas
|
||||||
{
|
{
|
||||||
IMGUI_API ImFontAtlas();
|
IMGUI_API ImFontAtlas();
|
||||||
@ -2884,7 +2872,7 @@ struct ImFontAtlas
|
|||||||
IMGUI_API bool Build(); // Build pixels data. This is called automatically for you by the GetTexData*** functions.
|
IMGUI_API bool Build(); // Build pixels data. This is called automatically for you by the GetTexData*** functions.
|
||||||
IMGUI_API void GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 1 byte per-pixel
|
IMGUI_API void GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 1 byte per-pixel
|
||||||
IMGUI_API void GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 4 bytes-per-pixel
|
IMGUI_API void GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 4 bytes-per-pixel
|
||||||
bool IsBuilt() const { return Fonts.Size > 0 && TexReady; } // Bit ambiguous: used to detect when user didn't built texture but effectively we should check TexID != 0 except that would be backend dependent...
|
bool IsBuilt() const { return Fonts.Size > 0 && TexReady; } // Bit ambiguous: used to detect when user didn't build texture but effectively we should check TexID != 0 except that would be backend dependent...
|
||||||
void SetTexID(ImTextureID id) { TexID = id; }
|
void SetTexID(ImTextureID id) { TexID = id; }
|
||||||
|
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
@ -2895,6 +2883,7 @@ struct ImFontAtlas
|
|||||||
// NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8"Hello world" syntax. See FAQ for details.
|
// NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8"Hello world" syntax. See FAQ for details.
|
||||||
// NB: Consider using ImFontGlyphRangesBuilder to build glyph ranges from textual data.
|
// NB: Consider using ImFontGlyphRangesBuilder to build glyph ranges from textual data.
|
||||||
IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin
|
IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin
|
||||||
|
IMGUI_API const ImWchar* GetGlyphRangesGreek(); // Default + Greek and Coptic
|
||||||
IMGUI_API const ImWchar* GetGlyphRangesKorean(); // Default + Korean characters
|
IMGUI_API const ImWchar* GetGlyphRangesKorean(); // Default + Korean characters
|
||||||
IMGUI_API const ImWchar* GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 2999 Ideographs
|
IMGUI_API const ImWchar* GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 2999 Ideographs
|
||||||
IMGUI_API const ImWchar* GetGlyphRangesChineseFull(); // Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs
|
IMGUI_API const ImWchar* GetGlyphRangesChineseFull(); // Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs
|
||||||
@ -3033,7 +3022,7 @@ enum ImGuiViewportFlags_
|
|||||||
ImGuiViewportFlags_TopMost = 1 << 9, // Platform Window: Display on top (for tooltips only).
|
ImGuiViewportFlags_TopMost = 1 << 9, // Platform Window: Display on top (for tooltips only).
|
||||||
ImGuiViewportFlags_Minimized = 1 << 10, // Platform Window: Window is minimized, can skip render. When minimized we tend to avoid using the viewport pos/size for clipping window or testing if they are contained in the viewport.
|
ImGuiViewportFlags_Minimized = 1 << 10, // Platform Window: Window is minimized, can skip render. When minimized we tend to avoid using the viewport pos/size for clipping window or testing if they are contained in the viewport.
|
||||||
ImGuiViewportFlags_NoAutoMerge = 1 << 11, // Platform Window: Avoid merging this window into another host window. This can only be set via ImGuiWindowClass viewport flags override (because we need to now ahead if we are going to create a viewport in the first place!).
|
ImGuiViewportFlags_NoAutoMerge = 1 << 11, // Platform Window: Avoid merging this window into another host window. This can only be set via ImGuiWindowClass viewport flags override (because we need to now ahead if we are going to create a viewport in the first place!).
|
||||||
ImGuiViewportFlags_CanHostOtherWindows = 1 << 12 // Main viewport: can host multiple imgui windows (secondary viewports are associated to a single window).
|
ImGuiViewportFlags_CanHostOtherWindows = 1 << 12, // Main viewport: can host multiple imgui windows (secondary viewports are associated to a single window).
|
||||||
};
|
};
|
||||||
|
|
||||||
// - Currently represents the Platform Window created by the application which is hosting our Dear ImGui windows.
|
// - Currently represents the Platform Window created by the application which is hosting our Dear ImGui windows.
|
||||||
@ -3216,15 +3205,17 @@ struct ImGuiPlatformImeData
|
|||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
IMGUI_API int GetKeyIndex(ImGuiKey key); // map ImGuiKey_* values into legacy native key index. == io.KeyMap[key]
|
IMGUI_API ImGuiKey GetKeyIndex(ImGuiKey key); // map ImGuiKey_* values into legacy native key index. == io.KeyMap[key]
|
||||||
#else
|
#else
|
||||||
static inline int GetKeyIndex(ImGuiKey key) { IM_ASSERT(key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END && "ImGuiKey and native_index was merged together and native_index is disabled by IMGUI_DISABLE_OBSOLETE_KEYIO. Please switch to ImGuiKey."); return key; }
|
static inline ImGuiKey GetKeyIndex(ImGuiKey key) { IM_ASSERT(key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END && "ImGuiKey and native_index was merged together and native_index is disabled by IMGUI_DISABLE_OBSOLETE_KEYIO. Please switch to ImGuiKey."); return key; }
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
|
// OBSOLETED in 1.89 (from August 2022)
|
||||||
|
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1)); // Use new ImageButton() signature (explicit item id, regular FramePadding)
|
||||||
// OBSOLETED in 1.88 (from May 2022)
|
// OBSOLETED in 1.88 (from May 2022)
|
||||||
static inline void CaptureKeyboardFromApp(bool want_capture_keyboard = true) { SetNextFrameWantCaptureKeyboard(want_capture_keyboard); } // Renamed as name was misleading + removed default value.
|
static inline void CaptureKeyboardFromApp(bool want_capture_keyboard = true) { SetNextFrameWantCaptureKeyboard(want_capture_keyboard); } // Renamed as name was misleading + removed default value.
|
||||||
static inline void CaptureMouseFromApp(bool want_capture_mouse = true) { SetNextFrameWantCaptureMouse(want_capture_mouse); } // Renamed as name was misleading + removed default value.
|
static inline void CaptureMouseFromApp(bool want_capture_mouse = true) { SetNextFrameWantCaptureMouse(want_capture_mouse); } // Renamed as name was misleading + removed default value.
|
||||||
@ -3238,25 +3229,23 @@ namespace ImGui
|
|||||||
static inline void ListBoxFooter() { EndListBox(); }
|
static inline void ListBoxFooter() { EndListBox(); }
|
||||||
// OBSOLETED in 1.79 (from August 2020)
|
// OBSOLETED in 1.79 (from August 2020)
|
||||||
static inline void OpenPopupContextItem(const char* str_id = NULL, ImGuiMouseButton mb = 1) { OpenPopupOnItemClick(str_id, mb); } // Bool return value removed. Use IsWindowAppearing() in BeginPopup() instead. Renamed in 1.77, renamed back in 1.79. Sorry!
|
static inline void OpenPopupContextItem(const char* str_id = NULL, ImGuiMouseButton mb = 1) { OpenPopupOnItemClick(str_id, mb); } // Bool return value removed. Use IsWindowAppearing() in BeginPopup() instead. Renamed in 1.77, renamed back in 1.79. Sorry!
|
||||||
// OBSOLETED in 1.78 (from June 2020)
|
|
||||||
// Old drag/sliders functions that took a 'float power = 1.0' argument instead of flags.
|
|
||||||
// For shared code, you can version check at compile-time with `#if IMGUI_VERSION_NUM >= 17704`.
|
|
||||||
IMGUI_API bool DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min, const void* p_max, const char* format, float power);
|
|
||||||
IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min, const void* p_max, const char* format, float power);
|
|
||||||
static inline bool DragFloat(const char* label, float* v, float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalar(label, ImGuiDataType_Float, v, v_speed, &v_min, &v_max, format, power); }
|
|
||||||
static inline bool DragFloat2(const char* label, float v[2], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 2, v_speed, &v_min, &v_max, format, power); }
|
|
||||||
static inline bool DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, power); }
|
|
||||||
static inline bool DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, power); }
|
|
||||||
IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, float power);
|
|
||||||
IMGUI_API bool SliderScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_min, const void* p_max, const char* format, float power);
|
|
||||||
static inline bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format, float power) { return SliderScalar(label, ImGuiDataType_Float, v, &v_min, &v_max, format, power); }
|
|
||||||
static inline bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format, float power) { return SliderScalarN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, power); }
|
|
||||||
static inline bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format, float power) { return SliderScalarN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, power); }
|
|
||||||
static inline bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format, float power) { return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power); }
|
|
||||||
// OBSOLETED in 1.77 (from June 2020)
|
|
||||||
static inline bool BeginPopupContextWindow(const char* str_id, ImGuiMouseButton mb, bool over_items) { return BeginPopupContextWindow(str_id, mb | (over_items ? 0 : ImGuiPopupFlags_NoOpenOverItems)); }
|
|
||||||
|
|
||||||
// Some of the older obsolete names along with their replacement (commented out so they are not reported in IDE)
|
// Some of the older obsolete names along with their replacement (commented out so they are not reported in IDE)
|
||||||
|
// [OBSOLETED in 1.78 (from June 2020] Old drag/sliders functions that took a 'float power > 1.0f' argument instead of ImGuiSliderFlags_Logarithmic. See github.com/ocornut/imgui/issues/3361 for details.
|
||||||
|
//IMGUI_API bool DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min, const void* p_max, const char* format, float power = 1.0f) // OBSOLETED in 1.78 (from June 2020)
|
||||||
|
//IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min, const void* p_max, const char* format, float power = 1.0f); // OBSOLETED in 1.78 (from June 2020)
|
||||||
|
//IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, float power = 1.0f); // OBSOLETED in 1.78 (from June 2020)
|
||||||
|
//IMGUI_API bool SliderScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_min, const void* p_max, const char* format, float power = 1.0f); // OBSOLETED in 1.78 (from June 2020)
|
||||||
|
//static inline bool DragFloat(const char* label, float* v, float v_speed, float v_min, float v_max, const char* format, float power = 1.0f) { return DragScalar(label, ImGuiDataType_Float, v, v_speed, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020)
|
||||||
|
//static inline bool DragFloat2(const char* label, float v[2], float v_speed, float v_min, float v_max, const char* format, float power = 1.0f) { return DragScalarN(label, ImGuiDataType_Float, v, 2, v_speed, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020)
|
||||||
|
//static inline bool DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* format, float power = 1.0f) { return DragScalarN(label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020)
|
||||||
|
//static inline bool DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* format, float power = 1.0f) { return DragScalarN(label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020)
|
||||||
|
//static inline bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format, float power = 1.0f) { return SliderScalar(label, ImGuiDataType_Float, v, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020)
|
||||||
|
//static inline bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format, float power = 1.0f) { return SliderScalarN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020)
|
||||||
|
//static inline bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format, float power = 1.0f) { return SliderScalarN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020)
|
||||||
|
//static inline bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format, float power = 1.0f) { return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020)
|
||||||
|
// [OBSOLETED in 1.77 and before]
|
||||||
|
//static inline bool BeginPopupContextWindow(const char* str_id, ImGuiMouseButton mb, bool over_items) { return BeginPopupContextWindow(str_id, mb | (over_items ? 0 : ImGuiPopupFlags_NoOpenOverItems)); } // OBSOLETED in 1.77 (from June 2020)
|
||||||
//static inline void TreeAdvanceToLabelPos() { SetCursorPosX(GetCursorPosX() + GetTreeNodeToLabelSpacing()); } // OBSOLETED in 1.72 (from July 2019)
|
//static inline void TreeAdvanceToLabelPos() { SetCursorPosX(GetCursorPosX() + GetTreeNodeToLabelSpacing()); } // OBSOLETED in 1.72 (from July 2019)
|
||||||
//static inline void SetNextTreeNodeOpen(bool open, ImGuiCond cond = 0) { SetNextItemOpen(open, cond); } // OBSOLETED in 1.71 (from June 2019)
|
//static inline void SetNextTreeNodeOpen(bool open, ImGuiCond cond = 0) { SetNextItemOpen(open, cond); } // OBSOLETED in 1.71 (from June 2019)
|
||||||
//static inline float GetContentRegionAvailWidth() { return GetContentRegionAvail().x; } // OBSOLETED in 1.70 (from May 2019)
|
//static inline float GetContentRegionAvailWidth() { return GetContentRegionAvail().x; } // OBSOLETED in 1.70 (from May 2019)
|
||||||
@ -3270,6 +3259,18 @@ namespace ImGui
|
|||||||
//static inline bool IsRootWindowOrAnyChildFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
|
//static inline bool IsRootWindowOrAnyChildFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
|
||||||
//static inline void SetNextWindowContentWidth(float w) { SetNextWindowContentSize(ImVec2(w, 0.0f)); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
|
//static inline void SetNextWindowContentWidth(float w) { SetNextWindowContentSize(ImVec2(w, 0.0f)); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
|
||||||
//static inline float GetItemsLineHeightWithSpacing() { return GetFrameHeightWithSpacing(); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
|
//static inline float GetItemsLineHeightWithSpacing() { return GetFrameHeightWithSpacing(); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
|
||||||
|
//IMGUI_API bool Begin(char* name, bool* p_open, ImVec2 size_first_use, float bg_alpha = -1.0f, ImGuiWindowFlags flags=0); // OBSOLETED in 1.52 (between Aug 2017 and Oct 2017): Equivalent of using SetNextWindowSize(size, ImGuiCond_FirstUseEver) and SetNextWindowBgAlpha().
|
||||||
|
//static inline bool IsRootWindowOrAnyChildHovered() { return IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows); } // OBSOLETED in 1.52 (between Aug 2017 and Oct 2017)
|
||||||
|
//static inline void AlignFirstTextHeightToWidgets() { AlignTextToFramePadding(); } // OBSOLETED in 1.52 (between Aug 2017 and Oct 2017)
|
||||||
|
//static inline void SetNextWindowPosCenter(ImGuiCond c=0) { SetNextWindowPos(GetMainViewport()->GetCenter(), c, ImVec2(0.5f,0.5f)); } // OBSOLETED in 1.52 (between Aug 2017 and Oct 2017)
|
||||||
|
//static inline bool IsItemHoveredRect() { return IsItemHovered(ImGuiHoveredFlags_RectOnly); } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017)
|
||||||
|
//static inline bool IsPosHoveringAnyWindow(const ImVec2&) { IM_ASSERT(0); return false; } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017): This was misleading and partly broken. You probably want to use the io.WantCaptureMouse flag instead.
|
||||||
|
//static inline bool IsMouseHoveringAnyWindow() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017)
|
||||||
|
//static inline bool IsMouseHoveringWindow() { return IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem); } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017)
|
||||||
|
//static inline bool CollapsingHeader(char* label, const char* str_id, bool framed = true, bool default_open = false) { return CollapsingHeader(label, (default_open ? (1 << 5) : 0)); } // OBSOLETED in 1.49
|
||||||
|
//static inline ImFont*GetWindowFont() { return GetFont(); } // OBSOLETED in 1.48
|
||||||
|
//static inline float GetWindowFontSize() { return GetFontSize(); } // OBSOLETED in 1.48
|
||||||
|
//static inline void SetScrollPosHere() { SetScrollHere(); } // OBSOLETED in 1.42
|
||||||
}
|
}
|
||||||
|
|
||||||
// OBSOLETED in 1.82 (from Mars 2021): flags for AddRect(), AddRectFilled(), AddImageRounded(), PathRect()
|
// OBSOLETED in 1.82 (from Mars 2021): flags for AddRect(), AddRectFilled(), AddImageRounded(), PathRect()
|
||||||
@ -3285,12 +3286,15 @@ enum ImDrawCornerFlags_
|
|||||||
ImDrawCornerFlags_Top = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_TopRight,
|
ImDrawCornerFlags_Top = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_TopRight,
|
||||||
ImDrawCornerFlags_Bot = ImDrawCornerFlags_BotLeft | ImDrawCornerFlags_BotRight,
|
ImDrawCornerFlags_Bot = ImDrawCornerFlags_BotLeft | ImDrawCornerFlags_BotRight,
|
||||||
ImDrawCornerFlags_Left = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_BotLeft,
|
ImDrawCornerFlags_Left = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_BotLeft,
|
||||||
ImDrawCornerFlags_Right = ImDrawCornerFlags_TopRight | ImDrawCornerFlags_BotRight
|
ImDrawCornerFlags_Right = ImDrawCornerFlags_TopRight | ImDrawCornerFlags_BotRight,
|
||||||
};
|
};
|
||||||
|
|
||||||
// RENAMED ImGuiKeyModFlags -> ImGuiModFlags in 1.88 (from April 2022)
|
// RENAMED and MERGED both ImGuiKey_ModXXX and ImGuiModFlags_XXX into ImGuiMod_XXX (from September 2022)
|
||||||
typedef int ImGuiKeyModFlags;
|
// RENAMED ImGuiKeyModFlags -> ImGuiModFlags in 1.88 (from April 2022). Exceptionally commented out ahead of obscolescence schedule to reduce confusion and because they were not meant to be used in the first place.
|
||||||
enum ImGuiKeyModFlags_ { ImGuiKeyModFlags_None = ImGuiModFlags_None, ImGuiKeyModFlags_Ctrl = ImGuiModFlags_Ctrl, ImGuiKeyModFlags_Shift = ImGuiModFlags_Shift, ImGuiKeyModFlags_Alt = ImGuiModFlags_Alt, ImGuiKeyModFlags_Super = ImGuiModFlags_Super };
|
typedef ImGuiKeyChord ImGuiModFlags; // == int. We generally use ImGuiKeyChord to mean "a ImGuiKey or-ed with any number of ImGuiMod_XXX value", but you may store only mods in there.
|
||||||
|
enum ImGuiModFlags_ { ImGuiModFlags_None = 0, ImGuiModFlags_Ctrl = ImGuiMod_Ctrl, ImGuiModFlags_Shift = ImGuiMod_Shift, ImGuiModFlags_Alt = ImGuiMod_Alt, ImGuiModFlags_Super = ImGuiMod_Super };
|
||||||
|
//typedef ImGuiKeyChord ImGuiKeyModFlags; // == int
|
||||||
|
//enum ImGuiKeyModFlags_ { ImGuiKeyModFlags_None = 0, ImGuiKeyModFlags_Ctrl = ImGuiMod_Ctrl, ImGuiKeyModFlags_Shift = ImGuiMod_Shift, ImGuiKeyModFlags_Alt = ImGuiMod_Alt, ImGuiKeyModFlags_Super = ImGuiMod_Super };
|
||||||
|
|
||||||
#endif // #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#endif // #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.88
|
// dear imgui, v1.89 WIP
|
||||||
// (demo code)
|
// (demo code)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
@ -8,11 +8,15 @@
|
|||||||
// Read imgui.cpp for more details, documentation and comments.
|
// Read imgui.cpp for more details, documentation and comments.
|
||||||
// Get the latest version at https://github.com/ocornut/imgui
|
// Get the latest version at https://github.com/ocornut/imgui
|
||||||
|
|
||||||
|
// -------------------------------------------------
|
||||||
|
// PLEASE DO NOT REMOVE THIS FILE FROM YOUR PROJECT!
|
||||||
|
// -------------------------------------------------
|
||||||
// Message to the person tempted to delete this file when integrating Dear ImGui into their codebase:
|
// Message to the person tempted to delete this file when integrating Dear ImGui into their codebase:
|
||||||
// Do NOT remove this file from your project! Think again! It is the most useful reference code that you and other
|
// Think again! It is the most useful reference code that you and other coders will want to refer to and call.
|
||||||
// coders will want to refer to and call. Have the ImGui::ShowDemoWindow() function wired in an always-available
|
// Have the ImGui::ShowDemoWindow() function wired in an always-available debug menu of your game/app!
|
||||||
// debug menu of your game/app! Removing this file from your project is hindering access to documentation for everyone
|
// Also include Metrics! ItemPicker! DebugLog! and other debug features.
|
||||||
// in your team, likely leading you to poorer usage of the library.
|
// Removing this file from your project is hindering access to documentation for everyone in your team,
|
||||||
|
// likely leading you to poorer usage of the library.
|
||||||
// Everything in this file will be stripped out by the linker if you don't call ImGui::ShowDemoWindow().
|
// Everything in this file will be stripped out by the linker if you don't call ImGui::ShowDemoWindow().
|
||||||
// If you want to link core Dear ImGui in your shipped builds but want a thorough guarantee that the demo will not be
|
// If you want to link core Dear ImGui in your shipped builds but want a thorough guarantee that the demo will not be
|
||||||
// linked, you can setup your imconfig.h with #define IMGUI_DISABLE_DEMO_WINDOWS and those functions will be empty.
|
// linked, you can setup your imconfig.h with #define IMGUI_DISABLE_DEMO_WINDOWS and those functions will be empty.
|
||||||
@ -46,15 +50,18 @@
|
|||||||
|
|
||||||
Index of this file:
|
Index of this file:
|
||||||
|
|
||||||
// [SECTION] Forward Declarations, Helpers
|
// [SECTION] Forward Declarations
|
||||||
|
// [SECTION] Helpers
|
||||||
// [SECTION] Demo Window / ShowDemoWindow()
|
// [SECTION] Demo Window / ShowDemoWindow()
|
||||||
|
// - ShowDemoWindow()
|
||||||
// - sub section: ShowDemoWindowWidgets()
|
// - sub section: ShowDemoWindowWidgets()
|
||||||
// - sub section: ShowDemoWindowLayout()
|
// - sub section: ShowDemoWindowLayout()
|
||||||
// - sub section: ShowDemoWindowPopups()
|
// - sub section: ShowDemoWindowPopups()
|
||||||
// - sub section: ShowDemoWindowTables()
|
// - sub section: ShowDemoWindowTables()
|
||||||
// - sub section: ShowDemoWindowMisc()
|
// - sub section: ShowDemoWindowInputs()
|
||||||
// [SECTION] About Window / ShowAboutWindow()
|
// [SECTION] About Window / ShowAboutWindow()
|
||||||
// [SECTION] Style Editor / ShowStyleEditor()
|
// [SECTION] Style Editor / ShowStyleEditor()
|
||||||
|
// [SECTION] User Guide / ShowUserGuide()
|
||||||
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
|
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
|
||||||
// [SECTION] Example App: Debug Console / ShowExampleAppConsole()
|
// [SECTION] Example App: Debug Console / ShowExampleAppConsole()
|
||||||
// [SECTION] Example App: Debug Log / ShowExampleAppLog()
|
// [SECTION] Example App: Debug Log / ShowExampleAppLog()
|
||||||
@ -95,7 +102,7 @@ Index of this file:
|
|||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning (disable: 4127) // condition expression is constant
|
#pragma warning (disable: 4127) // condition expression is constant
|
||||||
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
||||||
#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).
|
#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to an 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Clang/GCC warnings with -Weverything
|
// Clang/GCC warnings with -Weverything
|
||||||
@ -188,12 +195,25 @@ static void ShowExampleAppWindowTitles(bool* p_open);
|
|||||||
static void ShowExampleAppCustomRendering(bool* p_open);
|
static void ShowExampleAppCustomRendering(bool* p_open);
|
||||||
static void ShowExampleMenuFile();
|
static void ShowExampleMenuFile();
|
||||||
|
|
||||||
|
// We split the contents of the big ShowDemoWindow() function into smaller functions
|
||||||
|
// (because the link time of very large functions grow non-linearly)
|
||||||
|
static void ShowDemoWindowWidgets();
|
||||||
|
static void ShowDemoWindowLayout();
|
||||||
|
static void ShowDemoWindowPopups();
|
||||||
|
static void ShowDemoWindowTables();
|
||||||
|
static void ShowDemoWindowColumns();
|
||||||
|
static void ShowDemoWindowInputs();
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Helpers
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Helper to display a little (?) mark which shows a tooltip when hovered.
|
// Helper to display a little (?) mark which shows a tooltip when hovered.
|
||||||
// In your own code you may want to display an actual icon if you are using a merged icon fonts (see docs/FONTS.md)
|
// In your own code you may want to display an actual icon if you are using a merged icon fonts (see docs/FONTS.md)
|
||||||
static void HelpMarker(const char* desc)
|
static void HelpMarker(const char* desc)
|
||||||
{
|
{
|
||||||
ImGui::TextDisabled("(?)");
|
ImGui::TextDisabled("(?)");
|
||||||
if (ImGui::IsItemHovered())
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort))
|
||||||
{
|
{
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
||||||
@ -213,7 +233,7 @@ static void ShowDockingDisabledMessage()
|
|||||||
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper to wire demo markers located in code to a interactive browser
|
// Helper to wire demo markers located in code to an interactive browser
|
||||||
typedef void (*ImGuiDemoMarkerCallback)(const char* file, int line, const char* section, void* user_data);
|
typedef void (*ImGuiDemoMarkerCallback)(const char* file, int line, const char* section, void* user_data);
|
||||||
extern ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback;
|
extern ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback;
|
||||||
extern void* GImGuiDemoMarkerCallbackUserData;
|
extern void* GImGuiDemoMarkerCallbackUserData;
|
||||||
@ -221,71 +241,31 @@ ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback = NULL;
|
|||||||
void* GImGuiDemoMarkerCallbackUserData = NULL;
|
void* GImGuiDemoMarkerCallbackUserData = NULL;
|
||||||
#define IMGUI_DEMO_MARKER(section) do { if (GImGuiDemoMarkerCallback != NULL) GImGuiDemoMarkerCallback(__FILE__, __LINE__, section, GImGuiDemoMarkerCallbackUserData); } while (0)
|
#define IMGUI_DEMO_MARKER(section) do { if (GImGuiDemoMarkerCallback != NULL) GImGuiDemoMarkerCallback(__FILE__, __LINE__, section, GImGuiDemoMarkerCallbackUserData); } while (0)
|
||||||
|
|
||||||
// Helper to display basic user controls.
|
|
||||||
void ImGui::ShowUserGuide()
|
|
||||||
{
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
ImGui::BulletText("Double-click on title bar to collapse window.");
|
|
||||||
ImGui::BulletText(
|
|
||||||
"Click and drag on lower corner to resize window\n"
|
|
||||||
"(double-click to auto fit window to its contents).");
|
|
||||||
ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text.");
|
|
||||||
ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields.");
|
|
||||||
ImGui::BulletText("CTRL+Tab to select a window.");
|
|
||||||
if (io.FontAllowUserScaling)
|
|
||||||
ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents.");
|
|
||||||
ImGui::BulletText("While inputing text:\n");
|
|
||||||
ImGui::Indent();
|
|
||||||
ImGui::BulletText("CTRL+Left/Right to word jump.");
|
|
||||||
ImGui::BulletText("CTRL+A or double-click to select all.");
|
|
||||||
ImGui::BulletText("CTRL+X/C/V to use clipboard cut/copy/paste.");
|
|
||||||
ImGui::BulletText("CTRL+Z,CTRL+Y to undo/redo.");
|
|
||||||
ImGui::BulletText("ESCAPE to revert.");
|
|
||||||
ImGui::Unindent();
|
|
||||||
ImGui::BulletText("With keyboard navigation enabled:");
|
|
||||||
ImGui::Indent();
|
|
||||||
ImGui::BulletText("Arrow keys to navigate.");
|
|
||||||
ImGui::BulletText("Space to activate a widget.");
|
|
||||||
ImGui::BulletText("Return to input text into a widget.");
|
|
||||||
ImGui::BulletText("Escape to deactivate a widget, close popup, exit child window.");
|
|
||||||
ImGui::BulletText("Alt to jump to the menu layer of a window.");
|
|
||||||
ImGui::Unindent();
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] Demo Window / ShowDemoWindow()
|
// [SECTION] Demo Window / ShowDemoWindow()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
// - ShowDemoWindow()
|
||||||
// - ShowDemoWindowWidgets()
|
// - ShowDemoWindowWidgets()
|
||||||
// - ShowDemoWindowLayout()
|
// - ShowDemoWindowLayout()
|
||||||
// - ShowDemoWindowPopups()
|
// - ShowDemoWindowPopups()
|
||||||
// - ShowDemoWindowTables()
|
// - ShowDemoWindowTables()
|
||||||
// - ShowDemoWindowColumns()
|
// - ShowDemoWindowColumns()
|
||||||
// - ShowDemoWindowMisc()
|
// - ShowDemoWindowInputs()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// We split the contents of the big ShowDemoWindow() function into smaller functions
|
|
||||||
// (because the link time of very large functions grow non-linearly)
|
|
||||||
static void ShowDemoWindowWidgets();
|
|
||||||
static void ShowDemoWindowLayout();
|
|
||||||
static void ShowDemoWindowPopups();
|
|
||||||
static void ShowDemoWindowTables();
|
|
||||||
static void ShowDemoWindowColumns();
|
|
||||||
static void ShowDemoWindowMisc();
|
|
||||||
|
|
||||||
// Demonstrate most Dear ImGui features (this is big function!)
|
// Demonstrate most Dear ImGui features (this is big function!)
|
||||||
// You may execute this function to experiment with the UI and understand what it does.
|
// You may execute this function to experiment with the UI and understand what it does.
|
||||||
// You may then search for keywords in the code when you are interested by a specific feature.
|
// You may then search for keywords in the code when you are interested by a specific feature.
|
||||||
void ImGui::ShowDemoWindow(bool* p_open)
|
void ImGui::ShowDemoWindow(bool* p_open)
|
||||||
{
|
{
|
||||||
// Exceptionally add an extra assert here for people confused about initial Dear ImGui setup
|
// Exceptionally add an extra assert here for people confused about initial Dear ImGui setup
|
||||||
// Most ImGui functions would normally just crash if the context is missing.
|
// Most functions would normally just crash if the context is missing.
|
||||||
IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing dear imgui context. Refer to examples app!");
|
IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing dear imgui context. Refer to examples app!");
|
||||||
|
|
||||||
// Examples Apps (accessible from the "Examples" menu)
|
// Examples Apps (accessible from the "Examples" menu)
|
||||||
static bool show_app_main_menu_bar = false;
|
static bool show_app_main_menu_bar = false;
|
||||||
static bool show_app_dockspace = false;
|
static bool show_app_dockspace = false;
|
||||||
static bool show_app_documents = false;
|
static bool show_app_documents = false;
|
||||||
|
|
||||||
static bool show_app_console = false;
|
static bool show_app_console = false;
|
||||||
static bool show_app_log = false;
|
static bool show_app_log = false;
|
||||||
static bool show_app_layout = false;
|
static bool show_app_layout = false;
|
||||||
@ -301,7 +281,6 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
if (show_app_main_menu_bar) ShowExampleAppMainMenuBar();
|
if (show_app_main_menu_bar) ShowExampleAppMainMenuBar();
|
||||||
if (show_app_dockspace) ShowExampleAppDockSpace(&show_app_dockspace); // Process the Docking app first, as explicit DockSpace() nodes needs to be submitted early (read comments near the DockSpace function)
|
if (show_app_dockspace) ShowExampleAppDockSpace(&show_app_dockspace); // Process the Docking app first, as explicit DockSpace() nodes needs to be submitted early (read comments near the DockSpace function)
|
||||||
if (show_app_documents) ShowExampleAppDocuments(&show_app_documents); // Process the Document app next, as it may also use a DockSpace()
|
if (show_app_documents) ShowExampleAppDocuments(&show_app_documents); // Process the Document app next, as it may also use a DockSpace()
|
||||||
|
|
||||||
if (show_app_console) ShowExampleAppConsole(&show_app_console);
|
if (show_app_console) ShowExampleAppConsole(&show_app_console);
|
||||||
if (show_app_log) ShowExampleAppLog(&show_app_log);
|
if (show_app_log) ShowExampleAppLog(&show_app_log);
|
||||||
if (show_app_layout) ShowExampleAppLayout(&show_app_layout);
|
if (show_app_layout) ShowExampleAppLayout(&show_app_layout);
|
||||||
@ -314,7 +293,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
if (show_app_window_titles) ShowExampleAppWindowTitles(&show_app_window_titles);
|
if (show_app_window_titles) ShowExampleAppWindowTitles(&show_app_window_titles);
|
||||||
if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering);
|
if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering);
|
||||||
|
|
||||||
// Dear ImGui Apps (accessible from the "Tools" menu)
|
// Dear ImGui Tools/Apps (accessible from the "Tools" menu)
|
||||||
static bool show_app_metrics = false;
|
static bool show_app_metrics = false;
|
||||||
static bool show_app_debug_log = false;
|
static bool show_app_debug_log = false;
|
||||||
static bool show_app_stack_tool = false;
|
static bool show_app_stack_tool = false;
|
||||||
@ -379,10 +358,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Most "big" widgets share a common width settings by default. See 'Demo->Layout->Widgets Width' for details.
|
// Most "big" widgets share a common width settings by default. See 'Demo->Layout->Widgets Width' for details.
|
||||||
|
|
||||||
// e.g. Use 2/3 of the space for widgets and 1/3 for labels (right align)
|
// e.g. Use 2/3 of the space for widgets and 1/3 for labels (right align)
|
||||||
//ImGui::PushItemWidth(-ImGui::GetWindowWidth() * 0.35f);
|
//ImGui::PushItemWidth(-ImGui::GetWindowWidth() * 0.35f);
|
||||||
|
|
||||||
// e.g. Leave a fixed amount of width for labels (by passing a negative value), the rest goes to widgets.
|
// e.g. Leave a fixed amount of width for labels (by passing a negative value), the rest goes to widgets.
|
||||||
ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
|
ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
|
||||||
|
|
||||||
@ -527,6 +504,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::SameLine(); HelpMarker("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.");
|
ImGui::SameLine(); HelpMarker("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.");
|
||||||
ImGui::Checkbox("io.ConfigInputTextCursorBlink", &io.ConfigInputTextCursorBlink);
|
ImGui::Checkbox("io.ConfigInputTextCursorBlink", &io.ConfigInputTextCursorBlink);
|
||||||
ImGui::SameLine(); HelpMarker("Enable blinking cursor (optional as some users consider it to be distracting).");
|
ImGui::SameLine(); HelpMarker("Enable blinking cursor (optional as some users consider it to be distracting).");
|
||||||
|
ImGui::Checkbox("io.ConfigInputTextEnterKeepActive", &io.ConfigInputTextEnterKeepActive);
|
||||||
|
ImGui::SameLine(); HelpMarker("Pressing Enter will keep item active and select contents (single-line only).");
|
||||||
ImGui::Checkbox("io.ConfigDragClickToInputText", &io.ConfigDragClickToInputText);
|
ImGui::Checkbox("io.ConfigDragClickToInputText", &io.ConfigDragClickToInputText);
|
||||||
ImGui::SameLine(); HelpMarker("Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving).");
|
ImGui::SameLine(); HelpMarker("Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving).");
|
||||||
ImGui::Checkbox("io.ConfigWindowsResizeFromEdges", &io.ConfigWindowsResizeFromEdges);
|
ImGui::Checkbox("io.ConfigWindowsResizeFromEdges", &io.ConfigWindowsResizeFromEdges);
|
||||||
@ -615,7 +594,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ShowDemoWindowLayout();
|
ShowDemoWindowLayout();
|
||||||
ShowDemoWindowPopups();
|
ShowDemoWindowPopups();
|
||||||
ShowDemoWindowTables();
|
ShowDemoWindowTables();
|
||||||
ShowDemoWindowMisc();
|
ShowDemoWindowInputs();
|
||||||
|
|
||||||
// End of ShowDemoWindow()
|
// End of ShowDemoWindow()
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
@ -689,22 +668,6 @@ static void ShowDemoWindowWidgets()
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("%d", counter);
|
ImGui::Text("%d", counter);
|
||||||
|
|
||||||
IMGUI_DEMO_MARKER("Widgets/Basic/Tooltips");
|
|
||||||
ImGui::Text("Hover over me");
|
|
||||||
if (ImGui::IsItemHovered())
|
|
||||||
ImGui::SetTooltip("I am a tooltip");
|
|
||||||
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::Text("- or me");
|
|
||||||
if (ImGui::IsItemHovered())
|
|
||||||
{
|
|
||||||
ImGui::BeginTooltip();
|
|
||||||
ImGui::Text("I am a fancy tooltip");
|
|
||||||
static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f };
|
|
||||||
ImGui::PlotLines("Curve", arr, IM_ARRAYSIZE(arr));
|
|
||||||
ImGui::EndTooltip();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::LabelText("label", "Value");
|
ImGui::LabelText("label", "Value");
|
||||||
|
|
||||||
@ -729,7 +692,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
"USER:\n"
|
"USER:\n"
|
||||||
"Hold SHIFT or use mouse to select text.\n"
|
"Hold SHIFT or use mouse to select text.\n"
|
||||||
"CTRL+Left/Right to word jump.\n"
|
"CTRL+Left/Right to word jump.\n"
|
||||||
"CTRL+A or double-click to select all.\n"
|
"CTRL+A or Double-Click to select all.\n"
|
||||||
"CTRL+X,CTRL+C,CTRL+V clipboard.\n"
|
"CTRL+X,CTRL+C,CTRL+V clipboard.\n"
|
||||||
"CTRL+Z,CTRL+Y undo/redo.\n"
|
"CTRL+Z,CTRL+Y undo/redo.\n"
|
||||||
"ESCAPE to revert.\n\n"
|
"ESCAPE to revert.\n\n"
|
||||||
@ -828,6 +791,40 @@ static void ShowDemoWindowWidgets()
|
|||||||
"Using the simplified one-liner ListBox API here.\nRefer to the \"List boxes\" section below for an explanation of how to use the more flexible and general BeginListBox/EndListBox API.");
|
"Using the simplified one-liner ListBox API here.\nRefer to the \"List boxes\" section below for an explanation of how to use the more flexible and general BeginListBox/EndListBox API.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Tooltips
|
||||||
|
IMGUI_DEMO_MARKER("Widgets/Basic/Tooltips");
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
|
ImGui::Text("Tooltips:");
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Button("Button");
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
ImGui::SetTooltip("I am a tooltip");
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Button("Fancy");
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
{
|
||||||
|
ImGui::BeginTooltip();
|
||||||
|
ImGui::Text("I am a fancy tooltip");
|
||||||
|
static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f };
|
||||||
|
ImGui::PlotLines("Curve", arr, IM_ARRAYSIZE(arr));
|
||||||
|
ImGui::Text("Sin(time) = %f", sinf((float)ImGui::GetTime()));
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Button("Delayed");
|
||||||
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) // Delay best used on items that highlight on hover, so this not a great example!
|
||||||
|
ImGui::SetTooltip("I am a tooltip with a delay.");
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
HelpMarker(
|
||||||
|
"Tooltip are created by using the IsItemHovered() function over any kind of item.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1046,7 +1043,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
// Note that characters values are preserved even by InputText() if the font cannot be displayed,
|
// Note that characters values are preserved even by InputText() if the font cannot be displayed,
|
||||||
// so you can safely copy & paste garbled characters into another application.
|
// so you can safely copy & paste garbled characters into another application.
|
||||||
ImGui::TextWrapped(
|
ImGui::TextWrapped(
|
||||||
"CJK text will only appears if the font was loaded with the appropriate CJK character ranges. "
|
"CJK text will only appear if the font was loaded with the appropriate CJK character ranges. "
|
||||||
"Call io.Fonts->AddFontFromFileTTF() manually to load extra character ranges. "
|
"Call io.Fonts->AddFontFromFileTTF() manually to load extra character ranges. "
|
||||||
"Read docs/FONTS.md for details.");
|
"Read docs/FONTS.md for details.");
|
||||||
ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)"); // Normally we would use u8"blah blah" with the proper characters directly in the string.
|
ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)"); // Normally we would use u8"blah blah" with the proper characters directly in the string.
|
||||||
@ -1119,15 +1116,21 @@ static void ShowDemoWindowWidgets()
|
|||||||
static int pressed_count = 0;
|
static int pressed_count = 0;
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
|
// UV coordinates are often (0.0f, 0.0f) and (1.0f, 1.0f) to display an entire textures.
|
||||||
|
// Here are trying to display only a 32x32 pixels area of the texture, hence the UV computation.
|
||||||
|
// Read about UV coordinates here: https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples
|
||||||
ImGui::PushID(i);
|
ImGui::PushID(i);
|
||||||
int frame_padding = -1 + i; // -1 == uses default padding (style.FramePadding)
|
if (i > 0)
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(i - 1.0f, i - 1.0f));
|
||||||
ImVec2 size = ImVec2(32.0f, 32.0f); // Size of the image we want to make visible
|
ImVec2 size = ImVec2(32.0f, 32.0f); // Size of the image we want to make visible
|
||||||
ImVec2 uv0 = ImVec2(0.0f, 0.0f); // UV coordinates for lower-left
|
ImVec2 uv0 = ImVec2(0.0f, 0.0f); // UV coordinates for lower-left
|
||||||
ImVec2 uv1 = ImVec2(32.0f / my_tex_w, 32.0f / my_tex_h); // UV coordinates for (32,32) in our texture
|
ImVec2 uv1 = ImVec2(32.0f / my_tex_w, 32.0f / my_tex_h); // UV coordinates for (32,32) in our texture
|
||||||
ImVec4 bg_col = ImVec4(0.0f, 0.0f, 0.0f, 1.0f); // Black background
|
ImVec4 bg_col = ImVec4(0.0f, 0.0f, 0.0f, 1.0f); // Black background
|
||||||
ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); // No tint
|
ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); // No tint
|
||||||
if (ImGui::ImageButton(my_tex_id, size, uv0, uv1, frame_padding, bg_col, tint_col))
|
if (ImGui::ImageButton("", my_tex_id, size, uv0, uv1, bg_col, tint_col))
|
||||||
pressed_count += 1;
|
pressed_count += 1;
|
||||||
|
if (i > 0)
|
||||||
|
ImGui::PopStyleVar();
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
}
|
}
|
||||||
@ -1503,7 +1506,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
static char buf3[64];
|
static char buf3[64];
|
||||||
static int edit_count = 0;
|
static int edit_count = 0;
|
||||||
ImGui::InputText("Edit", buf3, 64, ImGuiInputTextFlags_CallbackEdit, Funcs::MyCallback, (void*)&edit_count);
|
ImGui::InputText("Edit", buf3, 64, ImGuiInputTextFlags_CallbackEdit, Funcs::MyCallback, (void*)&edit_count);
|
||||||
ImGui::SameLine(); HelpMarker("Here we toggle the casing of the first character on every edits + count edits.");
|
ImGui::SameLine(); HelpMarker("Here we toggle the casing of the first character on every edit + count edits.");
|
||||||
ImGui::SameLine(); ImGui::Text("(%d)", edit_count);
|
ImGui::SameLine(); ImGui::Text("(%d)", edit_count);
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
@ -2028,7 +2031,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
// - integer/float/double
|
// - integer/float/double
|
||||||
// To avoid polluting the public API with all possible combinations, we use the ImGuiDataType enum
|
// To avoid polluting the public API with all possible combinations, we use the ImGuiDataType enum
|
||||||
// to pass the type, and passing all arguments by pointer.
|
// to pass the type, and passing all arguments by pointer.
|
||||||
// This is the reason the test code below creates local variables to hold "zero" "one" etc. for each types.
|
// This is the reason the test code below creates local variables to hold "zero" "one" etc. for each type.
|
||||||
// In practice, if you frequently use a given type that is not covered by the normal API entry points,
|
// In practice, if you frequently use a given type that is not covered by the normal API entry points,
|
||||||
// you can wrap it yourself inside a 1 line function which can take typed argument as value instead of void*,
|
// you can wrap it yourself inside a 1 line function which can take typed argument as value instead of void*,
|
||||||
// and then pass their address to the generic function. For example:
|
// and then pass their address to the generic function. For example:
|
||||||
@ -2073,7 +2076,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
ImGui::Text("Drags:");
|
ImGui::Text("Drags:");
|
||||||
ImGui::Checkbox("Clamp integers to 0..50", &drag_clamp);
|
ImGui::Checkbox("Clamp integers to 0..50", &drag_clamp);
|
||||||
ImGui::SameLine(); HelpMarker(
|
ImGui::SameLine(); HelpMarker(
|
||||||
"As with every widgets in dear imgui, we never modify values unless there is a user interaction.\n"
|
"As with every widget in dear imgui, we never modify values unless there is a user interaction.\n"
|
||||||
"You can override the clamping limits by using CTRL+Click to input a value.");
|
"You can override the clamping limits by using CTRL+Click to input a value.");
|
||||||
ImGui::DragScalar("drag s8", ImGuiDataType_S8, &s8_v, drag_speed, drag_clamp ? &s8_zero : NULL, drag_clamp ? &s8_fifty : NULL);
|
ImGui::DragScalar("drag s8", ImGuiDataType_S8, &s8_v, drag_speed, drag_clamp ? &s8_zero : NULL, drag_clamp ? &s8_fifty : NULL);
|
||||||
ImGui::DragScalar("drag u8", ImGuiDataType_U8, &u8_v, drag_speed, drag_clamp ? &u8_zero : NULL, drag_clamp ? &u8_fifty : NULL, "%u ms");
|
ImGui::DragScalar("drag u8", ImGuiDataType_U8, &u8_v, drag_speed, drag_clamp ? &u8_zero : NULL, drag_clamp ? &u8_fifty : NULL, "%u ms");
|
||||||
@ -2372,7 +2375,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
HelpMarker("Testing how various types of items are interacting with the IsItemXXX functions. Note that the bool return value of most ImGui function is generally equivalent to calling ImGui::IsItemHovered().");
|
HelpMarker("Testing how various types of items are interacting with the IsItemXXX functions. Note that the bool return value of most ImGui function is generally equivalent to calling ImGui::IsItemHovered().");
|
||||||
ImGui::Checkbox("Item Disabled", &item_disabled);
|
ImGui::Checkbox("Item Disabled", &item_disabled);
|
||||||
|
|
||||||
// Submit selected item item so we can query their status in the code following it.
|
// Submit selected items so we can query their status in the code following it.
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
static bool b = false;
|
static bool b = false;
|
||||||
static float col4f[4] = { 1.0f, 0.5, 0.0f, 1.0f };
|
static float col4f[4] = { 1.0f, 0.5, 0.0f, 1.0f };
|
||||||
@ -2396,6 +2399,10 @@ static void ShowDemoWindowWidgets()
|
|||||||
if (item_type == 14){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::Combo("ITEM: Combo", ¤t, items, IM_ARRAYSIZE(items)); }
|
if (item_type == 14){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::Combo("ITEM: Combo", ¤t, items, IM_ARRAYSIZE(items)); }
|
||||||
if (item_type == 15){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::ListBox("ITEM: ListBox", ¤t, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); }
|
if (item_type == 15){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::ListBox("ITEM: ListBox", ¤t, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); }
|
||||||
|
|
||||||
|
bool hovered_delay_none = ImGui::IsItemHovered();
|
||||||
|
bool hovered_delay_short = ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort);
|
||||||
|
bool hovered_delay_normal = ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal);
|
||||||
|
|
||||||
// Display the values of IsItemHovered() and other common item state functions.
|
// Display the values of IsItemHovered() and other common item state functions.
|
||||||
// Note that the ImGuiHoveredFlags_XXX flags can be combined.
|
// Note that the ImGuiHoveredFlags_XXX flags can be combined.
|
||||||
// Because BulletText is an item itself and that would affect the output of IsItemXXX functions,
|
// Because BulletText is an item itself and that would affect the output of IsItemXXX functions,
|
||||||
@ -2440,6 +2447,8 @@ static void ShowDemoWindowWidgets()
|
|||||||
ImGui::GetItemRectMax().x, ImGui::GetItemRectMax().y,
|
ImGui::GetItemRectMax().x, ImGui::GetItemRectMax().y,
|
||||||
ImGui::GetItemRectSize().x, ImGui::GetItemRectSize().y
|
ImGui::GetItemRectSize().x, ImGui::GetItemRectSize().y
|
||||||
);
|
);
|
||||||
|
ImGui::BulletText(
|
||||||
|
"w/ Hovering Delay: None = %d, Fast %d, Normal = %d", hovered_delay_none, hovered_delay_short, hovered_delay_normal);
|
||||||
|
|
||||||
if (item_disabled)
|
if (item_disabled)
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
@ -2559,6 +2568,26 @@ static void ShowDemoWindowWidgets()
|
|||||||
ImGui::SameLine(); HelpMarker("Demonstrate using BeginDisabled()/EndDisabled() across this section.");
|
ImGui::SameLine(); HelpMarker("Demonstrate using BeginDisabled()/EndDisabled() across this section.");
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IMGUI_DEMO_MARKER("Widgets/Text Filter");
|
||||||
|
if (ImGui::TreeNode("Text Filter"))
|
||||||
|
{
|
||||||
|
// Helper class to easy setup a text filter.
|
||||||
|
// You may want to implement a more feature-full filtering scheme in your own application.
|
||||||
|
HelpMarker("Not a widget per-se, but ImGuiTextFilter is a helper to perform simple filtering on text strings.");
|
||||||
|
static ImGuiTextFilter filter;
|
||||||
|
ImGui::Text("Filter usage:\n"
|
||||||
|
" \"\" display all lines\n"
|
||||||
|
" \"xxx\" display lines containing \"xxx\"\n"
|
||||||
|
" \"xxx,yyy\" display lines containing \"xxx\" or \"yyy\"\n"
|
||||||
|
" \"-xxx\" hide lines containing \"xxx\"");
|
||||||
|
filter.Draw();
|
||||||
|
const char* lines[] = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" };
|
||||||
|
for (int i = 0; i < IM_ARRAYSIZE(lines); i++)
|
||||||
|
if (filter.PassFilter(lines[i]))
|
||||||
|
ImGui::BulletText("%s", lines[i]);
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ShowDemoWindowLayout()
|
static void ShowDemoWindowLayout()
|
||||||
@ -3473,7 +3502,7 @@ static void ShowDemoWindowPopups()
|
|||||||
// if (IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right))
|
// if (IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right))
|
||||||
// OpenPopup(id);
|
// OpenPopup(id);
|
||||||
// return BeginPopup(id);
|
// return BeginPopup(id);
|
||||||
// For advanced advanced uses you may want to replicate and customize this code.
|
// For advanced uses you may want to replicate and customize this code.
|
||||||
// See more details in BeginPopupContextItem().
|
// See more details in BeginPopupContextItem().
|
||||||
|
|
||||||
// Example 1
|
// Example 1
|
||||||
@ -3641,7 +3670,7 @@ static void ShowDemoWindowPopups()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dummy data structure that we use for the Table demo.
|
// Dummy data structure that we use for the Table demo.
|
||||||
// (pre-C++11 doesn't allow us to instantiate ImVector<MyItem> template if this structure if defined inside the demo function)
|
// (pre-C++11 doesn't allow us to instantiate ImVector<MyItem> template if this structure is defined inside the demo function)
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// We are passing our own identifier to TableSetupColumn() to facilitate identifying columns in the sorting code.
|
// We are passing our own identifier to TableSetupColumn() to facilitate identifying columns in the sorting code.
|
||||||
@ -3860,7 +3889,7 @@ static void ShowDemoWindowTables()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// [Method 2] Using TableNextColumn() called multiple times, instead of using a for loop + TableSetColumnIndex().
|
// [Method 2] Using TableNextColumn() called multiple times, instead of using a for loop + TableSetColumnIndex().
|
||||||
// This is generally more convenient when you have code manually submitting the contents of each columns.
|
// This is generally more convenient when you have code manually submitting the contents of each column.
|
||||||
HelpMarker("Using TableNextRow() + calling TableNextColumn() _before_ each cell, manually.");
|
HelpMarker("Using TableNextRow() + calling TableNextColumn() _before_ each cell, manually.");
|
||||||
if (ImGui::BeginTable("table2", 3))
|
if (ImGui::BeginTable("table2", 3))
|
||||||
{
|
{
|
||||||
@ -3878,10 +3907,10 @@ static void ShowDemoWindowTables()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// [Method 3] We call TableNextColumn() _before_ each cell. We never call TableNextRow(),
|
// [Method 3] We call TableNextColumn() _before_ each cell. We never call TableNextRow(),
|
||||||
// as TableNextColumn() will automatically wrap around and create new roes as needed.
|
// as TableNextColumn() will automatically wrap around and create new rows as needed.
|
||||||
// This is generally more convenient when your cells all contains the same type of data.
|
// This is generally more convenient when your cells all contains the same type of data.
|
||||||
HelpMarker(
|
HelpMarker(
|
||||||
"Only using TableNextColumn(), which tends to be convenient for tables where every cells contains the same type of contents.\n"
|
"Only using TableNextColumn(), which tends to be convenient for tables where every cell contains the same type of contents.\n"
|
||||||
"This is also more similar to the old NextColumn() function of the Columns API, and provided to facilitate the Columns->Tables API transition.");
|
"This is also more similar to the old NextColumn() function of the Columns API, and provided to facilitate the Columns->Tables API transition.");
|
||||||
if (ImGui::BeginTable("table3", 3))
|
if (ImGui::BeginTable("table3", 3))
|
||||||
{
|
{
|
||||||
@ -3933,7 +3962,7 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::SameLine(); ImGui::RadioButton("Text", &contents_type, CT_Text);
|
ImGui::SameLine(); ImGui::RadioButton("Text", &contents_type, CT_Text);
|
||||||
ImGui::SameLine(); ImGui::RadioButton("FillButton", &contents_type, CT_FillButton);
|
ImGui::SameLine(); ImGui::RadioButton("FillButton", &contents_type, CT_FillButton);
|
||||||
ImGui::Checkbox("Display headers", &display_headers);
|
ImGui::Checkbox("Display headers", &display_headers);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appears in Headers");
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appear in Headers");
|
||||||
PopStyleCompact();
|
PopStyleCompact();
|
||||||
|
|
||||||
if (ImGui::BeginTable("table1", 3, flags))
|
if (ImGui::BeginTable("table1", 3, flags))
|
||||||
@ -3972,8 +4001,8 @@ static void ShowDemoWindowTables()
|
|||||||
IMGUI_DEMO_MARKER("Tables/Resizable, stretch");
|
IMGUI_DEMO_MARKER("Tables/Resizable, stretch");
|
||||||
if (ImGui::TreeNode("Resizable, stretch"))
|
if (ImGui::TreeNode("Resizable, stretch"))
|
||||||
{
|
{
|
||||||
// By default, if we don't enable ScrollX the sizing policy for each columns is "Stretch"
|
// By default, if we don't enable ScrollX the sizing policy for each column is "Stretch"
|
||||||
// Each columns maintain a sizing weight, and they will occupy all available width.
|
// All columns maintain a sizing weight, and they will occupy all available width.
|
||||||
static ImGuiTableFlags flags = ImGuiTableFlags_SizingStretchSame | ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ContextMenuInBody;
|
static ImGuiTableFlags flags = ImGuiTableFlags_SizingStretchSame | ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ContextMenuInBody;
|
||||||
PushStyleCompact();
|
PushStyleCompact();
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_Resizable", &flags, ImGuiTableFlags_Resizable);
|
ImGui::CheckboxFlags("ImGuiTableFlags_Resizable", &flags, ImGuiTableFlags_Resizable);
|
||||||
@ -4095,7 +4124,7 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::CheckboxFlags("ImGuiTableFlags_Reorderable", &flags, ImGuiTableFlags_Reorderable);
|
ImGui::CheckboxFlags("ImGuiTableFlags_Reorderable", &flags, ImGuiTableFlags_Reorderable);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_Hideable", &flags, ImGuiTableFlags_Hideable);
|
ImGui::CheckboxFlags("ImGuiTableFlags_Hideable", &flags, ImGuiTableFlags_Hideable);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody);
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBodyUntilResize", &flags, ImGuiTableFlags_NoBordersInBodyUntilResize); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers)");
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBodyUntilResize", &flags, ImGuiTableFlags_NoBordersInBodyUntilResize); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body until hovered for resize (borders will always appear in Headers)");
|
||||||
PopStyleCompact();
|
PopStyleCompact();
|
||||||
|
|
||||||
if (ImGui::BeginTable("table1", 3, flags))
|
if (ImGui::BeginTable("table1", 3, flags))
|
||||||
@ -4153,7 +4182,7 @@ static void ShowDemoWindowTables()
|
|||||||
"- any form of row selection\n"
|
"- any form of row selection\n"
|
||||||
"Because of this, activating BorderOuterV sets the default to PadOuterX. Using PadOuterX or NoPadOuterX you can override the default.\n\n"
|
"Because of this, activating BorderOuterV sets the default to PadOuterX. Using PadOuterX or NoPadOuterX you can override the default.\n\n"
|
||||||
"Actual padding values are using style.CellPadding.\n\n"
|
"Actual padding values are using style.CellPadding.\n\n"
|
||||||
"In this demo we don't show horizontal borders to emphasis how they don't affect default horizontal padding.");
|
"In this demo we don't show horizontal borders to emphasize how they don't affect default horizontal padding.");
|
||||||
|
|
||||||
static ImGuiTableFlags flags1 = ImGuiTableFlags_BordersV;
|
static ImGuiTableFlags flags1 = ImGuiTableFlags_BordersV;
|
||||||
PushStyleCompact();
|
PushStyleCompact();
|
||||||
@ -4622,7 +4651,7 @@ static void ShowDemoWindowTables()
|
|||||||
IMGUI_DEMO_MARKER("Tables/Nested tables");
|
IMGUI_DEMO_MARKER("Tables/Nested tables");
|
||||||
if (ImGui::TreeNode("Nested tables"))
|
if (ImGui::TreeNode("Nested tables"))
|
||||||
{
|
{
|
||||||
HelpMarker("This demonstrate embedding a table into another table cell.");
|
HelpMarker("This demonstrates embedding a table into another table cell.");
|
||||||
|
|
||||||
if (ImGui::BeginTable("table_nested1", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
|
if (ImGui::BeginTable("table_nested1", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
|
||||||
{
|
{
|
||||||
@ -4667,7 +4696,7 @@ static void ShowDemoWindowTables()
|
|||||||
IMGUI_DEMO_MARKER("Tables/Row height");
|
IMGUI_DEMO_MARKER("Tables/Row height");
|
||||||
if (ImGui::TreeNode("Row height"))
|
if (ImGui::TreeNode("Row height"))
|
||||||
{
|
{
|
||||||
HelpMarker("You can pass a 'min_row_height' to TableNextRow().\n\nRows are padded with 'style.CellPadding.y' on top and bottom, so effectively the minimum row height will always be >= 'style.CellPadding.y * 2.0f'.\n\nWe cannot honor a _maximum_ row height as that would requires a unique clipping rectangle per row.");
|
HelpMarker("You can pass a 'min_row_height' to TableNextRow().\n\nRows are padded with 'style.CellPadding.y' on top and bottom, so effectively the minimum row height will always be >= 'style.CellPadding.y * 2.0f'.\n\nWe cannot honor a _maximum_ row height as that would require a unique clipping rectangle per row.");
|
||||||
if (ImGui::BeginTable("table_row_height", 1, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersInnerV))
|
if (ImGui::BeginTable("table_row_height", 1, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersInnerV))
|
||||||
{
|
{
|
||||||
for (int row = 0; row < 10; row++)
|
for (int row = 0; row < 10; row++)
|
||||||
@ -5229,7 +5258,7 @@ static void ShowDemoWindowTables()
|
|||||||
static bool show_headers = true;
|
static bool show_headers = true;
|
||||||
static bool show_wrapped_text = false;
|
static bool show_wrapped_text = false;
|
||||||
//static ImGuiTextFilter filter;
|
//static ImGuiTextFilter filter;
|
||||||
//ImGui::SetNextItemOpen(true, ImGuiCond_Once); // FIXME-TABLE: Enabling this results in initial clipped first pass on table which tend to affects column sizing
|
//ImGui::SetNextItemOpen(true, ImGuiCond_Once); // FIXME-TABLE: Enabling this results in initial clipped first pass on table which tend to affect column sizing
|
||||||
if (ImGui::TreeNode("Options"))
|
if (ImGui::TreeNode("Options"))
|
||||||
{
|
{
|
||||||
// Make the UI compact because there are so many fields
|
// Make the UI compact because there are so many fields
|
||||||
@ -5256,8 +5285,8 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersH", &flags, ImGuiTableFlags_BordersH);
|
ImGui::CheckboxFlags("ImGuiTableFlags_BordersH", &flags, ImGuiTableFlags_BordersH);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuterH", &flags, ImGuiTableFlags_BordersOuterH);
|
ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuterH", &flags, ImGuiTableFlags_BordersOuterH);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersInnerH", &flags, ImGuiTableFlags_BordersInnerH);
|
ImGui::CheckboxFlags("ImGuiTableFlags_BordersInnerH", &flags, ImGuiTableFlags_BordersInnerH);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appears in Headers");
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appear in Headers");
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBodyUntilResize", &flags, ImGuiTableFlags_NoBordersInBodyUntilResize); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers)");
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBodyUntilResize", &flags, ImGuiTableFlags_NoBordersInBodyUntilResize); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body until hovered for resize (borders will always appear in Headers)");
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5320,7 +5349,7 @@ static void ShowDemoWindowTables()
|
|||||||
HelpMarker("If scrolling is disabled (ScrollX and ScrollY not set):\n"
|
HelpMarker("If scrolling is disabled (ScrollX and ScrollY not set):\n"
|
||||||
"- The table is output directly in the parent window.\n"
|
"- The table is output directly in the parent window.\n"
|
||||||
"- OuterSize.x < 0.0f will right-align the table.\n"
|
"- OuterSize.x < 0.0f will right-align the table.\n"
|
||||||
"- OuterSize.x = 0.0f will narrow fit the table unless there are any Stretch column.\n"
|
"- OuterSize.x = 0.0f will narrow fit the table unless there are any Stretch columns.\n"
|
||||||
"- OuterSize.y then becomes the minimum size for the table, which will extend vertically if there are more rows (unless NoHostExtendY is set).");
|
"- OuterSize.y then becomes the minimum size for the table, which will extend vertically if there are more rows (unless NoHostExtendY is set).");
|
||||||
|
|
||||||
// From a user point of view we will tend to use 'inner_width' differently depending on whether our table is embedding scrolling.
|
// From a user point of view we will tend to use 'inner_width' differently depending on whether our table is embedding scrolling.
|
||||||
@ -5727,26 +5756,8 @@ static void ShowDemoWindowColumns()
|
|||||||
|
|
||||||
namespace ImGui { extern ImGuiKeyData* GetKeyData(ImGuiKey key); }
|
namespace ImGui { extern ImGuiKeyData* GetKeyData(ImGuiKey key); }
|
||||||
|
|
||||||
static void ShowDemoWindowMisc()
|
static void ShowDemoWindowInputs()
|
||||||
{
|
{
|
||||||
IMGUI_DEMO_MARKER("Filtering");
|
|
||||||
if (ImGui::CollapsingHeader("Filtering"))
|
|
||||||
{
|
|
||||||
// Helper class to easy setup a text filter.
|
|
||||||
// You may want to implement a more feature-full filtering scheme in your own application.
|
|
||||||
static ImGuiTextFilter filter;
|
|
||||||
ImGui::Text("Filter usage:\n"
|
|
||||||
" \"\" display all lines\n"
|
|
||||||
" \"xxx\" display lines containing \"xxx\"\n"
|
|
||||||
" \"xxx,yyy\" display lines containing \"xxx\" or \"yyy\"\n"
|
|
||||||
" \"-xxx\" hide lines containing \"xxx\"");
|
|
||||||
filter.Draw();
|
|
||||||
const char* lines[] = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" };
|
|
||||||
for (int i = 0; i < IM_ARRAYSIZE(lines); i++)
|
|
||||||
if (filter.PassFilter(lines[i]))
|
|
||||||
ImGui::BulletText("%s", lines[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus");
|
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus");
|
||||||
if (ImGui::CollapsingHeader("Inputs, Navigation & Focus"))
|
if (ImGui::CollapsingHeader("Inputs, Navigation & Focus"))
|
||||||
{
|
{
|
||||||
@ -5785,27 +5796,54 @@ static void ShowDemoWindowMisc()
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Display mouse cursors
|
||||||
|
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Mouse Cursors");
|
||||||
|
if (ImGui::TreeNode("Mouse Cursors"))
|
||||||
|
{
|
||||||
|
const char* mouse_cursors_names[] = { "Arrow", "TextInput", "ResizeAll", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE", "Hand", "NotAllowed" };
|
||||||
|
IM_ASSERT(IM_ARRAYSIZE(mouse_cursors_names) == ImGuiMouseCursor_COUNT);
|
||||||
|
|
||||||
|
ImGuiMouseCursor current = ImGui::GetMouseCursor();
|
||||||
|
ImGui::Text("Current mouse cursor = %d: %s", current, mouse_cursors_names[current]);
|
||||||
|
ImGui::BeginDisabled(true);
|
||||||
|
ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", &io.BackendFlags, ImGuiBackendFlags_HasMouseCursors);
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
|
ImGui::Text("Hover to see mouse cursors:");
|
||||||
|
ImGui::SameLine(); HelpMarker(
|
||||||
|
"Your application can render a different mouse cursor based on what ImGui::GetMouseCursor() returns. "
|
||||||
|
"If software cursor rendering (io.MouseDrawCursor) is set ImGui will draw the right cursor for you, "
|
||||||
|
"otherwise your backend needs to handle it.");
|
||||||
|
for (int i = 0; i < ImGuiMouseCursor_COUNT; i++)
|
||||||
|
{
|
||||||
|
char label[32];
|
||||||
|
sprintf(label, "Mouse cursor %d: %s", i, mouse_cursors_names[i]);
|
||||||
|
ImGui::Bullet(); ImGui::Selectable(label, false);
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
ImGui::SetMouseCursor(i);
|
||||||
|
}
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
|
||||||
// Display Keyboard/Mouse state
|
// Display Keyboard/Mouse state
|
||||||
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Keyboard, Gamepad & Navigation State");
|
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Keyboard, Gamepad & Navigation State");
|
||||||
if (ImGui::TreeNode("Keyboard, Gamepad & Navigation State"))
|
if (ImGui::TreeNode("Keyboard, Gamepad & Navigation State"))
|
||||||
{
|
{
|
||||||
// We iterate both legacy native range and named ImGuiKey ranges, which is a little odd but this allow displaying the data for old/new backends.
|
// We iterate both legacy native range and named ImGuiKey ranges, which is a little odd but this allows displaying the data for old/new backends.
|
||||||
// User code should never have to go through such hoops: old code may use native keycodes, new code may use ImGuiKey codes.
|
// User code should never have to go through such hoops: old code may use native keycodes, new code may use ImGuiKey codes.
|
||||||
#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO
|
#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
struct funcs { static bool IsLegacyNativeDupe(ImGuiKey) { return false; } };
|
struct funcs { static bool IsLegacyNativeDupe(ImGuiKey) { return false; } };
|
||||||
const ImGuiKey key_first = ImGuiKey_NamedKey_BEGIN;
|
const ImGuiKey key_first = (ImGuiKey)ImGuiKey_NamedKey_BEGIN;
|
||||||
#else
|
#else
|
||||||
struct funcs { static bool IsLegacyNativeDupe(ImGuiKey key) { return key < 512 && ImGui::GetIO().KeyMap[key] != -1; } }; // Hide Native<>ImGuiKey duplicates when both exists in the array
|
struct funcs { static bool IsLegacyNativeDupe(ImGuiKey key) { return key < 512 && ImGui::GetIO().KeyMap[key] != -1; } }; // Hide Native<>ImGuiKey duplicates when both exists in the array
|
||||||
const ImGuiKey key_first = 0;
|
const ImGuiKey key_first = (ImGuiKey)0;
|
||||||
//ImGui::Text("Legacy raw:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key++) { if (io.KeysDown[key]) { ImGui::SameLine(); ImGui::Text("\"%s\" %d", ImGui::GetKeyName(key), key); } }
|
//ImGui::Text("Legacy raw:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key++) { if (io.KeysDown[key]) { ImGui::SameLine(); ImGui::Text("\"%s\" %d", ImGui::GetKeyName(key), key); } }
|
||||||
#endif
|
#endif
|
||||||
ImGui::Text("Keys down:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key++) { if (funcs::IsLegacyNativeDupe(key)) continue; if (ImGui::IsKeyDown(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d (%.02f secs)", ImGui::GetKeyName(key), key, ImGui::GetKeyData(key)->DownDuration); } }
|
ImGui::Text("Keys down:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key)) continue; if (ImGui::IsKeyDown(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d (%.02f secs)", ImGui::GetKeyName(key), key, ImGui::GetKeyData(key)->DownDuration); } }
|
||||||
ImGui::Text("Keys pressed:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key++) { if (funcs::IsLegacyNativeDupe(key)) continue; if (ImGui::IsKeyPressed(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d", ImGui::GetKeyName(key), key); } }
|
ImGui::Text("Keys pressed:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key)) continue; if (ImGui::IsKeyPressed(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d", ImGui::GetKeyName(key), key); } }
|
||||||
ImGui::Text("Keys released:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key++) { if (funcs::IsLegacyNativeDupe(key)) continue; if (ImGui::IsKeyReleased(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d", ImGui::GetKeyName(key), key); } }
|
ImGui::Text("Keys released:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key)) continue; if (ImGui::IsKeyReleased(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d", ImGui::GetKeyName(key), key); } }
|
||||||
ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : "");
|
ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : "");
|
||||||
ImGui::Text("Chars queue:"); for (int i = 0; i < io.InputQueueCharacters.Size; i++) { ImWchar c = io.InputQueueCharacters[i]; ImGui::SameLine(); ImGui::Text("\'%c\' (0x%04X)", (c > ' ' && c <= 255) ? (char)c : '?', c); } // FIXME: We should convert 'c' to UTF-8 here but the functions are not public.
|
ImGui::Text("Chars queue:"); for (int i = 0; i < io.InputQueueCharacters.Size; i++) { ImWchar c = io.InputQueueCharacters[i]; ImGui::SameLine(); ImGui::Text("\'%c\' (0x%04X)", (c > ' ' && c <= 255) ? (char)c : '?', c); } // FIXME: We should convert 'c' to UTF-8 here but the functions are not public.
|
||||||
ImGui::Text("NavInputs down:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputs[i] > 0.0f) { ImGui::SameLine(); ImGui::Text("[%d] %.2f (%.02f secs)", i, io.NavInputs[i], io.NavInputsDownDuration[i]); }
|
|
||||||
ImGui::Text("NavInputs pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputsDownDuration[i] == 0.0f) { ImGui::SameLine(); ImGui::Text("[%d]", i); }
|
|
||||||
|
|
||||||
// Draw an arbitrary US keyboard layout to visualize translated keys
|
// Draw an arbitrary US keyboard layout to visualize translated keys
|
||||||
{
|
{
|
||||||
@ -5979,30 +6017,6 @@ static void ShowDemoWindowMisc()
|
|||||||
ImGui::Text("io.MouseDelta: (%.1f, %.1f)", mouse_delta.x, mouse_delta.y);
|
ImGui::Text("io.MouseDelta: (%.1f, %.1f)", mouse_delta.x, mouse_delta.y);
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Mouse cursors");
|
|
||||||
if (ImGui::TreeNode("Mouse cursors"))
|
|
||||||
{
|
|
||||||
const char* mouse_cursors_names[] = { "Arrow", "TextInput", "ResizeAll", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE", "Hand", "NotAllowed" };
|
|
||||||
IM_ASSERT(IM_ARRAYSIZE(mouse_cursors_names) == ImGuiMouseCursor_COUNT);
|
|
||||||
|
|
||||||
ImGuiMouseCursor current = ImGui::GetMouseCursor();
|
|
||||||
ImGui::Text("Current mouse cursor = %d: %s", current, mouse_cursors_names[current]);
|
|
||||||
ImGui::Text("Hover to see mouse cursors:");
|
|
||||||
ImGui::SameLine(); HelpMarker(
|
|
||||||
"Your application can render a different mouse cursor based on what ImGui::GetMouseCursor() returns. "
|
|
||||||
"If software cursor rendering (io.MouseDrawCursor) is set ImGui will draw the right cursor for you, "
|
|
||||||
"otherwise your backend needs to handle it.");
|
|
||||||
for (int i = 0; i < ImGuiMouseCursor_COUNT; i++)
|
|
||||||
{
|
|
||||||
char label[32];
|
|
||||||
sprintf(label, "Mouse cursor %d: %s", i, mouse_cursors_names[i]);
|
|
||||||
ImGui::Bullet(); ImGui::Selectable(label, false);
|
|
||||||
if (ImGui::IsItemHovered())
|
|
||||||
ImGui::SetMouseCursor(i);
|
|
||||||
}
|
|
||||||
ImGui::TreePop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6476,6 +6490,40 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] User Guide / ShowUserGuide()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void ImGui::ShowUserGuide()
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui::BulletText("Double-click on title bar to collapse window.");
|
||||||
|
ImGui::BulletText(
|
||||||
|
"Click and drag on lower corner to resize window\n"
|
||||||
|
"(double-click to auto fit window to its contents).");
|
||||||
|
ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text.");
|
||||||
|
ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields.");
|
||||||
|
ImGui::BulletText("CTRL+Tab to select a window.");
|
||||||
|
if (io.FontAllowUserScaling)
|
||||||
|
ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents.");
|
||||||
|
ImGui::BulletText("While inputing text:\n");
|
||||||
|
ImGui::Indent();
|
||||||
|
ImGui::BulletText("CTRL+Left/Right to word jump.");
|
||||||
|
ImGui::BulletText("CTRL+A or double-click to select all.");
|
||||||
|
ImGui::BulletText("CTRL+X/C/V to use clipboard cut/copy/paste.");
|
||||||
|
ImGui::BulletText("CTRL+Z,CTRL+Y to undo/redo.");
|
||||||
|
ImGui::BulletText("ESCAPE to revert.");
|
||||||
|
ImGui::Unindent();
|
||||||
|
ImGui::BulletText("With keyboard navigation enabled:");
|
||||||
|
ImGui::Indent();
|
||||||
|
ImGui::BulletText("Arrow keys to navigate.");
|
||||||
|
ImGui::BulletText("Space to activate a widget.");
|
||||||
|
ImGui::BulletText("Return to input text into a widget.");
|
||||||
|
ImGui::BulletText("Escape to deactivate a widget, close popup, exit child window.");
|
||||||
|
ImGui::BulletText("Alt to jump to the menu layer of a window.");
|
||||||
|
ImGui::Unindent();
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
|
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -6710,7 +6758,8 @@ struct ExampleAppConsole
|
|||||||
|
|
||||||
// Reserve enough left-over height for 1 separator + 1 input text
|
// Reserve enough left-over height for 1 separator + 1 input text
|
||||||
const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();
|
const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();
|
||||||
ImGui::BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), false, ImGuiWindowFlags_HorizontalScrollbar);
|
if (ImGui::BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), false, ImGuiWindowFlags_HorizontalScrollbar))
|
||||||
|
{
|
||||||
if (ImGui::BeginPopupContextWindow())
|
if (ImGui::BeginPopupContextWindow())
|
||||||
{
|
{
|
||||||
if (ImGui::Selectable("Clear")) ClearLog();
|
if (ImGui::Selectable("Clear")) ClearLog();
|
||||||
@ -6770,12 +6819,13 @@ struct ExampleAppConsole
|
|||||||
ScrollToBottom = false;
|
ScrollToBottom = false;
|
||||||
|
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
// Command-line
|
// Command-line
|
||||||
bool reclaim_focus = false;
|
bool reclaim_focus = false;
|
||||||
ImGuiInputTextFlags input_text_flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory;
|
ImGuiInputTextFlags input_text_flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_EscapeClearsAll | ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory;
|
||||||
if (ImGui::InputText("Input", InputBuf, IM_ARRAYSIZE(InputBuf), input_text_flags, &TextEditCallbackStub, (void*)this))
|
if (ImGui::InputText("Input", InputBuf, IM_ARRAYSIZE(InputBuf), input_text_flags, &TextEditCallbackStub, (void*)this))
|
||||||
{
|
{
|
||||||
char* s = InputBuf;
|
char* s = InputBuf;
|
||||||
@ -7017,8 +7067,9 @@ struct ExampleAppLog
|
|||||||
Filter.Draw("Filter", -100.0f);
|
Filter.Draw("Filter", -100.0f);
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::BeginChild("scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar);
|
|
||||||
|
|
||||||
|
if (ImGui::BeginChild("scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar))
|
||||||
|
{
|
||||||
if (clear)
|
if (clear)
|
||||||
Clear();
|
Clear();
|
||||||
if (copy)
|
if (copy)
|
||||||
@ -7030,7 +7081,7 @@ struct ExampleAppLog
|
|||||||
if (Filter.IsActive())
|
if (Filter.IsActive())
|
||||||
{
|
{
|
||||||
// In this example we don't use the clipper when Filter is enabled.
|
// In this example we don't use the clipper when Filter is enabled.
|
||||||
// This is because we don't have a random access on the result on our filter.
|
// This is because we don't have random access to the result of our filter.
|
||||||
// A real application processing logs with ten of thousands of entries may want to store the result of
|
// A real application processing logs with ten of thousands of entries may want to store the result of
|
||||||
// search/filter.. especially if the filtering function is not trivial (e.g. reg-exp).
|
// search/filter.. especially if the filtering function is not trivial (e.g. reg-exp).
|
||||||
for (int line_no = 0; line_no < LineOffsets.Size; line_no++)
|
for (int line_no = 0; line_no < LineOffsets.Size; line_no++)
|
||||||
@ -7052,7 +7103,7 @@ struct ExampleAppLog
|
|||||||
// on your side is recommended. Using ImGuiListClipper requires
|
// on your side is recommended. Using ImGuiListClipper requires
|
||||||
// - A) random access into your data
|
// - A) random access into your data
|
||||||
// - B) items all being the same height,
|
// - B) items all being the same height,
|
||||||
// both of which we can handle since we an array pointing to the beginning of each line of text.
|
// both of which we can handle since we have an array pointing to the beginning of each line of text.
|
||||||
// When using the filter (in the block of code above) we don't have random access into the data to display
|
// When using the filter (in the block of code above) we don't have random access into the data to display
|
||||||
// anymore, which is why we don't use the clipper. Storing or skimming through the search result would make
|
// anymore, which is why we don't use the clipper. Storing or skimming through the search result would make
|
||||||
// it possible (and would be recommended if you want to search through tens of thousands of entries).
|
// it possible (and would be recommended if you want to search through tens of thousands of entries).
|
||||||
@ -7073,7 +7124,7 @@ struct ExampleAppLog
|
|||||||
|
|
||||||
if (AutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())
|
if (AutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())
|
||||||
ImGui::SetScrollHereY(1.0f);
|
ImGui::SetScrollHereY(1.0f);
|
||||||
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
@ -7353,54 +7404,85 @@ static void ShowExampleAppAutoResize(bool* p_open)
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demonstrate creating a window with custom resize constraints.
|
// Demonstrate creating a window with custom resize constraints.
|
||||||
|
// Note that size constraints currently don't work on a docked window (when in 'docking' branch)
|
||||||
static void ShowExampleAppConstrainedResize(bool* p_open)
|
static void ShowExampleAppConstrainedResize(bool* p_open)
|
||||||
{
|
{
|
||||||
struct CustomConstraints
|
struct CustomConstraints
|
||||||
{
|
{
|
||||||
// Helper functions to demonstrate programmatic constraints
|
// Helper functions to demonstrate programmatic constraints
|
||||||
static void Square(ImGuiSizeCallbackData* data) { data->DesiredSize.x = data->DesiredSize.y = IM_MAX(data->DesiredSize.x, data->DesiredSize.y); }
|
// FIXME: This doesn't take account of decoration size (e.g. title bar), library should make this easier.
|
||||||
static void Step(ImGuiSizeCallbackData* data) { float step = (float)(int)(intptr_t)data->UserData; data->DesiredSize = ImVec2((int)(data->DesiredSize.x / step + 0.5f) * step, (int)(data->DesiredSize.y / step + 0.5f) * step); }
|
static void AspectRatio(ImGuiSizeCallbackData* data) { float aspect_ratio = *(float*)data->UserData; data->DesiredSize.x = IM_MAX(data->CurrentSize.x, data->CurrentSize.y); data->DesiredSize.y = (float)(int)(data->DesiredSize.x / aspect_ratio); }
|
||||||
|
static void Square(ImGuiSizeCallbackData* data) { data->DesiredSize.x = data->DesiredSize.y = IM_MAX(data->CurrentSize.x, data->CurrentSize.y); }
|
||||||
|
static void Step(ImGuiSizeCallbackData* data) { float step = *(float*)data->UserData; data->DesiredSize = ImVec2((int)(data->CurrentSize.x / step + 0.5f) * step, (int)(data->CurrentSize.y / step + 0.5f) * step); }
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* test_desc[] =
|
const char* test_desc[] =
|
||||||
{
|
{
|
||||||
|
"Between 100x100 and 500x500",
|
||||||
|
"At least 100x100",
|
||||||
"Resize vertical only",
|
"Resize vertical only",
|
||||||
"Resize horizontal only",
|
"Resize horizontal only",
|
||||||
"Width > 100, Height > 100",
|
"Width Between 400 and 500",
|
||||||
"Width 400-500",
|
"Custom: Aspect Ratio 16:9",
|
||||||
"Height 400-500",
|
|
||||||
"Custom: Always Square",
|
"Custom: Always Square",
|
||||||
"Custom: Fixed Steps (100)",
|
"Custom: Fixed Steps (100)",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Options
|
||||||
static bool auto_resize = false;
|
static bool auto_resize = false;
|
||||||
static int type = 0;
|
static bool window_padding = true;
|
||||||
|
static int type = 5; // Aspect Ratio
|
||||||
static int display_lines = 10;
|
static int display_lines = 10;
|
||||||
if (type == 0) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 0), ImVec2(-1, FLT_MAX)); // Vertical only
|
|
||||||
if (type == 1) ImGui::SetNextWindowSizeConstraints(ImVec2(0, -1), ImVec2(FLT_MAX, -1)); // Horizontal only
|
|
||||||
if (type == 2) ImGui::SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(FLT_MAX, FLT_MAX)); // Width > 100, Height > 100
|
|
||||||
if (type == 3) ImGui::SetNextWindowSizeConstraints(ImVec2(400, -1), ImVec2(500, -1)); // Width 400-500
|
|
||||||
if (type == 4) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 400), ImVec2(-1, 500)); // Height 400-500
|
|
||||||
if (type == 5) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Square); // Always Square
|
|
||||||
if (type == 6) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Step, (void*)(intptr_t)100); // Fixed Step
|
|
||||||
|
|
||||||
ImGuiWindowFlags flags = auto_resize ? ImGuiWindowFlags_AlwaysAutoResize : 0;
|
// Submit constraint
|
||||||
if (ImGui::Begin("Example: Constrained Resize", p_open, flags))
|
float aspect_ratio = 16.0f / 9.0f;
|
||||||
|
float fixed_step = 100.0f;
|
||||||
|
if (type == 0) ImGui::SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(500, 500)); // Between 100x100 and 500x500
|
||||||
|
if (type == 1) ImGui::SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(FLT_MAX, FLT_MAX)); // Width > 100, Height > 100
|
||||||
|
if (type == 2) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 0), ImVec2(-1, FLT_MAX)); // Vertical only
|
||||||
|
if (type == 3) ImGui::SetNextWindowSizeConstraints(ImVec2(0, -1), ImVec2(FLT_MAX, -1)); // Horizontal only
|
||||||
|
if (type == 4) ImGui::SetNextWindowSizeConstraints(ImVec2(400, -1), ImVec2(500, -1)); // Width Between and 400 and 500
|
||||||
|
if (type == 5) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::AspectRatio, (void*)&aspect_ratio); // Aspect ratio
|
||||||
|
if (type == 6) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Square); // Always Square
|
||||||
|
if (type == 7) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Step, (void*)&fixed_step); // Fixed Step
|
||||||
|
|
||||||
|
// Submit window
|
||||||
|
if (!window_padding)
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
||||||
|
const ImGuiWindowFlags window_flags = auto_resize ? ImGuiWindowFlags_AlwaysAutoResize : 0;
|
||||||
|
const bool window_open = ImGui::Begin("Example: Constrained Resize", p_open, window_flags);
|
||||||
|
if (!window_padding)
|
||||||
|
ImGui::PopStyleVar();
|
||||||
|
if (window_open)
|
||||||
{
|
{
|
||||||
IMGUI_DEMO_MARKER("Examples/Constrained Resizing window");
|
IMGUI_DEMO_MARKER("Examples/Constrained Resizing window");
|
||||||
|
if (ImGui::GetIO().KeyShift)
|
||||||
|
{
|
||||||
|
// Display a dummy viewport (in your real app you would likely use ImageButton() to display a texture.
|
||||||
|
ImVec2 avail_size = ImGui::GetContentRegionAvail();
|
||||||
|
ImVec2 pos = ImGui::GetCursorScreenPos();
|
||||||
|
ImGui::ColorButton("viewport", ImVec4(0.5f, 0.2f, 0.5f, 1.0f), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoDragDrop, avail_size);
|
||||||
|
ImGui::SetCursorScreenPos(ImVec2(pos.x + 10, pos.y + 10));
|
||||||
|
ImGui::Text("%.2f x %.2f", avail_size.x, avail_size.y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::Text("(Hold SHIFT to display a dummy viewport)");
|
||||||
if (ImGui::IsWindowDocked())
|
if (ImGui::IsWindowDocked())
|
||||||
ImGui::Text("Warning: Sizing Constraints won't work if the window is docked!");
|
ImGui::Text("Warning: Sizing Constraints won't work if the window is docked!");
|
||||||
if (ImGui::Button("200x200")) { ImGui::SetWindowSize(ImVec2(200, 200)); } ImGui::SameLine();
|
if (ImGui::Button("Set 200x200")) { ImGui::SetWindowSize(ImVec2(200, 200)); } ImGui::SameLine();
|
||||||
if (ImGui::Button("500x500")) { ImGui::SetWindowSize(ImVec2(500, 500)); } ImGui::SameLine();
|
if (ImGui::Button("Set 500x500")) { ImGui::SetWindowSize(ImVec2(500, 500)); } ImGui::SameLine();
|
||||||
if (ImGui::Button("800x200")) { ImGui::SetWindowSize(ImVec2(800, 200)); }
|
if (ImGui::Button("Set 800x200")) { ImGui::SetWindowSize(ImVec2(800, 200)); }
|
||||||
ImGui::SetNextItemWidth(200);
|
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 20);
|
||||||
ImGui::Combo("Constraint", &type, test_desc, IM_ARRAYSIZE(test_desc));
|
ImGui::Combo("Constraint", &type, test_desc, IM_ARRAYSIZE(test_desc));
|
||||||
ImGui::SetNextItemWidth(200);
|
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 20);
|
||||||
ImGui::DragInt("Lines", &display_lines, 0.2f, 1, 100);
|
ImGui::DragInt("Lines", &display_lines, 0.2f, 1, 100);
|
||||||
ImGui::Checkbox("Auto-resize", &auto_resize);
|
ImGui::Checkbox("Auto-resize", &auto_resize);
|
||||||
|
ImGui::Checkbox("Window padding", &window_padding);
|
||||||
for (int i = 0; i < display_lines; i++)
|
for (int i = 0; i < display_lines; i++)
|
||||||
ImGui::Text("%*sHello, sailor! Making this line long enough for the example.", i * 4, "");
|
ImGui::Text("%*sHello, sailor! Making this line long enough for the example.", i * 4, "");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7412,29 +7494,35 @@ static void ShowExampleAppConstrainedResize(bool* p_open)
|
|||||||
// + a context-menu to choose which corner of the screen to use.
|
// + a context-menu to choose which corner of the screen to use.
|
||||||
static void ShowExampleAppSimpleOverlay(bool* p_open)
|
static void ShowExampleAppSimpleOverlay(bool* p_open)
|
||||||
{
|
{
|
||||||
static int corner = 0;
|
static int location = 0;
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
||||||
if (corner != -1)
|
if (location >= 0)
|
||||||
{
|
{
|
||||||
const float PAD = 10.0f;
|
const float PAD = 10.0f;
|
||||||
const ImGuiViewport* viewport = ImGui::GetMainViewport();
|
const ImGuiViewport* viewport = ImGui::GetMainViewport();
|
||||||
ImVec2 work_pos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any!
|
ImVec2 work_pos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any!
|
||||||
ImVec2 work_size = viewport->WorkSize;
|
ImVec2 work_size = viewport->WorkSize;
|
||||||
ImVec2 window_pos, window_pos_pivot;
|
ImVec2 window_pos, window_pos_pivot;
|
||||||
window_pos.x = (corner & 1) ? (work_pos.x + work_size.x - PAD) : (work_pos.x + PAD);
|
window_pos.x = (location & 1) ? (work_pos.x + work_size.x - PAD) : (work_pos.x + PAD);
|
||||||
window_pos.y = (corner & 2) ? (work_pos.y + work_size.y - PAD) : (work_pos.y + PAD);
|
window_pos.y = (location & 2) ? (work_pos.y + work_size.y - PAD) : (work_pos.y + PAD);
|
||||||
window_pos_pivot.x = (corner & 1) ? 1.0f : 0.0f;
|
window_pos_pivot.x = (location & 1) ? 1.0f : 0.0f;
|
||||||
window_pos_pivot.y = (corner & 2) ? 1.0f : 0.0f;
|
window_pos_pivot.y = (location & 2) ? 1.0f : 0.0f;
|
||||||
ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always, window_pos_pivot);
|
ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always, window_pos_pivot);
|
||||||
ImGui::SetNextWindowViewport(viewport->ID);
|
ImGui::SetNextWindowViewport(viewport->ID);
|
||||||
window_flags |= ImGuiWindowFlags_NoMove;
|
window_flags |= ImGuiWindowFlags_NoMove;
|
||||||
}
|
}
|
||||||
|
else if (location == -2)
|
||||||
|
{
|
||||||
|
// Center window
|
||||||
|
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||||
|
window_flags |= ImGuiWindowFlags_NoMove;
|
||||||
|
}
|
||||||
ImGui::SetNextWindowBgAlpha(0.35f); // Transparent background
|
ImGui::SetNextWindowBgAlpha(0.35f); // Transparent background
|
||||||
if (ImGui::Begin("Example: Simple overlay", p_open, window_flags))
|
if (ImGui::Begin("Example: Simple overlay", p_open, window_flags))
|
||||||
{
|
{
|
||||||
IMGUI_DEMO_MARKER("Examples/Simple Overlay");
|
IMGUI_DEMO_MARKER("Examples/Simple Overlay");
|
||||||
ImGui::Text("Simple overlay\n" "in the corner of the screen.\n" "(right-click to change position)");
|
ImGui::Text("Simple overlay\n" "(right-click to change position)");
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
if (ImGui::IsMousePosValid())
|
if (ImGui::IsMousePosValid())
|
||||||
ImGui::Text("Mouse Position: (%.1f,%.1f)", io.MousePos.x, io.MousePos.y);
|
ImGui::Text("Mouse Position: (%.1f,%.1f)", io.MousePos.x, io.MousePos.y);
|
||||||
@ -7442,11 +7530,12 @@ static void ShowExampleAppSimpleOverlay(bool* p_open)
|
|||||||
ImGui::Text("Mouse Position: <invalid>");
|
ImGui::Text("Mouse Position: <invalid>");
|
||||||
if (ImGui::BeginPopupContextWindow())
|
if (ImGui::BeginPopupContextWindow())
|
||||||
{
|
{
|
||||||
if (ImGui::MenuItem("Custom", NULL, corner == -1)) corner = -1;
|
if (ImGui::MenuItem("Custom", NULL, location == -1)) location = -1;
|
||||||
if (ImGui::MenuItem("Top-left", NULL, corner == 0)) corner = 0;
|
if (ImGui::MenuItem("Center", NULL, location == -2)) location = -2;
|
||||||
if (ImGui::MenuItem("Top-right", NULL, corner == 1)) corner = 1;
|
if (ImGui::MenuItem("Top-left", NULL, location == 0)) location = 0;
|
||||||
if (ImGui::MenuItem("Bottom-left", NULL, corner == 2)) corner = 2;
|
if (ImGui::MenuItem("Top-right", NULL, location == 1)) location = 1;
|
||||||
if (ImGui::MenuItem("Bottom-right", NULL, corner == 3)) corner = 3;
|
if (ImGui::MenuItem("Bottom-left", NULL, location == 2)) location = 2;
|
||||||
|
if (ImGui::MenuItem("Bottom-right", NULL, location == 3)) location = 3;
|
||||||
if (p_open && ImGui::MenuItem("Close")) *p_open = false;
|
if (p_open && ImGui::MenuItem("Close")) *p_open = false;
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
@ -7494,8 +7583,8 @@ static void ShowExampleAppFullscreen(bool* p_open)
|
|||||||
// [SECTION] Example App: Manipulating Window Titles / ShowExampleAppWindowTitles()
|
// [SECTION] Example App: Manipulating Window Titles / ShowExampleAppWindowTitles()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demonstrate using "##" and "###" in identifiers to manipulate ID generation.
|
// Demonstrate the use of "##" and "###" in identifiers to manipulate ID generation.
|
||||||
// This apply to all regular items as well.
|
// This applies to all regular items as well.
|
||||||
// Read FAQ section "How can I have multiple widgets with the same label?" for details.
|
// Read FAQ section "How can I have multiple widgets with the same label?" for details.
|
||||||
static void ShowExampleAppWindowTitles(bool*)
|
static void ShowExampleAppWindowTitles(bool*)
|
||||||
{
|
{
|
||||||
@ -8039,7 +8128,8 @@ void ShowExampleAppDocuments(bool* p_open)
|
|||||||
if (ImGui::MenuItem("Close All Documents", NULL, false, open_count > 0))
|
if (ImGui::MenuItem("Close All Documents", NULL, false, open_count > 0))
|
||||||
for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
|
for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
|
||||||
app.Documents[doc_n].DoQueueClose();
|
app.Documents[doc_n].DoQueueClose();
|
||||||
if (ImGui::MenuItem("Exit", "Alt+F4")) {}
|
if (ImGui::MenuItem("Exit", "Ctrl+F4") && p_open)
|
||||||
|
*p_open = false;
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
ImGui::EndMenuBar();
|
ImGui::EndMenuBar();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.88
|
// dear imgui, v1.89 WIP
|
||||||
// (drawing and font code)
|
// (drawing and font code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -39,25 +39,12 @@ Index of this file:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h> // vsnprintf, sscanf, printf
|
#include <stdio.h> // vsnprintf, sscanf, printf
|
||||||
#if !defined(alloca)
|
|
||||||
#if defined(__GLIBC__) || defined(__sun) || defined(__APPLE__) || defined(__NEWLIB__)
|
|
||||||
#include <alloca.h> // alloca (glibc uses <alloca.h>. Note that Cygwin may have _WIN32 defined, so the order matters here)
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
#include <malloc.h> // alloca
|
|
||||||
#if !defined(alloca)
|
|
||||||
#define alloca _alloca // for clang with MS Codegen
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#include <stdlib.h> // alloca
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Visual Studio warnings
|
// Visual Studio warnings
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning (disable: 4127) // condition expression is constant
|
#pragma warning (disable: 4127) // condition expression is constant
|
||||||
#pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff)
|
#pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff)
|
||||||
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
||||||
#pragma warning (disable: 6255) // [Static Analyzer] _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead.
|
|
||||||
#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).
|
#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).
|
||||||
#pragma warning (disable: 26812) // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3). [MSVC Static Analyzer)
|
#pragma warning (disable: 26812) // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3). [MSVC Static Analyzer)
|
||||||
#endif
|
#endif
|
||||||
@ -67,9 +54,6 @@ Index of this file:
|
|||||||
#if __has_warning("-Wunknown-warning-option")
|
#if __has_warning("-Wunknown-warning-option")
|
||||||
#pragma clang diagnostic ignored "-Wunknown-warning-option" // warning: unknown warning group 'xxx' // not all warnings are known by all Clang versions and they tend to be rename-happy.. so ignoring warnings triggers new warnings on some configuration. Great!
|
#pragma clang diagnostic ignored "-Wunknown-warning-option" // warning: unknown warning group 'xxx' // not all warnings are known by all Clang versions and they tend to be rename-happy.. so ignoring warnings triggers new warnings on some configuration. Great!
|
||||||
#endif
|
#endif
|
||||||
#if __has_warning("-Walloca")
|
|
||||||
#pragma clang diagnostic ignored "-Walloca" // warning: use of function '__builtin_alloca' is discouraged
|
|
||||||
#endif
|
|
||||||
#pragma clang diagnostic ignored "-Wunknown-pragmas" // warning: unknown warning group 'xxx'
|
#pragma clang diagnostic ignored "-Wunknown-pragmas" // warning: unknown warning group 'xxx'
|
||||||
#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast // yes, they are more terse.
|
#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast // yes, they are more terse.
|
||||||
#pragma clang diagnostic ignored "-Wfloat-equal" // warning: comparing floating point with == or != is unsafe // storing and comparing against same constants ok.
|
#pragma clang diagnostic ignored "-Wfloat-equal" // warning: comparing floating point with == or != is unsafe // storing and comparing against same constants ok.
|
||||||
@ -761,7 +745,8 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32
|
|||||||
|
|
||||||
// Temporary buffer
|
// Temporary buffer
|
||||||
// The first <points_count> items are normals at each line point, then after that there are either 2 or 4 temp points for each line point
|
// The first <points_count> items are normals at each line point, then after that there are either 2 or 4 temp points for each line point
|
||||||
ImVec2* temp_normals = (ImVec2*)alloca(points_count * ((use_texture || !thick_line) ? 3 : 5) * sizeof(ImVec2)); //-V630
|
_Data->TempBuffer.reserve_discard(points_count * ((use_texture || !thick_line) ? 3 : 5));
|
||||||
|
ImVec2* temp_normals = _Data->TempBuffer.Data;
|
||||||
ImVec2* temp_points = temp_normals + points_count;
|
ImVec2* temp_points = temp_normals + points_count;
|
||||||
|
|
||||||
// Calculate normals (tangents) for each line segment
|
// Calculate normals (tangents) for each line segment
|
||||||
@ -1009,7 +994,8 @@ void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_coun
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Compute normals
|
// Compute normals
|
||||||
ImVec2* temp_normals = (ImVec2*)alloca(points_count * sizeof(ImVec2)); //-V630
|
_Data->TempBuffer.reserve_discard(points_count);
|
||||||
|
ImVec2* temp_normals = _Data->TempBuffer.Data;
|
||||||
for (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++)
|
for (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++)
|
||||||
{
|
{
|
||||||
const ImVec2& p0 = points[i0];
|
const ImVec2& p0 = points[i0];
|
||||||
@ -1303,6 +1289,7 @@ void ImDrawList::PathBezierCubicCurveTo(const ImVec2& p2, const ImVec2& p3, cons
|
|||||||
ImVec2 p1 = _Path.back();
|
ImVec2 p1 = _Path.back();
|
||||||
if (num_segments == 0)
|
if (num_segments == 0)
|
||||||
{
|
{
|
||||||
|
IM_ASSERT(_Data->CurveTessellationTol > 0.0f);
|
||||||
PathBezierCubicCurveToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, _Data->CurveTessellationTol, 0); // Auto-tessellated
|
PathBezierCubicCurveToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, _Data->CurveTessellationTol, 0); // Auto-tessellated
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1318,6 +1305,7 @@ void ImDrawList::PathBezierQuadraticCurveTo(const ImVec2& p2, const ImVec2& p3,
|
|||||||
ImVec2 p1 = _Path.back();
|
ImVec2 p1 = _Path.back();
|
||||||
if (num_segments == 0)
|
if (num_segments == 0)
|
||||||
{
|
{
|
||||||
|
IM_ASSERT(_Data->CurveTessellationTol > 0.0f);
|
||||||
PathBezierQuadraticCurveToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, _Data->CurveTessellationTol, 0);// Auto-tessellated
|
PathBezierQuadraticCurveToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, _Data->CurveTessellationTol, 0);// Auto-tessellated
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1332,6 +1320,7 @@ IM_STATIC_ASSERT(ImDrawFlags_RoundCornersTopLeft == (1 << 4));
|
|||||||
static inline ImDrawFlags FixRectCornerFlags(ImDrawFlags flags)
|
static inline ImDrawFlags FixRectCornerFlags(ImDrawFlags flags)
|
||||||
{
|
{
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
// Obsoleted in 1.82 (from February 2021)
|
||||||
// Legacy Support for hard coded ~0 (used to be a suggested equivalent to ImDrawCornerFlags_All)
|
// Legacy Support for hard coded ~0 (used to be a suggested equivalent to ImDrawCornerFlags_All)
|
||||||
// ~0 --> ImDrawFlags_RoundCornersAll or 0
|
// ~0 --> ImDrawFlags_RoundCornersAll or 0
|
||||||
if (flags == ~0)
|
if (flags == ~0)
|
||||||
@ -2306,10 +2295,11 @@ void ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[256], fl
|
|||||||
|
|
||||||
void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table[256], unsigned char* pixels, int x, int y, int w, int h, int stride)
|
void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table[256], unsigned char* pixels, int x, int y, int w, int h, int stride)
|
||||||
{
|
{
|
||||||
|
IM_ASSERT_PARANOID(w <= stride);
|
||||||
unsigned char* data = pixels + x + y * stride;
|
unsigned char* data = pixels + x + y * stride;
|
||||||
for (int j = h; j > 0; j--, data += stride)
|
for (int j = h; j > 0; j--, data += stride - w)
|
||||||
for (int i = 0; i < w; i++)
|
for (int i = w; i > 0; i--, data++)
|
||||||
data[i] = table[data[i]];
|
*data = table[*data];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef IMGUI_ENABLE_STB_TRUETYPE
|
#ifdef IMGUI_ENABLE_STB_TRUETYPE
|
||||||
@ -2326,7 +2316,7 @@ struct ImFontBuildSrcData
|
|||||||
int GlyphsHighest; // Highest requested codepoint
|
int GlyphsHighest; // Highest requested codepoint
|
||||||
int GlyphsCount; // Glyph count (excluding missing glyphs and glyphs already set by an earlier source font)
|
int GlyphsCount; // Glyph count (excluding missing glyphs and glyphs already set by an earlier source font)
|
||||||
ImBitVector GlyphsSet; // Glyph bit map (random access, 1-bit per codepoint. This will be a maximum of 8KB)
|
ImBitVector GlyphsSet; // Glyph bit map (random access, 1-bit per codepoint. This will be a maximum of 8KB)
|
||||||
ImVector<int> GlyphsList; // Glyph codepoints list (flattened version of GlyphsMap)
|
ImVector<int> GlyphsList; // Glyph codepoints list (flattened version of GlyphsSet)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Temporary data for one destination ImFont* (multiple source fonts can be merged into one destination ImFont)
|
// Temporary data for one destination ImFont* (multiple source fonts can be merged into one destination ImFont)
|
||||||
@ -2826,6 +2816,17 @@ const ImWchar* ImFontAtlas::GetGlyphRangesDefault()
|
|||||||
return &ranges[0];
|
return &ranges[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ImWchar* ImFontAtlas::GetGlyphRangesGreek()
|
||||||
|
{
|
||||||
|
static const ImWchar ranges[] =
|
||||||
|
{
|
||||||
|
0x0020, 0x00FF, // Basic Latin + Latin Supplement
|
||||||
|
0x0370, 0x03FF, // Greek and Coptic
|
||||||
|
0,
|
||||||
|
};
|
||||||
|
return &ranges[0];
|
||||||
|
}
|
||||||
|
|
||||||
const ImWchar* ImFontAtlas::GetGlyphRangesKorean()
|
const ImWchar* ImFontAtlas::GetGlyphRangesKorean()
|
||||||
{
|
{
|
||||||
static const ImWchar ranges[] =
|
static const ImWchar ranges[] =
|
||||||
@ -3338,11 +3339,21 @@ const ImFontGlyph* ImFont::FindGlyphNoFallback(ImWchar c) const
|
|||||||
return &Glyphs.Data[i];
|
return &Glyphs.Data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wrapping skips upcoming blanks
|
||||||
|
static inline const char* CalcWordWrapNextLineStartA(const char* text, const char* text_end)
|
||||||
|
{
|
||||||
|
while (text < text_end && ImCharIsBlankA(*text))
|
||||||
|
text++;
|
||||||
|
if (*text == '\n')
|
||||||
|
text++;
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simple word-wrapping for English, not full-featured. Please submit failing cases!
|
||||||
|
// This will return the next location to wrap from. If no wrapping if necessary, this will fast-forward to e.g. text_end.
|
||||||
|
// FIXME: Much possible improvements (don't cut things like "word !", "word!!!" but cut within "word,,,,", more sensible support for punctuations, support for Unicode punctuations, etc.)
|
||||||
const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const
|
const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const
|
||||||
{
|
{
|
||||||
// Simple word-wrapping for English, not full-featured. Please submit failing cases!
|
|
||||||
// FIXME: Much possible improvements (don't cut things like "word !", "word!!!" but cut within "word,,,,", more sensible support for punctuations, support for Unicode punctuations, etc.)
|
|
||||||
|
|
||||||
// For references, possible wrap point marked with ^
|
// For references, possible wrap point marked with ^
|
||||||
// "aaa bbb, ccc,ddd. eee fff. ggg!"
|
// "aaa bbb, ccc,ddd. eee fff. ggg!"
|
||||||
// ^ ^ ^ ^ ^__ ^ ^
|
// ^ ^ ^ ^ ^__ ^ ^
|
||||||
@ -3354,7 +3365,6 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c
|
|||||||
|
|
||||||
// Cut words that cannot possibly fit within one line.
|
// Cut words that cannot possibly fit within one line.
|
||||||
// e.g.: "The tropical fish" with ~5 characters worth of width --> "The tr" "opical" "fish"
|
// e.g.: "The tropical fish" with ~5 characters worth of width --> "The tr" "opical" "fish"
|
||||||
|
|
||||||
float line_width = 0.0f;
|
float line_width = 0.0f;
|
||||||
float word_width = 0.0f;
|
float word_width = 0.0f;
|
||||||
float blank_width = 0.0f;
|
float blank_width = 0.0f;
|
||||||
@ -3434,6 +3444,10 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c
|
|||||||
s = next_s;
|
s = next_s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wrap_width is too small to fit anything. Force displaying 1 character to minimize the height discontinuity.
|
||||||
|
// +1 may not be a character start point in UTF-8 but it's ok because caller loops use (text >= word_wrap_eol).
|
||||||
|
if (s == text && text < text_end)
|
||||||
|
return s + 1;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3458,11 +3472,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons
|
|||||||
{
|
{
|
||||||
// Calculate how far we can render. Requires two passes on the string data but keeps the code simple and not intrusive for what's essentially an uncommon feature.
|
// Calculate how far we can render. Requires two passes on the string data but keeps the code simple and not intrusive for what's essentially an uncommon feature.
|
||||||
if (!word_wrap_eol)
|
if (!word_wrap_eol)
|
||||||
{
|
|
||||||
word_wrap_eol = CalcWordWrapPositionA(scale, s, text_end, wrap_width - line_width);
|
word_wrap_eol = CalcWordWrapPositionA(scale, s, text_end, wrap_width - line_width);
|
||||||
if (word_wrap_eol == s) // Wrap_width is too small to fit anything. Force displaying 1 character to minimize the height discontinuity.
|
|
||||||
word_wrap_eol++; // +1 may not be a character start point in UTF-8 but it's ok because we use s >= word_wrap_eol below
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s >= word_wrap_eol)
|
if (s >= word_wrap_eol)
|
||||||
{
|
{
|
||||||
@ -3471,13 +3481,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons
|
|||||||
text_size.y += line_height;
|
text_size.y += line_height;
|
||||||
line_width = 0.0f;
|
line_width = 0.0f;
|
||||||
word_wrap_eol = NULL;
|
word_wrap_eol = NULL;
|
||||||
|
s = CalcWordWrapNextLineStartA(s, text_end); // Wrapping skips upcoming blanks
|
||||||
// Wrapping skips upcoming blanks
|
|
||||||
while (s < text_end)
|
|
||||||
{
|
|
||||||
const char c = *s;
|
|
||||||
if (ImCharIsBlankA(c)) { s++; } else if (c == '\n') { s++; break; } else { break; }
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3562,15 +3566,25 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im
|
|||||||
const float scale = size / FontSize;
|
const float scale = size / FontSize;
|
||||||
const float line_height = FontSize * scale;
|
const float line_height = FontSize * scale;
|
||||||
const bool word_wrap_enabled = (wrap_width > 0.0f);
|
const bool word_wrap_enabled = (wrap_width > 0.0f);
|
||||||
const char* word_wrap_eol = NULL;
|
|
||||||
|
|
||||||
// Fast-forward to first visible line
|
// Fast-forward to first visible line
|
||||||
const char* s = text_begin;
|
const char* s = text_begin;
|
||||||
if (y + line_height < clip_rect.y && !word_wrap_enabled)
|
if (y + line_height < clip_rect.y)
|
||||||
while (y + line_height < clip_rect.y && s < text_end)
|
while (y + line_height < clip_rect.y && s < text_end)
|
||||||
{
|
{
|
||||||
s = (const char*)memchr(s, '\n', text_end - s);
|
const char* line_end = (const char*)memchr(s, '\n', text_end - s);
|
||||||
s = s ? s + 1 : text_end;
|
if (word_wrap_enabled)
|
||||||
|
{
|
||||||
|
// FIXME-OPT: This is not optimal as do first do a search for \n before calling CalcWordWrapPositionA().
|
||||||
|
// If the specs for CalcWordWrapPositionA() were reworked to optionally return on \n we could combine both.
|
||||||
|
// However it is still better than nothing performing the fast-forward!
|
||||||
|
s = CalcWordWrapPositionA(scale, s, line_end, wrap_width);
|
||||||
|
s = CalcWordWrapNextLineStartA(s, text_end);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s = line_end ? line_end + 1 : text_end;
|
||||||
|
}
|
||||||
y += line_height;
|
y += line_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3602,6 +3616,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im
|
|||||||
unsigned int vtx_current_idx = draw_list->_VtxCurrentIdx;
|
unsigned int vtx_current_idx = draw_list->_VtxCurrentIdx;
|
||||||
|
|
||||||
const ImU32 col_untinted = col | ~IM_COL32_A_MASK;
|
const ImU32 col_untinted = col | ~IM_COL32_A_MASK;
|
||||||
|
const char* word_wrap_eol = NULL;
|
||||||
|
|
||||||
while (s < text_end)
|
while (s < text_end)
|
||||||
{
|
{
|
||||||
@ -3609,24 +3624,14 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im
|
|||||||
{
|
{
|
||||||
// Calculate how far we can render. Requires two passes on the string data but keeps the code simple and not intrusive for what's essentially an uncommon feature.
|
// Calculate how far we can render. Requires two passes on the string data but keeps the code simple and not intrusive for what's essentially an uncommon feature.
|
||||||
if (!word_wrap_eol)
|
if (!word_wrap_eol)
|
||||||
{
|
|
||||||
word_wrap_eol = CalcWordWrapPositionA(scale, s, text_end, wrap_width - (x - start_x));
|
word_wrap_eol = CalcWordWrapPositionA(scale, s, text_end, wrap_width - (x - start_x));
|
||||||
if (word_wrap_eol == s) // Wrap_width is too small to fit anything. Force displaying 1 character to minimize the height discontinuity.
|
|
||||||
word_wrap_eol++; // +1 may not be a character start point in UTF-8 but it's ok because we use s >= word_wrap_eol below
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s >= word_wrap_eol)
|
if (s >= word_wrap_eol)
|
||||||
{
|
{
|
||||||
x = start_x;
|
x = start_x;
|
||||||
y += line_height;
|
y += line_height;
|
||||||
word_wrap_eol = NULL;
|
word_wrap_eol = NULL;
|
||||||
|
s = CalcWordWrapNextLineStartA(s, text_end); // Wrapping skips upcoming blanks
|
||||||
// Wrapping skips upcoming blanks
|
|
||||||
while (s < text_end)
|
|
||||||
{
|
|
||||||
const char c = *s;
|
|
||||||
if (ImCharIsBlankA(c)) { s++; } else if (c == '\n') { s++; break; } else { break; }
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.88
|
// dear imgui, v1.89 WIP
|
||||||
// (internal structures/api)
|
// (internal structures/api)
|
||||||
|
|
||||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||||
@ -153,11 +153,11 @@ typedef int ImGuiDataAuthority; // -> enum ImGuiDataAuthority_ // E
|
|||||||
typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
|
typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
|
||||||
typedef int ImGuiActivateFlags; // -> enum ImGuiActivateFlags_ // Flags: for navigation/focus function (will be for ActivateItem() later)
|
typedef int ImGuiActivateFlags; // -> enum ImGuiActivateFlags_ // Flags: for navigation/focus function (will be for ActivateItem() later)
|
||||||
typedef int ImGuiDebugLogFlags; // -> enum ImGuiDebugLogFlags_ // Flags: for ShowDebugLogWindow(), g.DebugLogFlags
|
typedef int ImGuiDebugLogFlags; // -> enum ImGuiDebugLogFlags_ // Flags: for ShowDebugLogWindow(), g.DebugLogFlags
|
||||||
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag()
|
typedef int ImGuiInputFlags; // -> enum ImGuiInputFlags_ // Flags: for IsKeyPressedEx()
|
||||||
typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for DC.LastItemStatusFlags
|
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag(), g.LastItemData.InFlags
|
||||||
|
typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for g.LastItemData.StatusFlags
|
||||||
typedef int ImGuiOldColumnFlags; // -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
|
typedef int ImGuiOldColumnFlags; // -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
|
||||||
typedef int ImGuiNavHighlightFlags; // -> enum ImGuiNavHighlightFlags_ // Flags: for RenderNavHighlight()
|
typedef int ImGuiNavHighlightFlags; // -> enum ImGuiNavHighlightFlags_ // Flags: for RenderNavHighlight()
|
||||||
typedef int ImGuiNavDirSourceFlags; // -> enum ImGuiNavDirSourceFlags_ // Flags: for GetNavInputAmount2d()
|
|
||||||
typedef int ImGuiNavMoveFlags; // -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests
|
typedef int ImGuiNavMoveFlags; // -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests
|
||||||
typedef int ImGuiNextItemDataFlags; // -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions
|
typedef int ImGuiNextItemDataFlags; // -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions
|
||||||
typedef int ImGuiNextWindowDataFlags; // -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions
|
typedef int ImGuiNextWindowDataFlags; // -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions
|
||||||
@ -213,11 +213,12 @@ namespace ImStb
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Debug Logging for ShowDebugLogWindow(). This is designed for relatively rare events so please don't spam.
|
// Debug Logging for ShowDebugLogWindow(). This is designed for relatively rare events so please don't spam.
|
||||||
#define IMGUI_DEBUG_LOG(...) ImGui::DebugLog(__VA_ARGS__);
|
#define IMGUI_DEBUG_LOG(...) ImGui::DebugLog(__VA_ARGS__)
|
||||||
#define IMGUI_DEBUG_LOG_ACTIVEID(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventActiveId) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
#define IMGUI_DEBUG_LOG_ACTIVEID(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventActiveId) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
||||||
#define IMGUI_DEBUG_LOG_FOCUS(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventFocus) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
#define IMGUI_DEBUG_LOG_FOCUS(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventFocus) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
||||||
#define IMGUI_DEBUG_LOG_POPUP(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventPopup) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
#define IMGUI_DEBUG_LOG_POPUP(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventPopup) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
||||||
#define IMGUI_DEBUG_LOG_NAV(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventNav) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
#define IMGUI_DEBUG_LOG_NAV(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventNav) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
||||||
|
#define IMGUI_DEBUG_LOG_CLIPPER(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventClipper) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
||||||
#define IMGUI_DEBUG_LOG_IO(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventIO) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
#define IMGUI_DEBUG_LOG_IO(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventIO) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
||||||
#define IMGUI_DEBUG_LOG_DOCKING(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventDocking) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
#define IMGUI_DEBUG_LOG_DOCKING(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventDocking) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
||||||
#define IMGUI_DEBUG_LOG_VIEWPORT(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventViewport) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
#define IMGUI_DEBUG_LOG_VIEWPORT(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventViewport) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
||||||
@ -247,7 +248,9 @@ namespace ImStb
|
|||||||
#else
|
#else
|
||||||
#define IM_NEWLINE "\n"
|
#define IM_NEWLINE "\n"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef IM_TABSIZE // Until we move this to runtime and/or add proper tab support, at least allow users to compile-time override
|
||||||
#define IM_TABSIZE (4)
|
#define IM_TABSIZE (4)
|
||||||
|
#endif
|
||||||
#define IM_MEMALIGN(_OFF,_ALIGN) (((_OFF) + ((_ALIGN) - 1)) & ~((_ALIGN) - 1)) // Memory align e.g. IM_ALIGN(0,4)=0, IM_ALIGN(1,4)=4, IM_ALIGN(4,4)=4, IM_ALIGN(5,4)=8
|
#define IM_MEMALIGN(_OFF,_ALIGN) (((_OFF) + ((_ALIGN) - 1)) & ~((_ALIGN) - 1)) // Memory align e.g. IM_ALIGN(0,4)=0, IM_ALIGN(1,4)=4, IM_ALIGN(4,4)=4, IM_ALIGN(5,4)=8
|
||||||
#define IM_F32_TO_INT8_UNBOUND(_VAL) ((int)((_VAL) * 255.0f + ((_VAL)>=0 ? 0.5f : -0.5f))) // Unsaturated, for display purpose
|
#define IM_F32_TO_INT8_UNBOUND(_VAL) ((int)((_VAL) * 255.0f + ((_VAL)>=0 ? 0.5f : -0.5f))) // Unsaturated, for display purpose
|
||||||
#define IM_F32_TO_INT8_SAT(_VAL) ((int)(ImSaturate(_VAL) * 255.0f + 0.5f)) // Saturated, always output 0..255
|
#define IM_F32_TO_INT8_SAT(_VAL) ((int)(ImSaturate(_VAL) * 255.0f + 0.5f)) // Saturated, always output 0..255
|
||||||
@ -341,8 +344,10 @@ IMGUI_API const ImWchar*ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* bu
|
|||||||
IMGUI_API const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end);
|
IMGUI_API const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end);
|
||||||
IMGUI_API void ImStrTrimBlanks(char* str);
|
IMGUI_API void ImStrTrimBlanks(char* str);
|
||||||
IMGUI_API const char* ImStrSkipBlank(const char* str);
|
IMGUI_API const char* ImStrSkipBlank(const char* str);
|
||||||
|
IM_MSVC_RUNTIME_CHECKS_OFF
|
||||||
static inline bool ImCharIsBlankA(char c) { return c == ' ' || c == '\t'; }
|
static inline bool ImCharIsBlankA(char c) { return c == ' ' || c == '\t'; }
|
||||||
static inline bool ImCharIsBlankW(unsigned int c) { return c == ' ' || c == '\t' || c == 0x3000; }
|
static inline bool ImCharIsBlankW(unsigned int c) { return c == ' ' || c == '\t' || c == 0x3000; }
|
||||||
|
IM_MSVC_RUNTIME_CHECKS_RESTORE
|
||||||
|
|
||||||
// Helpers: Formatting
|
// Helpers: Formatting
|
||||||
IMGUI_API int ImFormatString(char* buf, size_t buf_size, const char* fmt, ...) IM_FMTARGS(3);
|
IMGUI_API int ImFormatString(char* buf, size_t buf_size, const char* fmt, ...) IM_FMTARGS(3);
|
||||||
@ -739,6 +744,9 @@ struct IMGUI_API ImDrawListSharedData
|
|||||||
ImVec4 ClipRectFullscreen; // Value for PushClipRectFullscreen()
|
ImVec4 ClipRectFullscreen; // Value for PushClipRectFullscreen()
|
||||||
ImDrawListFlags InitialFlags; // Initial flags at the beginning of the frame (it is possible to alter flags on a per-drawlist basis afterwards)
|
ImDrawListFlags InitialFlags; // Initial flags at the beginning of the frame (it is possible to alter flags on a per-drawlist basis afterwards)
|
||||||
|
|
||||||
|
// [Internal] Temp write buffer
|
||||||
|
ImVector<ImVec2> TempBuffer;
|
||||||
|
|
||||||
// [Internal] Lookup tables
|
// [Internal] Lookup tables
|
||||||
ImVec2 ArcFastVtx[IM_DRAWLIST_ARCFAST_TABLE_SIZE]; // Sample points on the quarter of the circle.
|
ImVec2 ArcFastVtx[IM_DRAWLIST_ARCFAST_TABLE_SIZE]; // Sample points on the quarter of the circle.
|
||||||
float ArcFastRadiusCutoff; // Cutoff radius after which arc drawing will fallback to slower PathArcTo()
|
float ArcFastRadiusCutoff; // Cutoff radius after which arc drawing will fallback to slower PathArcTo()
|
||||||
@ -763,10 +771,14 @@ struct ImDrawDataBuilder
|
|||||||
// [SECTION] Widgets support: flags, enums, data structures
|
// [SECTION] Widgets support: flags, enums, data structures
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Transient per-window flags, reset at the beginning of the frame. For child window, inherited from parent on first Begin().
|
// Flags used by upcoming items
|
||||||
|
// - input: PushItemFlag() manipulates g.CurrentItemFlags, ItemAdd() calls may add extra flags.
|
||||||
|
// - output: stored in g.LastItemData.InFlags
|
||||||
|
// Current window shared by all windows.
|
||||||
// This is going to be exposed in imgui.h when stabilized enough.
|
// This is going to be exposed in imgui.h when stabilized enough.
|
||||||
enum ImGuiItemFlags_
|
enum ImGuiItemFlags_
|
||||||
{
|
{
|
||||||
|
// Controlled by user
|
||||||
ImGuiItemFlags_None = 0,
|
ImGuiItemFlags_None = 0,
|
||||||
ImGuiItemFlags_NoTabStop = 1 << 0, // false // Disable keyboard tabbing (FIXME: should merge with _NoNav)
|
ImGuiItemFlags_NoTabStop = 1 << 0, // false // Disable keyboard tabbing (FIXME: should merge with _NoNav)
|
||||||
ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.
|
ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.
|
||||||
@ -776,10 +788,14 @@ enum ImGuiItemFlags_
|
|||||||
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // Disable MenuItem/Selectable() automatically closing their popup window
|
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // Disable MenuItem/Selectable() automatically closing their popup window
|
||||||
ImGuiItemFlags_MixedValue = 1 << 6, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets)
|
ImGuiItemFlags_MixedValue = 1 << 6, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets)
|
||||||
ImGuiItemFlags_ReadOnly = 1 << 7, // false // [ALPHA] Allow hovering interactions but underlying value is not changed.
|
ImGuiItemFlags_ReadOnly = 1 << 7, // false // [ALPHA] Allow hovering interactions but underlying value is not changed.
|
||||||
ImGuiItemFlags_Inputable = 1 << 8 // false // [WIP] Auto-activate input mode when tab focused. Currently only used and supported by a few items before it becomes a generic feature.
|
ImGuiItemFlags_NoWindowHoverableCheck = 1 << 8, // false // Disable hoverable check in ItemHoverable()
|
||||||
|
|
||||||
|
// Controlled by widget code
|
||||||
|
ImGuiItemFlags_Inputable = 1 << 10, // false // [WIP] Auto-activate input mode when tab focused. Currently only used and supported by a few items before it becomes a generic feature.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Storage for LastItem data
|
// Status flags for an already submitted item
|
||||||
|
// - output: stored in g.LastItemData.StatusFlags
|
||||||
enum ImGuiItemStatusFlags_
|
enum ImGuiItemStatusFlags_
|
||||||
{
|
{
|
||||||
ImGuiItemStatusFlags_None = 0,
|
ImGuiItemStatusFlags_None = 0,
|
||||||
@ -791,14 +807,13 @@ enum ImGuiItemStatusFlags_
|
|||||||
ImGuiItemStatusFlags_HasDeactivated = 1 << 5, // Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
|
ImGuiItemStatusFlags_HasDeactivated = 1 << 5, // Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
|
||||||
ImGuiItemStatusFlags_Deactivated = 1 << 6, // Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
|
ImGuiItemStatusFlags_Deactivated = 1 << 6, // Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
|
||||||
ImGuiItemStatusFlags_HoveredWindow = 1 << 7, // Override the HoveredWindow test to allow cross-window hover testing.
|
ImGuiItemStatusFlags_HoveredWindow = 1 << 7, // Override the HoveredWindow test to allow cross-window hover testing.
|
||||||
ImGuiItemStatusFlags_FocusedByTabbing = 1 << 8 // Set when the Focusable item just got focused by Tabbing (FIXME: to be removed soon)
|
ImGuiItemStatusFlags_FocusedByTabbing = 1 << 8, // Set when the Focusable item just got focused by Tabbing (FIXME: to be removed soon)
|
||||||
|
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
, // [imgui_tests only]
|
|
||||||
ImGuiItemStatusFlags_Openable = 1 << 20, // Item is an openable (e.g. TreeNode)
|
ImGuiItemStatusFlags_Openable = 1 << 20, // Item is an openable (e.g. TreeNode)
|
||||||
ImGuiItemStatusFlags_Opened = 1 << 21, //
|
ImGuiItemStatusFlags_Opened = 1 << 21, //
|
||||||
ImGuiItemStatusFlags_Checkable = 1 << 22, // Item is a checkable (e.g. CheckBox, MenuItem)
|
ImGuiItemStatusFlags_Checkable = 1 << 22, // Item is a checkable (e.g. CheckBox, MenuItem)
|
||||||
ImGuiItemStatusFlags_Checked = 1 << 23 //
|
ImGuiItemStatusFlags_Checked = 1 << 23, //
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -808,7 +823,7 @@ enum ImGuiInputTextFlagsPrivate_
|
|||||||
// [Internal]
|
// [Internal]
|
||||||
ImGuiInputTextFlags_Multiline = 1 << 26, // For internal use by InputTextMultiline()
|
ImGuiInputTextFlags_Multiline = 1 << 26, // For internal use by InputTextMultiline()
|
||||||
ImGuiInputTextFlags_NoMarkEdited = 1 << 27, // For internal use by functions using InputText() before reformatting data
|
ImGuiInputTextFlags_NoMarkEdited = 1 << 27, // For internal use by functions using InputText() before reformatting data
|
||||||
ImGuiInputTextFlags_MergedItem = 1 << 28 // For internal use by TempInputText(), will skip calling ItemAdd(). Require bounding-box to strictly match.
|
ImGuiInputTextFlags_MergedItem = 1 << 28, // For internal use by TempInputText(), will skip calling ItemAdd(). Require bounding-box to strictly match.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Extend ImGuiButtonFlags_
|
// Extend ImGuiButtonFlags_
|
||||||
@ -831,20 +846,20 @@ enum ImGuiButtonFlagsPrivate_
|
|||||||
ImGuiButtonFlags_NoNavFocus = 1 << 18, // don't override navigation focus when activated
|
ImGuiButtonFlags_NoNavFocus = 1 << 18, // don't override navigation focus when activated
|
||||||
ImGuiButtonFlags_NoHoveredOnFocus = 1 << 19, // don't report as hovered when nav focus is on this item
|
ImGuiButtonFlags_NoHoveredOnFocus = 1 << 19, // don't report as hovered when nav focus is on this item
|
||||||
ImGuiButtonFlags_PressedOnMask_ = ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_PressedOnDragDropHold,
|
ImGuiButtonFlags_PressedOnMask_ = ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_PressedOnDragDropHold,
|
||||||
ImGuiButtonFlags_PressedOnDefault_ = ImGuiButtonFlags_PressedOnClickRelease
|
ImGuiButtonFlags_PressedOnDefault_ = ImGuiButtonFlags_PressedOnClickRelease,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Extend ImGuiComboFlags_
|
// Extend ImGuiComboFlags_
|
||||||
enum ImGuiComboFlagsPrivate_
|
enum ImGuiComboFlagsPrivate_
|
||||||
{
|
{
|
||||||
ImGuiComboFlags_CustomPreview = 1 << 20 // enable BeginComboPreview()
|
ImGuiComboFlags_CustomPreview = 1 << 20, // enable BeginComboPreview()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Extend ImGuiSliderFlags_
|
// Extend ImGuiSliderFlags_
|
||||||
enum ImGuiSliderFlagsPrivate_
|
enum ImGuiSliderFlagsPrivate_
|
||||||
{
|
{
|
||||||
ImGuiSliderFlags_Vertical = 1 << 20, // Should this slider be orientated vertically?
|
ImGuiSliderFlags_Vertical = 1 << 20, // Should this slider be orientated vertically?
|
||||||
ImGuiSliderFlags_ReadOnly = 1 << 21
|
ImGuiSliderFlags_ReadOnly = 1 << 21,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Extend ImGuiSelectableFlags_
|
// Extend ImGuiSelectableFlags_
|
||||||
@ -858,13 +873,13 @@ enum ImGuiSelectableFlagsPrivate_
|
|||||||
ImGuiSelectableFlags_SpanAvailWidth = 1 << 24, // Span all avail width even if we declared less for layout purpose. FIXME: We may be able to remove this (added in 6251d379, 2bcafc86 for menus)
|
ImGuiSelectableFlags_SpanAvailWidth = 1 << 24, // Span all avail width even if we declared less for layout purpose. FIXME: We may be able to remove this (added in 6251d379, 2bcafc86 for menus)
|
||||||
ImGuiSelectableFlags_DrawHoveredWhenHeld = 1 << 25, // Always show active when held, even is not hovered. This concept could probably be renamed/formalized somehow.
|
ImGuiSelectableFlags_DrawHoveredWhenHeld = 1 << 25, // Always show active when held, even is not hovered. This concept could probably be renamed/formalized somehow.
|
||||||
ImGuiSelectableFlags_SetNavIdOnHover = 1 << 26, // Set Nav/Focus ID on mouse hover (used by MenuItem)
|
ImGuiSelectableFlags_SetNavIdOnHover = 1 << 26, // Set Nav/Focus ID on mouse hover (used by MenuItem)
|
||||||
ImGuiSelectableFlags_NoPadWithHalfSpacing = 1 << 27 // Disable padding each side with ItemSpacing * 0.5f
|
ImGuiSelectableFlags_NoPadWithHalfSpacing = 1 << 27, // Disable padding each side with ItemSpacing * 0.5f
|
||||||
};
|
};
|
||||||
|
|
||||||
// Extend ImGuiTreeNodeFlags_
|
// Extend ImGuiTreeNodeFlags_
|
||||||
enum ImGuiTreeNodeFlagsPrivate_
|
enum ImGuiTreeNodeFlagsPrivate_
|
||||||
{
|
{
|
||||||
ImGuiTreeNodeFlags_ClipLabelForTrailingButton = 1 << 20
|
ImGuiTreeNodeFlags_ClipLabelForTrailingButton = 1 << 20,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiSeparatorFlags_
|
enum ImGuiSeparatorFlags_
|
||||||
@ -872,19 +887,19 @@ enum ImGuiSeparatorFlags_
|
|||||||
ImGuiSeparatorFlags_None = 0,
|
ImGuiSeparatorFlags_None = 0,
|
||||||
ImGuiSeparatorFlags_Horizontal = 1 << 0, // Axis default to current layout type, so generally Horizontal unless e.g. in a menu bar
|
ImGuiSeparatorFlags_Horizontal = 1 << 0, // Axis default to current layout type, so generally Horizontal unless e.g. in a menu bar
|
||||||
ImGuiSeparatorFlags_Vertical = 1 << 1,
|
ImGuiSeparatorFlags_Vertical = 1 << 1,
|
||||||
ImGuiSeparatorFlags_SpanAllColumns = 1 << 2
|
ImGuiSeparatorFlags_SpanAllColumns = 1 << 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiTextFlags_
|
enum ImGuiTextFlags_
|
||||||
{
|
{
|
||||||
ImGuiTextFlags_None = 0,
|
ImGuiTextFlags_None = 0,
|
||||||
ImGuiTextFlags_NoWidthForLargeClippedText = 1 << 0
|
ImGuiTextFlags_NoWidthForLargeClippedText = 1 << 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiTooltipFlags_
|
enum ImGuiTooltipFlags_
|
||||||
{
|
{
|
||||||
ImGuiTooltipFlags_None = 0,
|
ImGuiTooltipFlags_None = 0,
|
||||||
ImGuiTooltipFlags_OverridePreviousTooltip = 1 << 0 // Override will clear/ignore previously submitted tooltip (defaults to append)
|
ImGuiTooltipFlags_OverridePreviousTooltip = 1 << 0, // Override will clear/ignore previously submitted tooltip (defaults to append)
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: this is in development, not exposed/functional as a generic feature yet.
|
// FIXME: this is in development, not exposed/functional as a generic feature yet.
|
||||||
@ -901,7 +916,7 @@ enum ImGuiLogType
|
|||||||
ImGuiLogType_TTY,
|
ImGuiLogType_TTY,
|
||||||
ImGuiLogType_File,
|
ImGuiLogType_File,
|
||||||
ImGuiLogType_Buffer,
|
ImGuiLogType_Buffer,
|
||||||
ImGuiLogType_Clipboard
|
ImGuiLogType_Clipboard,
|
||||||
};
|
};
|
||||||
|
|
||||||
// X/Y enums are fixed to 0/1 so they may be used to index ImVec2
|
// X/Y enums are fixed to 0/1 so they may be used to index ImVec2
|
||||||
@ -915,14 +930,14 @@ enum ImGuiAxis
|
|||||||
enum ImGuiPlotType
|
enum ImGuiPlotType
|
||||||
{
|
{
|
||||||
ImGuiPlotType_Lines,
|
ImGuiPlotType_Lines,
|
||||||
ImGuiPlotType_Histogram
|
ImGuiPlotType_Histogram,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiPopupPositionPolicy
|
enum ImGuiPopupPositionPolicy
|
||||||
{
|
{
|
||||||
ImGuiPopupPositionPolicy_Default,
|
ImGuiPopupPositionPolicy_Default,
|
||||||
ImGuiPopupPositionPolicy_ComboBox,
|
ImGuiPopupPositionPolicy_ComboBox,
|
||||||
ImGuiPopupPositionPolicy_Tooltip
|
ImGuiPopupPositionPolicy_Tooltip,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiDataTypeTempStorage
|
struct ImGuiDataTypeTempStorage
|
||||||
@ -944,7 +959,7 @@ enum ImGuiDataTypePrivate_
|
|||||||
{
|
{
|
||||||
ImGuiDataType_String = ImGuiDataType_COUNT + 1,
|
ImGuiDataType_String = ImGuiDataType_COUNT + 1,
|
||||||
ImGuiDataType_Pointer,
|
ImGuiDataType_Pointer,
|
||||||
ImGuiDataType_ID
|
ImGuiDataType_ID,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Stacked color modifier, backup of modified data so we can restore it
|
// Stacked color modifier, backup of modified data so we can restore it
|
||||||
@ -1028,7 +1043,7 @@ struct IMGUI_API ImGuiInputTextState
|
|||||||
bool CursorFollow; // set when we want scrolling to follow the current cursor position (not always!)
|
bool CursorFollow; // set when we want scrolling to follow the current cursor position (not always!)
|
||||||
bool SelectedAllMouseLock; // after a double-click to select all, we ignore further mouse drags to update selection
|
bool SelectedAllMouseLock; // after a double-click to select all, we ignore further mouse drags to update selection
|
||||||
bool Edited; // edited this frame
|
bool Edited; // edited this frame
|
||||||
ImGuiInputTextFlags Flags; // copy of InputText() flags
|
ImGuiInputTextFlags Flags; // copy of InputText() flags. may be used to check if e.g. ImGuiInputTextFlags_Password is set.
|
||||||
|
|
||||||
ImGuiInputTextState() { memset(this, 0, sizeof(*this)); }
|
ImGuiInputTextState() { memset(this, 0, sizeof(*this)); }
|
||||||
void ClearText() { CurLenW = CurLenA = 0; TextW[0] = 0; TextA[0] = 0; CursorClamp(); }
|
void ClearText() { CurLenW = CurLenA = 0; TextW[0] = 0; TextA[0] = 0; CursorClamp(); }
|
||||||
@ -1053,7 +1068,7 @@ struct ImGuiPopupData
|
|||||||
{
|
{
|
||||||
ImGuiID PopupId; // Set on OpenPopup()
|
ImGuiID PopupId; // Set on OpenPopup()
|
||||||
ImGuiWindow* Window; // Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup()
|
ImGuiWindow* Window; // Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup()
|
||||||
ImGuiWindow* SourceWindow; // Set on OpenPopup() copy of NavWindow at the time of opening the popup
|
ImGuiWindow* BackupNavWindow;// Set on OpenPopup(), a NavWindow that will be restored on popup close
|
||||||
int ParentNavLayer; // Resolved on BeginPopup(). Actually a ImGuiNavLayer type (declared down below), initialized to -1 which is not part of an enum, but serves well-enough as "not any of layers" value
|
int ParentNavLayer; // Resolved on BeginPopup(). Actually a ImGuiNavLayer type (declared down below), initialized to -1 which is not part of an enum, but serves well-enough as "not any of layers" value
|
||||||
int OpenFrameCount; // Set on OpenPopup()
|
int OpenFrameCount; // Set on OpenPopup()
|
||||||
ImGuiID OpenParentId; // Set on OpenPopup(), we need this to differentiate multiple menu sets from each others (e.g. inside menu bar vs loose menu items)
|
ImGuiID OpenParentId; // Set on OpenPopup(), we need this to differentiate multiple menu sets from each others (e.g. inside menu bar vs loose menu items)
|
||||||
@ -1076,7 +1091,7 @@ enum ImGuiNextWindowDataFlags_
|
|||||||
ImGuiNextWindowDataFlags_HasScroll = 1 << 7,
|
ImGuiNextWindowDataFlags_HasScroll = 1 << 7,
|
||||||
ImGuiNextWindowDataFlags_HasViewport = 1 << 8,
|
ImGuiNextWindowDataFlags_HasViewport = 1 << 8,
|
||||||
ImGuiNextWindowDataFlags_HasDock = 1 << 9,
|
ImGuiNextWindowDataFlags_HasDock = 1 << 9,
|
||||||
ImGuiNextWindowDataFlags_HasWindowClass = 1 << 10
|
ImGuiNextWindowDataFlags_HasWindowClass = 1 << 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Storage for SetNexWindow** functions
|
// Storage for SetNexWindow** functions
|
||||||
@ -1111,7 +1126,7 @@ enum ImGuiNextItemDataFlags_
|
|||||||
{
|
{
|
||||||
ImGuiNextItemDataFlags_None = 0,
|
ImGuiNextItemDataFlags_None = 0,
|
||||||
ImGuiNextItemDataFlags_HasWidth = 1 << 0,
|
ImGuiNextItemDataFlags_HasWidth = 1 << 0,
|
||||||
ImGuiNextItemDataFlags_HasOpen = 1 << 1
|
ImGuiNextItemDataFlags_HasOpen = 1 << 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiNextItemData
|
struct ImGuiNextItemData
|
||||||
@ -1186,13 +1201,25 @@ struct ImGuiPtrOrIndex
|
|||||||
|
|
||||||
typedef ImBitArray<ImGuiKey_NamedKey_COUNT, -ImGuiKey_NamedKey_BEGIN> ImBitArrayForNamedKeys;
|
typedef ImBitArray<ImGuiKey_NamedKey_COUNT, -ImGuiKey_NamedKey_BEGIN> ImBitArrayForNamedKeys;
|
||||||
|
|
||||||
enum ImGuiKeyPrivate_
|
// [Internal] Key ranges
|
||||||
{
|
#define ImGuiKey_LegacyNativeKey_BEGIN 0
|
||||||
ImGuiKey_LegacyNativeKey_BEGIN = 0,
|
#define ImGuiKey_LegacyNativeKey_END 512
|
||||||
ImGuiKey_LegacyNativeKey_END = 512,
|
#define ImGuiKey_Keyboard_BEGIN (ImGuiKey_NamedKey_BEGIN)
|
||||||
ImGuiKey_Gamepad_BEGIN = ImGuiKey_GamepadStart,
|
#define ImGuiKey_Keyboard_END (ImGuiKey_GamepadStart)
|
||||||
ImGuiKey_Gamepad_END = ImGuiKey_GamepadRStickRight + 1
|
#define ImGuiKey_Gamepad_BEGIN (ImGuiKey_GamepadStart)
|
||||||
};
|
#define ImGuiKey_Gamepad_END (ImGuiKey_GamepadRStickDown + 1)
|
||||||
|
#define ImGuiKey_Aliases_BEGIN (ImGuiKey_MouseLeft)
|
||||||
|
#define ImGuiKey_Aliases_END (ImGuiKey_MouseWheelY + 1)
|
||||||
|
|
||||||
|
// [Internal] Named shortcuts for Navigation
|
||||||
|
#define ImGuiKey_NavKeyboardTweakSlow ImGuiMod_Ctrl
|
||||||
|
#define ImGuiKey_NavKeyboardTweakFast ImGuiMod_Shift
|
||||||
|
#define ImGuiKey_NavGamepadTweakSlow ImGuiKey_GamepadL1
|
||||||
|
#define ImGuiKey_NavGamepadTweakFast ImGuiKey_GamepadR1
|
||||||
|
#define ImGuiKey_NavGamepadActivate ImGuiKey_GamepadFaceDown
|
||||||
|
#define ImGuiKey_NavGamepadCancel ImGuiKey_GamepadFaceRight
|
||||||
|
#define ImGuiKey_NavGamepadMenu ImGuiKey_GamepadFaceLeft
|
||||||
|
#define ImGuiKey_NavGamepadInput ImGuiKey_GamepadFaceUp
|
||||||
|
|
||||||
enum ImGuiInputEventType
|
enum ImGuiInputEventType
|
||||||
{
|
{
|
||||||
@ -1247,15 +1274,17 @@ struct ImGuiInputEvent
|
|||||||
ImGuiInputEvent() { memset(this, 0, sizeof(*this)); }
|
ImGuiInputEvent() { memset(this, 0, sizeof(*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME-NAV: Clarify/expose various repeat delay/rate
|
// Flags for IsKeyPressedEx(). In upcoming feature this will be used more (and IsKeyPressedEx() renamed)
|
||||||
enum ImGuiNavReadMode
|
// Don't mistake with ImGuiInputTextFlags! (for ImGui::InputText() function)
|
||||||
|
enum ImGuiInputFlags_
|
||||||
{
|
{
|
||||||
ImGuiNavReadMode_Down,
|
// Flags for IsKeyPressedEx()
|
||||||
ImGuiNavReadMode_Pressed,
|
ImGuiInputFlags_None = 0,
|
||||||
ImGuiNavReadMode_Released,
|
ImGuiInputFlags_Repeat = 1 << 0, // Return true on successive repeats. Default for legacy IsKeyPressed(). NOT Default for legacy IsMouseClicked(). MUST BE == 1.
|
||||||
ImGuiNavReadMode_Repeat,
|
ImGuiInputFlags_RepeatRateDefault = 1 << 1, // Repeat rate: Regular (default)
|
||||||
ImGuiNavReadMode_RepeatSlow,
|
ImGuiInputFlags_RepeatRateNavMove = 1 << 2, // Repeat rate: Fast
|
||||||
ImGuiNavReadMode_RepeatFast
|
ImGuiInputFlags_RepeatRateNavTweak = 1 << 3, // Repeat rate: Faster
|
||||||
|
ImGuiInputFlags_RepeatRateMask_ = ImGuiInputFlags_RepeatRateDefault | ImGuiInputFlags_RepeatRateNavMove | ImGuiInputFlags_RepeatRateNavTweak,
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1296,7 +1325,7 @@ enum ImGuiActivateFlags_
|
|||||||
ImGuiActivateFlags_None = 0,
|
ImGuiActivateFlags_None = 0,
|
||||||
ImGuiActivateFlags_PreferInput = 1 << 0, // Favor activation that requires keyboard text input (e.g. for Slider/Drag). Default if keyboard is available.
|
ImGuiActivateFlags_PreferInput = 1 << 0, // Favor activation that requires keyboard text input (e.g. for Slider/Drag). Default if keyboard is available.
|
||||||
ImGuiActivateFlags_PreferTweak = 1 << 1, // Favor activation for tweaking with arrows or gamepad (e.g. for Slider/Drag). Default if keyboard is not available.
|
ImGuiActivateFlags_PreferTweak = 1 << 1, // Favor activation for tweaking with arrows or gamepad (e.g. for Slider/Drag). Default if keyboard is not available.
|
||||||
ImGuiActivateFlags_TryToPreserveState = 1 << 2 // Request widget to preserve state if it can (e.g. InputText will try to preserve cursor/selection)
|
ImGuiActivateFlags_TryToPreserveState = 1 << 2, // Request widget to preserve state if it can (e.g. InputText will try to preserve cursor/selection)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Early work-in-progress API for ScrollToItem()
|
// Early work-in-progress API for ScrollToItem()
|
||||||
@ -1311,7 +1340,7 @@ enum ImGuiScrollFlags_
|
|||||||
ImGuiScrollFlags_AlwaysCenterY = 1 << 5, // Always center the result item on Y axis [default for Y axis for appearing window)
|
ImGuiScrollFlags_AlwaysCenterY = 1 << 5, // Always center the result item on Y axis [default for Y axis for appearing window)
|
||||||
ImGuiScrollFlags_NoScrollParent = 1 << 6, // Disable forwarding scrolling to parent window if required to keep item/rect visible (only scroll window the function was applied to).
|
ImGuiScrollFlags_NoScrollParent = 1 << 6, // Disable forwarding scrolling to parent window if required to keep item/rect visible (only scroll window the function was applied to).
|
||||||
ImGuiScrollFlags_MaskX_ = ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleCenterX | ImGuiScrollFlags_AlwaysCenterX,
|
ImGuiScrollFlags_MaskX_ = ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleCenterX | ImGuiScrollFlags_AlwaysCenterX,
|
||||||
ImGuiScrollFlags_MaskY_ = ImGuiScrollFlags_KeepVisibleEdgeY | ImGuiScrollFlags_KeepVisibleCenterY | ImGuiScrollFlags_AlwaysCenterY
|
ImGuiScrollFlags_MaskY_ = ImGuiScrollFlags_KeepVisibleEdgeY | ImGuiScrollFlags_KeepVisibleCenterY | ImGuiScrollFlags_AlwaysCenterY,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiNavHighlightFlags_
|
enum ImGuiNavHighlightFlags_
|
||||||
@ -1320,16 +1349,7 @@ enum ImGuiNavHighlightFlags_
|
|||||||
ImGuiNavHighlightFlags_TypeDefault = 1 << 0,
|
ImGuiNavHighlightFlags_TypeDefault = 1 << 0,
|
||||||
ImGuiNavHighlightFlags_TypeThin = 1 << 1,
|
ImGuiNavHighlightFlags_TypeThin = 1 << 1,
|
||||||
ImGuiNavHighlightFlags_AlwaysDraw = 1 << 2, // Draw rectangular highlight if (g.NavId == id) _even_ when using the mouse.
|
ImGuiNavHighlightFlags_AlwaysDraw = 1 << 2, // Draw rectangular highlight if (g.NavId == id) _even_ when using the mouse.
|
||||||
ImGuiNavHighlightFlags_NoRounding = 1 << 3
|
ImGuiNavHighlightFlags_NoRounding = 1 << 3,
|
||||||
};
|
|
||||||
|
|
||||||
enum ImGuiNavDirSourceFlags_
|
|
||||||
{
|
|
||||||
ImGuiNavDirSourceFlags_None = 0,
|
|
||||||
ImGuiNavDirSourceFlags_RawKeyboard = 1 << 0, // Raw keyboard (not pulled from nav), facilitate use of some functions before we can unify nav and keys
|
|
||||||
ImGuiNavDirSourceFlags_Keyboard = 1 << 1,
|
|
||||||
ImGuiNavDirSourceFlags_PadDPad = 1 << 2,
|
|
||||||
ImGuiNavDirSourceFlags_PadLStick = 1 << 3
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiNavMoveFlags_
|
enum ImGuiNavMoveFlags_
|
||||||
@ -1347,13 +1367,13 @@ enum ImGuiNavMoveFlags_
|
|||||||
ImGuiNavMoveFlags_FocusApi = 1 << 9,
|
ImGuiNavMoveFlags_FocusApi = 1 << 9,
|
||||||
ImGuiNavMoveFlags_Tabbing = 1 << 10, // == Focus + Activate if item is Inputable + DontChangeNavHighlight
|
ImGuiNavMoveFlags_Tabbing = 1 << 10, // == Focus + Activate if item is Inputable + DontChangeNavHighlight
|
||||||
ImGuiNavMoveFlags_Activate = 1 << 11,
|
ImGuiNavMoveFlags_Activate = 1 << 11,
|
||||||
ImGuiNavMoveFlags_DontSetNavHighlight = 1 << 12 // Do not alter the visible state of keyboard vs mouse nav highlight
|
ImGuiNavMoveFlags_DontSetNavHighlight = 1 << 12, // Do not alter the visible state of keyboard vs mouse nav highlight
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiNavLayer
|
enum ImGuiNavLayer
|
||||||
{
|
{
|
||||||
ImGuiNavLayer_Main = 0, // Main scrolling layer
|
ImGuiNavLayer_Main = 0, // Main scrolling layer
|
||||||
ImGuiNavLayer_Menu = 1, // Menu layer (access with Alt/ImGuiNavInput_Menu)
|
ImGuiNavLayer_Menu = 1, // Menu layer (access with Alt)
|
||||||
ImGuiNavLayer_COUNT
|
ImGuiNavLayer_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1384,16 +1404,16 @@ enum ImGuiOldColumnFlags_
|
|||||||
ImGuiOldColumnFlags_NoResize = 1 << 1, // Disable resizing columns when clicking on the dividers
|
ImGuiOldColumnFlags_NoResize = 1 << 1, // Disable resizing columns when clicking on the dividers
|
||||||
ImGuiOldColumnFlags_NoPreserveWidths = 1 << 2, // Disable column width preservation when adjusting columns
|
ImGuiOldColumnFlags_NoPreserveWidths = 1 << 2, // Disable column width preservation when adjusting columns
|
||||||
ImGuiOldColumnFlags_NoForceWithinWindow = 1 << 3, // Disable forcing columns to fit within window
|
ImGuiOldColumnFlags_NoForceWithinWindow = 1 << 3, // Disable forcing columns to fit within window
|
||||||
ImGuiOldColumnFlags_GrowParentContentsSize = 1 << 4 // (WIP) Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove.
|
ImGuiOldColumnFlags_GrowParentContentsSize = 1 << 4, // (WIP) Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove.
|
||||||
|
|
||||||
// Obsolete names (will be removed)
|
// Obsolete names (will be removed)
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
, ImGuiColumnsFlags_None = ImGuiOldColumnFlags_None,
|
ImGuiColumnsFlags_None = ImGuiOldColumnFlags_None,
|
||||||
ImGuiColumnsFlags_NoBorder = ImGuiOldColumnFlags_NoBorder,
|
ImGuiColumnsFlags_NoBorder = ImGuiOldColumnFlags_NoBorder,
|
||||||
ImGuiColumnsFlags_NoResize = ImGuiOldColumnFlags_NoResize,
|
ImGuiColumnsFlags_NoResize = ImGuiOldColumnFlags_NoResize,
|
||||||
ImGuiColumnsFlags_NoPreserveWidths = ImGuiOldColumnFlags_NoPreserveWidths,
|
ImGuiColumnsFlags_NoPreserveWidths = ImGuiOldColumnFlags_NoPreserveWidths,
|
||||||
ImGuiColumnsFlags_NoForceWithinWindow = ImGuiOldColumnFlags_NoForceWithinWindow,
|
ImGuiColumnsFlags_NoForceWithinWindow = ImGuiOldColumnFlags_NoForceWithinWindow,
|
||||||
ImGuiColumnsFlags_GrowParentContentsSize = ImGuiOldColumnFlags_GrowParentContentsSize
|
ImGuiColumnsFlags_GrowParentContentsSize = ImGuiOldColumnFlags_GrowParentContentsSize,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1440,6 +1460,9 @@ struct ImGuiOldColumns
|
|||||||
// [SECTION] Docking support
|
// [SECTION] Docking support
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define DOCKING_HOST_DRAW_CHANNEL_BG 0 // Dock host: background fill
|
||||||
|
#define DOCKING_HOST_DRAW_CHANNEL_FG 1 // Dock host: decorations and contents
|
||||||
|
|
||||||
#ifdef IMGUI_HAS_DOCK
|
#ifdef IMGUI_HAS_DOCK
|
||||||
|
|
||||||
// Extend ImGuiDockNodeFlags_
|
// Extend ImGuiDockNodeFlags_
|
||||||
@ -1472,7 +1495,7 @@ enum ImGuiDataAuthority_
|
|||||||
{
|
{
|
||||||
ImGuiDataAuthority_Auto,
|
ImGuiDataAuthority_Auto,
|
||||||
ImGuiDataAuthority_DockNode,
|
ImGuiDataAuthority_DockNode,
|
||||||
ImGuiDataAuthority_Window
|
ImGuiDataAuthority_Window,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiDockNodeState
|
enum ImGuiDockNodeState
|
||||||
@ -1480,7 +1503,7 @@ enum ImGuiDockNodeState
|
|||||||
ImGuiDockNodeState_Unknown,
|
ImGuiDockNodeState_Unknown,
|
||||||
ImGuiDockNodeState_HostWindowHiddenBecauseSingleWindow,
|
ImGuiDockNodeState_HostWindowHiddenBecauseSingleWindow,
|
||||||
ImGuiDockNodeState_HostWindowHiddenBecauseWindowsAreResizing,
|
ImGuiDockNodeState_HostWindowHiddenBecauseWindowsAreResizing,
|
||||||
ImGuiDockNodeState_HostWindowVisible
|
ImGuiDockNodeState_HostWindowVisible,
|
||||||
};
|
};
|
||||||
|
|
||||||
// sizeof() 156~192
|
// sizeof() 156~192
|
||||||
@ -1673,11 +1696,12 @@ enum ImGuiDebugLogFlags_
|
|||||||
ImGuiDebugLogFlags_EventFocus = 1 << 1,
|
ImGuiDebugLogFlags_EventFocus = 1 << 1,
|
||||||
ImGuiDebugLogFlags_EventPopup = 1 << 2,
|
ImGuiDebugLogFlags_EventPopup = 1 << 2,
|
||||||
ImGuiDebugLogFlags_EventNav = 1 << 3,
|
ImGuiDebugLogFlags_EventNav = 1 << 3,
|
||||||
ImGuiDebugLogFlags_EventIO = 1 << 4,
|
ImGuiDebugLogFlags_EventClipper = 1 << 4,
|
||||||
ImGuiDebugLogFlags_EventDocking = 1 << 5,
|
ImGuiDebugLogFlags_EventIO = 1 << 5,
|
||||||
ImGuiDebugLogFlags_EventViewport = 1 << 6,
|
ImGuiDebugLogFlags_EventDocking = 1 << 6,
|
||||||
ImGuiDebugLogFlags_EventMask_ = ImGuiDebugLogFlags_EventActiveId | ImGuiDebugLogFlags_EventFocus | ImGuiDebugLogFlags_EventPopup | ImGuiDebugLogFlags_EventNav | ImGuiDebugLogFlags_EventIO | ImGuiDebugLogFlags_EventDocking | ImGuiDebugLogFlags_EventViewport,
|
ImGuiDebugLogFlags_EventViewport = 1 << 7,
|
||||||
ImGuiDebugLogFlags_OutputToTTY = 1 << 10 // Also send output to TTY
|
ImGuiDebugLogFlags_EventMask_ = ImGuiDebugLogFlags_EventActiveId | ImGuiDebugLogFlags_EventFocus | ImGuiDebugLogFlags_EventPopup | ImGuiDebugLogFlags_EventNav | ImGuiDebugLogFlags_EventClipper | ImGuiDebugLogFlags_EventIO | ImGuiDebugLogFlags_EventDocking | ImGuiDebugLogFlags_EventViewport,
|
||||||
|
ImGuiDebugLogFlags_OutputToTTY = 1 << 10, // Also send output to TTY
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiMetricsConfig
|
struct ImGuiMetricsConfig
|
||||||
@ -1787,11 +1811,10 @@ struct ImGuiContext
|
|||||||
ImGuiWindow* CurrentWindow; // Window being drawn into
|
ImGuiWindow* CurrentWindow; // Window being drawn into
|
||||||
ImGuiWindow* HoveredWindow; // Window the mouse is hovering. Will typically catch mouse inputs.
|
ImGuiWindow* HoveredWindow; // Window the mouse is hovering. Will typically catch mouse inputs.
|
||||||
ImGuiWindow* HoveredWindowUnderMovingWindow; // Hovered window ignoring MovingWindow. Only set if MovingWindow is set.
|
ImGuiWindow* HoveredWindowUnderMovingWindow; // Hovered window ignoring MovingWindow. Only set if MovingWindow is set.
|
||||||
ImGuiDockNode* HoveredDockNode; // [Debug] Hovered dock node.
|
|
||||||
ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actual window that is moved is generally MovingWindow->RootWindowDockTree.
|
ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actual window that is moved is generally MovingWindow->RootWindowDockTree.
|
||||||
ImGuiWindow* WheelingWindow; // Track the window we started mouse-wheeling on. Until a timer elapse or mouse has moved, generally keep scrolling the same window even if during the course of scrolling the mouse ends up hovering a child window.
|
ImGuiWindow* WheelingWindow; // Track the window we started mouse-wheeling on. Until a timer elapse or mouse has moved, generally keep scrolling the same window even if during the course of scrolling the mouse ends up hovering a child window.
|
||||||
ImVec2 WheelingWindowRefMousePos;
|
ImVec2 WheelingWindowRefMousePos;
|
||||||
float WheelingWindowTimer;
|
float WheelingWindowReleaseTimer;
|
||||||
|
|
||||||
// Item/widgets state and tracking information
|
// Item/widgets state and tracking information
|
||||||
ImGuiID DebugHookIdInfo; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
|
ImGuiID DebugHookIdInfo; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
|
||||||
@ -1824,10 +1847,11 @@ struct ImGuiContext
|
|||||||
float LastActiveIdTimer; // Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.
|
float LastActiveIdTimer; // Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.
|
||||||
|
|
||||||
// Input Ownership
|
// Input Ownership
|
||||||
bool ActiveIdUsingMouseWheel; // Active widget will want to read mouse wheel. Blocks scrolling the underlying window.
|
|
||||||
ImU32 ActiveIdUsingNavDirMask; // Active widget will want to read those nav move requests (e.g. can activate a button and move away from it)
|
ImU32 ActiveIdUsingNavDirMask; // Active widget will want to read those nav move requests (e.g. can activate a button and move away from it)
|
||||||
ImU32 ActiveIdUsingNavInputMask; // Active widget will want to read those nav inputs.
|
|
||||||
ImBitArrayForNamedKeys ActiveIdUsingKeyInputMask; // Active widget will want to read those key inputs. When we grow the ImGuiKey enum we'll need to either to order the enum to make useful keys come first, either redesign this into e.g. a small array.
|
ImBitArrayForNamedKeys ActiveIdUsingKeyInputMask; // Active widget will want to read those key inputs. When we grow the ImGuiKey enum we'll need to either to order the enum to make useful keys come first, either redesign this into e.g. a small array.
|
||||||
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
|
ImU32 ActiveIdUsingNavInputMask; // If you used this. Since (IMGUI_VERSION_NUM >= 18804) : 'g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel);' becomes 'SetActiveIdUsingKey(ImGuiKey_Escape); SetActiveIdUsingKey(ImGuiKey_NavGamepadCancel);'
|
||||||
|
#endif
|
||||||
|
|
||||||
// Next window/item data
|
// Next window/item data
|
||||||
ImGuiItemFlags CurrentItemFlags; // == g.ItemFlagsStack.back()
|
ImGuiItemFlags CurrentItemFlags; // == g.ItemFlagsStack.back()
|
||||||
@ -1860,14 +1884,14 @@ struct ImGuiContext
|
|||||||
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusedWindow'
|
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusedWindow'
|
||||||
ImGuiID NavId; // Focused item for navigation
|
ImGuiID NavId; // Focused item for navigation
|
||||||
ImGuiID NavFocusScopeId; // Identify a selection scope (selection code often wants to "clear other items" when landing on an item of the selection set)
|
ImGuiID NavFocusScopeId; // Identify a selection scope (selection code often wants to "clear other items" when landing on an item of the selection set)
|
||||||
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem()
|
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItem()
|
||||||
ImGuiID NavActivateDownId; // ~~ IsNavInputDown(ImGuiNavInput_Activate) ? NavId : 0
|
ImGuiID NavActivateDownId; // ~~ IsKeyDown(ImGuiKey_Space) || IsKeyDown(ImGuiKey_NavGamepadActivate) ? NavId : 0
|
||||||
ImGuiID NavActivatePressedId; // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0
|
ImGuiID NavActivatePressedId; // ~~ IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_NavGamepadActivate) ? NavId : 0 (no repeat)
|
||||||
ImGuiID NavActivateInputId; // ~~ IsNavInputPressed(ImGuiNavInput_Input) ? NavId : 0; ImGuiActivateFlags_PreferInput will be set and NavActivateId will be 0.
|
ImGuiID NavActivateInputId; // ~~ IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadInput) ? NavId : 0; ImGuiActivateFlags_PreferInput will be set and NavActivateId will be 0.
|
||||||
ImGuiActivateFlags NavActivateFlags;
|
ImGuiActivateFlags NavActivateFlags;
|
||||||
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest).
|
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest).
|
||||||
ImGuiID NavJustMovedToFocusScopeId; // Just navigated to this focus scope id (result of a successfully MoveRequest).
|
ImGuiID NavJustMovedToFocusScopeId; // Just navigated to this focus scope id (result of a successfully MoveRequest).
|
||||||
ImGuiModFlags NavJustMovedToKeyMods;
|
ImGuiKeyChord NavJustMovedToKeyMods;
|
||||||
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame.
|
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame.
|
||||||
ImGuiActivateFlags NavNextActivateFlags;
|
ImGuiActivateFlags NavNextActivateFlags;
|
||||||
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard.
|
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard.
|
||||||
@ -1888,7 +1912,7 @@ struct ImGuiContext
|
|||||||
bool NavMoveForwardToNextFrame;
|
bool NavMoveForwardToNextFrame;
|
||||||
ImGuiNavMoveFlags NavMoveFlags;
|
ImGuiNavMoveFlags NavMoveFlags;
|
||||||
ImGuiScrollFlags NavMoveScrollFlags;
|
ImGuiScrollFlags NavMoveScrollFlags;
|
||||||
ImGuiModFlags NavMoveKeyMods;
|
ImGuiKeyChord NavMoveKeyMods;
|
||||||
ImGuiDir NavMoveDir; // Direction of the move request (left/right/up/down)
|
ImGuiDir NavMoveDir; // Direction of the move request (left/right/up/down)
|
||||||
ImGuiDir NavMoveDirForDebug;
|
ImGuiDir NavMoveDirForDebug;
|
||||||
ImGuiDir NavMoveClipDir; // FIXME-NAV: Describe the purpose of this better. Might want to rename?
|
ImGuiDir NavMoveClipDir; // FIXME-NAV: Describe the purpose of this better. Might want to rename?
|
||||||
@ -1909,6 +1933,8 @@ struct ImGuiContext
|
|||||||
float NavWindowingTimer;
|
float NavWindowingTimer;
|
||||||
float NavWindowingHighlightAlpha;
|
float NavWindowingHighlightAlpha;
|
||||||
bool NavWindowingToggleLayer;
|
bool NavWindowingToggleLayer;
|
||||||
|
ImVec2 NavWindowingAccumDeltaPos;
|
||||||
|
ImVec2 NavWindowingAccumDeltaSize;
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
float DimBgRatio; // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list)
|
float DimBgRatio; // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list)
|
||||||
@ -1951,6 +1977,12 @@ struct ImGuiContext
|
|||||||
ImVector<ImGuiPtrOrIndex> CurrentTabBarStack;
|
ImVector<ImGuiPtrOrIndex> CurrentTabBarStack;
|
||||||
ImVector<ImGuiShrinkWidthItem> ShrinkWidthBuffer;
|
ImVector<ImGuiShrinkWidthItem> ShrinkWidthBuffer;
|
||||||
|
|
||||||
|
// Hover Delay system
|
||||||
|
ImGuiID HoverDelayId;
|
||||||
|
ImGuiID HoverDelayIdPreviousFrame;
|
||||||
|
float HoverDelayTimer; // Currently used IsItemHovered(), generally inferred from g.HoveredIdTimer but kept uncleared until clear timer elapse.
|
||||||
|
float HoverDelayClearTimer; // Currently used IsItemHovered(): grace time before g.TooltipHoverTimer gets cleared.
|
||||||
|
|
||||||
// Widget state
|
// Widget state
|
||||||
ImVec2 MouseLastValidPos;
|
ImVec2 MouseLastValidPos;
|
||||||
ImGuiInputTextState InputTextState;
|
ImGuiInputTextState InputTextState;
|
||||||
@ -1972,7 +2004,6 @@ struct ImGuiContext
|
|||||||
float DisabledAlphaBackup; // Backup for style.Alpha for BeginDisabled()
|
float DisabledAlphaBackup; // Backup for style.Alpha for BeginDisabled()
|
||||||
short DisabledStackSize;
|
short DisabledStackSize;
|
||||||
short TooltipOverrideCount;
|
short TooltipOverrideCount;
|
||||||
float TooltipSlowDelay; // Time before slow tooltips appears (FIXME: This is temporary until we merge in tooltip timer+priority work)
|
|
||||||
ImVector<char> ClipboardHandlerData; // If no custom clipboard handler is defined
|
ImVector<char> ClipboardHandlerData; // If no custom clipboard handler is defined
|
||||||
ImVector<ImGuiID> MenusIdSubmittedThisFrame; // A list of menu IDs that were rendered at least once
|
ImVector<ImGuiID> MenusIdSubmittedThisFrame; // A list of menu IDs that were rendered at least once
|
||||||
|
|
||||||
@ -2013,12 +2044,14 @@ struct ImGuiContext
|
|||||||
ImGuiDebugLogFlags DebugLogFlags;
|
ImGuiDebugLogFlags DebugLogFlags;
|
||||||
ImGuiTextBuffer DebugLogBuf;
|
ImGuiTextBuffer DebugLogBuf;
|
||||||
bool DebugItemPickerActive; // Item picker is active (started with DebugStartItemPicker())
|
bool DebugItemPickerActive; // Item picker is active (started with DebugStartItemPicker())
|
||||||
|
ImU8 DebugItemPickerMouseButton;
|
||||||
ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this ID
|
ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this ID
|
||||||
ImGuiMetricsConfig DebugMetricsConfig;
|
ImGuiMetricsConfig DebugMetricsConfig;
|
||||||
ImGuiStackTool DebugStackTool;
|
ImGuiStackTool DebugStackTool;
|
||||||
|
ImGuiDockNode* DebugHoveredDockNode; // Hovered dock node.
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
float FramerateSecPerFrame[120]; // Calculate estimate of framerate for user over the last 2 seconds.
|
float FramerateSecPerFrame[60]; // Calculate estimate of framerate for user over the last 60 frames..
|
||||||
int FramerateSecPerFrameIdx;
|
int FramerateSecPerFrameIdx;
|
||||||
int FramerateSecPerFrameCount;
|
int FramerateSecPerFrameCount;
|
||||||
float FramerateSecPerFrameAccum;
|
float FramerateSecPerFrameAccum;
|
||||||
@ -2047,10 +2080,9 @@ struct ImGuiContext
|
|||||||
CurrentWindow = NULL;
|
CurrentWindow = NULL;
|
||||||
HoveredWindow = NULL;
|
HoveredWindow = NULL;
|
||||||
HoveredWindowUnderMovingWindow = NULL;
|
HoveredWindowUnderMovingWindow = NULL;
|
||||||
HoveredDockNode = NULL;
|
|
||||||
MovingWindow = NULL;
|
MovingWindow = NULL;
|
||||||
WheelingWindow = NULL;
|
WheelingWindow = NULL;
|
||||||
WheelingWindowTimer = 0.0f;
|
WheelingWindowReleaseTimer = 0.0f;
|
||||||
|
|
||||||
DebugHookIdInfo = 0;
|
DebugHookIdInfo = 0;
|
||||||
HoveredId = HoveredIdPreviousFrame = 0;
|
HoveredId = HoveredIdPreviousFrame = 0;
|
||||||
@ -2078,10 +2110,11 @@ struct ImGuiContext
|
|||||||
LastActiveId = 0;
|
LastActiveId = 0;
|
||||||
LastActiveIdTimer = 0.0f;
|
LastActiveIdTimer = 0.0f;
|
||||||
|
|
||||||
ActiveIdUsingMouseWheel = false;
|
|
||||||
ActiveIdUsingNavDirMask = 0x00;
|
ActiveIdUsingNavDirMask = 0x00;
|
||||||
ActiveIdUsingNavInputMask = 0x00;
|
|
||||||
ActiveIdUsingKeyInputMask.ClearAllBits();
|
ActiveIdUsingKeyInputMask.ClearAllBits();
|
||||||
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
|
ActiveIdUsingNavInputMask = 0x00;
|
||||||
|
#endif
|
||||||
|
|
||||||
CurrentItemFlags = ImGuiItemFlags_None;
|
CurrentItemFlags = ImGuiItemFlags_None;
|
||||||
BeginMenuCount = 0;
|
BeginMenuCount = 0;
|
||||||
@ -2096,7 +2129,7 @@ struct ImGuiContext
|
|||||||
NavId = NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavActivateInputId = 0;
|
NavId = NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavActivateInputId = 0;
|
||||||
NavJustMovedToId = NavJustMovedToFocusScopeId = NavNextActivateId = 0;
|
NavJustMovedToId = NavJustMovedToFocusScopeId = NavNextActivateId = 0;
|
||||||
NavActivateFlags = NavNextActivateFlags = ImGuiActivateFlags_None;
|
NavActivateFlags = NavNextActivateFlags = ImGuiActivateFlags_None;
|
||||||
NavJustMovedToKeyMods = ImGuiModFlags_None;
|
NavJustMovedToKeyMods = ImGuiMod_None;
|
||||||
NavInputSource = ImGuiInputSource_None;
|
NavInputSource = ImGuiInputSource_None;
|
||||||
NavLayer = ImGuiNavLayer_Main;
|
NavLayer = ImGuiNavLayer_Main;
|
||||||
NavIdIsAlive = false;
|
NavIdIsAlive = false;
|
||||||
@ -2112,7 +2145,7 @@ struct ImGuiContext
|
|||||||
NavMoveForwardToNextFrame = false;
|
NavMoveForwardToNextFrame = false;
|
||||||
NavMoveFlags = ImGuiNavMoveFlags_None;
|
NavMoveFlags = ImGuiNavMoveFlags_None;
|
||||||
NavMoveScrollFlags = ImGuiScrollFlags_None;
|
NavMoveScrollFlags = ImGuiScrollFlags_None;
|
||||||
NavMoveKeyMods = ImGuiModFlags_None;
|
NavMoveKeyMods = ImGuiMod_None;
|
||||||
NavMoveDir = NavMoveDirForDebug = NavMoveClipDir = ImGuiDir_None;
|
NavMoveDir = NavMoveDirForDebug = NavMoveClipDir = ImGuiDir_None;
|
||||||
NavScoringDebugCount = 0;
|
NavScoringDebugCount = 0;
|
||||||
NavTabbingDir = 0;
|
NavTabbingDir = 0;
|
||||||
@ -2143,6 +2176,9 @@ struct ImGuiContext
|
|||||||
TablesTempDataStacked = 0;
|
TablesTempDataStacked = 0;
|
||||||
CurrentTabBar = NULL;
|
CurrentTabBar = NULL;
|
||||||
|
|
||||||
|
HoverDelayId = HoverDelayIdPreviousFrame = 0;
|
||||||
|
HoverDelayTimer = HoverDelayClearTimer = 0.0f;
|
||||||
|
|
||||||
TempInputId = 0;
|
TempInputId = 0;
|
||||||
ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_;
|
ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_;
|
||||||
ColorEditLastHue = ColorEditLastSat = 0.0f;
|
ColorEditLastHue = ColorEditLastSat = 0.0f;
|
||||||
@ -2153,11 +2189,10 @@ struct ImGuiContext
|
|||||||
DragCurrentAccumDirty = false;
|
DragCurrentAccumDirty = false;
|
||||||
DragCurrentAccum = 0.0f;
|
DragCurrentAccum = 0.0f;
|
||||||
DragSpeedDefaultRatio = 1.0f / 100.0f;
|
DragSpeedDefaultRatio = 1.0f / 100.0f;
|
||||||
|
ScrollbarClickDeltaToGrabCenter = 0.0f;
|
||||||
DisabledAlphaBackup = 0.0f;
|
DisabledAlphaBackup = 0.0f;
|
||||||
DisabledStackSize = 0;
|
DisabledStackSize = 0;
|
||||||
ScrollbarClickDeltaToGrabCenter = 0.0f;
|
|
||||||
TooltipOverrideCount = 0;
|
TooltipOverrideCount = 0;
|
||||||
TooltipSlowDelay = 0.50f;
|
|
||||||
|
|
||||||
PlatformImeData.InputPos = ImVec2(0.0f, 0.0f);
|
PlatformImeData.InputPos = ImVec2(0.0f, 0.0f);
|
||||||
PlatformImeDataPrev.InputPos = ImVec2(-1.0f, -1.0f); // Different to ensure initial submission
|
PlatformImeDataPrev.InputPos = ImVec2(-1.0f, -1.0f); // Different to ensure initial submission
|
||||||
@ -2179,7 +2214,9 @@ struct ImGuiContext
|
|||||||
|
|
||||||
DebugLogFlags = ImGuiDebugLogFlags_OutputToTTY;
|
DebugLogFlags = ImGuiDebugLogFlags_OutputToTTY;
|
||||||
DebugItemPickerActive = false;
|
DebugItemPickerActive = false;
|
||||||
|
DebugItemPickerMouseButton = ImGuiMouseButton_Left;
|
||||||
DebugItemPickerBreakId = 0;
|
DebugItemPickerBreakId = 0;
|
||||||
|
DebugHoveredDockNode = NULL;
|
||||||
|
|
||||||
memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame));
|
memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame));
|
||||||
FramerateSecPerFrameIdx = FramerateSecPerFrameCount = 0;
|
FramerateSecPerFrameIdx = FramerateSecPerFrameCount = 0;
|
||||||
@ -2208,6 +2245,7 @@ struct IMGUI_API ImGuiWindowTempData
|
|||||||
float CurrLineTextBaseOffset; // Baseline offset (0.0f by default on a new line, generally == style.FramePadding.y when a framed item has been added).
|
float CurrLineTextBaseOffset; // Baseline offset (0.0f by default on a new line, generally == style.FramePadding.y when a framed item has been added).
|
||||||
float PrevLineTextBaseOffset;
|
float PrevLineTextBaseOffset;
|
||||||
bool IsSameLine;
|
bool IsSameLine;
|
||||||
|
bool IsSetPos;
|
||||||
ImVec1 Indent; // Indentation / start position from left of window (increased by TreePush/TreePop, etc.)
|
ImVec1 Indent; // Indentation / start position from left of window (increased by TreePush/TreePop, etc.)
|
||||||
ImVec1 ColumnsOffset; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API.
|
ImVec1 ColumnsOffset; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API.
|
||||||
ImVec1 GroupOffset;
|
ImVec1 GroupOffset;
|
||||||
@ -2287,6 +2325,7 @@ struct IMGUI_API ImGuiWindow
|
|||||||
bool HasCloseButton; // Set when the window has a close button (p_open != NULL)
|
bool HasCloseButton; // Set when the window has a close button (p_open != NULL)
|
||||||
signed char ResizeBorderHeld; // Current border being held for resize (-1: none, otherwise 0-3)
|
signed char ResizeBorderHeld; // Current border being held for resize (-1: none, otherwise 0-3)
|
||||||
short BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)
|
short BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)
|
||||||
|
short BeginCountPreviousFrame; // Number of Begin() during the previous frame
|
||||||
short BeginOrderWithinParent; // Begin() order within immediate parent window, if we are a child window. Otherwise 0.
|
short BeginOrderWithinParent; // Begin() order within immediate parent window, if we are a child window. Otherwise 0.
|
||||||
short BeginOrderWithinContext; // Begin() order within entire imgui context. This is mostly used for debugging submission order related issues.
|
short BeginOrderWithinContext; // Begin() order within entire imgui context. This is mostly used for debugging submission order related issues.
|
||||||
short FocusOrder; // Order within WindowsFocusOrder[], altered when windows are focused.
|
short FocusOrder; // Order within WindowsFocusOrder[], altered when windows are focused.
|
||||||
@ -2371,7 +2410,7 @@ public:
|
|||||||
ImGuiID GetID(int n);
|
ImGuiID GetID(int n);
|
||||||
ImGuiID GetIDFromRectangle(const ImRect& r_abs);
|
ImGuiID GetIDFromRectangle(const ImRect& r_abs);
|
||||||
|
|
||||||
// We don't use g.FontSize because the window may be != g.CurrentWidow.
|
// We don't use g.FontSize because the window may be != g.CurrentWindow.
|
||||||
ImRect Rect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }
|
ImRect Rect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }
|
||||||
float CalcFontSize() const { ImGuiContext& g = *GImGui; float scale = g.FontBaseSize * FontWindowScale * FontDpiScale; if (ParentWindow) scale *= ParentWindow->FontWindowScale; return scale; }
|
float CalcFontSize() const { ImGuiContext& g = *GImGui; float scale = g.FontBaseSize * FontWindowScale * FontDpiScale; if (ParentWindow) scale *= ParentWindow->FontWindowScale; return scale; }
|
||||||
float TitleBarHeight() const { ImGuiContext& g = *GImGui; return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0.0f : CalcFontSize() + g.Style.FramePadding.y * 2.0f; }
|
float TitleBarHeight() const { ImGuiContext& g = *GImGui; return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0.0f : CalcFontSize() + g.Style.FramePadding.y * 2.0f; }
|
||||||
@ -2389,7 +2428,7 @@ enum ImGuiTabBarFlagsPrivate_
|
|||||||
{
|
{
|
||||||
ImGuiTabBarFlags_DockNode = 1 << 20, // Part of a dock node [we don't use this in the master branch but it facilitate branch syncing to keep this around]
|
ImGuiTabBarFlags_DockNode = 1 << 20, // Part of a dock node [we don't use this in the master branch but it facilitate branch syncing to keep this around]
|
||||||
ImGuiTabBarFlags_IsFocused = 1 << 21,
|
ImGuiTabBarFlags_IsFocused = 1 << 21,
|
||||||
ImGuiTabBarFlags_SaveSettings = 1 << 22 // FIXME: Settings are handled by the docking system, this only request the tab bar to mark settings dirty when reordering tabs
|
ImGuiTabBarFlags_SaveSettings = 1 << 22, // FIXME: Settings are handled by the docking system, this only request the tab bar to mark settings dirty when reordering tabs
|
||||||
};
|
};
|
||||||
|
|
||||||
// Extend ImGuiTabItemFlags_
|
// Extend ImGuiTabItemFlags_
|
||||||
@ -2399,7 +2438,7 @@ enum ImGuiTabItemFlagsPrivate_
|
|||||||
ImGuiTabItemFlags_NoCloseButton = 1 << 20, // Track whether p_open was set or not (we'll need this info on the next frame to recompute ContentWidth during layout)
|
ImGuiTabItemFlags_NoCloseButton = 1 << 20, // Track whether p_open was set or not (we'll need this info on the next frame to recompute ContentWidth during layout)
|
||||||
ImGuiTabItemFlags_Button = 1 << 21, // Used by TabItemButton, change the tab item behavior to mimic a button
|
ImGuiTabItemFlags_Button = 1 << 21, // Used by TabItemButton, change the tab item behavior to mimic a button
|
||||||
ImGuiTabItemFlags_Unsorted = 1 << 22, // [Docking] Trailing tabs with the _Unsorted flag will be sorted based on the DockOrder of their Window.
|
ImGuiTabItemFlags_Unsorted = 1 << 22, // [Docking] Trailing tabs with the _Unsorted flag will be sorted based on the DockOrder of their Window.
|
||||||
ImGuiTabItemFlags_Preview = 1 << 23 // [Docking] Display tab shape for docking preview (height is adjusted slightly to compensate for the yet missing tab bar)
|
ImGuiTabItemFlags_Preview = 1 << 23, // [Docking] Display tab shape for docking preview (height is adjusted slightly to compensate for the yet missing tab bar)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Storage for one active tab item (sizeof() 48 bytes)
|
// Storage for one active tab item (sizeof() 48 bytes)
|
||||||
@ -2419,7 +2458,7 @@ struct ImGuiTabItem
|
|||||||
ImS16 IndexDuringLayout; // Index only used during TabBarLayout()
|
ImS16 IndexDuringLayout; // Index only used during TabBarLayout()
|
||||||
bool WantClose; // Marked as closed by SetTabItemClosed()
|
bool WantClose; // Marked as closed by SetTabItemClosed()
|
||||||
|
|
||||||
ImGuiTabItem() { memset(this, 0, sizeof(*this)); LastFrameVisible = LastFrameSelected = -1; NameOffset = -1; BeginOrder = IndexDuringLayout = -1; }
|
ImGuiTabItem() { memset(this, 0, sizeof(*this)); LastFrameVisible = LastFrameSelected = -1; RequestedWidth = -1.0f; NameOffset = -1; BeginOrder = IndexDuringLayout = -1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Storage for a tab bar (sizeof() 152 bytes)
|
// Storage for a tab bar (sizeof() 152 bytes)
|
||||||
@ -2857,21 +2896,10 @@ namespace ImGui
|
|||||||
IMGUI_API ImVec2 GetContentRegionMaxAbs();
|
IMGUI_API ImVec2 GetContentRegionMaxAbs();
|
||||||
IMGUI_API void ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_excess);
|
IMGUI_API void ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_excess);
|
||||||
|
|
||||||
// Parameter stacks
|
// Parameter stacks (shared)
|
||||||
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled);
|
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled);
|
||||||
IMGUI_API void PopItemFlag();
|
IMGUI_API void PopItemFlag();
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
||||||
// Currently refactoring focus/nav/tabbing system
|
|
||||||
// If you have old/custom copy-and-pasted widgets that used FocusableItemRegister():
|
|
||||||
// (Old) IMGUI_VERSION_NUM < 18209: using 'ItemAdd(....)' and 'bool tab_focused = FocusableItemRegister(...)'
|
|
||||||
// (Old) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_Focused) != 0'
|
|
||||||
// (New) IMGUI_VERSION_NUM >= 18413: using 'ItemAdd(..., ImGuiItemFlags_Inputable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_FocusedTabbing) != 0 || g.NavActivateInputId == id' (WIP)
|
|
||||||
// Widget code are simplified as there's no need to call FocusableItemUnregister() while managing the transition from regular widget to TempInputText()
|
|
||||||
inline bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id) { IM_ASSERT(0); IM_UNUSED(window); IM_UNUSED(id); return false; } // -> pass ImGuiItemAddFlags_Inputable flag to ItemAdd()
|
|
||||||
inline void FocusableItemUnregister(ImGuiWindow* window) { IM_ASSERT(0); IM_UNUSED(window); } // -> unnecessary: TempInputText() uses ImGuiInputTextFlags_MergedItem
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Logging/Capture
|
// Logging/Capture
|
||||||
IMGUI_API void LogBegin(ImGuiLogType type, int auto_open_depth); // -> BeginCapture() when we design v2 api, for now stay under the radar by using the old name.
|
IMGUI_API void LogBegin(ImGuiLogType type, int auto_open_depth); // -> BeginCapture() when we design v2 api, for now stay under the radar by using the old name.
|
||||||
IMGUI_API void LogToBuffer(int auto_open_depth = -1); // Start logging/capturing to internal buffer
|
IMGUI_API void LogToBuffer(int auto_open_depth = -1); // Start logging/capturing to internal buffer
|
||||||
@ -2913,10 +2941,6 @@ namespace ImGui
|
|||||||
IMGUI_API void NavMoveRequestCancel();
|
IMGUI_API void NavMoveRequestCancel();
|
||||||
IMGUI_API void NavMoveRequestApplyResult();
|
IMGUI_API void NavMoveRequestApplyResult();
|
||||||
IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags);
|
IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags);
|
||||||
IMGUI_API const char* GetNavInputName(ImGuiNavInput n);
|
|
||||||
IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiNavReadMode mode);
|
|
||||||
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiNavReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f);
|
|
||||||
IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate);
|
|
||||||
IMGUI_API void ActivateItem(ImGuiID id); // Remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again.
|
IMGUI_API void ActivateItem(ImGuiID id); // Remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again.
|
||||||
IMGUI_API void SetNavWindow(ImGuiWindow* window);
|
IMGUI_API void SetNavWindow(ImGuiWindow* window);
|
||||||
IMGUI_API void SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiID focus_scope_id, const ImRect& rect_rel);
|
IMGUI_API void SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiID focus_scope_id, const ImRect& rect_rel);
|
||||||
@ -2932,19 +2956,33 @@ namespace ImGui
|
|||||||
// Inputs
|
// Inputs
|
||||||
// FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions.
|
// FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions.
|
||||||
inline bool IsNamedKey(ImGuiKey key) { return key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END; }
|
inline bool IsNamedKey(ImGuiKey key) { return key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END; }
|
||||||
|
inline bool IsNamedKeyOrModKey(ImGuiKey key) { return (key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END) || key == ImGuiMod_Ctrl || key == ImGuiMod_Shift || key == ImGuiMod_Alt || key == ImGuiMod_Super; }
|
||||||
inline bool IsLegacyKey(ImGuiKey key) { return key >= ImGuiKey_LegacyNativeKey_BEGIN && key < ImGuiKey_LegacyNativeKey_END; }
|
inline bool IsLegacyKey(ImGuiKey key) { return key >= ImGuiKey_LegacyNativeKey_BEGIN && key < ImGuiKey_LegacyNativeKey_END; }
|
||||||
inline bool IsGamepadKey(ImGuiKey key) { return key >= ImGuiKey_Gamepad_BEGIN && key < ImGuiKey_Gamepad_END; }
|
inline bool IsGamepadKey(ImGuiKey key) { return key >= ImGuiKey_Gamepad_BEGIN && key < ImGuiKey_Gamepad_END; }
|
||||||
|
inline bool IsAliasKey(ImGuiKey key) { return key >= ImGuiKey_Aliases_BEGIN && key < ImGuiKey_Aliases_END; }
|
||||||
|
inline ImGuiKey ConvertSingleModFlagToKey(ImGuiKey key)
|
||||||
|
{
|
||||||
|
if (key == ImGuiMod_Ctrl) return ImGuiKey_ReservedForModCtrl;
|
||||||
|
if (key == ImGuiMod_Shift) return ImGuiKey_ReservedForModShift;
|
||||||
|
if (key == ImGuiMod_Alt) return ImGuiKey_ReservedForModAlt;
|
||||||
|
if (key == ImGuiMod_Super) return ImGuiKey_ReservedForModSuper;
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
IMGUI_API ImGuiKeyData* GetKeyData(ImGuiKey key);
|
IMGUI_API ImGuiKeyData* GetKeyData(ImGuiKey key);
|
||||||
|
IMGUI_API void GetKeyChordName(ImGuiKeyChord key_chord, char* out_buf, int out_buf_size);
|
||||||
IMGUI_API void SetItemUsingMouseWheel();
|
IMGUI_API void SetItemUsingMouseWheel();
|
||||||
IMGUI_API void SetActiveIdUsingNavAndKeys();
|
IMGUI_API void SetActiveIdUsingAllKeyboardKeys();
|
||||||
inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; }
|
inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; }
|
||||||
inline bool IsActiveIdUsingNavInput(ImGuiNavInput input) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavInputMask & (1 << input)) != 0; }
|
|
||||||
inline bool IsActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; return g.ActiveIdUsingKeyInputMask[key]; }
|
inline bool IsActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; return g.ActiveIdUsingKeyInputMask[key]; }
|
||||||
inline void SetActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; g.ActiveIdUsingKeyInputMask.SetBit(key); }
|
inline void SetActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; g.ActiveIdUsingKeyInputMask.SetBit(key); }
|
||||||
|
inline ImGuiKey MouseButtonToKey(ImGuiMouseButton button) { IM_ASSERT(button >= 0 && button < ImGuiMouseButton_COUNT); return (ImGuiKey)(ImGuiKey_MouseLeft + button); }
|
||||||
IMGUI_API bool IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold = -1.0f);
|
IMGUI_API bool IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold = -1.0f);
|
||||||
inline bool IsNavInputDown(ImGuiNavInput n) { ImGuiContext& g = *GImGui; return g.IO.NavInputs[n] > 0.0f; }
|
IMGUI_API ImVec2 GetKeyVector2d(ImGuiKey key_left, ImGuiKey key_right, ImGuiKey key_up, ImGuiKey key_down);
|
||||||
inline bool IsNavInputTest(ImGuiNavInput n, ImGuiNavReadMode rm) { return (GetNavInputAmount(n, rm) > 0.0f); }
|
IMGUI_API float GetNavTweakPressedAmount(ImGuiAxis axis);
|
||||||
IMGUI_API ImGuiModFlags GetMergedModFlags();
|
IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate);
|
||||||
|
IMGUI_API void GetTypematicRepeatRate(ImGuiInputFlags flags, float* repeat_delay, float* repeat_rate);
|
||||||
|
IMGUI_API bool IsKeyPressedEx(ImGuiKey key, ImGuiInputFlags flags = 0);
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { IM_ASSERT(IsNamedKey(key)); return IsKeyPressed(key, repeat); } // [removed in 1.87]
|
inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { IM_ASSERT(IsNamedKey(key)); return IsKeyPressed(key, repeat); } // [removed in 1.87]
|
||||||
#endif
|
#endif
|
||||||
@ -2962,7 +3000,8 @@ namespace ImGui
|
|||||||
IMGUI_API void DockContextQueueDock(ImGuiContext* ctx, ImGuiWindow* target, ImGuiDockNode* target_node, ImGuiWindow* payload, ImGuiDir split_dir, float split_ratio, bool split_outer);
|
IMGUI_API void DockContextQueueDock(ImGuiContext* ctx, ImGuiWindow* target, ImGuiDockNode* target_node, ImGuiWindow* payload, ImGuiDir split_dir, float split_ratio, bool split_outer);
|
||||||
IMGUI_API void DockContextQueueUndockWindow(ImGuiContext* ctx, ImGuiWindow* window);
|
IMGUI_API void DockContextQueueUndockWindow(ImGuiContext* ctx, ImGuiWindow* window);
|
||||||
IMGUI_API void DockContextQueueUndockNode(ImGuiContext* ctx, ImGuiDockNode* node);
|
IMGUI_API void DockContextQueueUndockNode(ImGuiContext* ctx, ImGuiDockNode* node);
|
||||||
IMGUI_API bool DockContextCalcDropPosForDocking(ImGuiWindow* target, ImGuiDockNode* target_node, ImGuiWindow* payload, ImGuiDir split_dir, bool split_outer, ImVec2* out_pos);
|
IMGUI_API bool DockContextCalcDropPosForDocking(ImGuiWindow* target, ImGuiDockNode* target_node, ImGuiWindow* payload_window, ImGuiDockNode* payload_node, ImGuiDir split_dir, bool split_outer, ImVec2* out_pos);
|
||||||
|
IMGUI_API ImGuiDockNode*DockContextFindNodeByID(ImGuiContext* ctx, ImGuiID id);
|
||||||
IMGUI_API bool DockNodeBeginAmendTabBar(ImGuiDockNode* node);
|
IMGUI_API bool DockNodeBeginAmendTabBar(ImGuiDockNode* node);
|
||||||
IMGUI_API void DockNodeEndAmendTabBar();
|
IMGUI_API void DockNodeEndAmendTabBar();
|
||||||
inline ImGuiDockNode* DockNodeGetRootNode(ImGuiDockNode* node) { while (node->ParentNode) node = node->ParentNode; return node; }
|
inline ImGuiDockNode* DockNodeGetRootNode(ImGuiDockNode* node) { while (node->ParentNode) node = node->ParentNode; return node; }
|
||||||
@ -3039,6 +3078,7 @@ namespace ImGui
|
|||||||
IMGUI_API void TableUpdateColumnsWeightFromWidth(ImGuiTable* table);
|
IMGUI_API void TableUpdateColumnsWeightFromWidth(ImGuiTable* table);
|
||||||
IMGUI_API void TableDrawBorders(ImGuiTable* table);
|
IMGUI_API void TableDrawBorders(ImGuiTable* table);
|
||||||
IMGUI_API void TableDrawContextMenu(ImGuiTable* table);
|
IMGUI_API void TableDrawContextMenu(ImGuiTable* table);
|
||||||
|
IMGUI_API bool TableBeginContextMenuPopup(ImGuiTable* table);
|
||||||
IMGUI_API void TableMergeDrawChannels(ImGuiTable* table);
|
IMGUI_API void TableMergeDrawChannels(ImGuiTable* table);
|
||||||
inline ImGuiTableInstanceData* TableGetInstanceData(ImGuiTable* table, int instance_no) { if (instance_no == 0) return &table->InstanceDataFirst; return &table->InstanceDataExtra[instance_no - 1]; }
|
inline ImGuiTableInstanceData* TableGetInstanceData(ImGuiTable* table, int instance_no) { if (instance_no == 0) return &table->InstanceDataFirst; return &table->InstanceDataExtra[instance_no - 1]; }
|
||||||
IMGUI_API void TableSortSpecsSanitize(ImGuiTable* table);
|
IMGUI_API void TableSortSpecsSanitize(ImGuiTable* table);
|
||||||
@ -3081,7 +3121,8 @@ namespace ImGui
|
|||||||
IMGUI_API void TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, ImVec2 mouse_pos);
|
IMGUI_API void TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, ImVec2 mouse_pos);
|
||||||
IMGUI_API bool TabBarProcessReorder(ImGuiTabBar* tab_bar);
|
IMGUI_API bool TabBarProcessReorder(ImGuiTabBar* tab_bar);
|
||||||
IMGUI_API bool TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags, ImGuiWindow* docked_window);
|
IMGUI_API bool TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags, ImGuiWindow* docked_window);
|
||||||
IMGUI_API ImVec2 TabItemCalcSize(const char* label, bool has_close_button);
|
IMGUI_API ImVec2 TabItemCalcSize(const char* label, bool has_close_button_or_unsaved_marker);
|
||||||
|
IMGUI_API ImVec2 TabItemCalcSize(ImGuiWindow* window);
|
||||||
IMGUI_API void TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col);
|
IMGUI_API void TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col);
|
||||||
IMGUI_API void TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImVec2 frame_padding, const char* label, ImGuiID tab_id, ImGuiID close_button_id, bool is_contents_visible, bool* out_just_closed, bool* out_text_clipped);
|
IMGUI_API void TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImVec2 frame_padding, const char* label, ImGuiID tab_id, ImGuiID close_button_id, bool is_contents_visible, bool* out_just_closed, bool* out_text_clipped);
|
||||||
|
|
||||||
@ -3118,7 +3159,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
||||||
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
||||||
IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, ImS64* p_scroll_v, ImS64 avail_v, ImS64 contents_v, ImDrawFlags flags);
|
IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, ImS64* p_scroll_v, ImS64 avail_v, ImS64 contents_v, ImDrawFlags flags);
|
||||||
IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col);
|
IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col);
|
||||||
IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis);
|
IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis);
|
||||||
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
||||||
IMGUI_API ImGuiID GetWindowResizeCornerID(ImGuiWindow* window, int n); // 0..3: corners
|
IMGUI_API ImGuiID GetWindowResizeCornerID(ImGuiWindow* window, int n); // 0..3: corners
|
||||||
@ -3133,8 +3174,9 @@ namespace ImGui
|
|||||||
IMGUI_API bool SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* p_v, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb);
|
IMGUI_API bool SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* p_v, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb);
|
||||||
IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f, ImU32 bg_col = 0);
|
IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f, ImU32 bg_col = 0);
|
||||||
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL);
|
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL);
|
||||||
IMGUI_API bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0); // Consume previous SetNextItemOpen() data, if any. May return true when logging
|
|
||||||
IMGUI_API void TreePushOverrideID(ImGuiID id);
|
IMGUI_API void TreePushOverrideID(ImGuiID id);
|
||||||
|
IMGUI_API void TreeNodeSetOpen(ImGuiID id, bool open);
|
||||||
|
IMGUI_API bool TreeNodeUpdateNextOpen(ImGuiID id, ImGuiTreeNodeFlags flags); // Return open state. Consume previous SetNextItemOpen() data, if any. May return true when logging.
|
||||||
|
|
||||||
// Template functions are instantiated in imgui_widgets.cpp for a finite number of types.
|
// Template functions are instantiated in imgui_widgets.cpp for a finite number of types.
|
||||||
// To use them externally (for custom widget) you may need an "extern template" statement in your code in order to link to existing instances and silence Clang warnings (see #2036).
|
// To use them externally (for custom widget) you may need an "extern template" statement in your code in order to link to existing instances and silence Clang warnings (see #2036).
|
||||||
@ -3159,7 +3201,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool TempInputText(const ImRect& bb, ImGuiID id, const char* label, char* buf, int buf_size, ImGuiInputTextFlags flags);
|
IMGUI_API bool TempInputText(const ImRect& bb, ImGuiID id, const char* label, char* buf, int buf_size, ImGuiInputTextFlags flags);
|
||||||
IMGUI_API bool TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const void* p_clamp_min = NULL, const void* p_clamp_max = NULL);
|
IMGUI_API bool TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const void* p_clamp_min = NULL, const void* p_clamp_max = NULL);
|
||||||
inline bool TempInputIsActive(ImGuiID id) { ImGuiContext& g = *GImGui; return (g.ActiveId == id && g.TempInputId == id); }
|
inline bool TempInputIsActive(ImGuiID id) { ImGuiContext& g = *GImGui; return (g.ActiveId == id && g.TempInputId == id); }
|
||||||
inline ImGuiInputTextState* GetInputTextState(ImGuiID id) { ImGuiContext& g = *GImGui; return (g.InputTextState.ID == id) ? &g.InputTextState : NULL; } // Get input text state if active
|
inline ImGuiInputTextState* GetInputTextState(ImGuiID id) { ImGuiContext& g = *GImGui; return (id != 0 && g.InputTextState.ID == id) ? &g.InputTextState : NULL; } // Get input text state if active
|
||||||
|
|
||||||
// Color
|
// Color
|
||||||
IMGUI_API void ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags);
|
IMGUI_API void ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags);
|
||||||
@ -3185,6 +3227,7 @@ namespace ImGui
|
|||||||
// Debug Tools
|
// Debug Tools
|
||||||
IMGUI_API void ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
IMGUI_API void ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
||||||
IMGUI_API void ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
IMGUI_API void ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
||||||
|
IMGUI_API void ErrorCheckUsingSetCursorPosToExtendParentBoundaries();
|
||||||
inline void DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255)) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); }
|
inline void DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255)) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); }
|
||||||
inline void DebugStartItemPicker() { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }
|
inline void DebugStartItemPicker() { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }
|
||||||
IMGUI_API void ShowFontAtlas(ImFontAtlas* atlas);
|
IMGUI_API void ShowFontAtlas(ImFontAtlas* atlas);
|
||||||
@ -3207,6 +3250,19 @@ namespace ImGui
|
|||||||
IMGUI_API void DebugNodeViewport(ImGuiViewportP* viewport);
|
IMGUI_API void DebugNodeViewport(ImGuiViewportP* viewport);
|
||||||
IMGUI_API void DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb);
|
IMGUI_API void DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb);
|
||||||
|
|
||||||
|
// Obsolete functions
|
||||||
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
inline bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0) { return TreeNodeUpdateNextOpen(id, flags); } // Renamed in 1.89
|
||||||
|
|
||||||
|
// Refactored focus/nav/tabbing system in 1.82 and 1.84. If you have old/custom copy-and-pasted widgets that used FocusableItemRegister():
|
||||||
|
// (Old) IMGUI_VERSION_NUM < 18209: using 'ItemAdd(....)' and 'bool tab_focused = FocusableItemRegister(...)'
|
||||||
|
// (Old) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_Focused) != 0'
|
||||||
|
// (New) IMGUI_VERSION_NUM >= 18413: using 'ItemAdd(..., ImGuiItemFlags_Inputable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_FocusedTabbing) != 0 || g.NavActivateInputId == id' (WIP)
|
||||||
|
// Widget code are simplified as there's no need to call FocusableItemUnregister() while managing the transition from regular widget to TempInputText()
|
||||||
|
inline bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id) { IM_ASSERT(0); IM_UNUSED(window); IM_UNUSED(id); return false; } // -> pass ImGuiItemAddFlags_Inputable flag to ItemAdd()
|
||||||
|
inline void FocusableItemUnregister(ImGuiWindow* window) { IM_ASSERT(0); IM_UNUSED(window); } // -> unnecessary: TempInputText() uses ImGuiInputTextFlags_MergedItem
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace ImGui
|
} // namespace ImGui
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.88
|
// dear imgui, v1.89 WIP
|
||||||
// (tables and columns code)
|
// (tables and columns code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -936,11 +936,19 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
|||||||
width_remaining_for_stretched_columns -= 1.0f;
|
width_remaining_for_stretched_columns -= 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determine if table is hovered which will be used to flag columns as hovered.
|
||||||
|
// - In principle we'd like to use the equivalent of IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem),
|
||||||
|
// but because our item is partially submitted at this point we use ItemHoverable() and a workaround (temporarily
|
||||||
|
// clear ActiveId, which is equivalent to the change provided by _AllowWhenBLockedByActiveItem).
|
||||||
|
// - This allows columns to be marked as hovered when e.g. clicking a button inside the column, or using drag and drop.
|
||||||
ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent);
|
ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent);
|
||||||
table->HoveredColumnBody = -1;
|
table->HoveredColumnBody = -1;
|
||||||
table->HoveredColumnBorder = -1;
|
table->HoveredColumnBorder = -1;
|
||||||
const ImRect mouse_hit_rect(table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.Max.x, ImMax(table->OuterRect.Max.y, table->OuterRect.Min.y + table_instance->LastOuterHeight));
|
const ImRect mouse_hit_rect(table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.Max.x, ImMax(table->OuterRect.Max.y, table->OuterRect.Min.y + table_instance->LastOuterHeight));
|
||||||
|
const ImGuiID backup_active_id = g.ActiveId;
|
||||||
|
g.ActiveId = 0;
|
||||||
const bool is_hovering_table = ItemHoverable(mouse_hit_rect, 0);
|
const bool is_hovering_table = ItemHoverable(mouse_hit_rect, 0);
|
||||||
|
g.ActiveId = backup_active_id;
|
||||||
|
|
||||||
// [Part 6] Setup final position, offset, skip/clip states and clipping rectangles, detect hovered column
|
// [Part 6] Setup final position, offset, skip/clip states and clipping rectangles, detect hovered column
|
||||||
// Process columns in their visible orders as we are comparing the visible order and adjusting host_clip_rect while looping.
|
// Process columns in their visible orders as we are comparing the visible order and adjusting host_clip_rect while looping.
|
||||||
@ -1105,19 +1113,11 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
|||||||
table->IsUsingHeaders = false;
|
table->IsUsingHeaders = false;
|
||||||
|
|
||||||
// [Part 11] Context menu
|
// [Part 11] Context menu
|
||||||
if (table->IsContextPopupOpen && table->InstanceCurrent == table->InstanceInteracted)
|
if (TableBeginContextMenuPopup(table))
|
||||||
{
|
|
||||||
const ImGuiID context_menu_id = ImHashStr("##ContextMenu", 0, table->ID);
|
|
||||||
if (BeginPopupEx(context_menu_id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings))
|
|
||||||
{
|
{
|
||||||
TableDrawContextMenu(table);
|
TableDrawContextMenu(table);
|
||||||
EndPopup();
|
EndPopup();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
table->IsContextPopupOpen = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// [Part 13] Sanitize and build sort specs before we have a change to use them for display.
|
// [Part 13] Sanitize and build sort specs before we have a change to use them for display.
|
||||||
// This path will only be exercised when sort specs are modified before header rows (e.g. init or visibility change)
|
// This path will only be exercised when sort specs are modified before header rows (e.g. init or visibility change)
|
||||||
@ -1725,6 +1725,8 @@ void ImGui::TableBeginRow(ImGuiTable* table)
|
|||||||
table->RowTextBaseline = 0.0f;
|
table->RowTextBaseline = 0.0f;
|
||||||
table->RowIndentOffsetX = window->DC.Indent.x - table->HostIndentX; // Lock indent
|
table->RowIndentOffsetX = window->DC.Indent.x - table->HostIndentX; // Lock indent
|
||||||
window->DC.PrevLineTextBaseOffset = 0.0f;
|
window->DC.PrevLineTextBaseOffset = 0.0f;
|
||||||
|
window->DC.CurrLineSize = ImVec2(0.0f, 0.0f);
|
||||||
|
window->DC.IsSameLine = window->DC.IsSetPos = false;
|
||||||
window->DC.CursorMaxPos.y = next_y1;
|
window->DC.CursorMaxPos.y = next_y1;
|
||||||
|
|
||||||
// Making the header BG color non-transparent will allow us to overlay it multiple times when handling smooth dragging.
|
// Making the header BG color non-transparent will allow us to overlay it multiple times when handling smooth dragging.
|
||||||
@ -2006,6 +2008,9 @@ void ImGui::TableEndCell(ImGuiTable* table)
|
|||||||
ImGuiTableColumn* column = &table->Columns[table->CurrentColumn];
|
ImGuiTableColumn* column = &table->Columns[table->CurrentColumn];
|
||||||
ImGuiWindow* window = table->InnerWindow;
|
ImGuiWindow* window = table->InnerWindow;
|
||||||
|
|
||||||
|
if (window->DC.IsSetPos)
|
||||||
|
ErrorCheckUsingSetCursorPosToExtendParentBoundaries();
|
||||||
|
|
||||||
// Report maximum position so we can infer content size per column.
|
// Report maximum position so we can infer content size per column.
|
||||||
float* p_max_pos_x;
|
float* p_max_pos_x;
|
||||||
if (table->RowFlags & ImGuiTableRowFlags_Headers)
|
if (table->RowFlags & ImGuiTableRowFlags_Headers)
|
||||||
@ -3000,7 +3005,7 @@ void ImGui::TableHeader(const char* label)
|
|||||||
RenderTextEllipsis(window->DrawList, label_pos, ImVec2(ellipsis_max, label_pos.y + label_height + g.Style.FramePadding.y), ellipsis_max, ellipsis_max, label, label_end, &label_size);
|
RenderTextEllipsis(window->DrawList, label_pos, ImVec2(ellipsis_max, label_pos.y + label_height + g.Style.FramePadding.y), ellipsis_max, ellipsis_max, label, label_end, &label_size);
|
||||||
|
|
||||||
const bool text_clipped = label_size.x > (ellipsis_max - label_pos.x);
|
const bool text_clipped = label_size.x > (ellipsis_max - label_pos.x);
|
||||||
if (text_clipped && hovered && g.HoveredIdNotActiveTimer > g.TooltipSlowDelay)
|
if (text_clipped && hovered && g.ActiveId == 0 && IsItemHovered(ImGuiHoveredFlags_DelayNormal))
|
||||||
SetTooltip("%.*s", (int)(label_end - label), label);
|
SetTooltip("%.*s", (int)(label_end - label), label);
|
||||||
|
|
||||||
// We don't use BeginPopupContextItem() because we want the popup to stay up even after the column is hidden
|
// We don't use BeginPopupContextItem() because we want the popup to stay up even after the column is hidden
|
||||||
@ -3035,6 +3040,17 @@ void ImGui::TableOpenContextMenu(int column_n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ImGui::TableBeginContextMenuPopup(ImGuiTable* table)
|
||||||
|
{
|
||||||
|
if (!table->IsContextPopupOpen || table->InstanceCurrent != table->InstanceInteracted)
|
||||||
|
return false;
|
||||||
|
const ImGuiID context_menu_id = ImHashStr("##ContextMenu", 0, table->ID);
|
||||||
|
if (BeginPopupEx(context_menu_id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings))
|
||||||
|
return true;
|
||||||
|
table->IsContextPopupOpen = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Output context menu into current window (generally a popup)
|
// Output context menu into current window (generally a popup)
|
||||||
// FIXME-TABLE: Ideally this should be writable by the user. Full programmatic access to that data?
|
// FIXME-TABLE: Ideally this should be writable by the user. Full programmatic access to that data?
|
||||||
void ImGui::TableDrawContextMenu(ImGuiTable* table)
|
void ImGui::TableDrawContextMenu(ImGuiTable* table)
|
||||||
@ -3954,6 +3970,7 @@ void ImGui::NextColumn()
|
|||||||
{
|
{
|
||||||
// New row/line: column 0 honor IndentX.
|
// New row/line: column 0 honor IndentX.
|
||||||
window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f);
|
window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f);
|
||||||
|
window->DC.IsSameLine = false;
|
||||||
columns->LineMinY = columns->LineMaxY;
|
columns->LineMinY = columns->LineMaxY;
|
||||||
}
|
}
|
||||||
window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
|
window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.88
|
// dear imgui, v1.89 WIP
|
||||||
// (widgets code)
|
// (widgets code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -611,7 +611,15 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
if (g.NavActivateDownId == id)
|
if (g.NavActivateDownId == id)
|
||||||
{
|
{
|
||||||
bool nav_activated_by_code = (g.NavActivateId == id);
|
bool nav_activated_by_code = (g.NavActivateId == id);
|
||||||
bool nav_activated_by_inputs = IsNavInputTest(ImGuiNavInput_Activate, (flags & ImGuiButtonFlags_Repeat) ? ImGuiNavReadMode_Repeat : ImGuiNavReadMode_Pressed);
|
bool nav_activated_by_inputs = (g.NavActivatePressedId == id);
|
||||||
|
if (!nav_activated_by_inputs && (flags & ImGuiButtonFlags_Repeat))
|
||||||
|
{
|
||||||
|
// Avoid pressing both keys from triggering double amount of repeat events
|
||||||
|
const ImGuiKeyData* key1 = GetKeyData(ImGuiKey_Space);
|
||||||
|
const ImGuiKeyData* key2 = GetKeyData(ImGuiKey_NavGamepadActivate);
|
||||||
|
const float t1 = ImMax(key1->DownDuration, key2->DownDuration);
|
||||||
|
nav_activated_by_inputs = CalcTypematicRepeatAmount(t1 - g.IO.DeltaTime, t1, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0;
|
||||||
|
}
|
||||||
if (nav_activated_by_code || nav_activated_by_inputs)
|
if (nav_activated_by_code || nav_activated_by_inputs)
|
||||||
{
|
{
|
||||||
// Set active id so it can be queried by user via IsItemActive(), equivalent of holding the mouse button.
|
// Set active id so it can be queried by user via IsItemActive(), equivalent of holding the mouse button.
|
||||||
@ -1036,14 +1044,15 @@ void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2&
|
|||||||
|
|
||||||
// ImageButton() is flawed as 'id' is always derived from 'texture_id' (see #2464 #1390)
|
// ImageButton() is flawed as 'id' is always derived from 'texture_id' (see #2464 #1390)
|
||||||
// We provide this internal helper to write your own variant while we figure out how to redesign the public ImageButton() API.
|
// We provide this internal helper to write your own variant while we figure out how to redesign the public ImageButton() API.
|
||||||
bool ImGui::ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col)
|
bool ImGui::ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size + padding * 2);
|
const ImVec2 padding = g.Style.FramePadding;
|
||||||
|
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size + padding * 2.0f);
|
||||||
ItemSize(bb);
|
ItemSize(bb);
|
||||||
if (!ItemAdd(bb, id))
|
if (!ItemAdd(bb, id))
|
||||||
return false;
|
return false;
|
||||||
@ -1062,9 +1071,21 @@ bool ImGui::ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size
|
|||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// frame_padding < 0: uses FramePadding from style (default)
|
bool ImGui::ImageButton(const char* str_id, ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col)
|
||||||
// frame_padding = 0: no framing
|
{
|
||||||
// frame_padding > 0: set framing size
|
ImGuiContext& g = *GImGui;
|
||||||
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
|
if (window->SkipItems)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return ImageButtonEx(window->GetID(str_id), user_texture_id, size, uv0, uv1, bg_col, tint_col);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
// Legacy API obsoleted in 1.89. Two differences with new ImageButton()
|
||||||
|
// - new ImageButton() requires an explicit 'const char* str_id' Old ImageButton() used opaque imTextureId (created issue with: multiple buttons with same image, transient texture id values, opaque computation of ID)
|
||||||
|
// - new ImageButton() always use style.FramePadding Old ImageButton() had an override argument.
|
||||||
|
// If you need to change padding with new ImageButton() you can use PushStyleVar(ImGuiStyleVar_FramePadding, value), consistent with other Button functions.
|
||||||
bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col, const ImVec4& tint_col)
|
bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col, const ImVec4& tint_col)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
@ -1077,9 +1098,14 @@ bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const I
|
|||||||
const ImGuiID id = window->GetID("#image");
|
const ImGuiID id = window->GetID("#image");
|
||||||
PopID();
|
PopID();
|
||||||
|
|
||||||
const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : g.Style.FramePadding;
|
if (frame_padding >= 0)
|
||||||
return ImageButtonEx(id, user_texture_id, size, uv0, uv1, padding, bg_col, tint_col);
|
PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2((float)frame_padding, (float)frame_padding));
|
||||||
|
bool ret = ImageButtonEx(id, user_texture_id, size, uv0, uv1, bg_col, tint_col);
|
||||||
|
if (frame_padding >= 0)
|
||||||
|
PopStyleVar();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif // #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
|
||||||
bool ImGui::Checkbox(const char* label, bool* v)
|
bool ImGui::Checkbox(const char* label, bool* v)
|
||||||
{
|
{
|
||||||
@ -1558,11 +1584,11 @@ void ImGui::ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_exc
|
|||||||
items[n].Width = width_rounded;
|
items[n].Width = width_rounded;
|
||||||
}
|
}
|
||||||
while (width_excess > 0.0f)
|
while (width_excess > 0.0f)
|
||||||
for (int n = 0; n < count; n++)
|
for (int n = 0; n < count && width_excess > 0.0f; n++)
|
||||||
if (items[n].Width + 1.0f <= items[n].InitialWidth)
|
|
||||||
{
|
{
|
||||||
items[n].Width += 1.0f;
|
float width_to_add = ImMin(items[n].InitialWidth - items[n].Width, 1.0f);
|
||||||
width_excess -= 1.0f;
|
items[n].Width += width_to_add;
|
||||||
|
width_excess -= width_to_add;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1877,11 +1903,11 @@ bool ImGui::Combo(const char* label, int* current_item, const char* items_separa
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// [SECTION] Data Type and Data Formatting Helpers [Internal]
|
// [SECTION] Data Type and Data Formatting Helpers [Internal]
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// - PatchFormatStringFloatToInt()
|
|
||||||
// - DataTypeGetInfo()
|
// - DataTypeGetInfo()
|
||||||
// - DataTypeFormatString()
|
// - DataTypeFormatString()
|
||||||
// - DataTypeApplyOp()
|
// - DataTypeApplyOp()
|
||||||
// - DataTypeApplyOpFromText()
|
// - DataTypeApplyOpFromText()
|
||||||
|
// - DataTypeCompare()
|
||||||
// - DataTypeClamp()
|
// - DataTypeClamp()
|
||||||
// - GetMinimumStepAtDecimalPrecision
|
// - GetMinimumStepAtDecimalPrecision
|
||||||
// - RoundScalarWithFormat<>()
|
// - RoundScalarWithFormat<>()
|
||||||
@ -1907,30 +1933,6 @@ static const ImGuiDataTypeInfo GDataTypeInfo[] =
|
|||||||
};
|
};
|
||||||
IM_STATIC_ASSERT(IM_ARRAYSIZE(GDataTypeInfo) == ImGuiDataType_COUNT);
|
IM_STATIC_ASSERT(IM_ARRAYSIZE(GDataTypeInfo) == ImGuiDataType_COUNT);
|
||||||
|
|
||||||
// FIXME-LEGACY: Prior to 1.61 our DragInt() function internally used floats and because of this the compile-time default value for format was "%.0f".
|
|
||||||
// Even though we changed the compile-time default, we expect users to have carried %f around, which would break the display of DragInt() calls.
|
|
||||||
// To honor backward compatibility we are rewriting the format string, unless IMGUI_DISABLE_OBSOLETE_FUNCTIONS is enabled. What could possibly go wrong?!
|
|
||||||
static const char* PatchFormatStringFloatToInt(const char* fmt)
|
|
||||||
{
|
|
||||||
if (fmt[0] == '%' && fmt[1] == '.' && fmt[2] == '0' && fmt[3] == 'f' && fmt[4] == 0) // Fast legacy path for "%.0f" which is expected to be the most common case.
|
|
||||||
return "%d";
|
|
||||||
const char* fmt_start = ImParseFormatFindStart(fmt); // Find % (if any, and ignore %%)
|
|
||||||
const char* fmt_end = ImParseFormatFindEnd(fmt_start); // Find end of format specifier, which itself is an exercise of confidence/recklessness (because snprintf is dependent on libc or user).
|
|
||||||
if (fmt_end > fmt_start && fmt_end[-1] == 'f')
|
|
||||||
{
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
||||||
if (fmt_start == fmt && fmt_end[0] == 0)
|
|
||||||
return "%d";
|
|
||||||
const char* tmp_format;
|
|
||||||
ImFormatStringToTempBuffer(&tmp_format, NULL, "%.*s%%d%s", (int)(fmt_start - fmt), fmt, fmt_end); // Honor leading and trailing decorations, but lose alignment/precision.
|
|
||||||
return tmp_format;
|
|
||||||
#else
|
|
||||||
IM_ASSERT(0 && "DragInt(): Invalid format string!"); // Old versions used a default parameter of "%.0f", please replace with e.g. "%d"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return fmt;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ImGuiDataTypeInfo* ImGui::DataTypeGetInfo(ImGuiDataType data_type)
|
const ImGuiDataTypeInfo* ImGui::DataTypeGetInfo(ImGuiDataType data_type)
|
||||||
{
|
{
|
||||||
IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT);
|
IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT);
|
||||||
@ -2189,7 +2191,10 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const
|
|||||||
else if (g.ActiveIdSource == ImGuiInputSource_Nav)
|
else if (g.ActiveIdSource == ImGuiInputSource_Nav)
|
||||||
{
|
{
|
||||||
const int decimal_precision = is_floating_point ? ImParseFormatPrecision(format, 3) : 0;
|
const int decimal_precision = is_floating_point ? ImParseFormatPrecision(format, 3) : 0;
|
||||||
adjust_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard | ImGuiNavDirSourceFlags_PadDPad, ImGuiNavReadMode_RepeatFast, 1.0f / 10.0f, 10.0f)[axis];
|
const bool tweak_slow = IsKeyDown((g.NavInputSource == ImGuiInputSource_Gamepad) ? ImGuiKey_NavGamepadTweakSlow : ImGuiKey_NavKeyboardTweakSlow);
|
||||||
|
const bool tweak_fast = IsKeyDown((g.NavInputSource == ImGuiInputSource_Gamepad) ? ImGuiKey_NavGamepadTweakFast : ImGuiKey_NavKeyboardTweakFast);
|
||||||
|
const float tweak_factor = tweak_slow ? 1.0f / 1.0f : tweak_fast ? 10.0f : 1.0f;
|
||||||
|
adjust_delta = GetNavTweakPressedAmount(axis) * tweak_factor;
|
||||||
v_speed = ImMax(v_speed, GetMinimumStepAtDecimalPrecision(decimal_precision));
|
v_speed = ImMax(v_speed, GetMinimumStepAtDecimalPrecision(decimal_precision));
|
||||||
}
|
}
|
||||||
adjust_delta *= v_speed;
|
adjust_delta *= v_speed;
|
||||||
@ -2287,6 +2292,7 @@ bool ImGui::DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.ActiveId == id)
|
if (g.ActiveId == id)
|
||||||
{
|
{
|
||||||
|
// Those are the things we can do easily outside the DragBehaviorT<> template, saves code generation.
|
||||||
if (g.ActiveIdSource == ImGuiInputSource_Mouse && !g.IO.MouseDown[0])
|
if (g.ActiveIdSource == ImGuiInputSource_Mouse && !g.IO.MouseDown[0])
|
||||||
ClearActiveID();
|
ClearActiveID();
|
||||||
else if (g.ActiveIdSource == ImGuiInputSource_Nav && g.NavActivatePressedId == id && !g.ActiveIdIsJustActivated)
|
else if (g.ActiveIdSource == ImGuiInputSource_Nav && g.NavActivatePressedId == id && !g.ActiveIdIsJustActivated)
|
||||||
@ -2340,8 +2346,6 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data,
|
|||||||
// Default format string when passing NULL
|
// Default format string when passing NULL
|
||||||
if (format == NULL)
|
if (format == NULL)
|
||||||
format = DataTypeGetInfo(data_type)->PrintFmt;
|
format = DataTypeGetInfo(data_type)->PrintFmt;
|
||||||
else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) // (FIXME-LEGACY: Patch old "%.0f" format string to use "%d", read function more details.)
|
|
||||||
format = PatchFormatStringFloatToInt(format);
|
|
||||||
|
|
||||||
const bool hovered = ItemHoverable(frame_bb, id);
|
const bool hovered = ItemHoverable(frame_bb, id);
|
||||||
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
||||||
@ -2547,35 +2551,6 @@ bool ImGui::DragIntRange2(const char* label, int* v_current_min, int* v_current_
|
|||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
||||||
|
|
||||||
// Obsolete versions with power parameter. See https://github.com/ocornut/imgui/issues/3361 for details.
|
|
||||||
bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min, const void* p_max, const char* format, float power)
|
|
||||||
{
|
|
||||||
ImGuiSliderFlags drag_flags = ImGuiSliderFlags_None;
|
|
||||||
if (power != 1.0f)
|
|
||||||
{
|
|
||||||
IM_ASSERT(power == 1.0f && "Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!");
|
|
||||||
IM_ASSERT(p_min != NULL && p_max != NULL); // When using a power curve the drag needs to have known bounds
|
|
||||||
drag_flags |= ImGuiSliderFlags_Logarithmic; // Fallback for non-asserting paths
|
|
||||||
}
|
|
||||||
return DragScalar(label, data_type, p_data, v_speed, p_min, p_max, format, drag_flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ImGui::DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min, const void* p_max, const char* format, float power)
|
|
||||||
{
|
|
||||||
ImGuiSliderFlags drag_flags = ImGuiSliderFlags_None;
|
|
||||||
if (power != 1.0f)
|
|
||||||
{
|
|
||||||
IM_ASSERT(power == 1.0f && "Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!");
|
|
||||||
IM_ASSERT(p_min != NULL && p_max != NULL); // When using a power curve the drag needs to have known bounds
|
|
||||||
drag_flags |= ImGuiSliderFlags_Logarithmic; // Fallback for non-asserting paths
|
|
||||||
}
|
|
||||||
return DragScalarN(label, data_type, p_data, components, v_speed, p_min, p_max, format, drag_flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// [SECTION] Widgets: SliderScalar, SliderFloat, SliderInt, etc.
|
// [SECTION] Widgets: SliderScalar, SliderFloat, SliderInt, etc.
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -2795,25 +2770,26 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ
|
|||||||
g.SliderCurrentAccumDirty = false;
|
g.SliderCurrentAccumDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ImVec2 input_delta2 = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard | ImGuiNavDirSourceFlags_PadDPad, ImGuiNavReadMode_RepeatFast, 0.0f, 0.0f);
|
float input_delta = (axis == ImGuiAxis_X) ? GetNavTweakPressedAmount(axis) : -GetNavTweakPressedAmount(axis);
|
||||||
float input_delta = (axis == ImGuiAxis_X) ? input_delta2.x : -input_delta2.y;
|
|
||||||
if (input_delta != 0.0f)
|
if (input_delta != 0.0f)
|
||||||
{
|
{
|
||||||
|
const bool tweak_slow = IsKeyDown((g.NavInputSource == ImGuiInputSource_Gamepad) ? ImGuiKey_NavGamepadTweakSlow : ImGuiKey_NavKeyboardTweakSlow);
|
||||||
|
const bool tweak_fast = IsKeyDown((g.NavInputSource == ImGuiInputSource_Gamepad) ? ImGuiKey_NavGamepadTweakFast : ImGuiKey_NavKeyboardTweakFast);
|
||||||
const int decimal_precision = is_floating_point ? ImParseFormatPrecision(format, 3) : 0;
|
const int decimal_precision = is_floating_point ? ImParseFormatPrecision(format, 3) : 0;
|
||||||
if (decimal_precision > 0)
|
if (decimal_precision > 0)
|
||||||
{
|
{
|
||||||
input_delta /= 100.0f; // Gamepad/keyboard tweak speeds in % of slider bounds
|
input_delta /= 100.0f; // Gamepad/keyboard tweak speeds in % of slider bounds
|
||||||
if (IsNavInputDown(ImGuiNavInput_TweakSlow))
|
if (tweak_slow)
|
||||||
input_delta /= 10.0f;
|
input_delta /= 10.0f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((v_range >= -100.0f && v_range <= 100.0f) || IsNavInputDown(ImGuiNavInput_TweakSlow))
|
if ((v_range >= -100.0f && v_range <= 100.0f) || tweak_slow)
|
||||||
input_delta = ((input_delta < 0.0f) ? -1.0f : +1.0f) / (float)v_range; // Gamepad/keyboard tweak speeds in integer steps
|
input_delta = ((input_delta < 0.0f) ? -1.0f : +1.0f) / (float)v_range; // Gamepad/keyboard tweak speeds in integer steps
|
||||||
else
|
else
|
||||||
input_delta /= 100.0f;
|
input_delta /= 100.0f;
|
||||||
}
|
}
|
||||||
if (IsNavInputDown(ImGuiNavInput_TweakFast))
|
if (tweak_fast)
|
||||||
input_delta *= 10.0f;
|
input_delta *= 10.0f;
|
||||||
|
|
||||||
g.SliderCurrentAccum += input_delta;
|
g.SliderCurrentAccum += input_delta;
|
||||||
@ -2901,6 +2877,7 @@ bool ImGui::SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type
|
|||||||
// Read imgui.cpp "API BREAKING CHANGES" section for 1.78 if you hit this assert.
|
// Read imgui.cpp "API BREAKING CHANGES" section for 1.78 if you hit this assert.
|
||||||
IM_ASSERT((flags == 1 || (flags & ImGuiSliderFlags_InvalidMask_) == 0) && "Invalid ImGuiSliderFlags flag! Has the 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.");
|
IM_ASSERT((flags == 1 || (flags & ImGuiSliderFlags_InvalidMask_) == 0) && "Invalid ImGuiSliderFlags flag! Has the 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.");
|
||||||
|
|
||||||
|
// Those are the things we can do easily outside the SliderBehaviorT<> template, saves code generation.
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if ((g.LastItemData.InFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly))
|
if ((g.LastItemData.InFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly))
|
||||||
return false;
|
return false;
|
||||||
@ -2960,8 +2937,6 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat
|
|||||||
// Default format string when passing NULL
|
// Default format string when passing NULL
|
||||||
if (format == NULL)
|
if (format == NULL)
|
||||||
format = DataTypeGetInfo(data_type)->PrintFmt;
|
format = DataTypeGetInfo(data_type)->PrintFmt;
|
||||||
else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) // (FIXME-LEGACY: Patch old "%.0f" format string to use "%d", read function more details.)
|
|
||||||
format = PatchFormatStringFloatToInt(format);
|
|
||||||
|
|
||||||
const bool hovered = ItemHoverable(frame_bb, id);
|
const bool hovered = ItemHoverable(frame_bb, id);
|
||||||
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
||||||
@ -3127,8 +3102,6 @@ bool ImGui::VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType d
|
|||||||
// Default format string when passing NULL
|
// Default format string when passing NULL
|
||||||
if (format == NULL)
|
if (format == NULL)
|
||||||
format = DataTypeGetInfo(data_type)->PrintFmt;
|
format = DataTypeGetInfo(data_type)->PrintFmt;
|
||||||
else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) // (FIXME-LEGACY: Patch old "%.0f" format string to use "%d", read function more details.)
|
|
||||||
format = PatchFormatStringFloatToInt(format);
|
|
||||||
|
|
||||||
const bool hovered = ItemHoverable(frame_bb, id);
|
const bool hovered = ItemHoverable(frame_bb, id);
|
||||||
if ((hovered && g.IO.MouseClicked[0]) || g.NavActivateId == id || g.NavActivateInputId == id)
|
if ((hovered && g.IO.MouseClicked[0]) || g.NavActivateId == id || g.NavActivateInputId == id)
|
||||||
@ -3175,33 +3148,6 @@ bool ImGui::VSliderInt(const char* label, const ImVec2& size, int* v, int v_min,
|
|||||||
return VSliderScalar(label, size, ImGuiDataType_S32, v, &v_min, &v_max, format, flags);
|
return VSliderScalar(label, size, ImGuiDataType_S32, v, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
||||||
|
|
||||||
// Obsolete versions with power parameter. See https://github.com/ocornut/imgui/issues/3361 for details.
|
|
||||||
bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, float power)
|
|
||||||
{
|
|
||||||
ImGuiSliderFlags slider_flags = ImGuiSliderFlags_None;
|
|
||||||
if (power != 1.0f)
|
|
||||||
{
|
|
||||||
IM_ASSERT(power == 1.0f && "Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!");
|
|
||||||
slider_flags |= ImGuiSliderFlags_Logarithmic; // Fallback for non-asserting paths
|
|
||||||
}
|
|
||||||
return SliderScalar(label, data_type, p_data, p_min, p_max, format, slider_flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ImGui::SliderScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* v_min, const void* v_max, const char* format, float power)
|
|
||||||
{
|
|
||||||
ImGuiSliderFlags slider_flags = ImGuiSliderFlags_None;
|
|
||||||
if (power != 1.0f)
|
|
||||||
{
|
|
||||||
IM_ASSERT(power == 1.0f && "Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!");
|
|
||||||
slider_flags |= ImGuiSliderFlags_Logarithmic; // Fallback for non-asserting paths
|
|
||||||
}
|
|
||||||
return SliderScalarN(label, data_type, v, components, v_min, v_max, format, slider_flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// [SECTION] Widgets: InputScalar, InputFloat, InputInt, etc.
|
// [SECTION] Widgets: InputScalar, InputFloat, InputInt, etc.
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -3449,6 +3395,7 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data
|
|||||||
SetNextItemWidth(ImMax(1.0f, CalcItemWidth() - (button_size + style.ItemInnerSpacing.x) * 2));
|
SetNextItemWidth(ImMax(1.0f, CalcItemWidth() - (button_size + style.ItemInnerSpacing.x) * 2));
|
||||||
if (InputText("", buf, IM_ARRAYSIZE(buf), flags)) // PushId(label) + "" gives us the expected ID from outside point of view
|
if (InputText("", buf, IM_ARRAYSIZE(buf), flags)) // PushId(label) + "" gives us the expected ID from outside point of view
|
||||||
value_changed = DataTypeApplyFromText(buf, data_type, p_data, format);
|
value_changed = DataTypeApplyFromText(buf, data_type, p_data, format);
|
||||||
|
IMGUI_TEST_ENGINE_ITEM_INFO(g.LastItemData.ID, label, g.LastItemData.StatusFlags);
|
||||||
|
|
||||||
// Step buttons
|
// Step buttons
|
||||||
const ImVec2 backup_frame_padding = style.FramePadding;
|
const ImVec2 backup_frame_padding = style.FramePadding;
|
||||||
@ -3603,7 +3550,7 @@ bool ImGui::InputTextMultiline(const char* label, char* buf, size_t buf_size, co
|
|||||||
|
|
||||||
bool ImGui::InputTextWithHint(const char* label, const char* hint, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
|
bool ImGui::InputTextWithHint(const char* label, const char* hint, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
|
||||||
{
|
{
|
||||||
IM_ASSERT(!(flags & ImGuiInputTextFlags_Multiline)); // call InputTextMultiline()
|
IM_ASSERT(!(flags & ImGuiInputTextFlags_Multiline)); // call InputTextMultiline() or InputTextEx() manually if you need multi-line + hint.
|
||||||
return InputTextEx(label, hint, buf, (int)buf_size, ImVec2(0, 0), flags, callback, user_data);
|
return InputTextEx(label, hint, buf, (int)buf_size, ImVec2(0, 0), flags, callback, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3694,13 +3641,10 @@ static int is_word_boundary_from_right(ImGuiInputTextState* obj, int idx)
|
|||||||
static int is_word_boundary_from_left(ImGuiInputTextState* obj, int idx) { if (obj->Flags & ImGuiInputTextFlags_Password) return 0; return idx > 0 ? (!is_separator(obj->TextW[idx - 1]) && is_separator(obj->TextW[idx])) : 1; }
|
static int is_word_boundary_from_left(ImGuiInputTextState* obj, int idx) { if (obj->Flags & ImGuiInputTextFlags_Password) return 0; return idx > 0 ? (!is_separator(obj->TextW[idx - 1]) && is_separator(obj->TextW[idx])) : 1; }
|
||||||
static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(ImGuiInputTextState* obj, int idx) { idx--; while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; }
|
static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(ImGuiInputTextState* obj, int idx) { idx--; while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; }
|
||||||
static int STB_TEXTEDIT_MOVEWORDRIGHT_MAC(ImGuiInputTextState* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; }
|
static int STB_TEXTEDIT_MOVEWORDRIGHT_MAC(ImGuiInputTextState* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; }
|
||||||
#define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h
|
|
||||||
#ifdef __APPLE__ // FIXME: Move setting to IO structure
|
|
||||||
#define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_MAC
|
|
||||||
#else
|
|
||||||
static int STB_TEXTEDIT_MOVEWORDRIGHT_WIN(ImGuiInputTextState* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; }
|
static int STB_TEXTEDIT_MOVEWORDRIGHT_WIN(ImGuiInputTextState* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; }
|
||||||
#define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_WIN
|
static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(ImGuiInputTextState* obj, int idx) { if (ImGui::GetIO().ConfigMacOSXBehaviors) return STB_TEXTEDIT_MOVEWORDRIGHT_MAC(obj, idx); else return STB_TEXTEDIT_MOVEWORDRIGHT_WIN(obj, idx); }
|
||||||
#endif
|
#define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h
|
||||||
|
#define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL
|
||||||
|
|
||||||
static void STB_TEXTEDIT_DELETECHARS(ImGuiInputTextState* obj, int pos, int n)
|
static void STB_TEXTEDIT_DELETECHARS(ImGuiInputTextState* obj, int pos, int n)
|
||||||
{
|
{
|
||||||
@ -3778,11 +3722,12 @@ static void stb_textedit_replace(ImGuiInputTextState* str, STB_TexteditState* st
|
|||||||
{
|
{
|
||||||
stb_text_makeundo_replace(str, state, 0, str->CurLenW, text_len);
|
stb_text_makeundo_replace(str, state, 0, str->CurLenW, text_len);
|
||||||
ImStb::STB_TEXTEDIT_DELETECHARS(str, 0, str->CurLenW);
|
ImStb::STB_TEXTEDIT_DELETECHARS(str, 0, str->CurLenW);
|
||||||
|
state->cursor = state->select_start = state->select_end = 0;
|
||||||
if (text_len <= 0)
|
if (text_len <= 0)
|
||||||
return;
|
return;
|
||||||
if (ImStb::STB_TEXTEDIT_INSERTCHARS(str, 0, text, text_len))
|
if (ImStb::STB_TEXTEDIT_INSERTCHARS(str, 0, text, text_len))
|
||||||
{
|
{
|
||||||
state->cursor = text_len;
|
state->cursor = state->select_start = state->select_end = text_len;
|
||||||
state->has_preferred_x = 0;
|
state->has_preferred_x = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3901,6 +3846,13 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
const unsigned c_decimal_point = (unsigned int)g.PlatformLocaleDecimalPoint;
|
const unsigned c_decimal_point = (unsigned int)g.PlatformLocaleDecimalPoint;
|
||||||
|
|
||||||
|
// Full-width -> half-width conversion for numeric fields (https://en.wikipedia.org/wiki/Halfwidth_and_Fullwidth_Forms_(Unicode_block)
|
||||||
|
// While this is mostly convenient, this has the side-effect for uninformed users accidentally inputting full-width characters that they may
|
||||||
|
// scratch their head as to why it works in numerical fields vs in generic text fields it would require support in the font.
|
||||||
|
if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsScientific | ImGuiInputTextFlags_CharsHexadecimal))
|
||||||
|
if (c >= 0xFF01 && c <= 0xFF5E)
|
||||||
|
c = c - 0xFF01 + 0x21;
|
||||||
|
|
||||||
// Allow 0-9 . - + * /
|
// Allow 0-9 . - + * /
|
||||||
if (flags & ImGuiInputTextFlags_CharsDecimal)
|
if (flags & ImGuiInputTextFlags_CharsDecimal)
|
||||||
if (!(c >= '0' && c <= '9') && (c != c_decimal_point) && (c != '-') && (c != '+') && (c != '*') && (c != '/'))
|
if (!(c >= '0' && c <= '9') && (c != c_decimal_point) && (c != '-') && (c != '+') && (c != '*') && (c != '/'))
|
||||||
@ -3919,11 +3871,13 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
|
|||||||
// Turn a-z into A-Z
|
// Turn a-z into A-Z
|
||||||
if (flags & ImGuiInputTextFlags_CharsUppercase)
|
if (flags & ImGuiInputTextFlags_CharsUppercase)
|
||||||
if (c >= 'a' && c <= 'z')
|
if (c >= 'a' && c <= 'z')
|
||||||
*p_char = (c += (unsigned int)('A' - 'a'));
|
c += (unsigned int)('A' - 'a');
|
||||||
|
|
||||||
if (flags & ImGuiInputTextFlags_CharsNoBlank)
|
if (flags & ImGuiInputTextFlags_CharsNoBlank)
|
||||||
if (ImCharIsBlankW(c))
|
if (ImCharIsBlankW(c))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
*p_char = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom callback filter
|
// Custom callback filter
|
||||||
@ -4149,11 +4103,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
FocusWindow(window);
|
FocusWindow(window);
|
||||||
|
|
||||||
// Declare our inputs
|
// Declare our inputs
|
||||||
IM_ASSERT(ImGuiNavInput_COUNT < 32);
|
|
||||||
g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right);
|
g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right);
|
||||||
if (is_multiline || (flags & ImGuiInputTextFlags_CallbackHistory))
|
if (is_multiline || (flags & ImGuiInputTextFlags_CallbackHistory))
|
||||||
g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);
|
g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);
|
||||||
g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel);
|
SetActiveIdUsingKey(ImGuiKey_Escape);
|
||||||
|
SetActiveIdUsingKey(ImGuiKey_NavGamepadCancel);
|
||||||
SetActiveIdUsingKey(ImGuiKey_Home);
|
SetActiveIdUsingKey(ImGuiKey_Home);
|
||||||
SetActiveIdUsingKey(ImGuiKey_End);
|
SetActiveIdUsingKey(ImGuiKey_End);
|
||||||
if (is_multiline)
|
if (is_multiline)
|
||||||
@ -4176,10 +4130,10 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
clear_active_id = true;
|
clear_active_id = true;
|
||||||
|
|
||||||
// Lock the decision of whether we are going to take the path displaying the cursor or selection
|
// Lock the decision of whether we are going to take the path displaying the cursor or selection
|
||||||
const bool render_cursor = (g.ActiveId == id) || (state && user_scroll_active);
|
bool render_cursor = (g.ActiveId == id) || (state && user_scroll_active);
|
||||||
bool render_selection = state && (state->HasSelection() || select_all) && (RENDER_SELECTION_WHEN_INACTIVE || render_cursor);
|
bool render_selection = state && (state->HasSelection() || select_all) && (RENDER_SELECTION_WHEN_INACTIVE || render_cursor);
|
||||||
bool value_changed = false;
|
bool value_changed = false;
|
||||||
bool enter_pressed = false;
|
bool validated = false;
|
||||||
|
|
||||||
// When read-only we always use the live data passed to the function
|
// When read-only we always use the live data passed to the function
|
||||||
// FIXME-OPT: Because our selection/cursor code currently needs the wide text we need to convert it when active, which is not ideal :(
|
// FIXME-OPT: Because our selection/cursor code currently needs the wide text we need to convert it when active, which is not ideal :(
|
||||||
@ -4275,9 +4229,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
}
|
}
|
||||||
else if (io.MouseClicked[0] && !state->SelectedAllMouseLock)
|
else if (io.MouseClicked[0] && !state->SelectedAllMouseLock)
|
||||||
{
|
{
|
||||||
// FIXME: unselect on late click could be done release?
|
|
||||||
if (hovered)
|
if (hovered)
|
||||||
{
|
{
|
||||||
|
if (io.KeyShift)
|
||||||
|
stb_textedit_drag(state, &state->Stb, mouse_x, mouse_y);
|
||||||
|
else
|
||||||
stb_textedit_click(state, &state->Stb, mouse_x, mouse_y);
|
stb_textedit_click(state, &state->Stb, mouse_x, mouse_y);
|
||||||
state->CursorAnimReset();
|
state->CursorAnimReset();
|
||||||
}
|
}
|
||||||
@ -4291,7 +4247,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
if (state->SelectedAllMouseLock && !io.MouseDown[0])
|
if (state->SelectedAllMouseLock && !io.MouseDown[0])
|
||||||
state->SelectedAllMouseLock = false;
|
state->SelectedAllMouseLock = false;
|
||||||
|
|
||||||
// We except backends to emit a Tab key but some also emit a Tab character which we ignore (#2467, #1336)
|
// We expect backends to emit a Tab key but some also emit a Tab character which we ignore (#2467, #1336)
|
||||||
// (For Tab and Enter: Win32/SFML/Allegro are sending both keys and chars, GLFW and SDL are only sending keys. For Space they all send all threes)
|
// (For Tab and Enter: Win32/SFML/Allegro are sending both keys and chars, GLFW and SDL are only sending keys. For Space they all send all threes)
|
||||||
const bool ignore_char_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeySuper);
|
const bool ignore_char_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeySuper);
|
||||||
if ((flags & ImGuiInputTextFlags_AllowTabInput) && IsKeyPressed(ImGuiKey_Tab) && !ignore_char_inputs && !io.KeyShift && !is_readonly)
|
if ((flags & ImGuiInputTextFlags_AllowTabInput) && IsKeyPressed(ImGuiKey_Tab) && !ignore_char_inputs && !io.KeyShift && !is_readonly)
|
||||||
@ -4322,7 +4278,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Process other shortcuts/key-presses
|
// Process other shortcuts/key-presses
|
||||||
bool cancel_edit = false;
|
bool revert_edit = false;
|
||||||
if (g.ActiveId == id && !g.ActiveIdIsJustActivated && !clear_active_id)
|
if (g.ActiveId == id && !g.ActiveIdIsJustActivated && !clear_active_id)
|
||||||
{
|
{
|
||||||
IM_ASSERT(state != NULL);
|
IM_ASSERT(state != NULL);
|
||||||
@ -4332,23 +4288,25 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
|
|
||||||
const int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0);
|
const int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0);
|
||||||
const bool is_osx = io.ConfigMacOSXBehaviors;
|
const bool is_osx = io.ConfigMacOSXBehaviors;
|
||||||
const bool is_osx_shift_shortcut = is_osx && (io.KeyMods == (ImGuiModFlags_Super | ImGuiModFlags_Shift));
|
const bool is_osx_shift_shortcut = is_osx && (io.KeyMods == (ImGuiMod_Super | ImGuiMod_Shift));
|
||||||
const bool is_wordmove_key_down = is_osx ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl
|
const bool is_wordmove_key_down = is_osx ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl
|
||||||
const bool is_startend_key_down = is_osx && io.KeySuper && !io.KeyCtrl && !io.KeyAlt; // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End
|
const bool is_startend_key_down = is_osx && io.KeySuper && !io.KeyCtrl && !io.KeyAlt; // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End
|
||||||
const bool is_ctrl_key_only = (io.KeyMods == ImGuiModFlags_Ctrl);
|
const bool is_ctrl_key_only = (io.KeyMods == ImGuiMod_Ctrl);
|
||||||
const bool is_shift_key_only = (io.KeyMods == ImGuiModFlags_Shift);
|
const bool is_shift_key_only = (io.KeyMods == ImGuiMod_Shift);
|
||||||
const bool is_shortcut_key = g.IO.ConfigMacOSXBehaviors ? (io.KeyMods == ImGuiModFlags_Super) : (io.KeyMods == ImGuiModFlags_Ctrl);
|
const bool is_shortcut_key = g.IO.ConfigMacOSXBehaviors ? (io.KeyMods == ImGuiMod_Super) : (io.KeyMods == ImGuiMod_Ctrl);
|
||||||
|
|
||||||
const bool is_cut = ((is_shortcut_key && IsKeyPressed(ImGuiKey_X)) || (is_shift_key_only && IsKeyPressed(ImGuiKey_Delete))) && !is_readonly && !is_password && (!is_multiline || state->HasSelection());
|
const bool is_cut = ((is_shortcut_key && IsKeyPressed(ImGuiKey_X)) || (is_shift_key_only && IsKeyPressed(ImGuiKey_Delete))) && !is_readonly && !is_password && (!is_multiline || state->HasSelection());
|
||||||
const bool is_copy = ((is_shortcut_key && IsKeyPressed(ImGuiKey_C)) || (is_ctrl_key_only && IsKeyPressed(ImGuiKey_Insert))) && !is_password && (!is_multiline || state->HasSelection());
|
const bool is_copy = ((is_shortcut_key && IsKeyPressed(ImGuiKey_C)) || (is_ctrl_key_only && IsKeyPressed(ImGuiKey_Insert))) && !is_password && (!is_multiline || state->HasSelection());
|
||||||
const bool is_paste = ((is_shortcut_key && IsKeyPressed(ImGuiKey_V)) || (is_shift_key_only && IsKeyPressed(ImGuiKey_Insert))) && !is_readonly;
|
const bool is_paste = ((is_shortcut_key && IsKeyPressed(ImGuiKey_V)) || (is_shift_key_only && IsKeyPressed(ImGuiKey_Insert))) && !is_readonly;
|
||||||
const bool is_undo = ((is_shortcut_key && IsKeyPressed(ImGuiKey_Z)) && !is_readonly && is_undoable);
|
const bool is_undo = ((is_shortcut_key && IsKeyPressed(ImGuiKey_Z)) && !is_readonly && is_undoable);
|
||||||
const bool is_redo = ((is_shortcut_key && IsKeyPressed(ImGuiKey_Y)) || (is_osx_shift_shortcut && IsKeyPressed(ImGuiKey_Z))) && !is_readonly && is_undoable;
|
const bool is_redo = ((is_shortcut_key && IsKeyPressed(ImGuiKey_Y)) || (is_osx_shift_shortcut && IsKeyPressed(ImGuiKey_Z))) && !is_readonly && is_undoable;
|
||||||
|
const bool is_select_all = is_shortcut_key && IsKeyPressed(ImGuiKey_A);
|
||||||
|
|
||||||
// We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful.
|
// We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful.
|
||||||
const bool is_validate_enter = IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_KeypadEnter);
|
const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
|
||||||
const bool is_validate_nav = (IsNavInputTest(ImGuiNavInput_Activate, ImGuiNavReadMode_Pressed) && !IsKeyPressed(ImGuiKey_Space)) || IsNavInputTest(ImGuiNavInput_Input, ImGuiNavReadMode_Pressed);
|
const bool is_enter_pressed = IsKeyPressed(ImGuiKey_Enter, true) || IsKeyPressed(ImGuiKey_KeypadEnter, true);
|
||||||
const bool is_cancel = IsKeyPressed(ImGuiKey_Escape) || IsNavInputTest(ImGuiNavInput_Cancel, ImGuiNavReadMode_Pressed);
|
const bool is_gamepad_validate = nav_gamepad_active && (IsKeyPressed(ImGuiKey_NavGamepadActivate, false) || IsKeyPressed(ImGuiKey_NavGamepadInput, false));
|
||||||
|
const bool is_cancel = IsKeyPressed(ImGuiKey_Escape, false) || (nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadCancel, false));
|
||||||
|
|
||||||
if (IsKeyPressed(ImGuiKey_LeftArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); }
|
if (IsKeyPressed(ImGuiKey_LeftArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); }
|
||||||
else if (IsKeyPressed(ImGuiKey_RightArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); }
|
else if (IsKeyPressed(ImGuiKey_RightArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); }
|
||||||
@ -4370,12 +4328,17 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
}
|
}
|
||||||
state->OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask);
|
state->OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask);
|
||||||
}
|
}
|
||||||
else if (is_validate_enter)
|
else if (is_enter_pressed || is_gamepad_validate)
|
||||||
{
|
{
|
||||||
|
// Determine if we turn Enter into a \n character
|
||||||
bool ctrl_enter_for_new_line = (flags & ImGuiInputTextFlags_CtrlEnterForNewLine) != 0;
|
bool ctrl_enter_for_new_line = (flags & ImGuiInputTextFlags_CtrlEnterForNewLine) != 0;
|
||||||
if (!is_multiline || (ctrl_enter_for_new_line && !io.KeyCtrl) || (!ctrl_enter_for_new_line && io.KeyCtrl))
|
if (!is_multiline || is_gamepad_validate || (ctrl_enter_for_new_line && !io.KeyCtrl) || (!ctrl_enter_for_new_line && io.KeyCtrl))
|
||||||
{
|
{
|
||||||
enter_pressed = clear_active_id = true;
|
validated = true;
|
||||||
|
if (io.ConfigInputTextEnterKeepActive && !is_multiline)
|
||||||
|
state->SelectAll(); // No need to scroll
|
||||||
|
else
|
||||||
|
clear_active_id = true;
|
||||||
}
|
}
|
||||||
else if (!is_readonly)
|
else if (!is_readonly)
|
||||||
{
|
{
|
||||||
@ -4384,21 +4347,32 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
state->OnKeyPressed((int)c);
|
state->OnKeyPressed((int)c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (is_validate_nav)
|
|
||||||
{
|
|
||||||
IM_ASSERT(!is_validate_enter);
|
|
||||||
enter_pressed = clear_active_id = true;
|
|
||||||
}
|
|
||||||
else if (is_cancel)
|
else if (is_cancel)
|
||||||
{
|
{
|
||||||
clear_active_id = cancel_edit = true;
|
if (flags & ImGuiInputTextFlags_EscapeClearsAll)
|
||||||
|
{
|
||||||
|
if (state->CurLenA > 0)
|
||||||
|
{
|
||||||
|
revert_edit = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
render_cursor = render_selection = false;
|
||||||
|
clear_active_id = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clear_active_id = revert_edit = true;
|
||||||
|
render_cursor = render_selection = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (is_undo || is_redo)
|
else if (is_undo || is_redo)
|
||||||
{
|
{
|
||||||
state->OnKeyPressed(is_undo ? STB_TEXTEDIT_K_UNDO : STB_TEXTEDIT_K_REDO);
|
state->OnKeyPressed(is_undo ? STB_TEXTEDIT_K_UNDO : STB_TEXTEDIT_K_REDO);
|
||||||
state->ClearSelection();
|
state->ClearSelection();
|
||||||
}
|
}
|
||||||
else if (is_shortcut_key && IsKeyPressed(ImGuiKey_A))
|
else if (is_select_all)
|
||||||
{
|
{
|
||||||
state->SelectAll();
|
state->SelectAll();
|
||||||
state->CursorFollow = true;
|
state->CursorFollow = true;
|
||||||
@ -4462,11 +4436,19 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
if (g.ActiveId == id)
|
if (g.ActiveId == id)
|
||||||
{
|
{
|
||||||
IM_ASSERT(state != NULL);
|
IM_ASSERT(state != NULL);
|
||||||
if (cancel_edit)
|
if (revert_edit && !is_readonly)
|
||||||
|
{
|
||||||
|
if (flags & ImGuiInputTextFlags_EscapeClearsAll)
|
||||||
|
{
|
||||||
|
// Clear input
|
||||||
|
apply_new_text = "";
|
||||||
|
apply_new_text_length = 0;
|
||||||
|
STB_TEXTEDIT_CHARTYPE empty_string;
|
||||||
|
stb_textedit_replace(state, &state->Stb, &empty_string, 0);
|
||||||
|
}
|
||||||
|
else if (strcmp(buf, state->InitialTextA.Data) != 0)
|
||||||
{
|
{
|
||||||
// Restore initial value. Only return true if restoring to the initial value changes the current buffer contents.
|
// Restore initial value. Only return true if restoring to the initial value changes the current buffer contents.
|
||||||
if (!is_readonly && strcmp(buf, state->InitialTextA.Data) != 0)
|
|
||||||
{
|
|
||||||
// Push records into the undo stack so we can CTRL+Z the revert operation itself
|
// Push records into the undo stack so we can CTRL+Z the revert operation itself
|
||||||
apply_new_text = state->InitialTextA.Data;
|
apply_new_text = state->InitialTextA.Data;
|
||||||
apply_new_text_length = state->InitialTextA.Size - 1;
|
apply_new_text_length = state->InitialTextA.Size - 1;
|
||||||
@ -4491,7 +4473,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
// When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't modified on this frame.
|
// When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't modified on this frame.
|
||||||
// If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail.
|
// If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail.
|
||||||
// This also allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage (please note that if you use this property along ImGuiInputTextFlags_CallbackResize you can end up with your temporary string object unnecessarily allocating once a frame, either store your string data, either if you don't then don't use ImGuiInputTextFlags_CallbackResize).
|
// This also allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage (please note that if you use this property along ImGuiInputTextFlags_CallbackResize you can end up with your temporary string object unnecessarily allocating once a frame, either store your string data, either if you don't then don't use ImGuiInputTextFlags_CallbackResize).
|
||||||
const bool apply_edit_back_to_user_buffer = !cancel_edit || (enter_pressed && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0);
|
const bool apply_edit_back_to_user_buffer = !revert_edit || (validated && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0);
|
||||||
if (apply_edit_back_to_user_buffer)
|
if (apply_edit_back_to_user_buffer)
|
||||||
{
|
{
|
||||||
// Apply new value immediately - copy modified buffer back
|
// Apply new value immediately - copy modified buffer back
|
||||||
@ -4566,6 +4548,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
if (callback_data.SelectionEnd != utf8_selection_end || buf_dirty) { state->Stb.select_end = (callback_data.SelectionEnd == callback_data.SelectionStart) ? state->Stb.select_start : ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionEnd); }
|
if (callback_data.SelectionEnd != utf8_selection_end || buf_dirty) { state->Stb.select_end = (callback_data.SelectionEnd == callback_data.SelectionStart) ? state->Stb.select_start : ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionEnd); }
|
||||||
if (buf_dirty)
|
if (buf_dirty)
|
||||||
{
|
{
|
||||||
|
IM_ASSERT((flags & ImGuiInputTextFlags_ReadOnly) == 0);
|
||||||
IM_ASSERT(callback_data.BufTextLen == (int)strlen(callback_data.Buf)); // You need to maintain BufTextLen if you change the text!
|
IM_ASSERT(callback_data.BufTextLen == (int)strlen(callback_data.Buf)); // You need to maintain BufTextLen if you change the text!
|
||||||
InputTextReconcileUndoStateAfterUserCallback(state, callback_data.Buf, callback_data.BufTextLen); // FIXME: Move the rest of this block inside function and rename to InputTextReconcileStateAfterUserCallback() ?
|
InputTextReconcileUndoStateAfterUserCallback(state, callback_data.Buf, callback_data.BufTextLen); // FIXME: Move the rest of this block inside function and rename to InputTextReconcileStateAfterUserCallback() ?
|
||||||
if (callback_data.BufTextLen > backup_current_text_length && is_resizable)
|
if (callback_data.BufTextLen > backup_current_text_length && is_resizable)
|
||||||
@ -4584,9 +4567,6 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
apply_new_text_length = state->CurLenA;
|
apply_new_text_length = state->CurLenA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear temporary user storage
|
|
||||||
state->Flags = ImGuiInputTextFlags_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy result to user buffer. This can currently only happen when (g.ActiveId == id)
|
// Copy result to user buffer. This can currently only happen when (g.ActiveId == id)
|
||||||
@ -4868,7 +4848,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
|
|
||||||
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags);
|
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags);
|
||||||
if ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0)
|
if ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0)
|
||||||
return enter_pressed;
|
return validated;
|
||||||
else
|
else
|
||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
@ -5108,6 +5088,8 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|||||||
OpenPopupOnItemClick("context", ImGuiPopupFlags_MouseButtonRight);
|
OpenPopupOnItemClick("context", ImGuiPopupFlags_MouseButtonRight);
|
||||||
|
|
||||||
if (BeginPopup("picker"))
|
if (BeginPopup("picker"))
|
||||||
|
{
|
||||||
|
if (g.CurrentWindow->BeginCount == 1)
|
||||||
{
|
{
|
||||||
picker_active_window = g.CurrentWindow;
|
picker_active_window = g.CurrentWindow;
|
||||||
if (label != label_display_end)
|
if (label != label_display_end)
|
||||||
@ -5119,6 +5101,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|||||||
ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags_DisplayMask_ | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf;
|
ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags_DisplayMask_ | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf;
|
||||||
SetNextItemWidth(square_sz * 12.0f); // Use 256 + bar sizes?
|
SetNextItemWidth(square_sz * 12.0f); // Use 256 + bar sizes?
|
||||||
value_changed |= ColorPicker4("##picker", col, picker_flags, &g.ColorPickerRef.x);
|
value_changed |= ColorPicker4("##picker", col, picker_flags, &g.ColorPickerRef.x);
|
||||||
|
}
|
||||||
EndPopup();
|
EndPopup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5162,7 +5145,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|||||||
bool accepted_drag_drop = false;
|
bool accepted_drag_drop = false;
|
||||||
if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F))
|
if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F))
|
||||||
{
|
{
|
||||||
memcpy((float*)col, payload->Data, sizeof(float) * 3); // Preserve alpha if any //-V512
|
memcpy((float*)col, payload->Data, sizeof(float) * 3); // Preserve alpha if any //-V512 //-V1086
|
||||||
value_changed = accepted_drag_drop = true;
|
value_changed = accepted_drag_drop = true;
|
||||||
}
|
}
|
||||||
if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F))
|
if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F))
|
||||||
@ -5181,7 +5164,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|||||||
if (picker_active_window && g.ActiveId != 0 && g.ActiveIdWindow == picker_active_window)
|
if (picker_active_window && g.ActiveId != 0 && g.ActiveIdWindow == picker_active_window)
|
||||||
g.LastItemData.ID = g.ActiveId;
|
g.LastItemData.ID = g.ActiveId;
|
||||||
|
|
||||||
if (value_changed)
|
if (value_changed && g.LastItemData.ID != 0) // In case of ID collision, the second EndGroup() won't catch g.ActiveId
|
||||||
MarkItemEdited(g.LastItemData.ID);
|
MarkItemEdited(g.LastItemData.ID);
|
||||||
|
|
||||||
return value_changed;
|
return value_changed;
|
||||||
@ -5569,7 +5552,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|||||||
|
|
||||||
if (value_changed && memcmp(backup_initial_col, col, components * sizeof(float)) == 0)
|
if (value_changed && memcmp(backup_initial_col, col, components * sizeof(float)) == 0)
|
||||||
value_changed = false;
|
value_changed = false;
|
||||||
if (value_changed)
|
if (value_changed && g.LastItemData.ID != 0) // In case of ID collision, the second EndGroup() won't catch g.ActiveId
|
||||||
MarkItemEdited(g.LastItemData.ID);
|
MarkItemEdited(g.LastItemData.ID);
|
||||||
|
|
||||||
PopID();
|
PopID();
|
||||||
@ -5904,7 +5887,14 @@ bool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char
|
|||||||
return TreeNodeBehavior(window->GetID(ptr_id), flags, label, label_end);
|
return TreeNodeBehavior(window->GetID(ptr_id), flags, label, label_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags)
|
void ImGui::TreeNodeSetOpen(ImGuiID id, bool open)
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
ImGuiStorage* storage = g.CurrentWindow->DC.StateStorage;
|
||||||
|
storage->SetInt(id, open ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui::TreeNodeUpdateNextOpen(ImGuiID id, ImGuiTreeNodeFlags flags)
|
||||||
{
|
{
|
||||||
if (flags & ImGuiTreeNodeFlags_Leaf)
|
if (flags & ImGuiTreeNodeFlags_Leaf)
|
||||||
return true;
|
return true;
|
||||||
@ -5920,7 +5910,7 @@ bool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags)
|
|||||||
if (g.NextItemData.OpenCond & ImGuiCond_Always)
|
if (g.NextItemData.OpenCond & ImGuiCond_Always)
|
||||||
{
|
{
|
||||||
is_open = g.NextItemData.OpenVal;
|
is_open = g.NextItemData.OpenVal;
|
||||||
storage->SetInt(id, is_open);
|
TreeNodeSetOpen(id, is_open);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -5929,7 +5919,7 @@ bool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags)
|
|||||||
if (stored_value == -1)
|
if (stored_value == -1)
|
||||||
{
|
{
|
||||||
is_open = g.NextItemData.OpenVal;
|
is_open = g.NextItemData.OpenVal;
|
||||||
storage->SetInt(id, is_open);
|
TreeNodeSetOpen(id, is_open);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -5995,7 +5985,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
|||||||
// For this purpose we essentially compare if g.NavIdIsAlive went from 0 to 1 between TreeNode() and TreePop().
|
// For this purpose we essentially compare if g.NavIdIsAlive went from 0 to 1 between TreeNode() and TreePop().
|
||||||
// This is currently only support 32 level deep and we are fine with (1 << Depth) overflowing into a zero.
|
// This is currently only support 32 level deep and we are fine with (1 << Depth) overflowing into a zero.
|
||||||
const bool is_leaf = (flags & ImGuiTreeNodeFlags_Leaf) != 0;
|
const bool is_leaf = (flags & ImGuiTreeNodeFlags_Leaf) != 0;
|
||||||
bool is_open = TreeNodeBehaviorIsOpen(id, flags);
|
bool is_open = TreeNodeUpdateNextOpen(id, flags);
|
||||||
if (is_open && !g.NavIdIsAlive && (flags & ImGuiTreeNodeFlags_NavLeftJumpsBackHere) && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
|
if (is_open && !g.NavIdIsAlive && (flags & ImGuiTreeNodeFlags_NavLeftJumpsBackHere) && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
|
||||||
window->DC.TreeJumpToParentOnPopMask |= (1 << window->DC.TreeDepth);
|
window->DC.TreeJumpToParentOnPopMask |= (1 << window->DC.TreeDepth);
|
||||||
|
|
||||||
@ -7010,10 +7000,10 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled)
|
|||||||
ImVec2 label_size = CalcTextSize(label, NULL, true);
|
ImVec2 label_size = CalcTextSize(label, NULL, true);
|
||||||
|
|
||||||
// Odd hack to allow hovering across menus of a same menu-set (otherwise we wouldn't be able to hover parent without always being a Child window)
|
// Odd hack to allow hovering across menus of a same menu-set (otherwise we wouldn't be able to hover parent without always being a Child window)
|
||||||
|
// This is only done for items for the menu set and not the full parent window.
|
||||||
const bool menuset_is_open = IsRootOfOpenMenuSet();
|
const bool menuset_is_open = IsRootOfOpenMenuSet();
|
||||||
ImGuiWindow* backed_nav_window = g.NavWindow;
|
|
||||||
if (menuset_is_open)
|
if (menuset_is_open)
|
||||||
g.NavWindow = window;
|
PushItemFlag(ImGuiItemFlags_NoWindowHoverableCheck, true);
|
||||||
|
|
||||||
// The reference position stored in popup_pos will be used by Begin() to find a suitable position for the child menu,
|
// The reference position stored in popup_pos will be used by Begin() to find a suitable position for the child menu,
|
||||||
// However the final position is going to be different! It is chosen by FindBestWindowPosForPopup().
|
// However the final position is going to be different! It is chosen by FindBestWindowPosForPopup().
|
||||||
@ -7062,7 +7052,7 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled)
|
|||||||
|
|
||||||
const bool hovered = (g.HoveredId == id) && enabled && !g.NavDisableMouseHover;
|
const bool hovered = (g.HoveredId == id) && enabled && !g.NavDisableMouseHover;
|
||||||
if (menuset_is_open)
|
if (menuset_is_open)
|
||||||
g.NavWindow = backed_nav_window;
|
PopItemFlag();
|
||||||
|
|
||||||
bool want_open = false;
|
bool want_open = false;
|
||||||
bool want_close = false;
|
bool want_close = false;
|
||||||
@ -7071,26 +7061,30 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled)
|
|||||||
// Close menu when not hovering it anymore unless we are moving roughly in the direction of the menu
|
// Close menu when not hovering it anymore unless we are moving roughly in the direction of the menu
|
||||||
// Implement http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown to avoid using timers, so menus feels more reactive.
|
// Implement http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown to avoid using timers, so menus feels more reactive.
|
||||||
bool moving_toward_child_menu = false;
|
bool moving_toward_child_menu = false;
|
||||||
ImGuiWindow* child_menu_window = (g.BeginPopupStack.Size < g.OpenPopupStack.Size && g.OpenPopupStack[g.BeginPopupStack.Size].SourceWindow == window) ? g.OpenPopupStack[g.BeginPopupStack.Size].Window : NULL;
|
ImGuiPopupData* child_popup = (g.BeginPopupStack.Size < g.OpenPopupStack.Size) ? &g.OpenPopupStack[g.BeginPopupStack.Size] : NULL; // Popup candidate (testing below)
|
||||||
if (g.HoveredWindow == window && child_menu_window != NULL && !(window->Flags & ImGuiWindowFlags_MenuBar))
|
ImGuiWindow* child_menu_window = (child_popup && child_popup->Window && child_popup->Window->ParentWindow == window) ? child_popup->Window : NULL;
|
||||||
|
if (g.HoveredWindow == window && child_menu_window != NULL)
|
||||||
{
|
{
|
||||||
float ref_unit = g.FontSize; // FIXME-DPI
|
float ref_unit = g.FontSize; // FIXME-DPI
|
||||||
|
float child_dir = (window->Pos.x < child_menu_window->Pos.x) ? 1.0f : -1.0f;
|
||||||
ImRect next_window_rect = child_menu_window->Rect();
|
ImRect next_window_rect = child_menu_window->Rect();
|
||||||
ImVec2 ta = (g.IO.MousePos - g.IO.MouseDelta);
|
ImVec2 ta = (g.IO.MousePos - g.IO.MouseDelta);
|
||||||
ImVec2 tb = (window->Pos.x < child_menu_window->Pos.x) ? next_window_rect.GetTL() : next_window_rect.GetTR();
|
ImVec2 tb = (child_dir > 0.0f) ? next_window_rect.GetTL() : next_window_rect.GetTR();
|
||||||
ImVec2 tc = (window->Pos.x < child_menu_window->Pos.x) ? next_window_rect.GetBL() : next_window_rect.GetBR();
|
ImVec2 tc = (child_dir > 0.0f) ? next_window_rect.GetBL() : next_window_rect.GetBR();
|
||||||
float extra = ImClamp(ImFabs(ta.x - tb.x) * 0.30f, ref_unit * 0.5f, ref_unit * 2.5f); // add a bit of extra slack.
|
float extra = ImClamp(ImFabs(ta.x - tb.x) * 0.30f, ref_unit * 0.5f, ref_unit * 2.5f); // add a bit of extra slack.
|
||||||
ta.x += (window->Pos.x < child_menu_window->Pos.x) ? -0.5f : +0.5f; // to avoid numerical issues (FIXME: ??)
|
ta.x += child_dir * -0.5f;
|
||||||
|
tb.x += child_dir * ref_unit;
|
||||||
|
tc.x += child_dir * ref_unit;
|
||||||
tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -ref_unit * 8.0f); // triangle has maximum height to limit the slope and the bias toward large sub-menus
|
tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -ref_unit * 8.0f); // triangle has maximum height to limit the slope and the bias toward large sub-menus
|
||||||
tc.y = ta.y + ImMin((tc.y + extra) - ta.y, +ref_unit * 8.0f);
|
tc.y = ta.y + ImMin((tc.y + extra) - ta.y, +ref_unit * 8.0f);
|
||||||
moving_toward_child_menu = ImTriangleContainsPoint(ta, tb, tc, g.IO.MousePos);
|
moving_toward_child_menu = ImTriangleContainsPoint(ta, tb, tc, g.IO.MousePos);
|
||||||
//GetForegroundDrawList()->AddTriangleFilled(ta, tb, tc, moving_toward_other_child_menu ? IM_COL32(0,128,0,128) : IM_COL32(128,0,0,128)); // [DEBUG]
|
//GetForegroundDrawList()->AddTriangleFilled(ta, tb, tc, moving_toward_child_menu ? IM_COL32(0,128,0,128) : IM_COL32(128,0,0,128)); // [DEBUG]
|
||||||
}
|
}
|
||||||
|
|
||||||
// The 'HovereWindow == window' check creates an inconsistency (e.g. moving away from menu slowly tends to hit same window, whereas moving away fast does not)
|
// The 'HovereWindow == window' check creates an inconsistency (e.g. moving away from menu slowly tends to hit same window, whereas moving away fast does not)
|
||||||
// But we also need to not close the top-menu menu when moving over void. Perhaps we should extend the triangle check to a larger polygon.
|
// But we also need to not close the top-menu menu when moving over void. Perhaps we should extend the triangle check to a larger polygon.
|
||||||
// (Remember to test this on BeginPopup("A")->BeginMenu("B") sequence which behaves slightly differently as B isn't a Child of A and hovering isn't shared.)
|
// (Remember to test this on BeginPopup("A")->BeginMenu("B") sequence which behaves slightly differently as B isn't a Child of A and hovering isn't shared.)
|
||||||
if (menu_is_open && !hovered && g.HoveredWindow == window && !moving_toward_child_menu)
|
if (menu_is_open && !hovered && g.HoveredWindow == window && !moving_toward_child_menu && !g.NavDisableMouseHover)
|
||||||
want_close = true;
|
want_close = true;
|
||||||
|
|
||||||
// Open
|
// Open
|
||||||
@ -7144,10 +7138,19 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled)
|
|||||||
|
|
||||||
if (menu_is_open)
|
if (menu_is_open)
|
||||||
{
|
{
|
||||||
SetNextWindowPos(popup_pos, ImGuiCond_Always); // Note: this is super misleading! The value will serve as reference for FindBestWindowPosForPopup(), not actual pos.
|
ImGuiLastItemData last_item_in_parent = g.LastItemData;
|
||||||
|
SetNextWindowPos(popup_pos, ImGuiCond_Always); // Note: misleading: the value will serve as reference for FindBestWindowPosForPopup(), not actual pos.
|
||||||
PushStyleVar(ImGuiStyleVar_ChildRounding, style.PopupRounding); // First level will use _PopupRounding, subsequent will use _ChildRounding
|
PushStyleVar(ImGuiStyleVar_ChildRounding, style.PopupRounding); // First level will use _PopupRounding, subsequent will use _ChildRounding
|
||||||
menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
|
menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
|
||||||
PopStyleVar();
|
PopStyleVar();
|
||||||
|
if (menu_is_open)
|
||||||
|
{
|
||||||
|
// Restore LastItemData so IsItemXXXX functions can work after BeginMenu()/EndMenu()
|
||||||
|
// (This fixes using IsItemClicked() and IsItemHovered(), but IsItemHovered() also relies on its support for ImGuiItemFlags_NoWindowHoverableCheck)
|
||||||
|
g.LastItemData = last_item_in_parent;
|
||||||
|
if (g.HoveredWindow == window)
|
||||||
|
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredWindow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -7164,15 +7167,16 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
|||||||
|
|
||||||
void ImGui::EndMenu()
|
void ImGui::EndMenu()
|
||||||
{
|
{
|
||||||
// Nav: When a left move request _within our child menu_ failed, close ourselves (the _parent_ menu).
|
// Nav: When a left move request our menu failed, close ourselves.
|
||||||
// A menu doesn't close itself because EndMenuBar() wants the catch the last Left<>Right inputs.
|
|
||||||
// However, it means that with the current code, a BeginMenu() from outside another menu or a menu-bar won't be closable with the Left direction.
|
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
if (g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet() && window->DC.LayoutType == ImGuiLayoutType_Vertical)
|
IM_ASSERT(window->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginMenu()/EndMenu() calls
|
||||||
if (g.NavWindow && (g.NavWindow->RootWindowForNav->Flags & ImGuiWindowFlags_Popup) && g.NavWindow->RootWindowForNav->ParentWindow == window)
|
ImGuiWindow* parent_window = window->ParentWindow; // Should always be != NULL is we passed assert.
|
||||||
|
if (window->BeginCount == window->BeginCountPreviousFrame)
|
||||||
|
if (g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet())
|
||||||
|
if (g.NavWindow && (g.NavWindow->RootWindowForNav == window) && parent_window->DC.LayoutType == ImGuiLayoutType_Vertical)
|
||||||
{
|
{
|
||||||
ClosePopupToLevel(g.BeginPopupStack.Size, true);
|
ClosePopupToLevel(g.BeginPopupStack.Size - 1, true);
|
||||||
NavMoveRequestCancel();
|
NavMoveRequestCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7190,10 +7194,10 @@ bool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut
|
|||||||
ImVec2 pos = window->DC.CursorPos;
|
ImVec2 pos = window->DC.CursorPos;
|
||||||
ImVec2 label_size = CalcTextSize(label, NULL, true);
|
ImVec2 label_size = CalcTextSize(label, NULL, true);
|
||||||
|
|
||||||
|
// See BeginMenuEx() for comments about this.
|
||||||
const bool menuset_is_open = IsRootOfOpenMenuSet();
|
const bool menuset_is_open = IsRootOfOpenMenuSet();
|
||||||
ImGuiWindow* backed_nav_window = g.NavWindow;
|
|
||||||
if (menuset_is_open)
|
if (menuset_is_open)
|
||||||
g.NavWindow = window;
|
PushItemFlag(ImGuiItemFlags_NoWindowHoverableCheck, true);
|
||||||
|
|
||||||
// We've been using the equivalent of ImGuiSelectableFlags_SetNavIdOnHover on all Selectable() since early Nav system days (commit 43ee5d73),
|
// We've been using the equivalent of ImGuiSelectableFlags_SetNavIdOnHover on all Selectable() since early Nav system days (commit 43ee5d73),
|
||||||
// but I am unsure whether this should be kept at all. For now moved it to be an opt-in feature used by menus only.
|
// but I am unsure whether this should be kept at all. For now moved it to be an opt-in feature used by menus only.
|
||||||
@ -7245,7 +7249,7 @@ bool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut
|
|||||||
EndDisabled();
|
EndDisabled();
|
||||||
PopID();
|
PopID();
|
||||||
if (menuset_is_open)
|
if (menuset_is_open)
|
||||||
g.NavWindow = backed_nav_window;
|
PopItemFlag();
|
||||||
|
|
||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
@ -7572,8 +7576,8 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
|||||||
// Additionally, when using TabBarAddTab() to manipulate tab bar order we occasionally insert new tabs that don't have a width yet,
|
// Additionally, when using TabBarAddTab() to manipulate tab bar order we occasionally insert new tabs that don't have a width yet,
|
||||||
// and we cannot wait for the next BeginTabItem() call. We cannot compute this width within TabBarAddTab() because font size depends on the active window.
|
// and we cannot wait for the next BeginTabItem() call. We cannot compute this width within TabBarAddTab() because font size depends on the active window.
|
||||||
const char* tab_name = tab_bar->GetTabName(tab);
|
const char* tab_name = tab_bar->GetTabName(tab);
|
||||||
const bool has_close_button = (tab->Flags & ImGuiTabItemFlags_NoCloseButton) ? false : true;
|
const bool has_close_button_or_unsaved_marker = (tab->Flags & ImGuiTabItemFlags_NoCloseButton) == 0 || (tab->Flags & ImGuiTabItemFlags_UnsavedDocument);
|
||||||
tab->ContentWidth = (tab->RequestedWidth > 0.0f) ? tab->RequestedWidth : TabItemCalcSize(tab_name, has_close_button).x;
|
tab->ContentWidth = (tab->RequestedWidth >= 0.0f) ? tab->RequestedWidth : TabItemCalcSize(tab_name, has_close_button_or_unsaved_marker).x;
|
||||||
|
|
||||||
int section_n = TabItemGetSectionIdx(tab);
|
int section_n = TabItemGetSectionIdx(tab);
|
||||||
ImGuiTabBarSection* section = §ions[section_n];
|
ImGuiTabBarSection* section = §ions[section_n];
|
||||||
@ -7585,9 +7589,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
|||||||
ImGuiShrinkWidthItem* shrink_width_item = &g.ShrinkWidthBuffer[shrink_buffer_indexes[section_n]++];
|
ImGuiShrinkWidthItem* shrink_width_item = &g.ShrinkWidthBuffer[shrink_buffer_indexes[section_n]++];
|
||||||
shrink_width_item->Index = tab_n;
|
shrink_width_item->Index = tab_n;
|
||||||
shrink_width_item->Width = shrink_width_item->InitialWidth = tab->ContentWidth;
|
shrink_width_item->Width = shrink_width_item->InitialWidth = tab->ContentWidth;
|
||||||
|
tab->Width = ImMax(tab->ContentWidth, 1.0f);
|
||||||
IM_ASSERT(tab->ContentWidth > 0.0f);
|
|
||||||
tab->Width = tab->ContentWidth;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute total ideal width (used for e.g. auto-resizing a window)
|
// Compute total ideal width (used for e.g. auto-resizing a window)
|
||||||
@ -7617,7 +7619,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
|||||||
width_excess = (section_0_w + section_2_w) - tab_bar->BarRect.GetWidth(); // Excess used to shrink leading/trailing section
|
width_excess = (section_0_w + section_2_w) - tab_bar->BarRect.GetWidth(); // Excess used to shrink leading/trailing section
|
||||||
|
|
||||||
// With ImGuiTabBarFlags_FittingPolicyScroll policy, we will only shrink leading/trailing if the central section is not visible anymore
|
// With ImGuiTabBarFlags_FittingPolicyScroll policy, we will only shrink leading/trailing if the central section is not visible anymore
|
||||||
if (width_excess > 0.0f && ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyResizeDown) || !central_section_is_visible))
|
if (width_excess >= 1.0f && ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyResizeDown) || !central_section_is_visible))
|
||||||
{
|
{
|
||||||
int shrink_data_count = (central_section_is_visible ? sections[1].TabCount : sections[0].TabCount + sections[2].TabCount);
|
int shrink_data_count = (central_section_is_visible ? sections[1].TabCount : sections[0].TabCount + sections[2].TabCount);
|
||||||
int shrink_data_offset = (central_section_is_visible ? sections[0].TabCount + sections[2].TabCount : 0);
|
int shrink_data_offset = (central_section_is_visible ? sections[0].TabCount + sections[2].TabCount : 0);
|
||||||
@ -7631,6 +7633,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
|||||||
if (shrinked_width < 0.0f)
|
if (shrinked_width < 0.0f)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
shrinked_width = ImMax(1.0f, shrinked_width);
|
||||||
int section_n = TabItemGetSectionIdx(tab);
|
int section_n = TabItemGetSectionIdx(tab);
|
||||||
sections[section_n].Width -= (tab->Width - shrinked_width);
|
sections[section_n].Width -= (tab->Width - shrinked_width);
|
||||||
tab->Width = shrinked_width;
|
tab->Width = shrinked_width;
|
||||||
@ -7674,7 +7677,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
|||||||
|
|
||||||
// CTRL+TAB can override visible tab temporarily
|
// CTRL+TAB can override visible tab temporarily
|
||||||
if (g.NavWindowingTarget != NULL && g.NavWindowingTarget->DockNode && g.NavWindowingTarget->DockNode->TabBar == tab_bar)
|
if (g.NavWindowingTarget != NULL && g.NavWindowingTarget->DockNode && g.NavWindowingTarget->DockNode->TabBar == tab_bar)
|
||||||
tab_bar->VisibleTabId = scroll_to_tab_id = g.NavWindowingTarget->ID;
|
tab_bar->VisibleTabId = scroll_to_tab_id = g.NavWindowingTarget->TabId;
|
||||||
|
|
||||||
// Update scrolling
|
// Update scrolling
|
||||||
if (scroll_to_tab_id != 0)
|
if (scroll_to_tab_id != 0)
|
||||||
@ -7785,7 +7788,9 @@ void ImGui::TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id)
|
|||||||
// Called on manual closure attempt
|
// Called on manual closure attempt
|
||||||
void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
|
void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
|
||||||
{
|
{
|
||||||
IM_ASSERT(!(tab->Flags & ImGuiTabItemFlags_Button));
|
if (tab->Flags & ImGuiTabItemFlags_Button)
|
||||||
|
return; // A button appended with TabItemButton().
|
||||||
|
|
||||||
if (!(tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
|
if (!(tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
|
||||||
{
|
{
|
||||||
// This will remove a frame of lag for selecting another tab on closure.
|
// This will remove a frame of lag for selecting another tab on closure.
|
||||||
@ -8140,18 +8145,19 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
|||||||
tab_bar->LastTabItemIdx = (ImS16)tab_bar->Tabs.index_from_ptr(tab);
|
tab_bar->LastTabItemIdx = (ImS16)tab_bar->Tabs.index_from_ptr(tab);
|
||||||
|
|
||||||
// Calculate tab contents size
|
// Calculate tab contents size
|
||||||
ImVec2 size = TabItemCalcSize(label, p_open != NULL);
|
ImVec2 size = TabItemCalcSize(label, (p_open != NULL) || (flags & ImGuiTabItemFlags_UnsavedDocument));
|
||||||
tab->RequestedWidth = -1.0f;
|
tab->RequestedWidth = -1.0f;
|
||||||
if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasWidth)
|
if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasWidth)
|
||||||
size.x = tab->RequestedWidth = g.NextItemData.Width;
|
size.x = tab->RequestedWidth = g.NextItemData.Width;
|
||||||
if (tab_is_new)
|
if (tab_is_new)
|
||||||
tab->Width = size.x;
|
tab->Width = ImMax(1.0f, size.x);
|
||||||
tab->ContentWidth = size.x;
|
tab->ContentWidth = size.x;
|
||||||
tab->BeginOrder = tab_bar->TabsActiveCount++;
|
tab->BeginOrder = tab_bar->TabsActiveCount++;
|
||||||
|
|
||||||
const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount);
|
const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount);
|
||||||
const bool tab_bar_focused = (tab_bar->Flags & ImGuiTabBarFlags_IsFocused) != 0;
|
const bool tab_bar_focused = (tab_bar->Flags & ImGuiTabBarFlags_IsFocused) != 0;
|
||||||
const bool tab_appearing = (tab->LastFrameVisible + 1 < g.FrameCount);
|
const bool tab_appearing = (tab->LastFrameVisible + 1 < g.FrameCount);
|
||||||
|
const bool tab_just_unsaved = (flags & ImGuiTabItemFlags_UnsavedDocument) && !(tab->Flags & ImGuiTabItemFlags_UnsavedDocument);
|
||||||
const bool is_tab_button = (flags & ImGuiTabItemFlags_Button) != 0;
|
const bool is_tab_button = (flags & ImGuiTabItemFlags_Button) != 0;
|
||||||
tab->LastFrameVisible = g.FrameCount;
|
tab->LastFrameVisible = g.FrameCount;
|
||||||
tab->Flags = flags;
|
tab->Flags = flags;
|
||||||
@ -8312,7 +8318,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
|||||||
SetActiveID(g.MovingWindow->MoveId, g.MovingWindow);
|
SetActiveID(g.MovingWindow->MoveId, g.MovingWindow);
|
||||||
g.ActiveIdClickOffset -= g.MovingWindow->Pos - bb.Min;
|
g.ActiveIdClickOffset -= g.MovingWindow->Pos - bb.Min;
|
||||||
g.ActiveIdNoClearOnFocusLoss = true;
|
g.ActiveIdNoClearOnFocusLoss = true;
|
||||||
SetActiveIdUsingNavAndKeys();
|
SetActiveIdUsingAllKeyboardKeys();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8346,7 +8352,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
|||||||
const ImGuiID close_button_id = p_open ? GetIDWithSeed("#CLOSE", NULL, docked_window ? docked_window->ID : id) : 0;
|
const ImGuiID close_button_id = p_open ? GetIDWithSeed("#CLOSE", NULL, docked_window ? docked_window->ID : id) : 0;
|
||||||
bool just_closed;
|
bool just_closed;
|
||||||
bool text_clipped;
|
bool text_clipped;
|
||||||
TabItemLabelAndCloseButton(display_draw_list, bb, flags, tab_bar->FramePadding, label, id, close_button_id, tab_contents_visible, &just_closed, &text_clipped);
|
TabItemLabelAndCloseButton(display_draw_list, bb, tab_just_unsaved ? (flags & ~ImGuiTabItemFlags_UnsavedDocument) : flags, tab_bar->FramePadding, label, id, close_button_id, tab_contents_visible, &just_closed, &text_clipped);
|
||||||
if (just_closed && p_open != NULL)
|
if (just_closed && p_open != NULL)
|
||||||
{
|
{
|
||||||
*p_open = false;
|
*p_open = false;
|
||||||
@ -8368,8 +8374,9 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
|||||||
// (We test IsItemHovered() to discard e.g. when another item is active or drag and drop over the tab bar, which g.HoveredId ignores)
|
// (We test IsItemHovered() to discard e.g. when another item is active or drag and drop over the tab bar, which g.HoveredId ignores)
|
||||||
// FIXME: This is a mess.
|
// FIXME: This is a mess.
|
||||||
// FIXME: We may want disabled tab to still display the tooltip?
|
// FIXME: We may want disabled tab to still display the tooltip?
|
||||||
if (text_clipped && g.HoveredId == id && !held && g.HoveredIdNotActiveTimer > g.TooltipSlowDelay && IsItemHovered())
|
if (text_clipped && g.HoveredId == id && !held)
|
||||||
if (!(tab_bar->Flags & ImGuiTabBarFlags_NoTooltip) && !(tab->Flags & ImGuiTabItemFlags_NoTooltip))
|
if (!(tab_bar->Flags & ImGuiTabBarFlags_NoTooltip) && !(tab->Flags & ImGuiTabItemFlags_NoTooltip))
|
||||||
|
if (IsItemHovered(ImGuiHoveredFlags_DelayNormal))
|
||||||
SetTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label);
|
SetTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label);
|
||||||
|
|
||||||
IM_ASSERT(!is_tab_button || !(tab_bar->SelectedTabId == tab->ID && is_tab_button)); // TabItemButton should not be selected
|
IM_ASSERT(!is_tab_button || !(tab_bar->SelectedTabId == tab->ID && is_tab_button)); // TabItemButton should not be selected
|
||||||
@ -8404,18 +8411,23 @@ void ImGui::SetTabItemClosed(const char* label)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImVec2 ImGui::TabItemCalcSize(const char* label, bool has_close_button)
|
ImVec2 ImGui::TabItemCalcSize(const char* label, bool has_close_button_or_unsaved_marker)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImVec2 label_size = CalcTextSize(label, NULL, true);
|
ImVec2 label_size = CalcTextSize(label, NULL, true);
|
||||||
ImVec2 size = ImVec2(label_size.x + g.Style.FramePadding.x, label_size.y + g.Style.FramePadding.y * 2.0f);
|
ImVec2 size = ImVec2(label_size.x + g.Style.FramePadding.x, label_size.y + g.Style.FramePadding.y * 2.0f);
|
||||||
if (has_close_button)
|
if (has_close_button_or_unsaved_marker)
|
||||||
size.x += g.Style.FramePadding.x + (g.Style.ItemInnerSpacing.x + g.FontSize); // We use Y intentionally to fit the close button circle.
|
size.x += g.Style.FramePadding.x + (g.Style.ItemInnerSpacing.x + g.FontSize); // We use Y intentionally to fit the close button circle.
|
||||||
else
|
else
|
||||||
size.x += g.Style.FramePadding.x + 1.0f;
|
size.x += g.Style.FramePadding.x + 1.0f;
|
||||||
return ImVec2(ImMin(size.x, TabBarCalcMaxTabWidth()), size.y);
|
return ImVec2(ImMin(size.x, TabBarCalcMaxTabWidth()), size.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImVec2 ImGui::TabItemCalcSize(ImGuiWindow* window)
|
||||||
|
{
|
||||||
|
return TabItemCalcSize(window->Name, window->HasCloseButton || (window->Flags & ImGuiWindowFlags_UnsavedDocument));
|
||||||
|
}
|
||||||
|
|
||||||
void ImGui::TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col)
|
void ImGui::TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col)
|
||||||
{
|
{
|
||||||
// While rendering tabs, we trim 1 pixel off the top of our bounding box so they can fit within a regular frame height while looking "detached" from it.
|
// While rendering tabs, we trim 1 pixel off the top of our bounding box so they can fit within a regular frame height while looking "detached" from it.
|
||||||
|
@ -508,7 +508,7 @@ bool ImFontAtlasBuildWithFreeTypeEx(FT_Library ft_library, ImFontAtlas* atlas, u
|
|||||||
// Allocate temporary rasterization data buffers.
|
// Allocate temporary rasterization data buffers.
|
||||||
// We could not find a way to retrieve accurate glyph size without rendering them.
|
// We could not find a way to retrieve accurate glyph size without rendering them.
|
||||||
// (e.g. slot->metrics->width not always matching bitmap->width, especially considering the Oblique transform)
|
// (e.g. slot->metrics->width not always matching bitmap->width, especially considering the Oblique transform)
|
||||||
// We allocate in chunks of 256 KB to not waste too much extra memory ahead. Hopefully users of FreeType won't find the temporary allocations.
|
// We allocate in chunks of 256 KB to not waste too much extra memory ahead. Hopefully users of FreeType won't mind the temporary allocations.
|
||||||
const int BITMAP_BUFFERS_CHUNK_SIZE = 256 * 1024;
|
const int BITMAP_BUFFERS_CHUNK_SIZE = 256 * 1024;
|
||||||
int buf_bitmap_current_used_bytes = 0;
|
int buf_bitmap_current_used_bytes = 0;
|
||||||
ImVector<unsigned char*> buf_bitmap_buffers;
|
ImVector<unsigned char*> buf_bitmap_buffers;
|
||||||
@ -556,6 +556,7 @@ bool ImFontAtlasBuildWithFreeTypeEx(FT_Library ft_library, ImFontAtlas* atlas, u
|
|||||||
buf_bitmap_current_used_bytes = 0;
|
buf_bitmap_current_used_bytes = 0;
|
||||||
buf_bitmap_buffers.push_back((unsigned char*)IM_ALLOC(BITMAP_BUFFERS_CHUNK_SIZE));
|
buf_bitmap_buffers.push_back((unsigned char*)IM_ALLOC(BITMAP_BUFFERS_CHUNK_SIZE));
|
||||||
}
|
}
|
||||||
|
IM_ASSERT(buf_bitmap_current_used_bytes + bitmap_size_in_bytes <= BITMAP_BUFFERS_CHUNK_SIZE); // We could probably allocate custom-sized buffer instead.
|
||||||
|
|
||||||
// Blit rasterized pixels to our temporary buffer and keep a pointer to it.
|
// Blit rasterized pixels to our temporary buffer and keep a pointer to it.
|
||||||
src_glyph.BitmapData = (unsigned int*)(buf_bitmap_buffers.back() + buf_bitmap_current_used_bytes);
|
src_glyph.BitmapData = (unsigned int*)(buf_bitmap_buffers.back() + buf_bitmap_current_used_bytes);
|
||||||
|
@ -171,7 +171,7 @@ private:
|
|||||||
Out
|
Out
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr static auto DirectionToKeyMap = std::array<int, 4> { ImGuiKey_A, ImGuiKey_D, ImGuiKey_W, ImGuiKey_S };
|
constexpr static auto DirectionToKeyMap = std::array<ImGuiKey, 4> { ImGuiKey_A, ImGuiKey_D, ImGuiKey_W, ImGuiKey_S };
|
||||||
constexpr static auto StartRangeMod = std::array<int, 4> { -1, 1, 1, -1 };
|
constexpr static auto StartRangeMod = std::array<int, 4> { -1, 1, 1, -1 };
|
||||||
constexpr static auto EndRangeMod = std::array<int, 4> { -1, 1, -1, 1 };
|
constexpr static auto EndRangeMod = std::array<int, 4> { -1, 1, -1, 1 };
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ void View::DrawOptions()
|
|||||||
}
|
}
|
||||||
if( !gpuData[i]->hasCalibration )
|
if( !gpuData[i]->hasCalibration )
|
||||||
{
|
{
|
||||||
ImGui::TreePush();
|
ImGui::TreePush( (void*)nullptr );
|
||||||
auto& drift = GpuDrift( gpuData[i] );
|
auto& drift = GpuDrift( gpuData[i] );
|
||||||
ImGui::SetNextItemWidth( 120 * scale );
|
ImGui::SetNextItemWidth( 120 * scale );
|
||||||
ImGui::PushID( i );
|
ImGui::PushID( i );
|
||||||
|
Loading…
Reference in New Issue
Block a user