imgui_internal.h (imgui-1.86) | : | imgui_internal.h (imgui-1.87) | ||
---|---|---|---|---|
// dear imgui, v1.86 | // dear imgui, v1.87 | |||
// (internal structures/api) | // (internal structures/api) | |||
// You may use this file to debug, understand or extend ImGui features but we do n't provide any guarantee of forward compatibility! | // You may use this file to debug, understand or extend ImGui features but we do n't provide any guarantee of forward compatibility! | |||
// Set: | // Set: | |||
// #define IMGUI_DEFINE_MATH_OPERATORS | // #define IMGUI_DEFINE_MATH_OPERATORS | |||
// To implement maths operators for ImVec2 (disabled by default to not collide w ith using IM_VEC2_CLASS_EXTRA along with your own math types+operators) | // To implement maths operators for ImVec2 (disabled by default to not collide w ith using IM_VEC2_CLASS_EXTRA along with your own math types+operators) | |||
/* | /* | |||
Index of this file: | Index of this file: | |||
// [SECTION] Header mess | // [SECTION] Header mess | |||
// [SECTION] Forward declarations | // [SECTION] Forward declarations | |||
// [SECTION] Context pointer | // [SECTION] Context pointer | |||
// [SECTION] STB libraries includes | // [SECTION] STB libraries includes | |||
// [SECTION] Macros | // [SECTION] Macros | |||
// [SECTION] Generic helpers | // [SECTION] Generic helpers | |||
// [SECTION] ImDrawList support | // [SECTION] ImDrawList support | |||
// [SECTION] Widgets support: flags, enums, data structures | // [SECTION] Widgets support: flags, enums, data structures | |||
// [SECTION] Inputs support | ||||
// [SECTION] Clipper support | // [SECTION] Clipper support | |||
// [SECTION] Navigation support | // [SECTION] Navigation support | |||
// [SECTION] Columns support | // [SECTION] Columns support | |||
// [SECTION] Multi-select support | // [SECTION] Multi-select support | |||
// [SECTION] Docking support | // [SECTION] Docking support | |||
// [SECTION] Viewport support | // [SECTION] Viewport support | |||
// [SECTION] Settings support | // [SECTION] Settings support | |||
// [SECTION] Metrics, Debug tools | // [SECTION] Metrics, Debug tools | |||
// [SECTION] Generic context hooks | // [SECTION] Generic context hooks | |||
// [SECTION] ImGuiContext (main imgui context) | // [SECTION] ImGuiContext (main imgui context) | |||
skipping to change at line 202 | skipping to change at line 203 | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
// Debug Logging | // Debug Logging | |||
#ifndef IMGUI_DEBUG_LOG | #ifndef IMGUI_DEBUG_LOG | |||
#define IMGUI_DEBUG_LOG(_FMT,...) printf("[%05d] " _FMT, GImGui->FrameCoun t, __VA_ARGS__) | #define IMGUI_DEBUG_LOG(_FMT,...) printf("[%05d] " _FMT, GImGui->FrameCoun t, __VA_ARGS__) | |||
#endif | #endif | |||
// Debug Logging for selected systems. Remove the '((void)0) //' to enable. | // Debug Logging for selected systems. Remove the '((void)0) //' to enable. | |||
//#define IMGUI_DEBUG_LOG_POPUP IMGUI_DEBUG_LOG // Enable log | //#define IMGUI_DEBUG_LOG_POPUP IMGUI_DEBUG_LOG // Enable log | |||
//#define IMGUI_DEBUG_LOG_NAV IMGUI_DEBUG_LOG // Enable log | //#define IMGUI_DEBUG_LOG_NAV IMGUI_DEBUG_LOG // Enable log | |||
//#define IMGUI_DEBUG_LOG_IO IMGUI_DEBUG_LOG // Enable log | ||||
#define IMGUI_DEBUG_LOG_POPUP(...) ((void)0) // Disable log | #define IMGUI_DEBUG_LOG_POPUP(...) ((void)0) // Disable log | |||
#define IMGUI_DEBUG_LOG_NAV(...) ((void)0) // Disable log | #define IMGUI_DEBUG_LOG_NAV(...) ((void)0) // Disable log | |||
#define IMGUI_DEBUG_LOG_IO(...) ((void)0) // Disable log | ||||
// Static Asserts | // Static Asserts | |||
#if (__cplusplus >= 201100) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201100) | ||||
#define IM_STATIC_ASSERT(_COND) static_assert(_COND, "") | #define IM_STATIC_ASSERT(_COND) static_assert(_COND, "") | |||
#else | ||||
#define IM_STATIC_ASSERT(_COND) typedef char static_assertion_##__line__ | ||||
[(_COND)?1:-1] | ||||
#endif | ||||
// "Paranoid" Debug Asserts are meant to only be enabled during specific debuggi ng/work, otherwise would slow down the code too much. | // "Paranoid" Debug Asserts are meant to only be enabled during specific debuggi ng/work, otherwise would slow down the code too much. | |||
// We currently don't have many of those so the effect is currently negligible, but onward intent to add more aggressive ones in the code. | // We currently don't have many of those so the effect is currently negligible, but onward intent to add more aggressive ones in the code. | |||
//#define IMGUI_DEBUG_PARANOID | //#define IMGUI_DEBUG_PARANOID | |||
#ifdef IMGUI_DEBUG_PARANOID | #ifdef IMGUI_DEBUG_PARANOID | |||
#define IM_ASSERT_PARANOID(_EXPR) IM_ASSERT(_EXPR) | #define IM_ASSERT_PARANOID(_EXPR) IM_ASSERT(_EXPR) | |||
#else | #else | |||
#define IM_ASSERT_PARANOID(_EXPR) | #define IM_ASSERT_PARANOID(_EXPR) | |||
#endif | #endif | |||
skipping to change at line 444 | skipping to change at line 443 | |||
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 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, 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 ImClamp(const ImVec2& v, const ImVec2& mn, 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, 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 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 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 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 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 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 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 ImFloor(float f) { return (float)(int)(f); } | static inline float ImFloor(float f) { return (float)(int)(f); } | |||
static inline float ImFloorSigned(float f) { return (float)((f >= 0 || (int)f == f) ? (int)f : (int)f - 1); } // Decent rep lacement for floorf() | static inline float ImFloorSigned(float f) { return (float)((f >= 0 || (float)(int)f == f) ? (int)f : (int)f - 1); } // Dec ent replacement for floorf() | |||
static inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2((float)(int)(v.x), (float)(int)(v.y)); } | static inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2((float)(int)(v.x), (float)(int)(v.y)); } | |||
static inline ImVec2 ImFloorSigned(const ImVec2& v) { return ImVec2(ImFloorSigned(v.x), ImFloorSigned(v.y)); } | ||||
static inline int ImModPositive(int a, int b) { return (a + b) % b; } | 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 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 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 > tar get) return ImMax(current - speed, target); return current; } | static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > tar get) return ImMax(current - speed, target); return current; } | |||
static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); } | 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 bool ImIsFloatAboveGuaranteedIntegerPrecision(float f) { return f <= -16777216 || f >= 16777216; } | |||
IM_MSVC_RUNTIME_CHECKS_RESTORE | IM_MSVC_RUNTIME_CHECKS_RESTORE | |||
// Helpers: Geometry | // Helpers: Geometry | |||
IMGUI_API ImVec2 ImBezierCubicCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, float t); | IMGUI_API ImVec2 ImBezierCubicCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, float t); | |||
skipping to change at line 543 | skipping to change at line 543 | |||
int a_mod = (n & 31); | int a_mod = (n & 31); | |||
int b_mod = (n2 > (n | 31) ? 31 : (n2 & 31)) + 1; | int b_mod = (n2 > (n | 31) ? 31 : (n2 & 31)) + 1; | |||
ImU32 mask = (ImU32)(((ImU64)1 << b_mod) - 1) & ~(ImU32)(((ImU64)1 << a_ mod) - 1); | ImU32 mask = (ImU32)(((ImU64)1 << b_mod) - 1) & ~(ImU32)(((ImU64)1 << a_ mod) - 1); | |||
arr[n >> 5] |= mask; | arr[n >> 5] |= mask; | |||
n = (n + 32) & ~31; | n = (n + 32) & ~31; | |||
} | } | |||
} | } | |||
// Helper: ImBitArray class (wrapper over ImBitArray functions) | // Helper: ImBitArray class (wrapper over ImBitArray functions) | |||
// Store 1-bit per value. | // Store 1-bit per value. | |||
template<int BITCOUNT> | template<int BITCOUNT, int OFFSET = 0> | |||
struct IMGUI_API ImBitArray | struct ImBitArray | |||
{ | { | |||
ImU32 Storage[(BITCOUNT + 31) >> 5]; | ImU32 Storage[(BITCOUNT + 31) >> 5]; | |||
ImBitArray() { ClearAllBits(); } | ImBitArray() { ClearAllBits(); } | |||
void ClearAllBits() { memset(Storage, 0, sizeof(Stor age)); } | void ClearAllBits() { memset(Storage, 0, sizeof(Stor age)); } | |||
void SetAllBits() { memset(Storage, 255, sizeof(St orage)); } | void SetAllBits() { memset(Storage, 255, sizeof(St orage)); } | |||
bool TestBit(int n) const { IM_ASSERT(n < BITCOUNT); retur | bool TestBit(int n) const { IM_ASSERT(n + OFFSET < BITCOUN | |||
n ImBitArrayTestBit(Storage, n); } | T); return ImBitArrayTestBit(Storage, n + OFFSET); } | |||
void SetBit(int n) { IM_ASSERT(n < BITCOUNT); ImBit | void SetBit(int n) { IM_ASSERT(n + OFFSET < BITCOUN | |||
ArraySetBit(Storage, n); } | T); ImBitArraySetBit(Storage, n + OFFSET); } | |||
void ClearBit(int n) { IM_ASSERT(n < BITCOUNT); ImBit | void ClearBit(int n) { IM_ASSERT(n + OFFSET < BITCOUN | |||
ArrayClearBit(Storage, n); } | T); ImBitArrayClearBit(Storage, n + OFFSET); } | |||
void SetBitRange(int n, int n2) { ImBitArraySetBitRange(Storage, | void SetBitRange(int n, int n2) { ImBitArraySetBitRange(Storage, | |||
n, n2); } // Works on range [n..n2) | n + OFFSET, n2 + OFFSET); } // Works on range [n..n2) | |||
bool operator[](int n) const { IM_ASSERT(n + OFFSET < BITCOUN | ||||
T); return ImBitArrayTestBit(Storage, n + OFFSET); } | ||||
}; | }; | |||
// Helper: ImBitVector | // Helper: ImBitVector | |||
// Store 1-bit per value. | // Store 1-bit per value. | |||
struct IMGUI_API ImBitVector | struct IMGUI_API ImBitVector | |||
{ | { | |||
ImVector<ImU32> Storage; | ImVector<ImU32> Storage; | |||
void Create(int sz) { Storage.resize((sz + 31) >> 5) ; memset(Storage.Data, 0, (size_t)Storage.Size * sizeof(Storage.Data[0])); } | void Create(int sz) { Storage.resize((sz + 31) >> 5) ; memset(Storage.Data, 0, (size_t)Storage.Size * sizeof(Storage.Data[0])); } | |||
void Clear() { Storage.clear(); } | void Clear() { Storage.clear(); } | |||
bool TestBit(int n) const { IM_ASSERT(n < (Storage.Size << 5)); return ImBitArrayTestBit(Storage.Data, n); } | bool TestBit(int n) const { IM_ASSERT(n < (Storage.Size << 5)); return ImBitArrayTestBit(Storage.Data, n); } | |||
skipping to change at line 624 | skipping to change at line 625 | |||
inline void* GetSpanPtrEnd(int n) { IM_ASSERT(n >= 0 && n < CH UNKS && CurrIdx == CHUNKS); return (void*)(BasePtr + Offsets[n] + Sizes[n]); } | inline void* GetSpanPtrEnd(int n) { IM_ASSERT(n >= 0 && n < CH UNKS && CurrIdx == CHUNKS); return (void*)(BasePtr + Offsets[n] + Sizes[n]); } | |||
template<typename T> | template<typename T> | |||
inline void GetSpan(int n, ImSpan<T>* span) { span->set((T*)GetSpanPtrBe gin(n), (T*)GetSpanPtrEnd(n)); } | inline void GetSpan(int n, ImSpan<T>* span) { span->set((T*)GetSpanPtrBe gin(n), (T*)GetSpanPtrEnd(n)); } | |||
}; | }; | |||
// Helper: ImPool<> | // 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, | // 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 hav e the same lifetime as the associated object. | // Honor constructor/destructor. Add/remove invalidate all pointers. Indexes hav e the same lifetime as the associated object. | |||
typedef int ImPoolIdx; | typedef int ImPoolIdx; | |||
template<typename T> | template<typename T> | |||
struct IMGUI_API ImPool | struct ImPool | |||
{ | { | |||
ImVector<T> Buf; // Contiguous data | ImVector<T> Buf; // Contiguous data | |||
ImGuiStorage Map; // ID->Index | ImGuiStorage Map; // ID->Index | |||
ImPoolIdx FreeIdx; // Next free idx to use | ImPoolIdx FreeIdx; // Next free idx to use | |||
ImPoolIdx AliveCount; // Number of active/alive items (for display pur pose) | ImPoolIdx AliveCount; // Number of active/alive items (for display pur pose) | |||
ImPool() { FreeIdx = AliveCount = 0; } | ImPool() { FreeIdx = AliveCount = 0; } | |||
~ImPool() { Clear(); } | ~ImPool() { Clear(); } | |||
T* GetByKey(ImGuiID key) { int idx = Map.GetInt(key, -1); return (idx != -1) ? &Buf[idx] : NULL; } | T* GetByKey(ImGuiID key) { int idx = Map.GetInt(key, -1); return (idx != -1) ? &Buf[idx] : NULL; } | |||
T* GetByIndex(ImPoolIdx n) { return &Buf[n]; } | T* GetByIndex(ImPoolIdx n) { return &Buf[n]; } | |||
skipping to change at line 661 | skipping to change at line 662 | |||
int GetSize() { return GetMapSize(); } // For ImPlot: should use GetMapSize() from (IMGUI_VERSION_NUM >= 18304) | int GetSize() { return GetMapSize(); } // For ImPlot: should use GetMapSize() from (IMGUI_VERSION_NUM >= 18304) | |||
#endif | #endif | |||
}; | }; | |||
// Helper: ImChunkStream<> | // Helper: ImChunkStream<> | |||
// Build and iterate a contiguous stream of variable-sized structures. | // Build and iterate a contiguous stream of variable-sized structures. | |||
// This is used by Settings to store persistent data while reducing allocation c ount. | // This is used by Settings to store persistent data while reducing allocation c ount. | |||
// We store the chunk size first, and align the final size on 4 bytes boundaries . | // We store the chunk size first, and align the final size on 4 bytes boundaries . | |||
// The tedious/zealous amount of casting is to avoid -Wcast-align warnings. | // The tedious/zealous amount of casting is to avoid -Wcast-align warnings. | |||
template<typename T> | template<typename T> | |||
struct IMGUI_API ImChunkStream | struct ImChunkStream | |||
{ | { | |||
ImVector<char> Buf; | ImVector<char> Buf; | |||
void clear() { Buf.clear(); } | void clear() { Buf.clear(); } | |||
bool empty() const { return Buf.Size == 0; } | bool empty() const { return Buf.Size == 0; } | |||
int size() const { return Buf.Size; } | int size() const { return Buf.Size; } | |||
T* alloc_chunk(size_t sz) { size_t HDR_SZ = 4; sz = IM_MEMALIGN(HD R_SZ + sz, 4u); int off = Buf.Size; Buf.resize(off + (int)sz); ((int*)(void*)(Bu f.Data + off))[0] = (int)sz; return (T*)(void*)(Buf.Data + off + (int)HDR_SZ); } | T* alloc_chunk(size_t sz) { size_t HDR_SZ = 4; sz = IM_MEMALIGN(HD R_SZ + sz, 4u); int off = Buf.Size; Buf.resize(off + (int)sz); ((int*)(void*)(Bu f.Data + off))[0] = (int)sz; return (T*)(void*)(Buf.Data + off + (int)HDR_SZ); } | |||
T* begin() { size_t HDR_SZ = 4; if (!Buf.Data) retu rn NULL; return (T*)(void*)(Buf.Data + HDR_SZ); } | T* begin() { size_t HDR_SZ = 4; if (!Buf.Data) retu rn NULL; return (T*)(void*)(Buf.Data + HDR_SZ); } | |||
T* next_chunk(T* p) { size_t HDR_SZ = 4; IM_ASSERT(p >= begi n() && p < end()); p = (T*)(void*)((char*)(void*)p + chunk_size(p)); if (p == (T *)(void*)((char*)end() + HDR_SZ)) return (T*)0; IM_ASSERT(p < end()); return p; } | T* next_chunk(T* p) { size_t HDR_SZ = 4; IM_ASSERT(p >= begi n() && p < end()); p = (T*)(void*)((char*)(void*)p + chunk_size(p)); if (p == (T *)(void*)((char*)end() + HDR_SZ)) return (T*)0; IM_ASSERT(p < end()); return p; } | |||
int chunk_size(const T* p) { return ((const int*)p)[-1]; } | int chunk_size(const T* p) { return ((const int*)p)[-1]; } | |||
skipping to change at line 900 | skipping to change at line 901 | |||
ImGuiAxis_X = 0, | ImGuiAxis_X = 0, | |||
ImGuiAxis_Y = 1 | ImGuiAxis_Y = 1 | |||
}; | }; | |||
enum ImGuiPlotType | enum ImGuiPlotType | |||
{ | { | |||
ImGuiPlotType_Lines, | ImGuiPlotType_Lines, | |||
ImGuiPlotType_Histogram | ImGuiPlotType_Histogram | |||
}; | }; | |||
enum ImGuiInputSource | ||||
{ | ||||
ImGuiInputSource_None = 0, | ||||
ImGuiInputSource_Mouse, | ||||
ImGuiInputSource_Keyboard, | ||||
ImGuiInputSource_Gamepad, | ||||
ImGuiInputSource_Nav, // Stored in g.ActiveIdSource only | ||||
ImGuiInputSource_Clipboard, // Currently only used by InputText() | ||||
ImGuiInputSource_COUNT | ||||
}; | ||||
// FIXME-NAV: Clarify/expose various repeat delay/rate | ||||
enum ImGuiInputReadMode | ||||
{ | ||||
ImGuiInputReadMode_Down, | ||||
ImGuiInputReadMode_Pressed, | ||||
ImGuiInputReadMode_Released, | ||||
ImGuiInputReadMode_Repeat, | ||||
ImGuiInputReadMode_RepeatSlow, | ||||
ImGuiInputReadMode_RepeatFast | ||||
}; | ||||
enum ImGuiPopupPositionPolicy | enum ImGuiPopupPositionPolicy | |||
{ | { | |||
ImGuiPopupPositionPolicy_Default, | ImGuiPopupPositionPolicy_Default, | |||
ImGuiPopupPositionPolicy_ComboBox, | ImGuiPopupPositionPolicy_ComboBox, | |||
ImGuiPopupPositionPolicy_Tooltip | ImGuiPopupPositionPolicy_Tooltip | |||
}; | }; | |||
struct ImGuiDataTypeTempStorage | struct ImGuiDataTypeTempStorage | |||
{ | { | |||
ImU8 Data[8]; // Can fit any data up to ImGuiDataType_COUNT | ImU8 Data[8]; // Can fit any data up to ImGuiDataType_COUNT | |||
skipping to change at line 1175 | skipping to change at line 1154 | |||
struct ImGuiPtrOrIndex | struct ImGuiPtrOrIndex | |||
{ | { | |||
void* Ptr; // Either field can be set, not both. e.g. Dock node tab bars are loose while BeginTabBar() ones are in a pool. | void* Ptr; // Either field can be set, not both. e.g. Dock node tab bars are loose while BeginTabBar() ones are in a pool. | |||
int Index; // Usually index in a main pool. | int Index; // Usually index in a main pool. | |||
ImGuiPtrOrIndex(void* ptr) { Ptr = ptr; Index = -1; } | ImGuiPtrOrIndex(void* ptr) { Ptr = ptr; Index = -1; } | |||
ImGuiPtrOrIndex(int index) { Ptr = NULL; Index = index; } | ImGuiPtrOrIndex(int index) { Ptr = NULL; Index = index; } | |||
}; | }; | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
// [SECTION] Inputs support | ||||
//----------------------------------------------------------------------------- | ||||
typedef ImBitArray<ImGuiKey_NamedKey_COUNT, -ImGuiKey_NamedKey_BEGIN> ImBitAr | ||||
rayForNamedKeys; | ||||
enum ImGuiKeyPrivate_ | ||||
{ | ||||
ImGuiKey_LegacyNativeKey_BEGIN = 0, | ||||
ImGuiKey_LegacyNativeKey_END = 512, | ||||
ImGuiKey_Gamepad_BEGIN = ImGuiKey_GamepadStart, | ||||
ImGuiKey_Gamepad_END = ImGuiKey_GamepadRStickRight + 1 | ||||
}; | ||||
enum ImGuiInputEventType | ||||
{ | ||||
ImGuiInputEventType_None = 0, | ||||
ImGuiInputEventType_MousePos, | ||||
ImGuiInputEventType_MouseWheel, | ||||
ImGuiInputEventType_MouseButton, | ||||
ImGuiInputEventType_Key, | ||||
ImGuiInputEventType_Char, | ||||
ImGuiInputEventType_Focus, | ||||
ImGuiInputEventType_COUNT | ||||
}; | ||||
enum ImGuiInputSource | ||||
{ | ||||
ImGuiInputSource_None = 0, | ||||
ImGuiInputSource_Mouse, | ||||
ImGuiInputSource_Keyboard, | ||||
ImGuiInputSource_Gamepad, | ||||
ImGuiInputSource_Clipboard, // Currently only used by InputText() | ||||
ImGuiInputSource_Nav, // Stored in g.ActiveIdSource only | ||||
ImGuiInputSource_COUNT | ||||
}; | ||||
// FIXME: Structures in the union below need to be declared as anonymous unions | ||||
appears to be an extension? | ||||
// Using ImVec2() would fail on Clang 'union member 'MousePos' has a non-trivial | ||||
default constructor' | ||||
struct ImGuiInputEventMousePos { float PosX, PosY; }; | ||||
struct ImGuiInputEventMouseWheel { float WheelX, WheelY; }; | ||||
struct ImGuiInputEventMouseButton { int Button; bool Down; }; | ||||
struct ImGuiInputEventKey { ImGuiKey Key; bool Down; float AnalogValue | ||||
; }; | ||||
struct ImGuiInputEventText { unsigned int Char; }; | ||||
struct ImGuiInputEventAppFocused { bool Focused; }; | ||||
struct ImGuiInputEvent | ||||
{ | ||||
ImGuiInputEventType Type; | ||||
ImGuiInputSource Source; | ||||
union | ||||
{ | ||||
ImGuiInputEventMousePos MousePos; // if Type == ImGuiInputEven | ||||
tType_MousePos | ||||
ImGuiInputEventMouseWheel MouseWheel; // if Type == ImGuiInputEven | ||||
tType_MouseWheel | ||||
ImGuiInputEventMouseButton MouseButton; // if Type == ImGuiInputEven | ||||
tType_MouseButton | ||||
ImGuiInputEventKey Key; // if Type == ImGuiInputEven | ||||
tType_Key | ||||
ImGuiInputEventText Text; // if Type == ImGuiInputEven | ||||
tType_Text | ||||
ImGuiInputEventAppFocused AppFocused; // if Type == ImGuiInputEven | ||||
tType_Focus | ||||
}; | ||||
bool AddedByTestEngine; | ||||
ImGuiInputEvent() { memset(this, 0, sizeof(*this)); } | ||||
}; | ||||
// FIXME-NAV: Clarify/expose various repeat delay/rate | ||||
enum ImGuiInputReadMode | ||||
{ | ||||
ImGuiInputReadMode_Down, | ||||
ImGuiInputReadMode_Pressed, | ||||
ImGuiInputReadMode_Released, | ||||
ImGuiInputReadMode_Repeat, | ||||
ImGuiInputReadMode_RepeatSlow, | ||||
ImGuiInputReadMode_RepeatFast | ||||
}; | ||||
//----------------------------------------------------------------------------- | ||||
// [SECTION] Clipper support | // [SECTION] Clipper support | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
struct ImGuiListClipperRange | struct ImGuiListClipperRange | |||
{ | { | |||
int Min; | int Min; | |||
int Max; | int Max; | |||
bool PosToIndexConvert; // Begin/End are absolute position (will be converted to indices later) | bool PosToIndexConvert; // Begin/End are absolute position (will be converted to indices later) | |||
ImS8 PosToIndexOffsetMin; // Add to Min after converting to indices | ImS8 PosToIndexOffsetMin; // Add to Min after converting to indices | |||
ImS8 PosToIndexOffsetMax; // Add to Min after converting to indices | ImS8 PosToIndexOffsetMax; // Add to Min after converting to indices | |||
skipping to change at line 1502 | skipping to change at line 1556 | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
// [SECTION] ImGuiContext (main imgui context) | // [SECTION] ImGuiContext (main imgui context) | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
struct ImGuiContext | struct ImGuiContext | |||
{ | { | |||
bool Initialized; | bool Initialized; | |||
bool FontAtlasOwnedByContext; // IO.Fonts-> is owned by the ImGuiContext and will be destructed along with it. | bool FontAtlasOwnedByContext; // IO.Fonts-> is owned by the ImGuiContext and will be destructed along with it. | |||
ImGuiIO IO; | ImGuiIO IO; | |||
ImVector<ImGuiInputEvent> InputEventsQueue; // Input events | ||||
which will be tricked/written into IO structure. | ||||
ImVector<ImGuiInputEvent> InputEventsTrail; // Past input ev | ||||
ents processed in NewFrame(). This is to allow domain-specific application to ac | ||||
cess e.g mouse/pen trail. | ||||
ImGuiStyle Style; | ImGuiStyle Style; | |||
ImFont* Font; // (Shortcut) == FontStack.empty() ? IO.Font : FontStack.back() | ImFont* Font; // (Shortcut) == FontStack.empty() ? IO.Font : FontStack.back() | |||
float FontSize; // (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text hei ght for current window. | float FontSize; // (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text hei ght for current window. | |||
float FontBaseSize; // (Shortcut) == IO.FontGlobalScale * Font->Scale * Font->FontSize. Base text height. | float FontBaseSize; // (Shortcut) == IO.FontGlobalScale * Font->Scale * Font->FontSize. Base text height. | |||
ImDrawListSharedData DrawListSharedData; | ImDrawListSharedData DrawListSharedData; | |||
double Time; | double Time; | |||
int FrameCount; | int FrameCount; | |||
int FrameCountEnded; | int FrameCountEnded; | |||
int FrameCountRendered; | int FrameCountRendered; | |||
bool WithinFrameScope; // Set by NewFra me(), cleared by EndFrame() | bool WithinFrameScope; // Set by NewFra me(), cleared by EndFrame() | |||
skipping to change at line 1556 | skipping to change at line 1612 | |||
float ActiveIdTimer; | float ActiveIdTimer; | |||
bool ActiveIdIsJustActivated; // Set at the ti me of activation for one frame | bool ActiveIdIsJustActivated; // Set at the ti me of activation for one frame | |||
bool ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, bu t not always) | bool ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, bu t not always) | |||
bool ActiveIdNoClearOnFocusLoss; // Disable losin g active id if the active id window gets unfocused. | bool ActiveIdNoClearOnFocusLoss; // Disable losin g active id if the active id window gets unfocused. | |||
bool ActiveIdHasBeenPressedBefore; // Track whether the active id led to a press (this is to allow changing between PressOnClick an d PressOnRelease without pressing twice). Used by range_select branch. | bool ActiveIdHasBeenPressedBefore; // Track whether the active id led to a press (this is to allow changing between PressOnClick an d PressOnRelease without pressing twice). Used by range_select branch. | |||
bool ActiveIdHasBeenEditedBefore; // Was the value associated to the widget Edited over the course of the Active state. | bool ActiveIdHasBeenEditedBefore; // Was the value associated to the widget Edited over the course of the Active state. | |||
bool ActiveIdHasBeenEditedThisFrame; | bool ActiveIdHasBeenEditedThisFrame; | |||
bool ActiveIdUsingMouseWheel; // Active widget will want to read mouse wheel. Blocks scrolling the underlying window. | bool ActiveIdUsingMouseWheel; // Active widget will want to read mouse wheel. Blocks scrolling the underlying window. | |||
ImU32 ActiveIdUsingNavDirMask; // Active widget will want to read those nav move requests (e.g. can activate a button and move away from it) | ImU32 ActiveIdUsingNavDirMask; // Active widget will want to read those nav move requests (e.g. can activate a button and move away from it) | |||
ImU32 ActiveIdUsingNavInputMask; // Active widget will want to read those nav inputs. | ImU32 ActiveIdUsingNavInputMask; // Active widget will want to read those nav inputs. | |||
ImU64 ActiveIdUsingKeyInputMask; // Active widget will want to read those key inputs. When we grow the ImGuiKey enum we'll need t o either to order the enum to make useful keys come first, either redesign this into e.g. a small array. | ImBitArrayForNamedKeys ActiveIdUsingKeyInputMask; // Active widget will want to read those key inputs. When we grow the ImGuiKey enum we'll need t o either to order the enum to make useful keys come first, either redesign this into e.g. a small array. | |||
ImVec2 ActiveIdClickOffset; // Clicked offse t from upper-left corner, if applicable (currently only set by ButtonBehavior) | ImVec2 ActiveIdClickOffset; // Clicked offse t from upper-left corner, if applicable (currently only set by ButtonBehavior) | |||
ImGuiWindow* ActiveIdWindow; | ImGuiWindow* ActiveIdWindow; | |||
ImGuiInputSource ActiveIdSource; // Activating wi th mouse or nav (gamepad/keyboard) | ImGuiInputSource ActiveIdSource; // Activating wi th mouse or nav (gamepad/keyboard) | |||
int ActiveIdMouseButton; | int ActiveIdMouseButton; | |||
ImGuiID ActiveIdPreviousFrame; | ImGuiID ActiveIdPreviousFrame; | |||
bool ActiveIdPreviousFrameIsAlive; | bool ActiveIdPreviousFrameIsAlive; | |||
bool ActiveIdPreviousFrameHasBeenEditedBefore; | bool ActiveIdPreviousFrameHasBeenEditedBefore; | |||
ImGuiWindow* ActiveIdPreviousFrameWindow; | ImGuiWindow* ActiveIdPreviousFrameWindow; | |||
ImGuiID LastActiveId; // Store the las t non-zero ActiveId, useful for animation. | ImGuiID LastActiveId; // Store the las t non-zero ActiveId, useful for animation. | |||
float LastActiveIdTimer; // Store the las t non-zero ActiveId timer since the beginning of activation, useful for animatio n. | float LastActiveIdTimer; // Store the las t non-zero ActiveId timer since the beginning of activation, useful for animatio n. | |||
skipping to change at line 1708 | skipping to change at line 1764 | |||
float DragSpeedDefaultRatio; // If speed == 0 .0f, uses (max-min) * DragSpeedDefaultRatio | float DragSpeedDefaultRatio; // If speed == 0 .0f, uses (max-min) * DragSpeedDefaultRatio | |||
float ScrollbarClickDeltaToGrabCenter; // Distance betw een mouse and center of grab box, normalized in parent space. Use storage? | float ScrollbarClickDeltaToGrabCenter; // Distance betw een mouse and center of grab box, normalized in parent space. Use storage? | |||
float DisabledAlphaBackup; // Backup for st yle.Alpha for BeginDisabled() | float DisabledAlphaBackup; // Backup for st yle.Alpha for BeginDisabled() | |||
short DisabledStackSize; | short DisabledStackSize; | |||
short TooltipOverrideCount; | short TooltipOverrideCount; | |||
float TooltipSlowDelay; // Time before s low tooltips appears (FIXME: This is temporary until we merge in tooltip timer+p riority work) | float TooltipSlowDelay; // Time before s low tooltips appears (FIXME: This is temporary until we merge in tooltip timer+p riority work) | |||
ImVector<char> ClipboardHandlerData; // If no custom clipboard handler is defined | ImVector<char> ClipboardHandlerData; // If no custom clipboard handler is defined | |||
ImVector<ImGuiID> MenusIdSubmittedThisFrame; // A list of men u IDs that were rendered at least once | ImVector<ImGuiID> MenusIdSubmittedThisFrame; // A list of men u IDs that were rendered at least once | |||
// Platform support | // Platform support | |||
ImVec2 PlatformImePos; // Cursor positi | ImGuiPlatformImeData PlatformImeData; // Data updated | |||
on request & last passed to the OS Input Method Editor | by current frame | |||
ImVec2 PlatformImeLastPos; | ImGuiPlatformImeData PlatformImeDataPrev; // Previous fram | |||
e data (when changing we will call io.SetPlatformImeDataFn | ||||
char PlatformLocaleDecimalPoint; // '.' or *local econv()->decimal_point | char PlatformLocaleDecimalPoint; // '.' or *local econv()->decimal_point | |||
// Settings | // Settings | |||
bool SettingsLoaded; | bool SettingsLoaded; | |||
float SettingsDirtyTimer; // Save .ini Set tings to memory when time reaches zero | float SettingsDirtyTimer; // Save .ini Set tings to memory when time reaches zero | |||
ImGuiTextBuffer SettingsIniData; // In memory .in i settings | ImGuiTextBuffer SettingsIniData; // In memory .in i settings | |||
ImVector<ImGuiSettingsHandler> SettingsHandlers; // List of .ini settings handlers | ImVector<ImGuiSettingsHandler> SettingsHandlers; // List of .ini settings handlers | |||
ImChunkStream<ImGuiWindowSettings> SettingsWindows; // ImGuiWindow . ini settings entries | ImChunkStream<ImGuiWindowSettings> SettingsWindows; // ImGuiWindow . ini settings entries | |||
ImChunkStream<ImGuiTableSettings> SettingsTables; // ImGuiTable .i ni settings entries | ImChunkStream<ImGuiTableSettings> SettingsTables; // ImGuiTable .i ni settings entries | |||
ImVector<ImGuiContextHook> Hooks; // Hooks for ext ensions (e.g. test engine) | ImVector<ImGuiContextHook> Hooks; // Hooks for ext ensions (e.g. test engine) | |||
skipping to change at line 1792 | skipping to change at line 1848 | |||
ActiveIdTimer = 0.0f; | ActiveIdTimer = 0.0f; | |||
ActiveIdIsJustActivated = false; | ActiveIdIsJustActivated = false; | |||
ActiveIdAllowOverlap = false; | ActiveIdAllowOverlap = false; | |||
ActiveIdNoClearOnFocusLoss = false; | ActiveIdNoClearOnFocusLoss = false; | |||
ActiveIdHasBeenPressedBefore = false; | ActiveIdHasBeenPressedBefore = false; | |||
ActiveIdHasBeenEditedBefore = false; | ActiveIdHasBeenEditedBefore = false; | |||
ActiveIdHasBeenEditedThisFrame = false; | ActiveIdHasBeenEditedThisFrame = false; | |||
ActiveIdUsingMouseWheel = false; | ActiveIdUsingMouseWheel = false; | |||
ActiveIdUsingNavDirMask = 0x00; | ActiveIdUsingNavDirMask = 0x00; | |||
ActiveIdUsingNavInputMask = 0x00; | ActiveIdUsingNavInputMask = 0x00; | |||
ActiveIdUsingKeyInputMask = 0x00; | ActiveIdUsingKeyInputMask.ClearAllBits(); | |||
ActiveIdClickOffset = ImVec2(-1, -1); | ActiveIdClickOffset = ImVec2(-1, -1); | |||
ActiveIdWindow = NULL; | ActiveIdWindow = NULL; | |||
ActiveIdSource = ImGuiInputSource_None; | ActiveIdSource = ImGuiInputSource_None; | |||
ActiveIdMouseButton = -1; | ActiveIdMouseButton = -1; | |||
ActiveIdPreviousFrame = 0; | ActiveIdPreviousFrame = 0; | |||
ActiveIdPreviousFrameIsAlive = false; | ActiveIdPreviousFrameIsAlive = false; | |||
ActiveIdPreviousFrameHasBeenEditedBefore = false; | ActiveIdPreviousFrameHasBeenEditedBefore = false; | |||
ActiveIdPreviousFrameWindow = NULL; | ActiveIdPreviousFrameWindow = NULL; | |||
LastActiveId = 0; | LastActiveId = 0; | |||
LastActiveIdTimer = 0.0f; | LastActiveIdTimer = 0.0f; | |||
skipping to change at line 1873 | skipping to change at line 1929 | |||
SliderCurrentAccumDirty = false; | SliderCurrentAccumDirty = false; | |||
DragCurrentAccumDirty = false; | DragCurrentAccumDirty = false; | |||
DragCurrentAccum = 0.0f; | DragCurrentAccum = 0.0f; | |||
DragSpeedDefaultRatio = 1.0f / 100.0f; | DragSpeedDefaultRatio = 1.0f / 100.0f; | |||
DisabledAlphaBackup = 0.0f; | DisabledAlphaBackup = 0.0f; | |||
DisabledStackSize = 0; | DisabledStackSize = 0; | |||
ScrollbarClickDeltaToGrabCenter = 0.0f; | ScrollbarClickDeltaToGrabCenter = 0.0f; | |||
TooltipOverrideCount = 0; | TooltipOverrideCount = 0; | |||
TooltipSlowDelay = 0.50f; | TooltipSlowDelay = 0.50f; | |||
PlatformImePos = PlatformImeLastPos = ImVec2(FLT_MAX, FLT_MAX); | PlatformImeData.InputPos = ImVec2(0.0f, 0.0f); | |||
PlatformImeDataPrev.InputPos = ImVec2(-1.0f, -1.0f); // Different to ens | ||||
ure initial submission | ||||
PlatformLocaleDecimalPoint = '.'; | PlatformLocaleDecimalPoint = '.'; | |||
SettingsLoaded = false; | SettingsLoaded = false; | |||
SettingsDirtyTimer = 0.0f; | SettingsDirtyTimer = 0.0f; | |||
HookIdNext = 0; | HookIdNext = 0; | |||
LogEnabled = false; | LogEnabled = false; | |||
LogType = ImGuiLogType_None; | LogType = ImGuiLogType_None; | |||
LogNextPrefix = LogNextSuffix = NULL; | LogNextPrefix = LogNextSuffix = NULL; | |||
LogFile = NULL; | LogFile = NULL; | |||
skipping to change at line 2287 | skipping to change at line 2344 | |||
float InnerWidth; // User value passed to BeginTable(), see comments at the top of BeginTable() for details. | float InnerWidth; // User value passed to BeginTable(), see comments at the top of BeginTable() for details. | |||
float ColumnsGivenWidth; // Sum of current co lumn width | float ColumnsGivenWidth; // Sum of current co lumn width | |||
float ColumnsAutoFitWidth; // Sum of ideal colu mn width in order nothing to be clipped, used for auto-fitting and content width submission in outer window | float ColumnsAutoFitWidth; // Sum of ideal colu mn width in order nothing to be clipped, used for auto-fitting and content width submission in outer window | |||
float ResizedColumnNextWidth; | float ResizedColumnNextWidth; | |||
float ResizeLockMinContentsX2; // Lock minimum cont ents width while resizing down in order to not create feedback loops. But we all ow growing the table. | float ResizeLockMinContentsX2; // Lock minimum cont ents width while resizing down in order to not create feedback loops. But we all ow growing the table. | |||
float RefScale; // Reference scale t o be able to rescale columns on font/dpi changes. | float RefScale; // Reference scale t o be able to rescale columns on font/dpi changes. | |||
ImRect OuterRect; // Note: for non-scr olling table, OuterRect.Max.y is often FLT_MAX until EndTable(), unless a height has been specified in BeginTable(). | ImRect OuterRect; // Note: for non-scr olling table, OuterRect.Max.y is often FLT_MAX until EndTable(), unless a height has been specified in BeginTable(). | |||
ImRect InnerRect; // InnerRect but wit hout decoration. As with OuterRect, for non-scrolling tables, InnerRect.Max.y is | ImRect InnerRect; // InnerRect but wit hout decoration. As with OuterRect, for non-scrolling tables, InnerRect.Max.y is | |||
ImRect WorkRect; | ImRect WorkRect; | |||
ImRect InnerClipRect; | ImRect InnerClipRect; | |||
ImRect BgClipRect; // We use this to cp u-clip cell background color fill | ImRect BgClipRect; // We use this to cp u-clip cell background color fill, evolve during the frame as we cross frozen ro ws boundaries | |||
ImRect Bg0ClipRectForDrawCmd; // Actual ImDrawCmd clip rect for BG0/1 channel. This tends to be == OuterWindow->ClipRect at BeginT able() because output in BG0/BG1 is cpu-clipped | ImRect Bg0ClipRectForDrawCmd; // Actual ImDrawCmd clip rect for BG0/1 channel. This tends to be == OuterWindow->ClipRect at BeginT able() because output in BG0/BG1 is cpu-clipped | |||
ImRect Bg2ClipRectForDrawCmd; // Actual ImDrawCmd clip rect for BG2 channel. This tends to be a correct, tight-fit, because output to BG2 are done by widgets relying on regular ClipRect. | ImRect Bg2ClipRectForDrawCmd; // Actual ImDrawCmd clip rect for BG2 channel. This tends to be a correct, tight-fit, because output to BG2 are done by widgets relying on regular ClipRect. | |||
ImRect HostClipRect; // This is used to c heck if we can eventually merge our columns draw calls into the current draw cal l of the current window. | ImRect HostClipRect; // This is used to c heck if we can eventually merge our columns draw calls into the current draw cal l of the current window. | |||
ImRect HostBackupInnerClipRect; // Backup of InnerWi ndow->ClipRect during PushTableBackground()/PopTableBackground() | ImRect HostBackupInnerClipRect; // Backup of InnerWi ndow->ClipRect during PushTableBackground()/PopTableBackground() | |||
ImGuiWindow* OuterWindow; // Parent window for the table | ImGuiWindow* OuterWindow; // Parent window for the table | |||
ImGuiWindow* InnerWindow; // Window holding th e table data (== OuterWindow or a child window) | ImGuiWindow* InnerWindow; // Window holding th e table data (== OuterWindow or a child window) | |||
ImGuiTextBuffer ColumnsNames; // Contiguous buffer holding columns names | ImGuiTextBuffer ColumnsNames; // Contiguous buffer holding columns names | |||
ImDrawListSplitter* DrawSplitter; // Shortcut to TempD ata->DrawSplitter while in table. Isolate draw commands per columns to avoid swi tching clip rect constantly | ImDrawListSplitter* DrawSplitter; // Shortcut to TempD ata->DrawSplitter while in table. Isolate draw commands per columns to avoid swi tching clip rect constantly | |||
ImGuiTableColumnSortSpecs SortSpecsSingle; | ImGuiTableColumnSortSpecs SortSpecsSingle; | |||
ImVector<ImGuiTableColumnSortSpecs> SortSpecsMulti; // FIXME-OPT: Using a small-vector pattern would be good. | ImVector<ImGuiTableColumnSortSpecs> SortSpecsMulti; // FIXME-OPT: Using a small-vector pattern would be good. | |||
skipping to change at line 2456 | skipping to change at line 2513 | |||
inline ImFont* GetDefaultFont() { ImGuiContext& g = *GImGui; return g.IO.FontDefault ? g.IO.FontDefault : g.IO.Fonts->Fonts[0]; } | inline ImFont* GetDefaultFont() { ImGuiContext& g = *GImGui; return g.IO.FontDefault ? g.IO.FontDefault : g.IO.Fonts->Fonts[0]; } | |||
inline ImDrawList* GetForegroundDrawList(ImGuiWindow* window) { IM_UNUS ED(window); return GetForegroundDrawList(); } // This seemingly unnecessary wrap per simplifies compatibility between the 'master' and 'docking' branches. | inline ImDrawList* GetForegroundDrawList(ImGuiWindow* window) { IM_UNUS ED(window); return GetForegroundDrawList(); } // This seemingly unnecessary wrap per simplifies compatibility between the 'master' and 'docking' branches. | |||
IMGUI_API ImDrawList* GetBackgroundDrawList(ImGuiViewport* viewport); // get background draw list for the given viewport. this draw li st will be the first rendering one. Useful to quickly draw shapes/text behind de ar imgui contents. | IMGUI_API ImDrawList* GetBackgroundDrawList(ImGuiViewport* viewport); // get background draw list for the given viewport. this draw li st will be the first rendering one. Useful to quickly draw shapes/text behind de ar imgui contents. | |||
IMGUI_API ImDrawList* GetForegroundDrawList(ImGuiViewport* viewport); // get foreground draw list for the given viewport. this draw li st will be the last rendered one. Useful to quickly draw shapes/text over dear i mgui contents. | IMGUI_API ImDrawList* GetForegroundDrawList(ImGuiViewport* viewport); // get foreground draw list for the given viewport. this draw li st will be the last rendered one. Useful to quickly draw shapes/text over dear i mgui contents. | |||
// Init | // Init | |||
IMGUI_API void Initialize(ImGuiContext* context); | IMGUI_API void Initialize(ImGuiContext* context); | |||
IMGUI_API void Shutdown(ImGuiContext* context); // Since 1.60 th is is a _private_ function. You can call DestroyContext() to destroy the context created by CreateContext(). | IMGUI_API void Shutdown(ImGuiContext* context); // Since 1.60 th is is a _private_ function. You can call DestroyContext() to destroy the context created by CreateContext(). | |||
// NewFrame | // NewFrame | |||
IMGUI_API void UpdateInputEvents(bool trickle_fast_inputs); | ||||
IMGUI_API void UpdateHoveredWindowAndCaptureFlags(); | IMGUI_API void UpdateHoveredWindowAndCaptureFlags(); | |||
IMGUI_API void StartMouseMovingWindow(ImGuiWindow* window); | IMGUI_API void StartMouseMovingWindow(ImGuiWindow* window); | |||
IMGUI_API void UpdateMouseMovingWindowNewFrame(); | IMGUI_API void UpdateMouseMovingWindowNewFrame(); | |||
IMGUI_API void UpdateMouseMovingWindowEndFrame(); | IMGUI_API void UpdateMouseMovingWindowEndFrame(); | |||
// Generic context hooks | // Generic context hooks | |||
IMGUI_API ImGuiID AddContextHook(ImGuiContext* context, const ImGuiCon textHook* hook); | IMGUI_API ImGuiID AddContextHook(ImGuiContext* context, const ImGuiCon textHook* hook); | |||
IMGUI_API void RemoveContextHook(ImGuiContext* context, ImGuiID hoo k_to_remove); | IMGUI_API void RemoveContextHook(ImGuiContext* context, ImGuiID hoo k_to_remove); | |||
IMGUI_API void CallContextHooks(ImGuiContext* context, ImGuiContext HookType type); | IMGUI_API void CallContextHooks(ImGuiContext* context, ImGuiContext HookType type); | |||
skipping to change at line 2576 | skipping to change at line 2634 | |||
// Gamepad/Keyboard Navigation | // Gamepad/Keyboard Navigation | |||
IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit ); | IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit ); | |||
IMGUI_API void NavInitRequestApplyResult(); | IMGUI_API void NavInitRequestApplyResult(); | |||
IMGUI_API bool NavMoveRequestButNoResultYet(); | IMGUI_API bool NavMoveRequestButNoResultYet(); | |||
IMGUI_API void NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir cli p_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags); | IMGUI_API void NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir cli p_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags); | |||
IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir cl ip_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags); | IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir cl ip_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags); | |||
IMGUI_API void NavMoveRequestResolveWithLastItem(ImGuiNavItemData* result); | IMGUI_API void NavMoveRequestResolveWithLastItem(ImGuiNavItemData* result); | |||
IMGUI_API void NavMoveRequestCancel(); | IMGUI_API void NavMoveRequestCancel(); | |||
IMGUI_API void NavMoveRequestApplyResult(); | IMGUI_API void NavMoveRequestApplyResult(); | |||
IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGui NavMoveFlags move_flags); | IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGui NavMoveFlags move_flags); | |||
IMGUI_API const char* GetNavInputName(ImGuiNavInput n); | ||||
IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMod e mode); | IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMod e mode); | |||
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sourc es, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f) ; | IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sourc es, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f) ; | |||
IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate); | IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate); | |||
IMGUI_API void ActivateItem(ImGuiID id); // Remotely activate a b utton, checkbox, tree node etc. given its unique ID. activation is queued and pr ocessed on the next frame when the item is encountered again. | IMGUI_API void ActivateItem(ImGuiID id); // Remotely activate a b utton, checkbox, tree node etc. given its unique ID. activation is queued and pr ocessed on the next frame when the item is encountered again. | |||
IMGUI_API void SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiI D focus_scope_id, const ImRect& rect_rel); | IMGUI_API void SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiI D focus_scope_id, const ImRect& rect_rel); | |||
// Focus Scope (WIP) | // Focus Scope (WIP) | |||
// This is generally used to identify a selection set (multiple of which may be in the same window), as selection | // This is generally used to identify a selection set (multiple of which may be in the same window), as selection | |||
// patterns generally need to react (e.g. clear selection) when landing on a n item of the set. | // patterns generally need to react (e.g. clear selection) when landing on a n item of the set. | |||
IMGUI_API void PushFocusScope(ImGuiID id); | IMGUI_API void PushFocusScope(ImGuiID id); | |||
IMGUI_API void PopFocusScope(); | IMGUI_API void PopFocusScope(); | |||
inline ImGuiID GetFocusedFocusScope() { ImGuiContext& g = *GImGui; return g.NavFocusScopeId; } // Focus scope w hich is actually active | inline ImGuiID GetFocusedFocusScope() { ImGuiContext& g = *GImGui; return g.NavFocusScopeId; } // Focus scope w hich is actually active | |||
inline ImGuiID GetFocusScope() { ImGuiContext& g = *GImGui; return g.CurrentWindow->DC.NavFocusScopeIdCurrent; } // Focus scope w e are outputting into, set by PushFocusScope() | inline ImGuiID GetFocusScope() { ImGuiContext& g = *GImGui; return g.CurrentWindow->DC.NavFocusScopeIdCurrent; } // Focus scope w e are outputting into, set by PushFocusScope() | |||
// Inputs | // Inputs | |||
// FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into Is KeyXXX functions. | // FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into Is KeyXXX functions. | |||
inline bool IsNamedKey(ImGuiKey key) | ||||
{ return key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END; | ||||
} | ||||
inline bool IsLegacyKey(ImGuiKey key) | ||||
{ return key >= ImGuiKey_LegacyNativeKey_BEGIN && key < ImGuiKey_LegacyN | ||||
ativeKey_END; } | ||||
inline bool IsGamepadKey(ImGuiKey key) | ||||
{ return key >= ImGuiKey_Gamepad_BEGIN && key < ImGuiKey_Gamepad_END; } | ||||
IMGUI_API ImGuiKeyData* GetKeyData(ImGuiKey key); | ||||
IMGUI_API void SetItemUsingMouseWheel(); | IMGUI_API void SetItemUsingMouseWheel(); | |||
IMGUI_API void SetActiveIdUsingNavAndKeys(); | IMGUI_API void SetActiveIdUsingNavAndKeys(); | |||
inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << d ir)) != 0; } | inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << d ir)) != 0; } | |||
inline bool IsActiveIdUsingNavInput(ImGuiNavInput input) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavInputMask & (1 << input)) != 0; } | inline bool IsActiveIdUsingNavInput(ImGuiNavInput input) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavInputMask & (1 << input)) != 0; } | |||
inline bool IsActiveIdUsingKey(ImGuiKey key) | inline bool IsActiveIdUsingKey(ImGuiKey key) | |||
{ ImGuiContext& g = *GImGui; IM_ASSERT(key < 64); return (g.ActiveIdUsin | { ImGuiContext& g = *GImGui; return g.ActiveIdUsingKeyInputMask[key]; } | |||
gKeyInputMask & ((ImU64)1 << key)) != 0; } | inline void SetActiveIdUsingKey(ImGuiKey key) | |||
{ ImGuiContext& g = *GImGui; g.ActiveIdUsingKeyInputMask.SetBit(key); } | ||||
IMGUI_API bool IsMouseDragPastThreshold(ImGuiMouseButton button, fl oat lock_threshold = -1.0f); | IMGUI_API bool IsMouseDragPastThreshold(ImGuiMouseButton button, fl oat lock_threshold = -1.0f); | |||
inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { ImGuiContext& g = *GImGui; const int key_index = g.IO.KeyMap[key]; ret urn (key_index >= 0) ? IsKeyPressed(key_index, repeat) : false; } | ||||
inline bool IsNavInputDown(ImGuiNavInput n) { ImGuiContext& g = *GImGui; return g.IO.NavInputs[n] > 0.0f; } | inline bool IsNavInputDown(ImGuiNavInput n) { ImGuiContext& g = *GImGui; return g.IO.NavInputs[n] > 0.0f; } | |||
inline bool IsNavInputTest(ImGuiNavInput n, ImGuiInputReadMode r m) { return (GetNavInputAmount(n, rm) > 0.0f); } | inline bool IsNavInputTest(ImGuiNavInput n, ImGuiInputReadMode r m) { return (GetNavInputAmount(n, rm) > 0.0f); } | |||
IMGUI_API ImGuiKeyModFlags GetMergedKeyModFlags(); | IMGUI_API ImGuiKeyModFlags GetMergedKeyModFlags(); | |||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO | ||||
inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) | ||||
{ IM_ASSERT(IsNamedKey(key)); return IsKeyPressed(key, repeat); } | ||||
#endif | ||||
// Drag and Drop | // Drag and Drop | |||
IMGUI_API bool BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id); | IMGUI_API bool BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id); | |||
IMGUI_API void ClearDragDrop(); | IMGUI_API void ClearDragDrop(); | |||
IMGUI_API bool IsDragDropPayloadBeingAccepted(); | IMGUI_API bool IsDragDropPayloadBeingAccepted(); | |||
// Internal Columns API (this is not exposed because we will encourage trans itioning to the Tables API) | // Internal Columns API (this is not exposed because we will encourage trans itioning to the Tables API) | |||
IMGUI_API void SetWindowClipRectBeforeSetChannel(ImGuiWindow* windo w, const ImRect& clip_rect); | IMGUI_API void SetWindowClipRectBeforeSetChannel(ImGuiWindow* windo w, const ImRect& clip_rect); | |||
IMGUI_API void BeginColumns(const char* str_id, int count, ImGuiOld ColumnFlags flags = 0); // setup number of columns. use an identifier to disting uish multiple column sets. close with EndColumns(). | IMGUI_API void BeginColumns(const char* str_id, int count, ImGuiOld ColumnFlags flags = 0); // setup number of columns. use an identifier to disting uish multiple column sets. close with EndColumns(). | |||
IMGUI_API void EndColumns(); // close columns | IMGUI_API void EndColumns(); // close columns | |||
skipping to change at line 2753 | skipping to change at line 2819 | |||
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API T ScaleValueFromRatioT(ImGuiDataType data_type, float t, T v_min, T v_max, bool is _logarithmic, float logarithmic_zero_epsilon, float zero_deadzone_size); | template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API T ScaleValueFromRatioT(ImGuiDataType data_type, float t, T v_min, T v_max, bool is _logarithmic, float logarithmic_zero_epsilon, float zero_deadzone_size); | |||
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API bool DragBehaviorT(ImGuiDataType data_type, T* v, float v_speed, T v_min, T v_max, co nst char* format, ImGuiSliderFlags flags); | template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API bool DragBehaviorT(ImGuiDataType data_type, T* v, float v_speed, T v_min, T v_max, co nst char* format, ImGuiSliderFlags flags); | |||
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API bool SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, T* v, T v _min, T v_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb); | template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API bool SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, T* v, T v _min, T v_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb); | |||
template<typename T, typename SIGNED_T> IMGUI_API T RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, T v); | template<typename T, typename SIGNED_T> IMGUI_API T RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, T v); | |||
template<typename T> IMGUI_API bool CheckboxFlagsT(const char* label, T* flags, T flags_value); | template<typename T> IMGUI_API bool CheckboxFlagsT(const char* label, T* flags, T flags_value); | |||
// Data type helpers | // Data type helpers | |||
IMGUI_API const ImGuiDataTypeInfo* DataTypeGetInfo(ImGuiDataType data_type) ; | IMGUI_API const ImGuiDataTypeInfo* DataTypeGetInfo(ImGuiDataType data_type) ; | |||
IMGUI_API int DataTypeFormatString(char* buf, int buf_size, ImGuiD ataType data_type, const void* p_data, const char* format); | IMGUI_API int DataTypeFormatString(char* buf, int buf_size, ImGuiD ataType data_type, const void* p_data, const char* format); | |||
IMGUI_API void DataTypeApplyOp(ImGuiDataType data_type, int op, voi d* output, const void* arg_1, const void* arg_2); | IMGUI_API void DataTypeApplyOp(ImGuiDataType data_type, int op, voi d* output, const void* arg_1, const void* arg_2); | |||
IMGUI_API bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* p_data, const char* format); | IMGUI_API bool DataTypeApplyFromText(const char* buf, ImGuiDataType data_type, void* p_data, const char* format); | |||
IMGUI_API int DataTypeCompare(ImGuiDataType data_type, const void* arg_1, const void* arg_2); | IMGUI_API int DataTypeCompare(ImGuiDataType data_type, const void* arg_1, const void* arg_2); | |||
IMGUI_API bool DataTypeClamp(ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max); | IMGUI_API bool DataTypeClamp(ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max); | |||
// InputText | // InputText | |||
IMGUI_API bool InputTextEx(const char* label, const char* hint, cha r* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiIn putTextCallback callback = NULL, void* user_data = NULL); | IMGUI_API bool InputTextEx(const char* label, const char* hint, cha r* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiIn putTextCallback callback = NULL, void* user_data = NULL); | |||
IMGUI_API bool TempInputText(const ImRect& bb, ImGuiID id, const ch ar* label, char* buf, int buf_size, ImGuiInputTextFlags flags); | IMGUI_API bool TempInputText(const ImRect& bb, ImGuiID id, const ch ar* label, char* buf, int buf_size, ImGuiInputTextFlags flags); | |||
IMGUI_API bool TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const vo id* p_clamp_min = NULL, const void* p_clamp_max = NULL); | IMGUI_API bool TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const vo id* p_clamp_min = NULL, const void* p_clamp_max = NULL); | |||
inline bool TempInputIsActive(ImGuiID id) { ImGuiContext& g = *GImGui; return (g.ActiveId == id && g.TempInputId == id); } | inline bool TempInputIsActive(ImGuiID id) { ImGuiContext& g = *GImGui; return (g.ActiveId == id && g.TempInputId == id); } | |||
inline ImGuiInputTextState* GetInputTextState(ImGuiID id) { ImGuiContext& g = *GImGui; return (g.InputTextState.ID == id) ? &g.InputTextState : NULL; } // Get input text state if active | inline ImGuiInputTextState* GetInputTextState(ImGuiID id) { ImGuiContext& g = *GImGui; return (g.InputTextState.ID == id) ? &g.InputTextState : NULL; } // Get input text state if active | |||
skipping to change at line 2817 | skipping to change at line 2883 | |||
// [SECTION] ImFontAtlas internal API | // [SECTION] ImFontAtlas internal API | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
// This structure is likely to evolve as we add support for incremental atlas up dates | // This structure is likely to evolve as we add support for incremental atlas up dates | |||
struct ImFontBuilderIO | struct ImFontBuilderIO | |||
{ | { | |||
bool (*FontBuilder_Build)(ImFontAtlas* atlas); | bool (*FontBuilder_Build)(ImFontAtlas* atlas); | |||
}; | }; | |||
// Helper for font builder | // Helper for font builder | |||
#ifdef IMGUI_ENABLE_STB_TRUETYPE | ||||
IMGUI_API const ImFontBuilderIO* ImFontAtlasGetBuilderForStbTruetype(); | IMGUI_API const ImFontBuilderIO* ImFontAtlasGetBuilderForStbTruetype(); | |||
#endif | ||||
IMGUI_API void ImFontAtlasBuildInit(ImFontAtlas* atlas); | IMGUI_API void ImFontAtlasBuildInit(ImFontAtlas* atlas); | |||
IMGUI_API void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent); | IMGUI_API void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent); | |||
IMGUI_API void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* st brp_context_opaque); | IMGUI_API void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* st brp_context_opaque); | |||
IMGUI_API void ImFontAtlasBuildFinish(ImFontAtlas* atlas); | IMGUI_API void ImFontAtlasBuildFinish(ImFontAtlas* atlas); | |||
IMGUI_API void ImFontAtlasBuildRender8bppRectFromString(ImFontAtlas* atlas, int x, int y, int w, int h, const char* in_str, char in_marker_char, unsigned c har in_marker_pixel_value); | IMGUI_API void ImFontAtlasBuildRender8bppRectFromString(ImFontAtlas* atlas, int x, int y, int w, int h, const char* in_str, char in_marker_char, unsigned c har in_marker_pixel_value); | |||
IMGUI_API void ImFontAtlasBuildRender32bppRectFromString(ImFontAtlas* atlas , int x, int y, int w, int h, const char* in_str, char in_marker_char, unsigned int in_marker_pixel_value); | IMGUI_API void ImFontAtlasBuildRender32bppRectFromString(ImFontAtlas* atlas , int x, int y, int w, int h, const char* in_str, char in_marker_char, unsigned int in_marker_pixel_value); | |||
IMGUI_API void ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_ta ble[256], float in_multiply_factor); | IMGUI_API void ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_ta ble[256], float in_multiply_factor); | |||
IMGUI_API void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table [256], unsigned char* pixels, int x, int y, int w, int h, int stride); | IMGUI_API void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table [256], unsigned char* pixels, int x, int y, int w, int h, int stride); | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
skipping to change at line 2841 | skipping to change at line 2909 | |||
#ifdef IMGUI_ENABLE_TEST_ENGINE | #ifdef IMGUI_ENABLE_TEST_ENGINE | |||
extern void ImGuiTestEngineHook_ItemAdd(ImGuiContext* ctx, const ImRect& bb, ImGuiID id); | extern void ImGuiTestEngineHook_ItemAdd(ImGuiContext* ctx, const ImRect& bb, ImGuiID id); | |||
extern void ImGuiTestEngineHook_ItemInfo(ImGuiContext* ctx, ImGuiID id, const char* label, ImGuiItemStatusFlags flags); | extern void ImGuiTestEngineHook_ItemInfo(ImGuiContext* ctx, ImGuiID id, const char* label, ImGuiItemStatusFlags flags); | |||
extern void ImGuiTestEngineHook_Log(ImGuiContext* ctx, const char* fmt, ...); | extern void ImGuiTestEngineHook_Log(ImGuiContext* ctx, const char* fmt, ...); | |||
extern const char* ImGuiTestEngine_FindItemDebugLabel(ImGuiContext* ctx, ImGuiI D id); | extern const char* ImGuiTestEngine_FindItemDebugLabel(ImGuiContext* ctx, ImGuiI D id); | |||
#define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID) if (g.TestEngineHook Items) ImGuiTestEngineHook_ItemAdd(&g, _BB, _ID) // Register item bounding box | #define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID) if (g.TestEngineHook Items) ImGuiTestEngineHook_ItemAdd(&g, _BB, _ID) // Register item bounding box | |||
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) if (g.TestEngineHook Items) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS) // Register item label and status flags (optional) | #define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) if (g.TestEngineHook Items) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS) // Register item label and status flags (optional) | |||
#define IMGUI_TEST_ENGINE_LOG(_FMT,...) if (g.TestEngineHook Items) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__) // Custom log ent ry from user land into test log | #define IMGUI_TEST_ENGINE_LOG(_FMT,...) if (g.TestEngineHook Items) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__) // Custom log ent ry from user land into test log | |||
#else | #else | |||
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) ((void)0) | #define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID) ((void)0) | |||
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) ((void)g) | ||||
#endif | #endif | |||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | |||
#if defined(__clang__) | #if defined(__clang__) | |||
#pragma clang diagnostic pop | #pragma clang diagnostic pop | |||
#elif defined(__GNUC__) | #elif defined(__GNUC__) | |||
#pragma GCC diagnostic pop | #pragma GCC diagnostic pop | |||
#endif | #endif | |||
End of changes. 30 change blocks. | ||||
54 lines changed or deleted | 144 lines changed or added |