Revision a8009d0e
Added by david.sorber 8 months ago
| external/imgui/imgui_internal.h | ||
|---|---|---|
|
// dear imgui, v1.91.5
|
||
|
// dear imgui, v1.92.5
|
||
|
// (internal structures/api)
|
||
|
|
||
|
// You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility.
|
||
| ... | ... | |
|
// [SECTION] Macros
|
||
|
// [SECTION] Generic helpers
|
||
|
// [SECTION] ImDrawList support
|
||
|
// [SECTION] Style support
|
||
|
// [SECTION] Data types support
|
||
|
// [SECTION] Widgets support: flags, enums, data structures
|
||
|
// [SECTION] Popup support
|
||
| ... | ... | |
|
// [SECTION] Tab bar, Tab item support
|
||
|
// [SECTION] Table support
|
||
|
// [SECTION] ImGui internal API
|
||
|
// [SECTION] ImFontLoader
|
||
|
// [SECTION] ImFontAtlas internal API
|
||
|
// [SECTION] Test Engine specific hooks (imgui_test_engine)
|
||
|
|
||
| ... | ... | |
|
#if (defined __SSE__ || defined __x86_64__ || defined _M_X64 || (defined(_M_IX86_FP) && (_M_IX86_FP >= 1))) && !defined(IMGUI_DISABLE_SSE)
|
||
|
#define IMGUI_ENABLE_SSE
|
||
|
#include <immintrin.h>
|
||
|
#if (defined __AVX__ || defined __SSE4_2__)
|
||
|
#define IMGUI_ENABLE_SSE4_2
|
||
|
#include <nmmintrin.h>
|
||
|
#endif
|
||
|
#endif
|
||
|
// Emscripten has partial SSE 4.2 support where _mm_crc32_u32 is not available. See https://emscripten.org/docs/porting/simd.html#id11 and #8213
|
||
|
#if defined(IMGUI_ENABLE_SSE4_2) && !defined(IMGUI_USE_LEGACY_CRC32_ADLER) && !defined(__EMSCRIPTEN__)
|
||
|
#define IMGUI_ENABLE_SSE4_2_CRC
|
||
|
#endif
|
||
|
|
||
|
// Visual Studio warnings
|
||
|
#ifdef _MSC_VER
|
||
|
#pragma warning (push)
|
||
|
#pragma warning (disable: 4251) // class 'xxx' needs to have dll-interface to be used by clients of struct 'xxx' // when IMGUI_API is set to__declspec(dllexport)
|
||
|
#pragma warning (disable: 26812) // The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3). [MSVC Static Analyzer)
|
||
|
#pragma warning (disable: 26495) // [Static Analyzer] Variable 'XXX' is uninitialized. Always initialize a member variable (type.6).
|
||
|
#pragma warning (disable: 26812) // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).
|
||
|
#if defined(_MSC_VER) && _MSC_VER >= 1922 // MSVC 2019 16.2 or later
|
||
|
#pragma warning (disable: 5054) // operator '|': deprecated between enumerations of different types
|
||
|
#endif
|
||
| ... | ... | |
|
#elif defined(__GNUC__)
|
||
|
#pragma GCC diagnostic push
|
||
|
#pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
|
||
|
#pragma GCC diagnostic ignored "-Wfloat-equal" // warning: comparing floating-point with '==' or '!=' is unsafe
|
||
|
#pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead
|
||
|
#pragma GCC diagnostic ignored "-Wdeprecated-enum-enum-conversion" // warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_') is deprecated
|
||
|
#endif
|
||
| ... | ... | |
|
// [SECTION] Forward declarations
|
||
|
//-----------------------------------------------------------------------------
|
||
|
|
||
|
// Utilities
|
||
|
// (other types which are not forwarded declared are: ImBitArray<>, ImSpan<>, ImSpanAllocator<>, ImStableVector<>, ImPool<>, ImChunkStream<>)
|
||
|
struct ImBitVector; // Store 1-bit per value
|
||
|
struct ImRect; // An axis-aligned rectangle (2 points)
|
||
|
struct ImGuiTextIndex; // Maintain a line index for a text buffer.
|
||
|
|
||
|
// ImDrawList/ImFontAtlas
|
||
|
struct ImDrawDataBuilder; // Helper to build a ImDrawData instance
|
||
|
struct ImDrawListSharedData; // Data shared between all ImDrawList instances
|
||
|
struct ImFontAtlasBuilder; // Internal storage for incrementally packing and building a ImFontAtlas
|
||
|
struct ImFontAtlasPostProcessData; // Data available to potential texture post-processing functions
|
||
|
struct ImFontAtlasRectEntry; // Packed rectangle lookup entry
|
||
|
|
||
|
// ImGui
|
||
|
struct ImGuiBoxSelectState; // Box-selection state (currently used by multi-selection, could potentially be used by others)
|
||
|
struct ImGuiColorMod; // Stacked color modifier, backup of modified data so we can restore it
|
||
|
struct ImGuiContext; // Main Dear ImGui context
|
||
|
struct ImGuiContextHook; // Hook for extensions like ImGuiTestEngine
|
||
|
struct ImGuiDataVarInfo; // Variable information (e.g. to access style variables from an enum)
|
||
|
struct ImGuiDataTypeInfo; // Type information associated to a ImGuiDataType enum
|
||
|
struct ImGuiDeactivatedItemData; // Data for IsItemDeactivated()/IsItemDeactivatedAfterEdit() function.
|
||
|
struct ImGuiErrorRecoveryState; // Storage of stack sizes for error handling and recovery
|
||
|
struct ImGuiGroupData; // Stacked storage data for BeginGroup()/EndGroup()
|
||
|
struct ImGuiInputTextState; // Internal state of the currently focused/edited text input box
|
||
| ... | ... | |
|
struct ImGuiPopupData; // Storage for current popup stack
|
||
|
struct ImGuiSettingsHandler; // Storage for one type registered in the .ini file
|
||
|
struct ImGuiStyleMod; // Stacked style modifier, backup of modified data so we can restore it
|
||
|
struct ImGuiStyleVarInfo; // Style variable information (e.g. to access style variables from an enum)
|
||
|
struct ImGuiTabBar; // Storage for a tab bar
|
||
|
struct ImGuiTabItem; // Storage for a tab item (within a tab bar)
|
||
|
struct ImGuiTable; // Storage for a table
|
||
| ... | ... | |
|
typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
|
||
|
|
||
|
// Flags
|
||
|
typedef int ImDrawTextFlags; // -> enum ImDrawTextFlags_ // Flags: for ImTextCalcWordWrapPositionEx()
|
||
|
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 ImGuiFocusRequestFlags; // -> enum ImGuiFocusRequestFlags_ // Flags: for FocusWindow()
|
||
| ... | ... | |
|
typedef int ImGuiTextFlags; // -> enum ImGuiTextFlags_ // Flags: for TextEx()
|
||
|
typedef int ImGuiTooltipFlags; // -> enum ImGuiTooltipFlags_ // Flags: for BeginTooltipEx()
|
||
|
typedef int ImGuiTypingSelectFlags; // -> enum ImGuiTypingSelectFlags_ // Flags: for GetTypingSelectRequest()
|
||
|
typedef int ImGuiWindowBgClickFlags; // -> enum ImGuiWindowBgClickFlags_ // Flags: for overriding behavior of clicking on window background/void.
|
||
|
typedef int ImGuiWindowRefreshFlags; // -> enum ImGuiWindowRefreshFlags_ // Flags: for SetNextWindowRefreshPolicy()
|
||
|
|
||
|
// Table column indexing
|
||
|
typedef ImS16 ImGuiTableColumnIdx;
|
||
|
typedef ImU16 ImGuiTableDrawChannelIdx;
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
// [SECTION] Context pointer
|
||
|
// See implementation of this variable in imgui.cpp for comments and details.
|
||
| ... | ... | |
|
#endif
|
||
|
|
||
|
// Debug Logging for ShowDebugLogWindow(). This is designed for relatively rare events so please don't spam.
|
||
|
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||
|
#define IMGUI_DEBUG_LOG(...) ImGui::DebugLog(__VA_ARGS__)
|
||
|
#else
|
||
|
#define IMGUI_DEBUG_LOG(...) ((void)0)
|
||
|
#endif
|
||
|
#define IMGUI_DEBUG_LOG_ERROR(...) do { ImGuiContext& g2 = *GImGui; if (g2.DebugLogFlags & ImGuiDebugLogFlags_EventError) IMGUI_DEBUG_LOG(__VA_ARGS__); else g2.DebugLogSkippedErrors++; } while (0)
|
||
|
#define IMGUI_DEBUG_LOG_ERROR(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventError) IMGUI_DEBUG_LOG(__VA_ARGS__); else g.DebugLogSkippedErrors++; } 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_POPUP(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventPopup) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
||
| ... | ... | |
|
#define IMGUI_DEBUG_LOG_SELECTION(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventSelection) 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_FONT(...) do { ImGuiContext* g2 = GImGui; if (g2 && g2->DebugLogFlags & ImGuiDebugLogFlags_EventFont) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) // Called from ImFontAtlas function which may operate without a context.
|
||
|
#define IMGUI_DEBUG_LOG_INPUTROUTING(...) do{if (g.DebugLogFlags & ImGuiDebugLogFlags_EventInputRouting)IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
||
|
|
||
|
// Static Asserts
|
||
| ... | ... | |
|
#define IM_F32_TO_INT8_SAT(_VAL) ((int)(ImSaturate(_VAL) * 255.0f + 0.5f)) // Saturated, always output 0..255
|
||
|
#define IM_TRUNC(_VAL) ((float)(int)(_VAL)) // ImTrunc() is not inlined in MSVC debug builds
|
||
|
#define IM_ROUND(_VAL) ((float)(int)((_VAL) + 0.5f)) //
|
||
|
#define IM_STRINGIFY_HELPER(_X) #_X
|
||
|
#define IM_STRINGIFY(_X) IM_STRINGIFY_HELPER(_X) // Preprocessor idiom to stringify e.g. an integer.
|
||
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||
|
#define IM_FLOOR IM_TRUNC
|
||
|
#define IM_FLOOR IM_TRUNC // [OBSOLETE] Renamed in 1.90.0 (Sept 2023)
|
||
|
#endif
|
||
|
|
||
|
// Hint for branch prediction
|
||
| ... | ... | |
|
#define IM_PRIu64 "llu"
|
||
|
#define IM_PRIX64 "llX"
|
||
|
#endif
|
||
|
#define IM_TEXTUREID_TO_U64(_TEXID) ((ImU64)(intptr_t)(_TEXID))
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
// [SECTION] Generic helpers
|
||
| ... | ... | |
|
// - Helper: ImBitArray
|
||
|
// - Helper: ImBitVector
|
||
|
// - Helper: ImSpan<>, ImSpanAllocator<>
|
||
|
// - Helper: ImStableVector<>
|
||
|
// - Helper: ImPool<>
|
||
|
// - Helper: ImChunkStream<>
|
||
|
// - Helper: ImGuiTextIndex
|
||
| ... | ... | |
|
// Helpers: Hashing
|
||
|
IMGUI_API ImGuiID ImHashData(const void* data, size_t data_size, ImGuiID seed = 0);
|
||
|
IMGUI_API ImGuiID ImHashStr(const char* data, size_t data_size = 0, ImGuiID seed = 0);
|
||
|
IMGUI_API const char* ImHashSkipUncontributingPrefix(const char* label);
|
||
|
|
||
|
// Helpers: Sorting
|
||
|
#ifndef ImQsort
|
||
|
static inline void ImQsort(void* base, size_t count, size_t size_of_element, int(IMGUI_CDECL *compare_func)(void const*, void const*)) { if (count > 1) qsort(base, count, size_of_element, compare_func); }
|
||
|
inline void ImQsort(void* base, size_t count, size_t size_of_element, int(IMGUI_CDECL *compare_func)(void const*, void const*)) { if (count > 1) qsort(base, count, size_of_element, compare_func); }
|
||
|
#endif
|
||
|
|
||
|
// Helpers: Color Blending
|
||
|
IMGUI_API ImU32 ImAlphaBlendColors(ImU32 col_a, ImU32 col_b);
|
||
|
|
||
|
// Helpers: Bit manipulation
|
||
|
static inline bool ImIsPowerOfTwo(int v) { return v != 0 && (v & (v - 1)) == 0; }
|
||
|
static inline bool ImIsPowerOfTwo(ImU64 v) { return v != 0 && (v & (v - 1)) == 0; }
|
||
|
static inline int ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }
|
||
|
inline bool ImIsPowerOfTwo(int v) { return v != 0 && (v & (v - 1)) == 0; }
|
||
|
inline bool ImIsPowerOfTwo(ImU64 v) { return v != 0 && (v & (v - 1)) == 0; }
|
||
|
inline int ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }
|
||
|
inline unsigned int ImCountSetBits(unsigned int v) { unsigned int count = 0; while (v > 0) { v = v & (v - 1); count++; } return count; }
|
||
|
|
||
|
// Helpers: String
|
||
|
#define ImStrlen strlen
|
||
|
#define ImMemchr memchr
|
||
|
IMGUI_API int ImStricmp(const char* str1, const char* str2); // Case insensitive compare.
|
||
|
IMGUI_API int ImStrnicmp(const char* str1, const char* str2, size_t count); // Case insensitive compare to a certain count.
|
||
|
IMGUI_API void ImStrncpy(char* dst, const char* src, size_t count); // Copy to a certain count and always zero terminate (strncpy doesn't).
|
||
|
IMGUI_API char* ImStrdup(const char* str); // Duplicate a string.
|
||
|
IMGUI_API void* ImMemdup(const void* src, size_t size); // Duplicate a chunk of memory.
|
||
|
IMGUI_API char* ImStrdupcpy(char* dst, size_t* p_dst_size, const char* str); // Copy in provided buffer, recreate buffer if needed.
|
||
|
IMGUI_API const char* ImStrchrRange(const char* str_begin, const char* str_end, char c); // Find first occurrence of 'c' in string range.
|
||
|
IMGUI_API const char* ImStreolRange(const char* str, const char* str_end); // End end-of-line
|
||
| ... | ... | |
|
IMGUI_API int ImStrlenW(const ImWchar* str); // Computer string length (ImWchar string)
|
||
|
IMGUI_API const char* ImStrbol(const char* buf_mid_line, const char* buf_begin); // Find beginning-of-line
|
||
|
IM_MSVC_RUNTIME_CHECKS_OFF
|
||
|
static inline char ImToUpper(char c) { return (c >= 'a' && c <= 'z') ? c &= ~32 : c; }
|
||
|
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 ImCharIsXdigitA(char c) { return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'); }
|
||
|
inline char ImToUpper(char c) { return (c >= 'a' && c <= 'z') ? c &= ~32 : c; }
|
||
|
inline bool ImCharIsBlankA(char c) { return c == ' ' || c == '\t'; }
|
||
|
inline bool ImCharIsBlankW(unsigned int c) { return c == ' ' || c == '\t' || c == 0x3000; }
|
||
|
inline bool ImCharIsXdigitA(char c) { return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'); }
|
||
|
IM_MSVC_RUNTIME_CHECKS_RESTORE
|
||
|
|
||
|
// Helpers: Formatting
|
||
| ... | ... | |
|
IMGUI_API int ImParseFormatPrecision(const char* format, int default_value);
|
||
|
|
||
|
// Helpers: UTF-8 <> wchar conversions
|
||
|
IMGUI_API const char* ImTextCharToUtf8(char out_buf[5], unsigned int c); // return out_buf
|
||
|
IMGUI_API int ImTextCharToUtf8(char out_buf[5], unsigned int c); // return output UTF-8 bytes count
|
||
|
IMGUI_API int ImTextStrToUtf8(char* out_buf, int out_buf_size, const ImWchar* in_text, const ImWchar* in_text_end); // return output UTF-8 bytes count
|
||
|
IMGUI_API int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end); // read one character. return input UTF-8 bytes count
|
||
|
IMGUI_API int ImTextStrFromUtf8(ImWchar* out_buf, int out_buf_size, const char* in_text, const char* in_text_end, const char** in_remaining = NULL); // return input UTF-8 bytes count
|
||
|
IMGUI_API int ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end); // return number of UTF-8 code-points (NOT bytes count)
|
||
|
IMGUI_API int ImTextCountUtf8BytesFromChar(const char* in_text, const char* in_text_end); // return number of bytes to express one char in UTF-8
|
||
|
IMGUI_API int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end); // return number of bytes to express string in UTF-8
|
||
|
IMGUI_API const char* ImTextFindPreviousUtf8Codepoint(const char* in_text_start, const char* in_text_curr); // return previous UTF-8 code-point.
|
||
|
IMGUI_API const char* ImTextFindPreviousUtf8Codepoint(const char* in_text_start, const char* in_p); // return previous UTF-8 code-point.
|
||
|
IMGUI_API const char* ImTextFindValidUtf8CodepointEnd(const char* in_text_start, const char* in_text_end, const char* in_p); // return previous UTF-8 code-point if 'in_p' is not the end of a valid one.
|
||
|
IMGUI_API int ImTextCountLines(const char* in_text, const char* in_text_end); // return number of lines taken by text. trailing carriage return doesn't count as an extra line.
|
||
|
|
||
|
// Helpers: High-level text functions (DO NOT USE!!! THIS IS A MINIMAL SUBSET OF LARGER UPCOMING CHANGES)
|
||
|
enum ImDrawTextFlags_
|
||
|
{
|
||
|
ImDrawTextFlags_None = 0,
|
||
|
ImDrawTextFlags_CpuFineClip = 1 << 0, // Must be == 1/true for legacy with 'bool cpu_fine_clip' arg to RenderText()
|
||
|
ImDrawTextFlags_WrapKeepBlanks = 1 << 1,
|
||
|
ImDrawTextFlags_StopOnNewLine = 1 << 2,
|
||
|
};
|
||
|
IMGUI_API ImVec2 ImFontCalcTextSizeEx(ImFont* font, float size, float max_width, float wrap_width, const char* text_begin, const char* text_end_display, const char* text_end, const char** out_remaining, ImVec2* out_offset, ImDrawTextFlags flags);
|
||
|
IMGUI_API const char* ImFontCalcWordWrapPositionEx(ImFont* font, float size, const char* text, const char* text_end, float wrap_width, ImDrawTextFlags flags = 0);
|
||
|
IMGUI_API const char* ImTextCalcWordWrapNextLineStart(const char* text, const char* text_end, ImDrawTextFlags flags = 0); // trim trailing space and find beginning of next line
|
||
|
|
||
|
// Helpers: File System
|
||
|
#ifdef IMGUI_DISABLE_FILE_FUNCTIONS
|
||
|
#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS
|
||
|
typedef void* ImFileHandle;
|
||
|
static inline ImFileHandle ImFileOpen(const char*, const char*) { return NULL; }
|
||
|
static inline bool ImFileClose(ImFileHandle) { return false; }
|
||
|
static inline ImU64 ImFileGetSize(ImFileHandle) { return (ImU64)-1; }
|
||
|
static inline ImU64 ImFileRead(void*, ImU64, ImU64, ImFileHandle) { return 0; }
|
||
|
static inline ImU64 ImFileWrite(const void*, ImU64, ImU64, ImFileHandle) { return 0; }
|
||
|
inline ImFileHandle ImFileOpen(const char*, const char*) { return NULL; }
|
||
|
inline bool ImFileClose(ImFileHandle) { return false; }
|
||
|
inline ImU64 ImFileGetSize(ImFileHandle) { return (ImU64)-1; }
|
||
|
inline ImU64 ImFileRead(void*, ImU64, ImU64, ImFileHandle) { return 0; }
|
||
|
inline ImU64 ImFileWrite(const void*, ImU64, ImU64, ImFileHandle) { return 0; }
|
||
|
#endif
|
||
|
#ifndef IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS
|
||
|
typedef FILE* ImFileHandle;
|
||
| ... | ... | |
|
#define ImAtan2(Y, X) atan2f((Y), (X))
|
||
|
#define ImAtof(STR) atof(STR)
|
||
|
#define ImCeil(X) ceilf(X)
|
||
|
static inline float ImPow(float x, float y) { return powf(x, y); } // DragBehaviorT/SliderBehaviorT uses ImPow with either float/double and need the precision
|
||
|
static inline double ImPow(double x, double y) { return pow(x, y); }
|
||
|
static inline float ImLog(float x) { return logf(x); } // DragBehaviorT/SliderBehaviorT uses ImLog with either float/double and need the precision
|
||
|
static inline double ImLog(double x) { return log(x); }
|
||
|
static inline int ImAbs(int x) { return x < 0 ? -x : x; }
|
||
|
static inline float ImAbs(float x) { return fabsf(x); }
|
||
|
static inline double ImAbs(double x) { return fabs(x); }
|
||
|
static inline float ImSign(float x) { return (x < 0.0f) ? -1.0f : (x > 0.0f) ? 1.0f : 0.0f; } // Sign operator - returns -1, 0 or 1 based on sign of argument
|
||
|
static inline double ImSign(double x) { return (x < 0.0) ? -1.0 : (x > 0.0) ? 1.0 : 0.0; }
|
||
|
inline float ImPow(float x, float y) { return powf(x, y); } // DragBehaviorT/SliderBehaviorT uses ImPow with either float/double and need the precision
|
||
|
inline double ImPow(double x, double y) { return pow(x, y); }
|
||
|
inline float ImLog(float x) { return logf(x); } // DragBehaviorT/SliderBehaviorT uses ImLog with either float/double and need the precision
|
||
|
inline double ImLog(double x) { return log(x); }
|
||
|
inline int ImAbs(int x) { return x < 0 ? -x : x; }
|
||
|
inline float ImAbs(float x) { return fabsf(x); }
|
||
|
inline double ImAbs(double x) { return fabs(x); }
|
||
|
inline float ImSign(float x) { return (x < 0.0f) ? -1.0f : (x > 0.0f) ? 1.0f : 0.0f; } // Sign operator - returns -1, 0 or 1 based on sign of argument
|
||
|
inline double ImSign(double x) { return (x < 0.0) ? -1.0 : (x > 0.0) ? 1.0 : 0.0; }
|
||
|
#ifdef IMGUI_ENABLE_SSE
|
||
|
static inline float ImRsqrt(float x) { return _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ss(x))); }
|
||
|
inline float ImRsqrt(float x) { return _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ss(x))); }
|
||
|
#else
|
||
|
static inline float ImRsqrt(float x) { return 1.0f / sqrtf(x); }
|
||
|
inline float ImRsqrt(float x) { return 1.0f / sqrtf(x); }
|
||
|
#endif
|
||
|
static inline double ImRsqrt(double x) { return 1.0 / sqrt(x); }
|
||
|
inline double ImRsqrt(double x) { return 1.0 / sqrt(x); }
|
||
|
#endif
|
||
|
// - ImMin/ImMax/ImClamp/ImLerp/ImSwap are used by widgets which support variety of types: signed/unsigned int/long long float/double
|
||
|
// (Exceptionally using templates here but we could also redefine them for those types)
|
||
|
template<typename T> static inline T ImMin(T lhs, T rhs) { return lhs < rhs ? lhs : rhs; }
|
||
|
template<typename T> static inline T ImMax(T lhs, T rhs) { return lhs >= rhs ? lhs : rhs; }
|
||
|
template<typename T> static inline T ImClamp(T v, T mn, T mx) { return (v < mn) ? mn : (v > mx) ? mx : v; }
|
||
|
template<typename T> static inline T ImLerp(T a, T b, float t) { return (T)(a + (b - a) * t); }
|
||
|
template<typename T> static inline void ImSwap(T& a, T& b) { T tmp = a; a = b; b = tmp; }
|
||
|
template<typename T> static inline T ImAddClampOverflow(T a, T b, T mn, T mx) { if (b < 0 && (a < mn - b)) return mn; if (b > 0 && (a > mx - b)) return mx; return a + b; }
|
||
|
template<typename T> static inline T ImSubClampOverflow(T a, T b, T mn, T mx) { if (b > 0 && (a < mn + b)) return mn; if (b < 0 && (a > mx + b)) return mx; return a - b; }
|
||
|
template<typename T> T ImMin(T lhs, T rhs) { return lhs < rhs ? lhs : rhs; }
|
||
|
template<typename T> T ImMax(T lhs, T rhs) { return lhs >= rhs ? lhs : rhs; }
|
||
|
template<typename T> T ImClamp(T v, T mn, T mx) { return (v < mn) ? mn : (v > mx) ? mx : v; }
|
||
|
template<typename T> T ImLerp(T a, T b, float t) { return (T)(a + (b - a) * t); }
|
||
|
template<typename T> void ImSwap(T& a, T& b) { T tmp = a; a = b; b = tmp; }
|
||
|
template<typename T> T ImAddClampOverflow(T a, T b, T mn, T mx) { if (b < 0 && (a < mn - b)) return mn; if (b > 0 && (a > mx - b)) return mx; return a + b; }
|
||
|
template<typename T> T ImSubClampOverflow(T a, T b, T mn, T mx) { if (b > 0 && (a < mn + b)) return mn; if (b < 0 && (a > mx + b)) return mx; return a - b; }
|
||
|
// - Misc maths helpers
|
||
|
static inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x < rhs.x ? lhs.x : rhs.x, lhs.y < rhs.y ? lhs.y : rhs.y); }
|
||
|
static inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x >= rhs.x ? lhs.x : rhs.x, lhs.y >= rhs.y ? lhs.y : rhs.y); }
|
||
|
static inline ImVec2 ImClamp(const ImVec2& v, const ImVec2&mn, const ImVec2&mx) { return ImVec2((v.x < mn.x) ? mn.x : (v.x > mx.x) ? mx.x : v.x, (v.y < mn.y) ? mn.y : (v.y > mx.y) ? mx.y : v.y); }
|
||
|
static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, float t) { return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t); }
|
||
|
static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, const ImVec2& t) { return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y); }
|
||
|
static inline ImVec4 ImLerp(const ImVec4& a, const ImVec4& b, float t) { return ImVec4(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t, a.w + (b.w - a.w) * t); }
|
||
|
static inline float ImSaturate(float f) { return (f < 0.0f) ? 0.0f : (f > 1.0f) ? 1.0f : f; }
|
||
|
static inline float ImLengthSqr(const ImVec2& lhs) { return (lhs.x * lhs.x) + (lhs.y * lhs.y); }
|
||
|
static inline float ImLengthSqr(const ImVec4& lhs) { return (lhs.x * lhs.x) + (lhs.y * lhs.y) + (lhs.z * lhs.z) + (lhs.w * lhs.w); }
|
||
|
static inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = (lhs.x * lhs.x) + (lhs.y * lhs.y); if (d > 0.0f) return ImRsqrt(d); return fail_value; }
|
||
|
static inline float ImTrunc(float f) { return (float)(int)(f); }
|
||
|
static inline ImVec2 ImTrunc(const ImVec2& v) { return ImVec2((float)(int)(v.x), (float)(int)(v.y)); }
|
||
|
static inline float ImFloor(float f) { return (float)((f >= 0 || (float)(int)f == f) ? (int)f : (int)f - 1); } // Decent replacement for floorf()
|
||
|
static inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2(ImFloor(v.x), ImFloor(v.y)); }
|
||
|
static inline int ImModPositive(int a, int b) { return (a + b) % b; }
|
||
|
static inline float ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; }
|
||
|
static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); }
|
||
|
static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }
|
||
|
static inline float ImLinearRemapClamp(float s0, float s1, float d0, float d1, float x) { return ImSaturate((x - s0) / (s1 - s0)) * (d1 - d0) + d0; }
|
||
|
static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }
|
||
|
static inline bool ImIsFloatAboveGuaranteedIntegerPrecision(float f) { return f <= -16777216 || f >= 16777216; }
|
||
|
static inline float ImExponentialMovingAverage(float avg, float sample, int n) { avg -= avg / n; avg += sample / n; return avg; }
|
||
|
inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x < rhs.x ? lhs.x : rhs.x, lhs.y < rhs.y ? lhs.y : rhs.y); }
|
||
|
inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x >= rhs.x ? lhs.x : rhs.x, lhs.y >= rhs.y ? lhs.y : rhs.y); }
|
||
|
inline ImVec2 ImClamp(const ImVec2& v, const ImVec2&mn, const ImVec2&mx){ return ImVec2((v.x < mn.x) ? mn.x : (v.x > mx.x) ? mx.x : v.x, (v.y < mn.y) ? mn.y : (v.y > mx.y) ? mx.y : v.y); }
|
||
|
inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, float t) { return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t); }
|
||
|
inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, const ImVec2& t) { return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y); }
|
||
|
inline ImVec4 ImLerp(const ImVec4& a, const ImVec4& b, float t) { return ImVec4(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t, a.w + (b.w - a.w) * t); }
|
||
|
inline float ImSaturate(float f) { return (f < 0.0f) ? 0.0f : (f > 1.0f) ? 1.0f : f; }
|
||
|
inline float ImLengthSqr(const ImVec2& lhs) { return (lhs.x * lhs.x) + (lhs.y * lhs.y); }
|
||
|
inline float ImLengthSqr(const ImVec4& lhs) { return (lhs.x * lhs.x) + (lhs.y * lhs.y) + (lhs.z * lhs.z) + (lhs.w * lhs.w); }
|
||
|
inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = (lhs.x * lhs.x) + (lhs.y * lhs.y); if (d > 0.0f) return ImRsqrt(d); return fail_value; }
|
||
|
inline float ImTrunc(float f) { return (float)(int)(f); }
|
||
|
inline ImVec2 ImTrunc(const ImVec2& v) { return ImVec2((float)(int)(v.x), (float)(int)(v.y)); }
|
||
|
inline float ImFloor(float f) { return (float)((f >= 0 || (float)(int)f == f) ? (int)f : (int)f - 1); } // Decent replacement for floorf()
|
||
|
inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2(ImFloor(v.x), ImFloor(v.y)); }
|
||
|
inline float ImTrunc64(float f) { return (float)(ImS64)(f); }
|
||
|
inline float ImRound64(float f) { return (float)(ImS64)(f + 0.5f); }
|
||
|
inline int ImModPositive(int a, int b) { return (a + b) % b; }
|
||
|
inline float ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; }
|
||
|
inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); }
|
||
|
inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }
|
||
|
inline float ImLinearRemapClamp(float s0, float s1, float d0, float d1, float x) { return ImSaturate((x - s0) / (s1 - s0)) * (d1 - d0) + d0; }
|
||
|
inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }
|
||
|
inline bool ImIsFloatAboveGuaranteedIntegerPrecision(float f) { return f <= -16777216 || f >= 16777216; }
|
||
|
inline float ImExponentialMovingAverage(float avg, float sample, int n){ avg -= avg / n; avg += sample / n; return avg; }
|
||
|
IM_MSVC_RUNTIME_CHECKS_RESTORE
|
||
|
|
||
|
// Helpers: Geometry
|
||
| ... | ... | |
|
constexpr ImVec1(float _x) : x(_x) { }
|
||
|
};
|
||
|
|
||
|
// Helper: ImVec2i (2D vector, integer)
|
||
|
struct ImVec2i
|
||
|
{
|
||
|
int x, y;
|
||
|
constexpr ImVec2i() : x(0), y(0) {}
|
||
|
constexpr ImVec2i(int _x, int _y) : x(_x), y(_y) {}
|
||
|
};
|
||
|
|
||
|
// Helper: ImVec2ih (2D vector, half-size integer, for long-term packed storage)
|
||
|
struct ImVec2ih
|
||
|
{
|
||
| ... | ... | |
|
void Floor() { Min.x = IM_TRUNC(Min.x); Min.y = IM_TRUNC(Min.y); Max.x = IM_TRUNC(Max.x); Max.y = IM_TRUNC(Max.y); }
|
||
|
bool IsInverted() const { return Min.x > Max.x || Min.y > Max.y; }
|
||
|
ImVec4 ToVec4() const { return ImVec4(Min.x, Min.y, Max.x, Max.y); }
|
||
|
const ImVec4& AsVec4() const { return *(const ImVec4*)&Min.x; }
|
||
|
};
|
||
|
|
||
|
// Helper: ImBitArray
|
||
| ... | ... | |
|
inline void GetSpan(int n, ImSpan<T>* span) { span->set((T*)GetSpanPtrBegin(n), (T*)GetSpanPtrEnd(n)); }
|
||
|
};
|
||
|
|
||
|
// Helper: ImStableVector<>
|
||
|
// Allocating chunks of BLOCK_SIZE items. Objects pointers are never invalidated when growing, only by clear().
|
||
|
// Important: does not destruct anything!
|
||
|
// Implemented only the minimum set of functions we need for it.
|
||
|
template<typename T, int BLOCK_SIZE>
|
||
|
struct ImStableVector
|
||
|
{
|
||
|
int Size = 0;
|
||
|
int Capacity = 0;
|
||
|
ImVector<T*> Blocks;
|
||
|
|
||
|
// Functions
|
||
|
inline ~ImStableVector() { for (T* block : Blocks) IM_FREE(block); }
|
||
|
|
||
|
inline void clear() { Size = Capacity = 0; Blocks.clear_delete(); }
|
||
|
inline void resize(int new_size) { if (new_size > Capacity) reserve(new_size); Size = new_size; }
|
||
|
inline void reserve(int new_cap)
|
||
|
{
|
||
|
new_cap = IM_MEMALIGN(new_cap, BLOCK_SIZE);
|
||
|
int old_count = Capacity / BLOCK_SIZE;
|
||
|
int new_count = new_cap / BLOCK_SIZE;
|
||
|
if (new_count <= old_count)
|
||
|
return;
|
||
|
Blocks.resize(new_count);
|
||
|
for (int n = old_count; n < new_count; n++)
|
||
|
Blocks[n] = (T*)IM_ALLOC(sizeof(T) * BLOCK_SIZE);
|
||
|
Capacity = new_cap;
|
||
|
}
|
||
|
inline T& operator[](int i) { IM_ASSERT(i >= 0 && i < Size); return Blocks[i / BLOCK_SIZE][i % BLOCK_SIZE]; }
|
||
|
inline const T& operator[](int i) const { IM_ASSERT(i >= 0 && i < Size); return Blocks[i / BLOCK_SIZE][i % BLOCK_SIZE]; }
|
||
|
inline T* push_back(const T& v) { int i = Size; IM_ASSERT(i >= 0); if (Size == Capacity) reserve(Capacity + BLOCK_SIZE); void* ptr = &Blocks[i / BLOCK_SIZE][i % BLOCK_SIZE]; memcpy(ptr, &v, sizeof(v)); Size++; return (T*)ptr; }
|
||
|
};
|
||
|
|
||
|
// Helper: ImPool<>
|
||
|
// Basic keyed storage for contiguous instances, slow/amortized insertion, O(1) indexable, O(Log N) queries by ID over a dense/hot buffer,
|
||
|
// Honor constructor/destructor. Add/remove invalidate all pointers. Indexes have the same lifetime as the associated object.
|
||
| ... | ... | |
|
// Maintain a line index for a text buffer. This is a strong candidate to be moved into the public API.
|
||
|
struct ImGuiTextIndex
|
||
|
{
|
||
|
ImVector<int> LineOffsets;
|
||
|
ImVector<int> Offsets;
|
||
|
int EndOffset = 0; // Because we don't own text buffer we need to maintain EndOffset (may bake in LineOffsets?)
|
||
|
|
||
|
void clear() { LineOffsets.clear(); EndOffset = 0; }
|
||
|
int size() { return LineOffsets.Size; }
|
||
|
const char* get_line_begin(const char* base, int n) { return base + LineOffsets[n]; }
|
||
|
const char* get_line_end(const char* base, int n) { return base + (n + 1 < LineOffsets.Size ? (LineOffsets[n + 1] - 1) : EndOffset); }
|
||
|
void clear() { Offsets.clear(); EndOffset = 0; }
|
||
|
int size() { return Offsets.Size; }
|
||
|
const char* get_line_begin(const char* base, int n) { return base + (Offsets.Size != 0 ? Offsets[n] : 0); }
|
||
|
const char* get_line_end(const char* base, int n) { return base + (n + 1 < Offsets.Size ? (Offsets[n + 1] - 1) : EndOffset); }
|
||
|
void append(const char* base, int old_size, int new_size);
|
||
|
};
|
||
|
|
||
|
// Helper: ImGuiStorage
|
||
|
IMGUI_API ImGuiStoragePair* ImLowerBound(ImGuiStoragePair* in_begin, ImGuiStoragePair* in_end, ImGuiID key);
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
// [SECTION] ImDrawList support
|
||
|
//-----------------------------------------------------------------------------
|
||
| ... | ... | |
|
#define IM_DRAWLIST_ARCFAST_SAMPLE_MAX IM_DRAWLIST_ARCFAST_TABLE_SIZE // Sample index _PathArcToFastEx() for 360 angle.
|
||
|
|
||
|
// Data shared between all ImDrawList instances
|
||
|
// You may want to create your own instance of this if you want to use ImDrawList completely without ImGui. In that case, watch out for future changes to this structure.
|
||
|
// Conceptually this could have been called e.g. ImDrawListSharedContext
|
||
|
// Typically one ImGui context would create and maintain one of this.
|
||
|
// You may want to create your own instance of you try to ImDrawList completely without ImGui. In that case, watch out for future changes to this structure.
|
||
|
struct IMGUI_API ImDrawListSharedData
|
||
|
{
|
||
|
ImVec2 TexUvWhitePixel; // UV of white pixel in the atlas
|
||
|
ImFont* Font; // Current/default font (optional, for simplified AddText overload)
|
||
|
float FontSize; // Current/default font size (optional, for simplified AddText overload)
|
||
|
float FontScale; // Current/default font scale (== FontSize / Font->FontSize)
|
||
|
ImVec2 TexUvWhitePixel; // UV of white pixel in the atlas (== FontAtlas->TexUvWhitePixel)
|
||
|
const ImVec4* TexUvLines; // UV of anti-aliased lines in the atlas (== FontAtlas->TexUvLines)
|
||
|
ImFontAtlas* FontAtlas; // Current font atlas
|
||
|
ImFont* Font; // Current font (used for simplified AddText overload)
|
||
|
float FontSize; // Current font size (used for for simplified AddText overload)
|
||
|
float FontScale; // Current font scale (== FontSize / Font->FontSize)
|
||
|
float CurveTessellationTol; // Tessellation tolerance when using PathBezierCurveTo()
|
||
|
float CircleSegmentMaxError; // Number of circle segments to use per pixel of radius for AddCircle() etc
|
||
|
ImVec4 ClipRectFullscreen; // Value for PushClipRectFullscreen()
|
||
|
float InitialFringeScale; // Initial scale to apply to AA fringe
|
||
|
ImDrawListFlags InitialFlags; // Initial flags at the beginning of the frame (it is possible to alter flags on a per-drawlist basis afterwards)
|
||
|
ImVec4 ClipRectFullscreen; // Value for PushClipRectFullscreen()
|
||
|
ImVector<ImVec2> TempBuffer; // Temporary write buffer
|
||
|
ImVector<ImDrawList*> DrawLists; // All draw lists associated to this ImDrawListSharedData
|
||
|
ImGuiContext* Context; // [OPTIONAL] Link to Dear ImGui context. 99% of ImDrawList/ImFontAtlas can function without an ImGui context, but this facilitate handling one legacy edge case.
|
||
|
|
||
|
// [Internal] Temp write buffer
|
||
|
ImVector<ImVec2> TempBuffer;
|
||
|
|
||
|
// [Internal] Lookup tables
|
||
|
// Lookup tables
|
||
|
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()
|
||
|
ImU8 CircleSegmentCounts[64]; // Precomputed segment count for given radius before we calculate it dynamically (to avoid calculation overhead)
|
||
|
const ImVec4* TexUvLines; // UV of anti-aliased lines in the atlas
|
||
|
|
||
|
ImDrawListSharedData();
|
||
|
~ImDrawListSharedData();
|
||
|
void SetCircleTessellationMaxError(float max_error);
|
||
|
};
|
||
|
|
||
| ... | ... | |
|
ImDrawDataBuilder() { memset(this, 0, sizeof(*this)); }
|
||
|
};
|
||
|
|
||
|
struct ImFontStackData
|
||
|
{
|
||
|
ImFont* Font;
|
||
|
float FontSizeBeforeScaling; // ~~ style.FontSizeBase
|
||
|
float FontSizeAfterScaling; // ~~ g.FontSize
|
||
|
};
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
// [SECTION] Data types support
|
||
|
// [SECTION] Style support
|
||
|
//-----------------------------------------------------------------------------
|
||
|
|
||
|
struct ImGuiDataVarInfo
|
||
|
struct ImGuiStyleVarInfo
|
||
|
{
|
||
|
ImGuiDataType Type;
|
||
|
ImU32 Count; // 1+
|
||
|
ImU32 Offset; // Offset in parent structure
|
||
|
ImU32 Count : 8; // 1+
|
||
|
ImGuiDataType DataType : 8;
|
||
|
ImU32 Offset : 16; // Offset in parent structure
|
||
|
void* GetVarPtr(void* parent) const { return (void*)((unsigned char*)parent + Offset); }
|
||
|
};
|
||
|
|
||
|
// Stacked color modifier, backup of modified data so we can restore it
|
||
|
struct ImGuiColorMod
|
||
|
{
|
||
|
ImGuiCol Col;
|
||
|
ImVec4 BackupValue;
|
||
|
};
|
||
|
|
||
|
// Stacked style modifier, backup of modified data so we can restore it. Data type inferred from the variable.
|
||
|
struct ImGuiStyleMod
|
||
|
{
|
||
|
ImGuiStyleVar VarIdx;
|
||
|
union { int BackupInt[2]; float BackupFloat[2]; };
|
||
|
ImGuiStyleMod(ImGuiStyleVar idx, int v) { VarIdx = idx; BackupInt[0] = v; }
|
||
|
ImGuiStyleMod(ImGuiStyleVar idx, float v) { VarIdx = idx; BackupFloat[0] = v; }
|
||
|
ImGuiStyleMod(ImGuiStyleVar idx, ImVec2 v) { VarIdx = idx; BackupFloat[0] = v.x; BackupFloat[1] = v.y; }
|
||
|
};
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
// [SECTION] Data types support
|
||
|
//-----------------------------------------------------------------------------
|
||
|
|
||
|
struct ImGuiDataTypeStorage
|
||
|
{
|
||
|
ImU8 Data[8]; // Opaque storage to fit any data up to ImGuiDataType_COUNT
|
||
| ... | ... | |
|
// Extend ImGuiDataType_
|
||
|
enum ImGuiDataTypePrivate_
|
||
|
{
|
||
|
ImGuiDataType_String = ImGuiDataType_COUNT + 1,
|
||
|
ImGuiDataType_Pointer,
|
||
|
ImGuiDataType_Pointer = ImGuiDataType_COUNT,
|
||
|
ImGuiDataType_ID,
|
||
|
};
|
||
|
|
||
| ... | ... | |
|
ImGuiItemFlags_AllowOverlap = 1 << 14, // false // Allow being overlapped by another widget. Not-hovered to Hovered transition deferred by a frame.
|
||
|
ImGuiItemFlags_NoNavDisableMouseHover = 1 << 15, // false // Nav keyboard/gamepad mode doesn't disable hover highlight (behave as if NavHighlightItemUnderNav==false).
|
||
|
ImGuiItemFlags_NoMarkEdited = 1 << 16, // false // Skip calling MarkItemEdited()
|
||
|
ImGuiItemFlags_NoFocus = 1 << 17, // false // [EXPERIMENTAL: Not very well specced] Clicking doesn't take focus. Automatically sets ImGuiButtonFlags_NoFocus + ImGuiButtonFlags_NoNavFocus in ButtonBehavior().
|
||
|
|
||
|
// Controlled by widget code
|
||
|
ImGuiItemFlags_Inputable = 1 << 20, // false // [WIP] Auto-activate input mode when tab focused. Currently only used and supported by a few items before it becomes a generic feature.
|
||
| ... | ... | |
|
ImGuiItemStatusFlags_Visible = 1 << 8, // [WIP] Set when item is overlapping the current clipping rectangle (Used internally. Please don't use yet: API/system will change as we refactor Itemadd()).
|
||
|
ImGuiItemStatusFlags_HasClipRect = 1 << 9, // g.LastItemData.ClipRect is valid.
|
||
|
ImGuiItemStatusFlags_HasShortcut = 1 << 10, // g.LastItemData.Shortcut valid. Set by SetNextItemShortcut() -> ItemAdd().
|
||
|
//ImGuiItemStatusFlags_FocusedByTabbing = 1 << 8, // Removed IN 1.90.1 (Dec 2023). The trigger is part of g.NavActivateId. See commit 54c1bdeceb.
|
||
|
|
||
|
// Additional status + semantic for ImGuiTestEngine
|
||
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||
| ... | ... | |
|
ImGuiButtonFlags_PressedOnRelease = 1 << 7, // return true on release (default requires click+release)
|
||
|
ImGuiButtonFlags_PressedOnDoubleClick = 1 << 8, // return true on double-click (default requires click+release)
|
||
|
ImGuiButtonFlags_PressedOnDragDropHold = 1 << 9, // return true when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers)
|
||
|
//ImGuiButtonFlags_Repeat = 1 << 10, // hold to repeat
|
||
|
//ImGuiButtonFlags_Repeat = 1 << 10, // hold to repeat -> use ImGuiItemFlags_ButtonRepeat instead.
|
||
|
ImGuiButtonFlags_FlattenChildren = 1 << 11, // allow interactions even if a child window is overlapping
|
||
|
ImGuiButtonFlags_AllowOverlap = 1 << 12, // require previous frame HoveredId to either match id or be null before being usable.
|
||
|
//ImGuiButtonFlags_DontClosePopups = 1 << 13, // disable automatically closing parent popup on press
|
||
| ... | ... | |
|
ImGuiButtonFlags_NoHoveredOnFocus = 1 << 19, // don't report as hovered when nav focus is on this item
|
||
|
ImGuiButtonFlags_NoSetKeyOwner = 1 << 20, // don't set key/input owner on the initial click (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
|
||
|
ImGuiButtonFlags_NoTestKeyOwner = 1 << 21, // don't test key/input owner when polling the key (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
|
||
|
ImGuiButtonFlags_NoFocus = 1 << 22, // [EXPERIMENTAL: Not very well specced]. Don't focus parent window when clicking.
|
||
|
ImGuiButtonFlags_PressedOnMask_ = ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_PressedOnDragDropHold,
|
||
|
ImGuiButtonFlags_PressedOnDefault_ = ImGuiButtonFlags_PressedOnClickRelease,
|
||
|
//ImGuiButtonFlags_NoKeyModifiers = ImGuiButtonFlags_NoKeyModsAllowed, // Renamed in 1.91.4
|
||
|
};
|
||
|
|
||
|
// Extend ImGuiComboFlags_
|
||
| ... | ... | |
|
{
|
||
|
// NB: need to be in sync with last value of ImGuiSelectableFlags_
|
||
|
ImGuiSelectableFlags_NoHoldingActiveID = 1 << 20,
|
||
|
ImGuiSelectableFlags_SelectOnNav = 1 << 21, // (WIP) Auto-select when moved into. This is not exposed in public API as to handle multi-select and modifiers we will need user to explicitly control focus scope. May be replaced with a BeginSelection() API.
|
||
|
ImGuiSelectableFlags_SelectOnClick = 1 << 22, // Override button behavior to react on Click (default is Click+Release)
|
||
|
ImGuiSelectableFlags_SelectOnRelease = 1 << 23, // Override button behavior to react on Release (default is Click+Release)
|
||
|
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)
|
||
| ... | ... | |
|
// Extend ImGuiTreeNodeFlags_
|
||
|
enum ImGuiTreeNodeFlagsPrivate_
|
||
|
{
|
||
|
ImGuiTreeNodeFlags_NoNavFocus = 1 << 27,// Don't claim nav focus when interacting with this item (#8551)
|
||
|
ImGuiTreeNodeFlags_ClipLabelForTrailingButton = 1 << 28,// FIXME-WIP: Hard-coded for CollapsingHeader()
|
||
|
ImGuiTreeNodeFlags_UpsideDownArrow = 1 << 29,// FIXME-WIP: Turn Down arrow into an Up arrow, for reversed trees (#6517)
|
||
|
ImGuiTreeNodeFlags_OpenOnMask_ = ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_OpenOnArrow,
|
||
|
ImGuiTreeNodeFlags_DrawLinesMask_ = ImGuiTreeNodeFlags_DrawLinesNone | ImGuiTreeNodeFlags_DrawLinesFull | ImGuiTreeNodeFlags_DrawLinesToNodes,
|
||
|
};
|
||
|
|
||
|
enum ImGuiSeparatorFlags_
|
||
| ... | ... | |
|
ImGuiPlotType_Histogram,
|
||
|
};
|
||
|
|
||
|
// Stacked color modifier, backup of modified data so we can restore it
|
||
|
struct ImGuiColorMod
|
||
|
{
|
||
|
ImGuiCol Col;
|
||
|
ImVec4 BackupValue;
|
||
|
};
|
||
|
|
||
|
// Stacked style modifier, backup of modified data so we can restore it. Data type inferred from the variable.
|
||
|
struct ImGuiStyleMod
|
||
|
{
|
||
|
ImGuiStyleVar VarIdx;
|
||
|
union { int BackupInt[2]; float BackupFloat[2]; };
|
||
|
ImGuiStyleMod(ImGuiStyleVar idx, int v) { VarIdx = idx; BackupInt[0] = v; }
|
||
|
ImGuiStyleMod(ImGuiStyleVar idx, float v) { VarIdx = idx; BackupFloat[0] = v; }
|
||
|
ImGuiStyleMod(ImGuiStyleVar idx, ImVec2 v) { VarIdx = idx; BackupFloat[0] = v.x; BackupFloat[1] = v.y; }
|
||
|
};
|
||
|
|
||
|
// Storage data for BeginComboPreview()/EndComboPreview()
|
||
|
struct IMGUI_API ImGuiComboPreviewData
|
||
|
{
|
||
| ... | ... | |
|
ImVec2 BackupCurrLineSize;
|
||
|
float BackupCurrLineTextBaseOffset;
|
||
|
ImGuiID BackupActiveIdIsAlive;
|
||
|
bool BackupActiveIdPreviousFrameIsAlive;
|
||
|
bool BackupActiveIdHasBeenEditedThisFrame;
|
||
|
bool BackupDeactivatedIdIsAlive;
|
||
|
bool BackupHoveredIdIsAlive;
|
||
|
bool BackupIsSameLine;
|
||
|
bool EmitItem;
|
||
| ... | ... | |
|
{
|
||
|
ImGuiContext* Ctx; // parent UI context (needs to be set explicitly by parent).
|
||
|
ImStbTexteditState* Stb; // State for stb_textedit.h
|
||
|
ImGuiInputTextFlags Flags; // copy of InputText() flags. may be used to check if e.g. ImGuiInputTextFlags_Password is set.
|
||
|
ImGuiID ID; // widget id owning the text state
|
||
|
int TextLen; // UTF-8 length of the string in TextA (in bytes)
|
||
|
const char* TextSrc; // == TextA.Data unless read-only, in which case == buf passed to InputText(). Field only set and valid _inside_ the call InputText() call.
|
||
|
ImVector<char> TextA; // main UTF8 buffer. TextA.Size is a buffer size! Should always be >= buf_size passed by user (and of course >= CurLenA + 1).
|
||
|
ImVector<char> TextToRevertTo; // value to revert to when pressing Escape = backup of end-user buffer at the time of focus (in UTF-8, unaltered)
|
||
|
ImVector<char> CallbackTextBackup; // temporary storage for callback to support automatic reconcile of undo-stack
|
||
|
int BufCapacity; // end-user buffer capacity (include zero terminator)
|
||
|
ImVec2 Scroll; // horizontal offset (managed manually) + vertical scrolling (pulled from child window's own Scroll.y)
|
||
|
int LineCount; // last line count (solely for debugging)
|
||
|
float WrapWidth; // word-wrapping width
|
||
|
float CursorAnim; // timer for cursor blink, reset on every user action so the cursor reappears immediately
|
||
|
bool CursorFollow; // set when we want scrolling to follow the current cursor position (not always!)
|
||
|
bool CursorCenterY; // set when we want scrolling to be centered over the cursor position (while resizing a word-wrapping field)
|
||
|
bool SelectedAllMouseLock; // after a double-click to select all, we ignore further mouse drags to update selection
|
||
|
bool Edited; // edited this frame
|
||
|
ImGuiInputTextFlags Flags; // copy of InputText() flags. may be used to check if e.g. ImGuiInputTextFlags_Password is set.
|
||
|
bool ReloadUserBuf; // force a reload of user buf so it may be modified externally. may be automatic in future version.
|
||
|
int ReloadSelectionStart; // POSITIONS ARE IN IMWCHAR units *NOT* UTF-8 this is why this is not exposed yet.
|
||
|
bool WantReloadUserBuf; // force a reload of user buf so it may be modified externally. may be automatic in future version.
|
||
|
ImS8 LastMoveDirectionLR; // ImGuiDir_Left or ImGuiDir_Right. track last movement direction so when cursor cross over a word-wrapping boundaries we can display it on either line depending on last move.s
|
||
|
int ReloadSelectionStart;
|
||
|
int ReloadSelectionEnd;
|
||
|
|
||
|
ImGuiInputTextState();
|
||
| ... | ... | |
|
void ClearFreeMemory() { TextA.clear(); TextToRevertTo.clear(); }
|
||
|
void OnKeyPressed(int key); // Cannot be inline because we call in code in stb_textedit.h implementation
|
||
|
void OnCharPressed(unsigned int c);
|
||
|
float GetPreferredOffsetX() const;
|
||
|
|
||
|
// Cursor & Selection
|
||
|
void CursorAnimReset();
|
||
| ... | ... | |
|
// Refresh policy/frequency, Load Balancing etc.
|
||
|
};
|
||
|
|
||
|
enum ImGuiWindowBgClickFlags_
|
||
|
{
|
||
|
ImGuiWindowBgClickFlags_None = 0,
|
||
|
ImGuiWindowBgClickFlags_Move = 1 << 0, // Click on bg/void + drag to move window. Cleared by default when using io.ConfigWindowsMoveFromTitleBarOnly.
|
||
|
};
|
||
|
|
||
|
enum ImGuiNextWindowDataFlags_
|
||
|
{
|
||
|
ImGuiNextWindowDataFlags_None = 0,
|
||
| ... | ... | |
|
ImGuiNextWindowDataFlags_HasFocus = 1 << 5,
|
||
|
ImGuiNextWindowDataFlags_HasBgAlpha = 1 << 6,
|
||
|
ImGuiNextWindowDataFlags_HasScroll = 1 << 7,
|
||
|
ImGuiNextWindowDataFlags_HasChildFlags = 1 << 8,
|
||
|
ImGuiNextWindowDataFlags_HasRefreshPolicy = 1 << 9,
|
||
|
ImGuiNextWindowDataFlags_HasWindowFlags = 1 << 8,
|
||
|
ImGuiNextWindowDataFlags_HasChildFlags = 1 << 9,
|
||
|
ImGuiNextWindowDataFlags_HasRefreshPolicy = 1 << 10,
|
||
|
};
|
||
|
|
||
|
// Storage for SetNexWindow** functions
|
||
|
struct ImGuiNextWindowData
|
||
|
{
|
||
|
ImGuiNextWindowDataFlags Flags;
|
||
|
ImGuiNextWindowDataFlags HasFlags;
|
||
|
|
||
|
// Members below are NOT cleared. Always rely on HasFlags.
|
||
|
ImGuiCond PosCond;
|
||
|
ImGuiCond SizeCond;
|
||
|
ImGuiCond CollapsedCond;
|
||
| ... | ... | |
|
ImVec2 SizeVal;
|
||
|
ImVec2 ContentSizeVal;
|
||
|
ImVec2 ScrollVal;
|
||
|
ImGuiWindowFlags WindowFlags; // Only honored by BeginTable()
|
||
|
ImGuiChildFlags ChildFlags;
|
||
|
bool CollapsedVal;
|
||
|
ImRect SizeConstraintRect;
|
||
| ... | ... | |
|
ImGuiWindowRefreshFlags RefreshFlagsVal;
|
||
|
|
||
|
ImGuiNextWindowData() { memset(this, 0, sizeof(*this)); }
|
||
|
inline void ClearFlags() { Flags = ImGuiNextWindowDataFlags_None; }
|
||
|
inline void ClearFlags() { HasFlags = ImGuiNextWindowDataFlags_None; }
|
||
|
};
|
||
|
|
||
|
enum ImGuiNextItemDataFlags_
|
||
| ... | ... | |
|
{
|
||
|
ImGuiNextItemDataFlags HasFlags; // Called HasFlags instead of Flags to avoid mistaking this
|
||
|
ImGuiItemFlags ItemFlags; // Currently only tested/used for ImGuiItemFlags_AllowOverlap and ImGuiItemFlags_HasSelectionUserData.
|
||
|
// Non-flags members are NOT cleared by ItemAdd() meaning they are still valid during NavProcessItem()
|
||
|
|
||
|
// Members below are NOT cleared by ItemAdd() meaning they are still valid during e.g. NavProcessItem(). Always rely on HasFlags.
|
||
|
ImGuiID FocusScopeId; // Set by SetNextItemSelectionUserData()
|
||
|
ImGuiSelectionUserData SelectionUserData; // Set by SetNextItemSelectionUserData() (note that NULL/0 is a valid value, we use -1 == ImGuiSelectionUserData_Invalid to mark invalid values)
|
||
|
float Width; // Set by SetNextItemWidth()
|
||
| ... | ... | |
|
struct ImGuiLastItemData
|
||
|
{
|
||
|
ImGuiID ID;
|
||
|
ImGuiItemFlags ItemFlags; // See ImGuiItemFlags_
|
||
|
ImGuiItemFlags ItemFlags; // See ImGuiItemFlags_ (called 'InFlags' before v1.91.4).
|
||
|
ImGuiItemStatusFlags StatusFlags; // See ImGuiItemStatusFlags_
|
||
|
ImRect Rect; // Full rectangle
|
||
|
ImRect NavRect; // Navigation scoring rectangle (not displayed)
|
||
|
// Rarely used fields are not explicitly cleared, only valid when the corresponding ImGuiItemStatusFlags ar set.
|
||
|
// Rarely used fields are not explicitly cleared, only valid when the corresponding ImGuiItemStatusFlags are set.
|
||
|
ImRect DisplayRect; // Display rectangle. ONLY VALID IF (StatusFlags & ImGuiItemStatusFlags_HasDisplayRect) is set.
|
||
|
ImRect ClipRect; // Clip rectangle at the time of submitting item. ONLY VALID IF (StatusFlags & ImGuiItemStatusFlags_HasClipRect) is set..
|
||
|
ImGuiKeyChord Shortcut; // Shortcut at the time of submitting item. ONLY VALID IF (StatusFlags & ImGuiItemStatusFlags_HasShortcut) is set..
|
||
| ... | ... | |
|
};
|
||
|
|
||
|
// Store data emitted by TreeNode() for usage by TreePop()
|
||
|
// - To implement ImGuiTreeNodeFlags_NavLeftJumpsBackHere: store the minimum amount of data
|
||
|
// - To implement ImGuiTreeNodeFlags_NavLeftJumpsToParent: store the minimum amount of data
|
||
|
// which we can't infer in TreePop(), to perform the equivalent of NavApplyItemToResult().
|
||
|
// Only stored when the node is a potential candidate for landing on a Left arrow jump.
|
||
|
struct ImGuiTreeNodeStackData
|
||
|
{
|
||
|
ImGuiID ID;
|
||
|
ImGuiTreeNodeFlags TreeFlags;
|
||
|
ImGuiItemFlags ItemFlags; // Used for nav landing
|
||
|
ImRect NavRect; // Used for nav landing
|
||
|
ImGuiItemFlags ItemFlags; // Used for nav landing
|
||
|
ImRect NavRect; // Used for nav landing
|
||
|
float DrawLinesX1;
|
||
|
float DrawLinesToNodesY2;
|
||
|
ImGuiTableColumnIdx DrawLinesTableColumn;
|
||
|
};
|
||
|
|
||
|
// sizeof() = 20
|
||
| ... | ... | |
|
ImGuiLastItemData ParentLastItemDataBackup;
|
||
|
ImGuiErrorRecoveryState StackSizesInBegin; // Store size of various stacks for asserting
|
||
|
bool DisabledOverrideReenable; // Non-child window override disabled flag
|
||
|
float DisabledOverrideReenableAlphaBackup;
|
||
|
};
|
||
|
|
||
|
struct ImGuiShrinkWidthItem
|
||
| ... | ... | |
|
ImGuiPtrOrIndex(int index) { Ptr = NULL; Index = index; }
|
||
|
};
|
||
|
|
||
|
// Data used by IsItemDeactivated()/IsItemDeactivatedAfterEdit() functions
|
||
|
struct ImGuiDeactivatedItemData
|
||
|
{
|
||
|
ImGuiID ID;
|
||
|
int ElapseFrame;
|
||
|
bool HasBeenEditedBefore;
|
||
|
bool IsAlive;
|
||
|
};
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
// [SECTION] Popup support
|
||
|
//-----------------------------------------------------------------------------
|
||
| ... | ... | |
|
ImGuiInputEventType_COUNT
|
||
|
};
|
||
|
|
||
|
enum ImGuiInputSource
|
||
|
enum ImGuiInputSource : int
|
||
|
{
|
||
|
ImGuiInputSource_None = 0,
|
||
|
ImGuiInputSource_Mouse, // Note: may be Mouse or TouchScreen or Pen. See io.MouseSource to distinguish them.
|
||
| ... | ... | |
|
{
|
||
|
ImGuiKeyRoutingIndex NextEntryIndex;
|
||
|
ImU16 Mods; // Technically we'd only need 4-bits but for simplify we store ImGuiMod_ values which need 16-bits.
|
||
|
ImU8 RoutingCurrScore; // [DEBUG] For debug display
|
||
|
ImU8 RoutingNextScore; // Lower is better (0: perfect score)
|
||
|
ImU16 RoutingCurrScore; // [DEBUG] For debug display
|
||
|
ImU16 RoutingNextScore; // Lower is better (0: perfect score)
|
||
|
ImGuiID RoutingCurr;
|
||
|
ImGuiID RoutingNext;
|
||
|
|
||
|
ImGuiKeyRoutingData() { NextEntryIndex = -1; Mods = 0; RoutingCurrScore = RoutingNextScore = 255; RoutingCurr = RoutingNext = ImGuiKeyOwner_NoOwner; }
|
||
|
ImGuiKeyRoutingData() { NextEntryIndex = -1; Mods = 0; RoutingCurrScore = RoutingNextScore = 0; RoutingCurr = RoutingNext = ImGuiKeyOwner_NoOwner; }
|
||
|
};
|
||
|
|
||
|
// Routing table: maintain a desired owner for each possible key-chord (key + mods), and setup owner in NewFrame() when mods are matching.
|
||
| ... | ... | |
|
ImGuiActivateFlags_PreferInput = 1 << 0, // Favor activation that requires keyboard text input (e.g. for Slider/Drag). Default for Enter key.
|
||
|
ImGuiActivateFlags_PreferTweak = 1 << 1, // Favor activation for tweaking with arrows or gamepad (e.g. for Slider/Drag). Default for Space key and if keyboard is not used.
|
||
|
ImGuiActivateFlags_TryToPreserveState = 1 << 2, // Request widget to preserve state if it can (e.g. InputText will try to preserve cursor/selection)
|
||
|
ImGuiActivateFlags_FromTabbing = 1 << 3, // Activation requested by a tabbing request
|
||
|
ImGuiActivateFlags_FromTabbing = 1 << 3, // Activation requested by a tabbing request (ImGuiNavMoveFlags_IsTabbing)
|
||
|
ImGuiActivateFlags_FromShortcut = 1 << 4, // Activation requested by an item shortcut via SetNextItemShortcut() function.
|
||
|
ImGuiActivateFlags_FromFocusApi = 1 << 5, // Activation requested by an api request (ImGuiNavMoveFlags_FocusApi)
|
||
|
};
|
||
|
|
||
|
// Early work-in-progress API for ScrollToItem()
|
||
| ... | ... | |
|
ImGuiNavHighlightFlags_Compact = ImGuiNavRenderCursorFlags_Compact, // Renamed in 1.91.4
|
||
|
ImGuiNavHighlightFlags_AlwaysDraw = ImGuiNavRenderCursorFlags_AlwaysDraw, // Renamed in 1.91.4
|
||
|
ImGuiNavHighlightFlags_NoRounding = ImGuiNavRenderCursorFlags_NoRounding, // Renamed in 1.91.4
|
||
|
//ImGuiNavHighlightFlags_TypeThin = ImGuiNavRenderCursorFlags_Compact, // Renamed in 1.90.2
|
||
|
#endif
|
||
|
};
|
||
|
|
||
| ... | ... | |
|
ImGuiNavMoveFlags_WrapMask_ = ImGuiNavMoveFlags_LoopX | ImGuiNavMoveFlags_LoopY | ImGuiNavMoveFlags_WrapX | ImGuiNavMoveFlags_WrapY,
|
||
|
ImGuiNavMoveFlags_AllowCurrentNavId = 1 << 4, // Allow scoring and considering the current NavId as a move target candidate. This is used when the move source is offset (e.g. pressing PageDown actually needs to send a Up move request, if we are pressing PageDown from the bottom-most item we need to stay in place)
|
||
|
ImGuiNavMoveFlags_AlsoScoreVisibleSet = 1 << 5, // Store alternate result in NavMoveResultLocalVisible that only comprise elements that are already fully visible (used by PageUp/PageDown)
|
||
|
ImGuiNavMoveFlags_ScrollToEdgeY = 1 << 6, // Force scrolling to min/max (used by Home/End) // FIXME-NAV: Aim to remove or reword, probably unnecessary
|
||
|
ImGuiNavMoveFlags_ScrollToEdgeY = 1 << 6, // Force scrolling to min/max (used by Home/End) // FIXME-NAV: Aim to remove or reword as ImGuiScrollFlags
|
||
|
ImGuiNavMoveFlags_Forwarded = 1 << 7,
|
||
|
ImGuiNavMoveFlags_DebugNoResult = 1 << 8, // Dummy scoring for debug purpose, don't apply result
|
||
|
ImGuiNavMoveFlags_FocusApi = 1 << 9, // Requests from focus API can land/focus/activate items even if they are marked with _NoTabStop (see NavProcessItemForTabbingRequest() for details)
|
||
| ... | ... | |
|
// [SECTION] Metrics, Debug Tools
|
||
|
//-----------------------------------------------------------------------------
|
||
|
|
||
|
// See IMGUI_DEBUG_LOG() and IMGUI_DEBUG_LOG_XXX() macros.
|
||
|
enum ImGuiDebugLogFlags_
|
||
|
{
|
||
|
// Event types
|
||
| ... | ... | |
|
ImGuiDebugLogFlags_EventClipper = 1 << 5,
|
||
|
ImGuiDebugLogFlags_EventSelection = 1 << 6,
|
||
|
ImGuiDebugLogFlags_EventIO = 1 << 7,
|
||
|
ImGuiDebugLogFlags_EventInputRouting = 1 << 8,
|
||
|
ImGuiDebugLogFlags_EventDocking = 1 << 9, // Unused in this branch
|
||
|
ImGuiDebugLogFlags_EventViewport = 1 << 10, // Unused in this branch
|
||
|
ImGuiDebugLogFlags_EventFont = 1 << 8,
|
||
|
ImGuiDebugLogFlags_EventInputRouting = 1 << 9,
|
||
|
ImGuiDebugLogFlags_EventDocking = 1 << 10, // Unused in this branch
|
||
|
ImGuiDebugLogFlags_EventViewport = 1 << 11, // Unused in this branch
|
||
|
|
||
|
ImGuiDebugLogFlags_EventMask_ = ImGuiDebugLogFlags_EventError | ImGuiDebugLogFlags_EventActiveId | ImGuiDebugLogFlags_EventFocus | ImGuiDebugLogFlags_EventPopup | ImGuiDebugLogFlags_EventNav | ImGuiDebugLogFlags_EventClipper | ImGuiDebugLogFlags_EventSelection | ImGuiDebugLogFlags_EventIO | ImGuiDebugLogFlags_EventInputRouting | ImGuiDebugLogFlags_EventDocking | ImGuiDebugLogFlags_EventViewport,
|
||
|
ImGuiDebugLogFlags_EventMask_ = ImGuiDebugLogFlags_EventError | ImGuiDebugLogFlags_EventActiveId | ImGuiDebugLogFlags_EventFocus | ImGuiDebugLogFlags_EventPopup | ImGuiDebugLogFlags_EventNav | ImGuiDebugLogFlags_EventClipper | ImGuiDebugLogFlags_EventSelection | ImGuiDebugLogFlags_EventIO | ImGuiDebugLogFlags_EventFont | ImGuiDebugLogFlags_EventInputRouting | ImGuiDebugLogFlags_EventDocking | ImGuiDebugLogFlags_EventViewport,
|
||
|
ImGuiDebugLogFlags_OutputToTTY = 1 << 20, // Also send output to TTY
|
||
|
ImGuiDebugLogFlags_OutputToTestEngine = 1 << 21, // Also send output to Test Engine
|
||
|
};
|
||
| ... | ... | |
|
bool ShowDrawCmdMesh = true;
|
||
|
bool ShowDrawCmdBoundingBoxes = true;
|
||
|
bool ShowTextEncodingViewer = false;
|
||
|
bool ShowAtlasTintedWithTextColor = false;
|
||
|
bool ShowTextureUsedRect = false;
|
||
|
int ShowWindowsRectsType = -1;
|
||
|
int ShowTablesRectsType = -1;
|
||
|
int HighlightMonitorIdx = -1;
|
||
|
ImGuiID HighlightViewportID = 0;
|
||
|
bool ShowFontPreview = true;
|
||
|
};
|
||
|
|
||
|
struct ImGuiStackLevelInfo
|
||
|
{
|
||
|
ImGuiID ID;
|
||
|
ImS8 QueryFrameCount; // >= 1: Query in progress
|
||
|
bool QuerySuccess; // Obtained result from DebugHookIdInfo()
|
||
|
ImGuiDataType DataType : 8;
|
||
|
char Desc[57]; // Arbitrarily sized buffer to hold a result (FIXME: could replace Results[] with a chunk stream?) FIXME: Now that we added CTRL+C this should be fixed.
|
||
|
ImS8 QueryFrameCount; // >= 1: Sub-query in progress
|
||
|
bool QuerySuccess; // Sub-query obtained result from DebugHookIdInfo()
|
||
|
ImS8 DataType; // ImGuiDataType
|
||
|
int DescOffset; // -1 or offset into parent's ResultsPathsBuf
|
||
|
|
||
|
ImGuiStackLevelInfo() { memset(this, 0, sizeof(*this)); DataType = -1; DescOffset = -1; }
|
||
|
};
|
||
|
|
||
|
struct ImGuiDebugItemPathQuery
|
||
|
{
|
||
|
ImGuiID MainID; // ID to query details for.
|
||
|
bool Active; // Used to disambiguate the case when ID == 0 and e.g. some code calls PushOverrideID(0).
|
||
|
bool Complete; // All sub-queries are finished (some may have failed).
|
||
|
ImS8 Step; // -1: query stack + init Results, >= 0: filling individual stack level.
|
||
|
ImVector<ImGuiStackLevelInfo> Results;
|
||
|
ImGuiTextBuffer ResultsDescBuf;
|
||
|
ImGuiTextBuffer ResultPathBuf;
|
||
|
|
||
|
ImGuiStackLevelInfo() { memset(this, 0, sizeof(*this)); }
|
||
|
ImGuiDebugItemPathQuery() { memset(this, 0, sizeof(*this)); }
|
||
|
};
|
||
|
|
||
|
// State for ID Stack tool queries
|
||
|
struct ImGuiIDStackTool
|
||
|
{
|
||
|
bool OptHexEncodeNonAsciiChars;
|
||
|
bool OptCopyToClipboardOnCtrlC;
|
||
|
int LastActiveFrame;
|
||
|
int StackLevel; // -1: query stack and resize Results, >= 0: individual stack level
|
||
|
ImGuiID QueryId; // ID to query details for
|
||
|
ImVector<ImGuiStackLevelInfo> Results;
|
||
|
bool CopyToClipboardOnCtrlC;
|
||
|
float CopyToClipboardLastTime;
|
||
|
|
||
|
ImGuiIDStackTool() { memset(this, 0, sizeof(*this)); CopyToClipboardLastTime = -FLT_MAX; }
|
||
|
ImGuiIDStackTool() { memset(this, 0, sizeof(*this)); LastActiveFrame = -1; OptHexEncodeNonAsciiChars = true; CopyToClipboardLastTime = -FLT_MAX; }
|
||
|
};
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
| ... | ... | |
|
struct ImGuiContext
|
||
|
{
|
||
|
bool Initialized;
|
||
|
bool FontAtlasOwnedByContext; // IO.Fonts-> is owned by the ImGuiContext and will be destructed along with it.
|
||
|
bool WithinFrameScope; // Set by NewFrame(), cleared by EndFrame()
|
||
|
bool WithinFrameScopeWithImplicitWindow; // Set by NewFrame(), cleared by EndFrame() when the implicit debug window has been pushed
|
||
|
bool TestEngineHookItems; // Will call test engine hooks: ImGuiTestEngineHook_ItemAdd(), ImGuiTestEngineHook_ItemInfo(), ImGuiTestEngineHook_Log()
|
||
|
int FrameCount;
|
||
|
int FrameCountEnded;
|
||
|
int FrameCountRendered;
|
||
|
double Time;
|
||
|
char ContextName[16]; // Storage for a context name (to facilitate debugging multi-context setups)
|
||
|
ImGuiIO IO;
|
||
|
ImGuiPlatformIO PlatformIO;
|
||
|
ImGuiStyle Style;
|
||
|
ImFont* Font; // (Shortcut) == FontStack.empty() ? IO.Font : FontStack.back()
|
||
|
float FontSize; // (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text height for current window.
|
||
|
float FontBaseSize; // (Shortcut) == IO.FontGlobalScale * Font->Scale * Font->FontSize. Base text height.
|
||
|
float FontScale; // == FontSize / Font->FontSize
|
||
|
float CurrentDpiScale; // Current window/viewport DpiScale
|
||
|
ImVector<ImFontAtlas*> FontAtlases; // List of font atlases used by the context (generally only contains g.IO.Fonts aka the main font atlas)
|
||
|
ImFont* Font; // Currently bound font. (== FontStack.back().Font)
|
||
|
ImFontBaked* FontBaked; // Currently bound font at currently bound size. (== Font->GetFontBaked(FontSize))
|
||
|
float FontSize; // Currently bound font size == line height (== FontSizeBase + externals scales applied in the UpdateCurrentFontSize() function).
|
||
|
float FontSizeBase; // Font size before scaling == style.FontSizeBase == value passed to PushFont() when specified.
|
||
|
float FontBakedScale; // == FontBaked->Size / FontSize. Scale factor over baked size. Rarely used nowadays, very often == 1.0f.
|
||
|
float FontRasterizerDensity; // Current font density. Used by all calls to GetFontBaked().
|
||
|
float CurrentDpiScale; // Current window/viewport DpiScale == CurrentViewport->DpiScale
|
||
|
ImDrawListSharedData DrawListSharedData;
|
||
|
double Time;
|
||
|
int FrameCount;
|
||
|
int FrameCountEnded;
|
||
|
int FrameCountRendered;
|
||
|
bool WithinFrameScope; // Set by NewFrame(), cleared by EndFrame()
|
||
|
bool WithinFrameScopeWithImplicitWindow; // Set by NewFrame(), cleared by EndFrame() when the implicit debug window has been pushed
|
||
|
bool WithinEndChild; // Set within EndChild()
|
||
|
bool GcCompactAll; // Request full GC
|
||
|
bool TestEngineHookItems; // Will call test engine hooks: ImGuiTestEngineHook_ItemAdd(), ImGuiTestEngineHook_ItemInfo(), ImGuiTestEngineHook_Log()
|
||
|
ImGuiID WithinEndChildID; // Set within EndChild()
|
||
|
void* TestEngine; // Test engine user data
|
||
|
char ContextName[16]; // Storage for a context name (to facilitate debugging multi-context setups)
|
||
|
|
||
|
// Inputs
|
||
|
ImVector<ImGuiInputEvent> InputEventsQueue; // Input events which will be trickled/written into IO structure.
|
||
| ... | ... | |
|
ImVector<ImGuiWindowStackData> CurrentWindowStack;
|
||
|
ImGuiStorage WindowsById; // Map window's ImGuiID to ImGuiWindow*
|
||
|
int WindowsActiveCount; // Number of unique windows submitted by frame
|
||
|
ImVec2 WindowsHoverPadding; // Padding around resizable windows for which hovering on counts as hovering the window == ImMax(style.TouchExtraPadding, WINDOWS_HOVER_PADDING).
|
||
|
float WindowsBorderHoverPadding; // Padding around resizable windows for which hovering on counts as hovering the window == ImMax(style.TouchExtraPadding, style.WindowBorderHoverPadding). This isn't so multi-dpi friendly.
|
||
|
ImGuiID DebugBreakInWindow; // Set to break in Begin() call.
|
||
|
ImGuiWindow* CurrentWindow; // Window being drawn into
|
||
|
ImGuiWindow* HoveredWindow; // Window the mouse is hovering. Will typically catch mouse inputs.
|
||
| ... | ... | |
|
ImVec2 WheelingAxisAvg;
|
||
|
|
||
|
// Item/widgets state and tracking information
|
||
|
ImGuiID DebugDrawIdConflicts; // Set when we detect multiple items with the same identifier
|
||
|
ImGuiID DebugHookIdInfo; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by ID Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
|
||
|
ImGuiID DebugDrawIdConflictsId; // Set when we detect multiple items with the same identifier
|
||
|
ImGuiID DebugHookIdInfoId; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by ID Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
|
||
|
ImGuiID HoveredId; // Hovered widget, filled during the frame
|
||
|
ImGuiID HoveredIdPreviousFrame;
|
||
|
int HoveredIdPreviousFrameItemCount; // Count numbers of items using the same ID as last frame's hovered id
|
||
| ... | ... | |
|
bool ActiveIdHasBeenEditedBefore; // Was the value associated to the widget Edited over the course of the Active state.
|
||
|
bool ActiveIdHasBeenEditedThisFrame;
|
||
|
bool ActiveIdFromShortcut;
|
||
|
int ActiveIdMouseButton : 8;
|
||
|
ImS8 ActiveIdMouseButton;
|
||
|
ImGuiID ActiveIdDisabledId; // When clicking a disabled item we set ActiveId=window->MoveId to avoid interference with widget code. Actual item ID is stored here.
|
||
|
ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
|
||
|
ImGuiWindow* ActiveIdWindow;
|
||
|
ImGuiInputSource ActiveIdSource; // Activating source: ImGuiInputSource_Mouse OR ImGuiInputSource_Keyboard OR ImGuiInputSource_Gamepad
|
||
|
ImGuiWindow* ActiveIdWindow;
|
||
|
ImGuiID ActiveIdPreviousFrame;
|
||
|
bool ActiveIdPreviousFrameIsAlive;
|
||
|
bool ActiveIdPreviousFrameHasBeenEditedBefore;
|
||
|
ImGuiWindow* ActiveIdPreviousFrameWindow;
|
||
|
ImGuiDeactivatedItemData DeactivatedItemData;
|
||
|
ImGuiDataTypeStorage ActiveIdValueOnActivation; // Backup of initial value at the time of activation. ONLY SET BY SPECIFIC WIDGETS: DragXXX and SliderXXX.
|
||
|
ImGuiID LastActiveId; // Store the last non-zero ActiveId, useful for animation.
|
||
|
float LastActiveIdTimer; // Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.
|
||
|
|
||
| ... | ... | |
|
ImGuiLastItemData LastItemData; // Storage for last submitted item (setup by ItemAdd)
|
||
|
ImGuiNextWindowData NextWindowData; // Storage for SetNextWindow** functions
|
||
|
bool DebugShowGroupRects;
|
||
|
bool GcCompactAll; // Request full GC
|
||
|
|
||
|
// Shared stacks
|
||
|
ImGuiCol DebugFlashStyleColorIdx; // (Keep close to ColorStack to share cache line)
|
||
|
ImVector<ImGuiColorMod> ColorStack; // Stack for PushStyleColor()/PopStyleColor() - inherited by Begin()
|
||
|
ImVector<ImGuiStyleMod> StyleVarStack; // Stack for PushStyleVar()/PopStyleVar() - inherited by Begin()
|
||
|
ImVector<ImFont*> FontStack; // Stack for PushFont()/PopFont() - inherited by Begin()
|
||
|
ImVector<ImFontStackData> FontStack; // Stack for PushFont()/PopFont() - inherited by Begin()
|
||
|
ImVector<ImGuiFocusScopeData> FocusScopeStack; // Stack for PushFocusScope()/PopFocusScope() - inherited by BeginChild(), pushed into by Begin()
|
||
|
ImVector<ImGuiItemFlags> ItemFlagsStack; // Stack for PushItemFlag()/PopItemFlag() - inherited by Begin()
|
||
|
ImVector<ImGuiGroupData> GroupStack; // Stack for BeginGroup()/EndGroup() - not inherited by Begin()
|
||
| ... | ... | |
|
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusedWindow'
|
||
|
ImGuiID NavFocusScopeId; // Focused focus scope (e.g. selection code often wants to "clear other items" when landing on an item of the same scope)
|
||
|
ImGuiNavLayer NavLayer; // Focused layer (main scrolling layer, or menu/title bar layer)
|
||
|
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItem()
|
||
|
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItemByID()
|
||
|
ImGuiID NavActivateDownId; // ~~ IsKeyDown(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyDown(ImGuiKey_NavGamepadActivate) ? NavId : 0
|
||
|
ImGuiID NavActivatePressedId; // ~~ IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate) ? NavId : 0 (no repeat)
|
||
|
ImGuiActivateFlags NavActivateFlags;
|
||
|
ImVector<ImGuiFocusScopeData> NavFocusRoute; // Reversed copy focus scope stack for NavId (should contains NavFocusScopeId). This essentially follow the window->ParentWindowForFocusRoute chain.
|
||
|
ImGuiID NavHighlightActivatedId;
|
||
|
float NavHighlightActivatedTimer;
|
||
|
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame.
|
||
|
ImGuiID NavNextActivateId; // Set by ActivateItemByID(), queued until next frame.
|
||
|
ImGuiActivateFlags NavNextActivateFlags;
|
||
|
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS CAN ONLY BE ImGuiInputSource_Keyboard or ImGuiInputSource_Mouse
|
||
|
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS CAN ONLY BE ImGuiInputSource_Keyboard or ImGuiInputSource_Gamepad
|
||
|
ImGuiSelectionUserData NavLastValidSelectionUserData; // Last valid data passed to SetNextItemSelectionUser(), or -1. For current window. Not reset when focusing an item that doesn't have selection data.
|
||
|
ImS8 NavCursorHideFrames;
|
||
|
//ImGuiID NavActivateInputId; // Removed in 1.89.4 (July 2023). This is now part of g.NavActivateId and sets g.NavActivateFlags |= ImGuiActivateFlags_PreferInput. See commit c9a53aa74, issue #5606.
|
||
|
|
||
|
// Navigation: Init & Move Requests
|
||
|
bool NavAnyRequest; // ~~ NavMoveRequest || NavInitRequest this is to perform early out in ItemAdd()
|
||
| ... | ... | |
|
bool NavJustMovedToIsTabbing; // Copy of ImGuiNavMoveFlags_IsTabbing. Maybe we should store whole flags.
|
||
|
bool NavJustMovedToHasSelectionData; // Copy of move result's ItemFlags & ImGuiItemFlags_HasSelectionUserData). Maybe we should just store ImGuiNavItemData.
|
||
|
|
||
|
// Navigation: Windowing (CTRL+TAB for list, or Menu button + keys or directional pads to move/resize)
|
||
|
// Navigation: Windowing (Ctrl+Tab for list, or Menu button + keys or directional pads to move/resize)
|
||
|
bool ConfigNavWindowingWithGamepad; // = true. Enable Ctrl+Tab by holding ImGuiKey_GamepadFaceLeft (== ImGuiKey_NavGamepadMenu). When false, the button may still be used to toggle Menu layer.
|
||
|
ImGuiKeyChord ConfigNavWindowingKeyNext; // = ImGuiMod_Ctrl | ImGuiKey_Tab (or ImGuiMod_Super | ImGuiKey_Tab on OS X). For reconfiguration (see #4828)
|
||
|
ImGuiKeyChord ConfigNavWindowingKeyPrev; // = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab (or ImGuiMod_Super | ImGuiMod_Shift | ImGuiKey_Tab on OS X)
|
||
|
ImGuiWindow* NavWindowingTarget; // Target window when doing CTRL+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most!
|
||
|
ImGuiWindow* NavWindowingTarget; // Target window when doing Ctrl+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most!
|
||
|
ImGuiWindow* NavWindowingTargetAnim; // Record of last valid NavWindowingTarget until DimBgRatio and NavWindowingHighlightAlpha becomes 0.0f, so the fade-out can stay on it.
|
||
|
ImGuiWindow* NavWindowingListWindow; // Internal window actually listing the CTRL+Tab contents
|
||
|
ImGuiWindow* NavWindowingListWindow; // Internal window actually listing the Ctrl+Tab contents
|
||
|
float NavWindowingTimer;
|
||
|
float NavWindowingHighlightAlpha;
|
||
|
bool NavWindowingToggleLayer;
|
||
|
ImGuiKey NavWindowingToggleKey;
|
||
|
ImGuiInputSource NavWindowingInputSource;
|
||
|
bool NavWindowingToggleLayer; // Set while Alt or GamepadMenu is held, may be cleared by other operations, and processed when releasing the key.
|
||
|
ImGuiKey NavWindowingToggleKey; // Keyboard/gamepad key used when toggling to menu layer.
|
||
|
ImVec2 NavWindowingAccumDeltaPos;
|
||
|
ImVec2 NavWindowingAccumDeltaSize;
|
||
|
|
||
|
// 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)
|
||
|
|
||
|
// Drag and Drop
|
||
|
bool DragDropActive;
|
||
| ... | ... | |
|
ImRect DragDropTargetRect; // Store rectangle of current target candidate (we favor small targets when overlapping)
|
||
|
ImRect DragDropTargetClipRect; // Store ClipRect at the time of item's drawing
|
||
|
ImGuiID DragDropTargetId;
|
||
|
ImGuiDragDropFlags DragDropAcceptFlags;
|
||
|
ImGuiID DragDropTargetFullViewport;
|
||
|
ImGuiDragDropFlags DragDropAcceptFlagsCurr;
|
||
|
ImGuiDragDropFlags DragDropAcceptFlagsPrev;
|
||
|
float DragDropAcceptIdCurrRectSurface; // Target item surface (we resolve overlapping targets by prioritizing the smaller surface)
|
||
|
ImGuiID DragDropAcceptIdCurr; // Target item id (set at the time of accepting the payload)
|
||
|
ImGuiID DragDropAcceptIdPrev; // Target item id from previous frame (we need to store this to allow for overlapping drag and drop targets)
|
||
| ... | ... | |
|
|
||
|
// Widget state
|
||
|
ImGuiInputTextState InputTextState;
|
||
|
ImGuiTextIndex InputTextLineIndex; // Temporary storage
|
||
|
ImGuiInputTextDeactivatedState InputTextDeactivatedState;
|
||
|
ImFont InputTextPasswordFont;
|
||
|
ImGuiID TempInputId; // Temporary text input when CTRL+clicking on a slider, etc.
|
||
|
ImFontBaked InputTextPasswordFontBackupBaked;
|
||
|
ImFontFlags InputTextPasswordFontBackupFlags;
|
||
|
ImGuiID TempInputId; // Temporary text input when using Ctrl+Click on a slider, etc.
|
||
|
ImGuiDataTypeStorage DataTypeZeroValue; // 0 for all data types
|
||
|
int BeginMenuDepth;
|
||
|
int BeginComboDepth;
|
||
| ... | ... | |
|
ImGuiTypingSelectState TypingSelectState; // State for GetTypingSelectRequest()
|
||
|
|
||
|
// Platform support
|
||
|
ImGuiPlatformImeData PlatformImeData; // Data updated by current frame
|
||
|
ImGuiPlatformImeData PlatformImeData; // Data updated by current frame. Will be applied at end of the frame. For some backends, this is required to have WantVisible=true in order to receive text message.
|
||
|
ImGuiPlatformImeData PlatformImeDataPrev; // Previous frame data. When changed we call the platform_io.Platform_SetImeDataFn() handler.
|
||
|
|
||
|
// Extensions
|
||
|
// FIXME: We could provide an API to register one slot in an array held in ImGuiContext?
|
||
|
ImVector<ImTextureData*> UserTextures; // List of textures created/managed by user or third-party extension. Automatically appended into platform_io.Textures[].
|
||
|
|
||
|
// Settings
|
||
|
bool SettingsLoaded;
|
||
|
float SettingsDirtyTimer; // Save .ini Settings to memory when time reaches zero
|
||
| ... | ... | |
|
|
||
|
// Capture/Logging
|
||
|
bool LogEnabled; // Currently capturing
|
||
|
bool LogLineFirstItem;
|
||
|
ImGuiLogFlags LogFlags; // Capture flags/type
|
||
|
ImGuiWindow* LogWindow;
|
||
|
ImFileHandle LogFile; // If != NULL log to stdout/ file
|
||
|
ImGuiTextBuffer LogBuffer; // Accumulation buffer when log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators.
|
||
|
const char* LogNextPrefix;
|
||
|
const char* LogNextPrefix; // See comment in LogSetNextTextDecoration(): doesn't copy underlying data, use carefully!
|
||
|
const char* LogNextSuffix;
|
||
|
float LogLinePosY;
|
||
|
bool LogLineFirstItem;
|
||
|
int LogDepthRef;
|
||
|
int LogDepthToExpand;
|
||
|
int LogDepthToExpandDefault; // Default/stored value for LogDepthMaxExpand if not specified in the LogXXX function call.
|
||
| ... | ... | |
|
|
||
|
// Debug Tools
|
||
|
// (some of the highly frequently used data are interleaved in other structures above: DebugBreakXXX fields, DebugHookIdInfo, DebugLocateId etc.)
|
||
|
int DebugDrawIdConflictsCount; // Locked count (preserved when holding CTRL)
|
||
|
int DebugDrawIdConflictsCount; // Locked count (preserved when holding Ctrl)
|
||
|
ImGuiDebugLogFlags DebugLogFlags;
|
||
|
ImGuiTextBuffer DebugLogBuf;
|
||
|
ImGuiTextIndex DebugLogIndex;
|
||
| ... | ... | |
|
float DebugFlashStyleColorTime;
|
||
|
ImVec4 DebugFlashStyleColorBackup;
|
||
|
ImGuiMetricsConfig DebugMetricsConfig;
|
||
|
ImGuiDebugItemPathQuery DebugItemPathQuery;
|
||
|
ImGuiIDStackTool DebugIDStackTool;
|
||
|
ImGuiDebugAllocInfo DebugAllocInfo;
|
||
|
#if defined(IMGUI_DEBUG_HIGHLIGHT_ALL_ID_CONFLICTS) && !defined(IMGUI_DISABLE_DEBUG_TOOLS)
|
||
|
ImGuiStorage DebugDrawIdConflictsAliveCount;
|
||
|
ImGuiStorage DebugDrawIdConflictsHighlightSet;
|
||
|
#endif
|
||
|
|
||
|
// Misc
|
||
|
float FramerateSecPerFrame[60]; // Calculate estimate of framerate for user over the last 60 frames..
|
||
| ... | ... | |
|
float FramerateSecPerFrameAccum;
|
||
|
int WantCaptureMouseNextFrame; // Explicit capture override via SetNextFrameWantCaptureMouse()/SetNextFrameWantCaptureKeyboard(). Default to -1.
|
||
|
int WantCaptureKeyboardNextFrame; // "
|
||
|
int WantTextInputNextFrame;
|
||
|
int WantTextInputNextFrame; // Copied in EndFrame() from g.PlatformImeData.WantTextInput. Needs to be set for some backends (SDL3) to emit character inputs.
|
||
|
ImVector<char> TempBuffer; // Temporary text buffer
|
||
|
char TempKeychordName[64];
|
||
|
|
||
|
ImGuiContext(ImFontAtlas* shared_font_atlas);
|
||
|
~ImGuiContext();
|
||
|
};
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
| ... | ... | |
|
ImVec2 MenuBarOffset; // MenuBarOffset.x is sort of equivalent of a per-layer CursorPos.x, saved/restored as we switch to the menu bar. The only situation when MenuBarOffset.y is > 0 if when (SafeAreaPadding.y > FramePadding.y), often used on TVs.
|
||
|
ImGuiMenuColumns MenuColumns; // Simplified columns storage for menu items measurement
|
||
|
int TreeDepth; // Current tree depth.
|
||
|
ImU32 TreeHasStackDataDepthMask; // Store whether given depth has ImGuiTreeNodeStackData data. Could be turned into a ImU64 if necessary.
|
||
|
ImU32 TreeHasStackDataDepthMask; // Store whether given depth has ImGuiTreeNodeStackData data. Could be turned into a ImU64 if necessary.
|
||
|
ImU32 TreeRecordsClippedNodesY2Mask; // Store whether we should keep recording Y2. Cleared when passing clip max. Equivalent TreeHasStackDataDepthMask value should always be set.
|
||
|
ImVector<ImGuiWindow*> ChildWindows;
|
||
|
ImGuiStorage* StateStorage; // Current persistent per-window storage (store e.g. tree node open/close state)
|
||
|
ImGuiOldColumns* CurrentColumns; // Current columns set
|
||
| ... | ... | |
|
ImGuiLayoutType LayoutType;
|
||
|
ImGuiLayoutType ParentLayoutType; // Layout type of parent window at the time of Begin()
|
||
|
ImU32 ModalDimBgColor;
|
||
|
ImGuiItemStatusFlags WindowItemStatusFlags;
|
||
|
ImGuiItemStatusFlags ChildItemStatusFlags;
|
||
|
|
||
|
// Local parameters stacks
|
||
|
// We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.
|
||
| ... | ... | |
|
ImVec2 ScrollTargetEdgeSnapDist; // 0.0f = no snapping, >0.0f snapping threshold
|
||
|
ImVec2 ScrollbarSizes; // Size taken by each scrollbars on their smaller axis. Pay attention! ScrollbarSizes.x == width of the vertical scrollbar, ScrollbarSizes.y = height of the horizontal scrollbar.
|
||
|
bool ScrollbarX, ScrollbarY; // Are scrollbars visible?
|
||
|
bool ScrollbarXStabilizeEnabled; // Was ScrollbarX previously auto-stabilized?
|
||
|
ImU8 ScrollbarXStabilizeToggledHistory; // Used to stabilize scrollbar visibility in case of feedback loops
|
||
|
bool Active; // Set to true on Begin(), unless Collapsed
|
||
|
bool WasActive;
|
||
|
bool WriteAccessed; // Set to true when any widget access the current window
|
||
| ... | ... | |
|
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 FocusOrder; // Order within WindowsFocusOrder[], altered when windows are focused.
|
||
|
ImGuiDir AutoPosLastDirection;
|
||
|
ImS8 AutoFitFramesX, AutoFitFramesY;
|
||
|
bool AutoFitOnlyGrows;
|
||
|
ImGuiDir AutoPosLastDirection;
|
||
|
ImS8 HiddenFramesCanSkipItems; // Hide the window for N frames
|
||
|
ImS8 HiddenFramesCannotSkipItems; // Hide the window for N frames while allowing items to be submitted so we can measure their size
|
||
|
ImS8 HiddenFramesForRenderOnly; // Hide the window until frame N at Render() time only
|
||
|
ImS8 DisableInputsFrames; // Disable window interactions for N frames
|
||
|
ImGuiWindowBgClickFlags BgClickFlags : 8; // Configure behavior of click+dragging on window bg/void or over items. Default sets by io.ConfigWindowsMoveFromTitleBarOnly. If you use this please report in #3379.
|
||
|
ImGuiCond SetWindowPosAllowFlags : 8; // store acceptable condition flags for SetNextWindowPos() use.
|
||
|
ImGuiCond SetWindowSizeAllowFlags : 8; // store acceptable condition flags for SetNextWindowSize() use.
|
||
|
ImGuiCond SetWindowCollapsedAllowFlags : 8; // store acceptable condition flags for SetNextWindowCollapsed() use.
|
||
| ... | ... | |
|
ImGuiStorage StateStorage;
|
||
|
ImVector<ImGuiOldColumns> ColumnsStorage;
|
||
|
float FontWindowScale; // User scale multiplier per-window, via SetWindowFontScale()
|
||
|
float FontWindowScaleParents;
|
||
|
float FontRefSize; // This is a copy of window->CalcFontSize() at the time of Begin(), trying to phase out CalcFontSize() especially as it may be called on non-current window.
|
||
|
int SettingsOffset; // Offset into SettingsWindows[] (offsets are always valid as we only grow the array from the back)
|
||
|
|
||
|
ImDrawList* DrawList; // == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer)
|
||
| ... | ... | |
|
ImGuiWindow* RootWindowPopupTree; // Point to ourself or first ancestor that is not a child window. Cross through popups parent<>child.
|
||
|
ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
|
||
|
ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag.
|
||
|
ImGuiWindow* ParentWindowForFocusRoute; // Set to manual link a window to its logical parent so that Shortcut() chain are honoerd (e.g. Tool linked to Document)
|
||
|
ImGuiWindow* ParentWindowForFocusRoute; // Set to manual link a window to its logical parent so that Shortcut() chain are honored (e.g. Tool linked to Document)
|
||
|
|
||
|
ImGuiWindow* NavLastChildNavWindow; // When going to the menu bar, we remember the child window we came from. (This could probably be made implicit if we kept g.Windows sorted by last focused including child window.)
|
||
|
ImGuiID NavLastIds[ImGuiNavLayer_COUNT]; // Last known NavId for this window, per layer (0/1)
|
||
| ... | ... | |
|
|
||
|
// 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); }
|
||
|
float CalcFontSize() const { ImGuiContext& g = *Ctx; float scale = g.FontBaseSize * FontWindowScale; if (ParentWindow) scale *= ParentWindow->FontWindowScale; return scale; }
|
||
|
ImRect TitleBarRect() const { return ImRect(Pos, ImVec2(Pos.x + SizeFull.x, Pos.y + TitleBarHeight)); }
|
||
|
ImRect MenuBarRect() const { float y1 = Pos.y + TitleBarHeight; return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight); }
|
||
|
|
||
|
// [OBSOLETE] ImGuiWindow::CalcFontSize() was removed in 1.92.0 because error-prone/misleading. You can use window->FontRefSize for a copy of g.FontSize at the time of the last Begin() call for this window.
|
||
|
//float CalcFontSize() const { ImGuiContext& g = *Ctx; return g.FontSizeBase * FontWindowScale * FontWindowScaleParents;
|
||
|
};
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
| ... | ... | |
|
ImGuiTabItemFlags_SectionMask_ = ImGuiTabItemFlags_Leading | ImGuiTabItemFlags_Trailing,
|
||
|
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_Invisible = 1 << 22, // To reserve space e.g. with ImGuiTabItemFlags_Leading
|
||
|
//ImGuiTabItemFlags_Unsorted = 1 << 23, // [Docking] Trailing tabs with the _Unsorted flag will be sorted based on the DockOrder of their Window.
|
||
|
};
|
||
|
|
||
|
// Storage for one active tab item (sizeof() 40 bytes)
|
||
| ... | ... | |
|
int LastFrameSelected; // This allows us to infer an ordered list of the last activated tabs with little maintenance
|
||
|
float Offset; // Position relative to beginning of tab
|
||
|
float Width; // Width currently displayed
|
||
|
float ContentWidth; // Width of label, stored during BeginTabItem() call
|
||
|
float ContentWidth; // Width of label + padding, stored during BeginTabItem() call (misnamed as "Content" would normally imply width of label only)
|
||
|
float RequestedWidth; // Width optionally requested by caller, -1.0f is unused
|
||
|
ImS32 NameOffset; // When Window==NULL, offset to name within parent ImGuiTabBar::TabsNames
|
||
|
ImS16 BeginOrder; // BeginTabItem() order, used to re-order tabs after toggling ImGuiTabBarFlags_Reorderable
|
||
| ... | ... | |
|
ImGuiID ID; // Zero for tab-bars used by docking
|
||
|
ImGuiID SelectedTabId; // Selected tab/window
|
||
|
ImGuiID NextSelectedTabId; // Next selected tab/window. Will also trigger a scrolling animation
|
||
|
ImGuiID VisibleTabId; // Can occasionally be != SelectedTabId (e.g. when previewing contents for CTRL+TAB preview)
|
||
|
ImGuiID VisibleTabId; // Can occasionally be != SelectedTabId (e.g. when previewing contents for Ctrl+Tab preview)
|
||
|
int CurrFrameVisible;
|
||
|
int PrevFrameVisible;
|
||
|
ImRect BarRect;
|
||
|
float BarRectPrevWidth; // Backup of previous width. When width change we enforce keep horizontal scroll on focused tab.
|
||
|
float CurrTabsContentsHeight;
|
||
|
float PrevTabsContentsHeight; // Record the height of contents submitted below the tab bar
|
||
|
float WidthAllTabs; // Actual width of all tabs (locked during layout)
|
||
| ... | ... | |
|
bool WantLayout;
|
||
|
bool VisibleTabWasSubmitted;
|
||
|
bool TabsAddedNew; // Set to true when a new tab item or button has been added to the tab bar during last frame
|
||
|
bool ScrollButtonEnabled;
|
||
|
ImS16 TabsActiveCount; // Number of tabs submitted this frame.
|
||
|
ImS16 LastTabItemIdx; // Index of last BeginTabItem() tab for use by EndTabItem()
|
||
|
float ItemSpacingY;
|
||
| ... | ... | |
|
//-----------------------------------------------------------------------------
|
||
|
|
||
|
#define IM_COL32_DISABLE IM_COL32(0,0,0,1) // Special sentinel code which cannot be used as a regular color.
|
||
|
#define IMGUI_TABLE_MAX_COLUMNS 512 // May be further lifted
|
||
|
|
||
|
// Our current column maximum is 64 but we may raise that in the future.
|
||
|
typedef ImS16 ImGuiTableColumnIdx;
|
||
|
typedef ImU16 ImGuiTableDrawChannelIdx;
|
||
|
#define IMGUI_TABLE_MAX_COLUMNS 512 // Arbitrary "safety" maximum, may be lifted in the future if needed. Must fit in ImGuiTableColumnIdx/ImGuiTableDrawChannelIdx.
|
||
|
|
||
|
// [Internal] sizeof() ~ 112
|
||
|
// We use the terminology "Enabled" to refer to a column that is not Hidden by user/api.
|
||
| ... | ... | |
|
{
|
||
|
ImGuiID ID;
|
||
|
ImGuiTableFlags Flags;
|
||
|
void* RawData; // Single allocation to hold Columns[], DisplayOrderToIndex[] and RowCellData[]
|
||
|
void* RawData; // Single allocation to hold Columns[], DisplayOrderToIndex[], and RowCellData[]
|
||
|
ImGuiTableTempData* TempData; // Transient data while table is active. Point within g.CurrentTableStack[]
|
||
|
ImSpan<ImGuiTableColumn> Columns; // Point within RawData[]
|
||
|
ImSpan<ImGuiTableColumnIdx> DisplayOrderToIndex; // Point within RawData[]. Store display order of columns (when not reordered, the values are 0...Count-1)
|
||
| ... | ... | |
|
int ColumnsCount; // Number of columns declared in BeginTable()
|
||
|
int CurrentRow;
|
||
|
int CurrentColumn;
|
||
|
ImS16 InstanceCurrent; // Count of BeginTable() calls with same ID in the same frame (generally 0). This is a little bit similar to BeginCount for a window, but multiple table with same ID look are multiple tables, they are just synched.
|
||
|
ImS16 InstanceCurrent; // Count of BeginTable() calls with same ID in the same frame (generally 0). This is a little bit similar to BeginCount for a window, but multiple tables with the same ID are multiple tables, they are just synced.
|
||
|
ImS16 InstanceInteracted; // Mark which instance (generally 0) of the same ID is being interacted with
|
||
|
float RowPosY1;
|
||
|
float RowPosY2;
|
||
| ... | ... | |
|
float AngledHeadersHeight; // Set by TableAngledHeadersRow(), used in TableUpdateLayout()
|
||
|
float AngledHeadersSlope; // Set by TableAngledHeadersRow(), used in TableUpdateLayout()
|
||
|
ImRect OuterRect; // Note: for non-scrolling table, OuterRect.Max.y is often FLT_MAX until EndTable(), unless a height has been specified in BeginTable().
|
||
|
ImRect InnerRect; // InnerRect but without decoration. As with OuterRect, for non-scrolling tables, InnerRect.Max.y is
|
||
|
ImRect InnerRect; // InnerRect but without decoration. As with OuterRect, for non-scrolling tables, InnerRect.Max.y is "
|
||
|
ImRect WorkRect;
|
||
|
ImRect InnerClipRect;
|
||
|
ImRect BgClipRect; // We use this to cpu-clip cell background color fill, evolve during the frame as we cross frozen rows boundaries
|
||
| ... | ... | |
|
ImGuiTableDrawChannelIdx DummyDrawChannel; // Redirect non-visible columns here.
|
||
|
ImGuiTableDrawChannelIdx Bg2DrawChannelCurrent; // For Selectable() and other widgets drawing across columns after the freezing line. Index within DrawSplitter.Channels[]
|
||
|
ImGuiTableDrawChannelIdx Bg2DrawChannelUnfrozen;
|
||
|
ImS8 NavLayer; // ImGuiNavLayer at the time of BeginTable().
|
||
|
bool IsLayoutLocked; // Set by TableUpdateLayout() which is called when beginning the first row.
|
||
|
bool IsInsideRow; // Set when inside TableBeginRow()/TableEndRow().
|
||
|
bool IsInitializing;
|
||
|
bool IsSortSpecsDirty;
|
||
|
bool IsUsingHeaders; // Set when the first row had the ImGuiTableRowFlags_Headers flag.
|
||
|
bool IsContextPopupOpen; // Set when default context menu is open (also see: ContextPopupColumn, InstanceInteracted).
|
||
|
bool DisableDefaultContextMenu; // Disable default context menu contents. You may submit your own using TableBeginContextMenuPopup()/EndPopup()
|
||
|
bool DisableDefaultContextMenu; // Disable default context menu. You may submit your own using TableBeginContextMenuPopup()/EndPopup()
|
||
|
bool IsSettingsRequestLoad;
|
||
|
bool IsSettingsDirty; // Set when table settings have changed and needs to be reported into ImGuiTableSetttings data.
|
||
|
bool IsSettingsDirty; // Set when table settings have changed and needs to be reported into ImGuiTableSettings data.
|
||
|
bool IsDefaultDisplayOrder; // Set when display order is unchanged from default (DisplayOrder contains 0...Count-1)
|
||
|
bool IsResetAllRequest;
|
||
|
bool IsResetDisplayOrderRequest;
|
||
| ... | ... | |
|
// sizeof() ~ 136 bytes.
|
||
|
struct IMGUI_API ImGuiTableTempData
|
||
|
{
|
||
|
ImGuiID WindowID; // Shortcut to g.Tables[TableIndex]->OuterWindow->ID.
|
||
|
int TableIndex; // Index in g.Tables.Buf[] pool
|
||
|
float LastTimeActive; // Last timestamp this structure was used
|
||
|
float AngledHeadersExtraWidth; // Used in EndTable()
|
||
| ... | ... | |
|
ImGuiTableTempData() { memset(this, 0, sizeof(*this)); LastTimeActive = -1.0f; }
|
||
|
};
|
||
|
|
||
|
// sizeof() ~ 12
|
||
|
// sizeof() ~ 16
|
||
|
struct ImGuiTableColumnSettings
|
||
|
{
|
||
|
float WidthOrWeight;
|
||
| ... | ... | |
|
ImGuiTableColumnIdx DisplayOrder;
|
||
|
ImGuiTableColumnIdx SortOrder;
|
||
|
ImU8 SortDirection : 2;
|
||
|
ImU8 IsEnabled : 1; // "Visible" in ini file
|
||
|
ImS8 IsEnabled : 2; // "Visible" in ini file
|
||
|
ImU8 IsStretch : 1;
|
||
|
|
||
|
ImGuiTableColumnSettings()
|
||
| ... | ... | |
|
Index = -1;
|
||
|
DisplayOrder = SortOrder = -1;
|
||
|
SortDirection = ImGuiSortDirection_None;
|
||
|
IsEnabled = 1;
|
||
|
IsEnabled = -1;
|
||
|
IsStretch = 0;
|
||
|
}
|
||
|
};
|
||
| ... | ... | |
|
// If this ever crashes because g.CurrentWindow is NULL, it means that either:
|
||
|
// - ImGui::NewFrame() has never been called, which is illegal.
|
||
|
// - You are calling ImGui functions after ImGui::EndFrame()/ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal.
|
||
|
IMGUI_API ImGuiIO& GetIOEx(ImGuiContext* ctx);
|
||
|
IMGUI_API ImGuiIO& GetIO(ImGuiContext* ctx);
|
||
|
IMGUI_API ImGuiPlatformIO& GetPlatformIO(ImGuiContext* ctx);
|
||
|
inline ImGuiWindow* GetCurrentWindowRead() { ImGuiContext& g = *GImGui; return g.CurrentWindow; }
|
||
|
inline ImGuiWindow* GetCurrentWindow() { ImGuiContext& g = *GImGui; g.CurrentWindow->WriteAccessed = true; return g.CurrentWindow; }
|
||
|
IMGUI_API ImGuiWindow* FindWindowByID(ImGuiID id);
|
||
| ... | ... | |
|
IMGUI_API void UpdateWindowSkipRefresh(ImGuiWindow* window);
|
||
|
IMGUI_API ImVec2 CalcWindowNextAutoFitSize(ImGuiWindow* window);
|
||
|
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent, bool popup_hierarchy);
|
||
|
IMGUI_API bool IsWindowInBeginStack(ImGuiWindow* window);
|
||
|
IMGUI_API bool IsWindowWithinBeginStackOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
|
||
|
IMGUI_API bool IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_below);
|
||
|
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
|
||
| ... | ... | |
|
IMGUI_API void SetNextWindowRefreshPolicy(ImGuiWindowRefreshFlags flags);
|
||
|
|
||
|
// Fonts, drawing
|
||
|
IMGUI_API void SetCurrentFont(ImFont* font);
|
||
|
inline ImFont* GetDefaultFont() { ImGuiContext& g = *GImGui; return g.IO.FontDefault ? g.IO.FontDefault : g.IO.Fonts->Fonts[0]; }
|
||
|
IMGUI_API void RegisterUserTexture(ImTextureData* tex); // Register external texture. EXPERIMENTAL: DO NOT USE YET.
|
||
|
IMGUI_API void UnregisterUserTexture(ImTextureData* tex);
|
||
|
IMGUI_API void RegisterFontAtlas(ImFontAtlas* atlas);
|
||
|
IMGUI_API void UnregisterFontAtlas(ImFontAtlas* atlas);
|
||
|
IMGUI_API void SetCurrentFont(ImFont* font, float font_size_before_scaling, float font_size_after_scaling);
|
||
|
IMGUI_API void UpdateCurrentFontSize(float restore_font_size_after_scaling);
|
||
|
IMGUI_API void SetFontRasterizerDensity(float rasterizer_density);
|
||
|
inline float GetFontRasterizerDensity() { return GImGui->FontRasterizerDensity; }
|
||
|
inline float GetRoundedFontSize(float size) { return IM_ROUND(size); }
|
||
|
IMGUI_API ImFont* GetDefaultFont();
|
||
|
IMGUI_API void PushPasswordFont();
|
||
|
IMGUI_API void PopPasswordFont();
|
||
|
inline ImDrawList* GetForegroundDrawList(ImGuiWindow* window) { IM_UNUSED(window); return GetForegroundDrawList(); } // This seemingly unnecessary wrapper simplifies compatibility between the 'master' and 'docking' branches.
|
||
|
IMGUI_API ImDrawList* GetBackgroundDrawList(ImGuiViewport* viewport); // get background draw list for the given viewport. this draw list will be the first rendering one. Useful to quickly draw shapes/text behind dear imgui contents.
|
||
|
IMGUI_API ImDrawList* GetForegroundDrawList(ImGuiViewport* viewport); // get foreground draw list for the given viewport. this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents.
|
||
| ... | ... | |
|
|
||
|
// NewFrame
|
||
|
IMGUI_API void UpdateInputEvents(bool trickle_fast_inputs);
|
||
|
IMGUI_API void UpdateHoveredWindowAndCaptureFlags();
|
||
|
IMGUI_API void UpdateHoveredWindowAndCaptureFlags(const ImVec2& mouse_pos);
|
||
|
IMGUI_API void FindHoveredWindowEx(const ImVec2& pos, bool find_first_and_in_any_viewport, ImGuiWindow** out_hovered_window, ImGuiWindow** out_hovered_window_under_moving_window);
|
||
|
IMGUI_API void StartMouseMovingWindow(ImGuiWindow* window);
|
||
|
IMGUI_API void StopMouseMovingWindow();
|
||
|
IMGUI_API void UpdateMouseMovingWindowNewFrame();
|
||
|
IMGUI_API void UpdateMouseMovingWindowEndFrame();
|
||
|
|
||
| ... | ... | |
|
IMGUI_API void CallContextHooks(ImGuiContext* context, ImGuiContextHookType type);
|
||
|
|
||
|
// Viewports
|
||
|
IMGUI_API void ScaleWindowsInViewport(ImGuiViewportP* viewport, float scale);
|
||
|
IMGUI_API void SetWindowViewport(ImGuiWindow* window, ImGuiViewportP* viewport);
|
||
|
|
||
|
// Settings
|
||
| ... | ... | |
|
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id, ImGuiItemFlags item_flags);
|
||
|
IMGUI_API bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flags = 0);
|
||
|
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id);
|
||
|
IMGUI_API void SetLastItemData(ImGuiID item_id, ImGuiItemFlags in_flags, ImGuiItemStatusFlags status_flags, const ImRect& item_rect);
|
||
|
IMGUI_API void SetLastItemData(ImGuiID item_id, ImGuiItemFlags item_flags, ImGuiItemStatusFlags status_flags, const ImRect& item_rect);
|
||
|
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_w, float default_h);
|
||
|
IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x);
|
||
|
IMGUI_API void PushMultiItemsWidths(int components, float width_full);
|
||
|
IMGUI_API void ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_excess);
|
||
|
IMGUI_API void ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_excess, float width_min);
|
||
|
IMGUI_API void CalcClipRectVisibleItemsY(const ImRect& clip_rect, const ImVec2& pos, float items_height, int* out_visible_start, int* out_visible_end);
|
||
|
|
||
|
// Parameter stacks (shared)
|
||
|
IMGUI_API const ImGuiDataVarInfo* GetStyleVarInfo(ImGuiStyleVar idx);
|
||
|
IMGUI_API const ImGuiStyleVarInfo* GetStyleVarInfo(ImGuiStyleVar idx);
|
||
|
IMGUI_API void BeginDisabledOverrideReenable();
|
||
|
IMGUI_API void EndDisabledOverrideReenable();
|
||
|
|
||
| ... | ... | |
|
|
||
|
// Popups, Modals
|
||
|
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_window_flags);
|
||
|
IMGUI_API bool BeginPopupMenuEx(ImGuiID id, const char* label, ImGuiWindowFlags extra_window_flags);
|
||
|
IMGUI_API void OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags = ImGuiPopupFlags_None);
|
||
|
IMGUI_API void ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup);
|
||
|
IMGUI_API void ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup);
|
||
| ... | ... | |
|
IMGUI_API void NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags);
|
||
|
IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags);
|
||
|
IMGUI_API void NavMoveRequestResolveWithLastItem(ImGuiNavItemData* result);
|
||
|
IMGUI_API void NavMoveRequestResolveWithPastTreeNode(ImGuiNavItemData* result, ImGuiTreeNodeStackData* tree_node_data);
|
||
|
IMGUI_API void NavMoveRequestResolveWithPastTreeNode(ImGuiNavItemData* result, const ImGuiTreeNodeStackData* tree_node_data);
|
||
|
IMGUI_API void NavMoveRequestCancel();
|
||
|
IMGUI_API void NavMoveRequestApplyResult();
|
||
|
IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags);
|
||
| ... | ... | |
|
// This should be part of a larger set of API: FocusItem(offset = -1), FocusItemByID(id), ActivateItem(offset = -1), ActivateItemByID(id) etc. which are
|
||
|
// much harder to design and implement than expected. I have a couple of private branches on this matter but it's not simple. For now implementing the easy ones.
|
||
|
IMGUI_API void FocusItem(); // Focus last item (no selection/activation).
|
||
|
IMGUI_API void ActivateItemByID(ImGuiID id); // Activate an item by ID (button, checkbox, tree node etc.). Activation is queued and processed on the next frame when the item is encountered again.
|
||
Update Dear ImGui to version 1.92.5.