mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-21 07:16:34 +00:00
Merge branch 'master' into docking
# Conflicts: # imgui.cpp # imgui_internal.h
This commit is contained in:
commit
8596f2b0fc
14
imgui.cpp
14
imgui.cpp
@ -4419,7 +4419,7 @@ static void ImGui::EndFrameDrawDimmedBackgrounds()
|
|||||||
ImGuiViewportP* viewport = g.Viewports[viewport_n];
|
ImGuiViewportP* viewport = g.Viewports[viewport_n];
|
||||||
if (modal_window && viewport == modal_window->Viewport)
|
if (modal_window && viewport == modal_window->Viewport)
|
||||||
continue;
|
continue;
|
||||||
if (g.NavWindowingList && viewport == g.NavWindowingList->Viewport)
|
if (g.NavWindowingListWindow && viewport == g.NavWindowingListWindow->Viewport)
|
||||||
continue;
|
continue;
|
||||||
if (g.NavWindowingTargetAnim && viewport == g.NavWindowingTargetAnim->Viewport)
|
if (g.NavWindowingTargetAnim && viewport == g.NavWindowingTargetAnim->Viewport)
|
||||||
continue;
|
continue;
|
||||||
@ -4567,7 +4567,7 @@ void ImGui::Render()
|
|||||||
// Add ImDrawList to render
|
// Add ImDrawList to render
|
||||||
ImGuiWindow* windows_to_render_top_most[2];
|
ImGuiWindow* windows_to_render_top_most[2];
|
||||||
windows_to_render_top_most[0] = (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus)) ? g.NavWindowingTarget->RootWindow : NULL;
|
windows_to_render_top_most[0] = (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus)) ? g.NavWindowingTarget->RootWindow : NULL;
|
||||||
windows_to_render_top_most[1] = (g.NavWindowingTarget ? g.NavWindowingList : NULL);
|
windows_to_render_top_most[1] = (g.NavWindowingTarget ? g.NavWindowingListWindow : NULL);
|
||||||
for (int n = 0; n != g.Windows.Size; n++)
|
for (int n = 0; n != g.Windows.Size; n++)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = g.Windows[n];
|
ImGuiWindow* window = g.Windows[n];
|
||||||
@ -6030,7 +6030,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
bool window_title_visible_elsewhere = false;
|
bool window_title_visible_elsewhere = false;
|
||||||
if ((window->Viewport && window->Viewport->Window == window) || (window->DockIsActive))
|
if ((window->Viewport && window->Viewport->Window == window) || (window->DockIsActive))
|
||||||
window_title_visible_elsewhere = true;
|
window_title_visible_elsewhere = true;
|
||||||
else if (g.NavWindowingList != NULL && (window->Flags & ImGuiWindowFlags_NoNavFocus) == 0) // Window titles visible when using CTRL+TAB
|
else if (g.NavWindowingListWindow != NULL && (window->Flags & ImGuiWindowFlags_NoNavFocus) == 0) // Window titles visible when using CTRL+TAB
|
||||||
window_title_visible_elsewhere = true;
|
window_title_visible_elsewhere = true;
|
||||||
if (window_title_visible_elsewhere && !window_just_created && strcmp(name, window->Name) != 0)
|
if (window_title_visible_elsewhere && !window_just_created && strcmp(name, window->Name) != 0)
|
||||||
{
|
{
|
||||||
@ -6427,8 +6427,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
PushClipRect(host_rect.Min, host_rect.Max, false);
|
PushClipRect(host_rect.Min, host_rect.Max, false);
|
||||||
|
|
||||||
// Draw modal or window list full viewport dimming background (for other viewports we'll render them in EndFrame)
|
// Draw modal or window list full viewport dimming background (for other viewports we'll render them in EndFrame)
|
||||||
|
ImGuiWindow* window_window_list = g.NavWindowingListWindow;
|
||||||
const bool dim_bg_for_modal = (flags & ImGuiWindowFlags_Modal) && window == GetTopMostPopupModal() && window->HiddenFramesCannotSkipItems <= 0;
|
const bool dim_bg_for_modal = (flags & ImGuiWindowFlags_Modal) && window == GetTopMostPopupModal() && window->HiddenFramesCannotSkipItems <= 0;
|
||||||
const bool dim_bg_for_window_list = g.NavWindowingTargetAnim && ((window == g.NavWindowingTargetAnim->RootWindow) || (g.NavWindowingList && (window == g.NavWindowingList) && g.NavWindowingList->Viewport != g.NavWindowingTargetAnim->Viewport));
|
const bool dim_bg_for_window_list = g.NavWindowingTargetAnim && ((window == g.NavWindowingTargetAnim->RootWindow) || (window == window_window_list && window_window_list->Viewport != g.NavWindowingTargetAnim->Viewport));
|
||||||
if (dim_bg_for_modal || dim_bg_for_window_list)
|
if (dim_bg_for_modal || dim_bg_for_window_list)
|
||||||
{
|
{
|
||||||
const ImU32 dim_bg_col = GetColorU32(dim_bg_for_modal ? ImGuiCol_ModalWindowDimBg : ImGuiCol_NavWindowingDimBg, g.DimBgRatio);
|
const ImU32 dim_bg_col = GetColorU32(dim_bg_for_modal ? ImGuiCol_ModalWindowDimBg : ImGuiCol_NavWindowingDimBg, g.DimBgRatio);
|
||||||
@ -7323,6 +7324,7 @@ void ImGui::ActivateItem(ImGuiID id)
|
|||||||
g.NavNextActivateId = id;
|
g.NavNextActivateId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: this is storing in same stack as IDStack, so Push/Pop mismatch will be reported there.
|
||||||
void ImGui::PushFocusScope(ImGuiID id)
|
void ImGui::PushFocusScope(ImGuiID id)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
@ -9841,8 +9843,8 @@ void ImGui::NavUpdateWindowingOverlay()
|
|||||||
if (g.NavWindowingTimer < NAV_WINDOWING_LIST_APPEAR_DELAY)
|
if (g.NavWindowingTimer < NAV_WINDOWING_LIST_APPEAR_DELAY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (g.NavWindowingList == NULL)
|
if (g.NavWindowingListWindow == NULL)
|
||||||
g.NavWindowingList = FindWindowByName("###NavWindowingList");
|
g.NavWindowingListWindow = FindWindowByName("###NavWindowingList");
|
||||||
ImGuiViewportP* viewport = /*g.NavWindow ? g.NavWindow->Viewport :*/ (ImGuiViewportP*)GetMainViewport();
|
ImGuiViewportP* viewport = /*g.NavWindow ? g.NavWindow->Viewport :*/ (ImGuiViewportP*)GetMainViewport();
|
||||||
SetNextWindowSizeConstraints(ImVec2(viewport->Size.x * 0.20f, viewport->Size.y * 0.20f), ImVec2(FLT_MAX, FLT_MAX));
|
SetNextWindowSizeConstraints(ImVec2(viewport->Size.x * 0.20f, viewport->Size.y * 0.20f), ImVec2(FLT_MAX, FLT_MAX));
|
||||||
SetNextWindowPos(viewport->Pos + viewport->Size * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
SetNextWindowPos(viewport->Pos + viewport->Size * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||||
|
699
imgui_internal.h
699
imgui_internal.h
@ -9,15 +9,26 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Index of this file:
|
Index of this file:
|
||||||
// Header mess
|
|
||||||
// Forward declarations
|
// [SECTION] Header mess
|
||||||
// STB libraries includes
|
// [SECTION] Forward declarations
|
||||||
// Context pointer
|
// [SECTION] Context pointer
|
||||||
// Generic helpers
|
// [SECTION] STB libraries includes
|
||||||
// Misc data structures
|
// [SECTION] Macros
|
||||||
// Main imgui context
|
// [SECTION] Generic helpers
|
||||||
// Tab bar, tab item
|
// [SECTION] ImDrawList support
|
||||||
// Internal API
|
// [SECTION] Widgets support: flags, enums, data structures
|
||||||
|
// [SECTION] Columns support
|
||||||
|
// [SECTION] Settings support
|
||||||
|
// [SECTION] Multi-select support
|
||||||
|
// [SECTION] Docking support
|
||||||
|
// [SECTION] Viewport support
|
||||||
|
// [SECTION] ImGuiContext (main imgui context)
|
||||||
|
// [SECTION] ImGuiWindowTempData, ImGuiWindow
|
||||||
|
// [SECTION] Tab bar, Tab item support
|
||||||
|
// [SECTION] Table support
|
||||||
|
// [SECTION] Internal API
|
||||||
|
// [SECTION] Test Engine Hooks (imgui_test_engine)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -25,7 +36,7 @@ Index of this file:
|
|||||||
#ifndef IMGUI_DISABLE
|
#ifndef IMGUI_DISABLE
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Header mess
|
// [SECTION] Header mess
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef IMGUI_VERSION
|
#ifndef IMGUI_VERSION
|
||||||
@ -70,7 +81,7 @@ Index of this file:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Forward declarations
|
// [SECTION] Forward declarations
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
struct ImBitVector; // Store 1-bit per value
|
struct ImBitVector; // Store 1-bit per value
|
||||||
@ -119,8 +130,17 @@ typedef int ImGuiSliderFlags; // -> enum ImGuiSliderFlags_ // F
|
|||||||
typedef int ImGuiTextFlags; // -> enum ImGuiTextFlags_ // Flags: for TextEx()
|
typedef int ImGuiTextFlags; // -> enum ImGuiTextFlags_ // Flags: for TextEx()
|
||||||
typedef int ImGuiTooltipFlags; // -> enum ImGuiTooltipFlags_ // Flags: for BeginTooltipEx()
|
typedef int ImGuiTooltipFlags; // -> enum ImGuiTooltipFlags_ // Flags: for BeginTooltipEx()
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Context pointer
|
||||||
|
// See implementation of this variable in imgui.cpp for comments and details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef GImGui
|
||||||
|
extern IMGUI_API ImGuiContext* GImGui; // Current implicit context pointer
|
||||||
|
#endif
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// STB libraries includes
|
// [SECTION] STB libraries includes
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace ImStb
|
namespace ImStb
|
||||||
@ -138,20 +158,12 @@ namespace ImStb
|
|||||||
} // namespace ImStb
|
} // namespace ImStb
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Context pointer
|
// [SECTION] Macros
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef GImGui
|
|
||||||
extern IMGUI_API ImGuiContext* GImGui; // Current implicit context pointer
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Internal Drag and Drop payload types. String starting with '_' are reserved for Dear ImGui.
|
// Internal Drag and Drop payload types. String starting with '_' are reserved for Dear ImGui.
|
||||||
#define IMGUI_PAYLOAD_TYPE_WINDOW "_IMWINDOW" // Payload == ImGuiWindow*
|
#define IMGUI_PAYLOAD_TYPE_WINDOW "_IMWINDOW" // Payload == ImGuiWindow*
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Macros
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Debug Logging
|
// Debug Logging
|
||||||
#ifndef IMGUI_DEBUG_LOG
|
#ifndef IMGUI_DEBUG_LOG
|
||||||
#define IMGUI_DEBUG_LOG(_FMT,...) printf("[%05d] " _FMT, GImGui->FrameCount, __VA_ARGS__)
|
#define IMGUI_DEBUG_LOG(_FMT,...) printf("[%05d] " _FMT, GImGui->FrameCount, __VA_ARGS__)
|
||||||
@ -207,32 +219,50 @@ extern IMGUI_API ImGuiContext* GImGui; // Current implicit context pointer
|
|||||||
#define IMGUI_CDECL
|
#define IMGUI_CDECL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Debug Tools
|
||||||
|
// Use 'Metrics->Tools->Item Picker' to break into the call-stack of a specific item.
|
||||||
|
#ifndef IM_DEBUG_BREAK
|
||||||
|
#if defined(__clang__)
|
||||||
|
#define IM_DEBUG_BREAK() __builtin_debugtrap()
|
||||||
|
#elif defined (_MSC_VER)
|
||||||
|
#define IM_DEBUG_BREAK() __debugbreak()
|
||||||
|
#else
|
||||||
|
#define IM_DEBUG_BREAK() IM_ASSERT(0) // It is expected that you define IM_DEBUG_BREAK() into something that will break nicely in a debugger!
|
||||||
|
#endif
|
||||||
|
#endif // #ifndef IM_DEBUG_BREAK
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Generic helpers
|
// [SECTION] Generic helpers
|
||||||
// Note that the ImXXX helpers functions are lower-level than ImGui functions.
|
// Note that the ImXXX helpers functions are lower-level than ImGui functions.
|
||||||
// ImGui functions or the ImGui context are never called/used from other ImXXX functions.
|
// ImGui functions or the ImGui context are never called/used from other ImXXX functions.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// - Helpers: Misc
|
// - Helpers: Hashing
|
||||||
|
// - Helpers: Sorting
|
||||||
// - Helpers: Bit manipulation
|
// - Helpers: Bit manipulation
|
||||||
// - Helpers: String, Formatting
|
// - Helpers: String, Formatting
|
||||||
// - Helpers: UTF-8 <> wchar conversions
|
// - Helpers: UTF-8 <> wchar conversions
|
||||||
// - Helpers: ImVec2/ImVec4 operators
|
// - Helpers: ImVec2/ImVec4 operators
|
||||||
// - Helpers: Maths
|
// - Helpers: Maths
|
||||||
// - Helpers: Geometry
|
// - Helpers: Geometry
|
||||||
// - Helpers: Bit arrays
|
// - Helper: ImVec1
|
||||||
|
// - Helper: ImVec2ih
|
||||||
|
// - Helper: ImRect
|
||||||
|
// - Helper: ImBitArray
|
||||||
// - Helper: ImBitVector
|
// - Helper: ImBitVector
|
||||||
// - Helper: ImPool<>
|
// - Helper: ImPool<>
|
||||||
// - Helper: ImChunkStream<>
|
// - Helper: ImChunkStream<>
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Helpers: Misc
|
// Helpers: Hashing
|
||||||
#define ImQsort qsort
|
|
||||||
IMGUI_API ImU32 ImHashData(const void* data, size_t data_size, ImU32 seed = 0);
|
IMGUI_API ImU32 ImHashData(const void* data, size_t data_size, ImU32 seed = 0);
|
||||||
IMGUI_API ImU32 ImHashStr(const char* data, size_t data_size = 0, ImU32 seed = 0);
|
IMGUI_API ImU32 ImHashStr(const char* data, size_t data_size = 0, ImU32 seed = 0);
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
static inline ImU32 ImHash(const void* data, int size, ImU32 seed = 0) { return size ? ImHashData(data, (size_t)size, seed) : ImHashStr((const char*)data, 0, seed); } // [moved to ImHashStr/ImHashData in 1.68]
|
static inline ImU32 ImHash(const void* data, int size, ImU32 seed = 0) { return size ? ImHashData(data, (size_t)size, seed) : ImHashStr((const char*)data, 0, seed); } // [moved to ImHashStr/ImHashData in 1.68]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Helpers: Sorting
|
||||||
|
#define ImQsort qsort
|
||||||
|
|
||||||
// Helpers: Color Blending
|
// Helpers: Color Blending
|
||||||
IMGUI_API ImU32 ImAlphaBlendColors(ImU32 col_a, ImU32 col_b);
|
IMGUI_API ImU32 ImAlphaBlendColors(ImU32 col_a, ImU32 col_b);
|
||||||
|
|
||||||
@ -301,7 +331,6 @@ static inline ImU64 ImFileGetSize(ImFileHandle)
|
|||||||
static inline ImU64 ImFileRead(void*, ImU64, ImU64, ImFileHandle) { return 0; }
|
static inline ImU64 ImFileRead(void*, ImU64, ImU64, ImFileHandle) { return 0; }
|
||||||
static inline ImU64 ImFileWrite(const void*, ImU64, ImU64, ImFileHandle) { return 0; }
|
static inline ImU64 ImFileWrite(const void*, ImU64, ImU64, ImFileHandle) { return 0; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS
|
||||||
typedef FILE* ImFileHandle;
|
typedef FILE* ImFileHandle;
|
||||||
IMGUI_API ImFileHandle ImFileOpen(const char* filename, const char* mode);
|
IMGUI_API ImFileHandle ImFileOpen(const char* filename, const char* mode);
|
||||||
@ -369,7 +398,61 @@ IMGUI_API void ImTriangleBarycentricCoords(const ImVec2& a, const ImVec2&
|
|||||||
inline float ImTriangleArea(const ImVec2& a, const ImVec2& b, const ImVec2& c) { return ImFabs((a.x * (b.y - c.y)) + (b.x * (c.y - a.y)) + (c.x * (a.y - b.y))) * 0.5f; }
|
inline float ImTriangleArea(const ImVec2& a, const ImVec2& b, const ImVec2& c) { return ImFabs((a.x * (b.y - c.y)) + (b.x * (c.y - a.y)) + (c.x * (a.y - b.y))) * 0.5f; }
|
||||||
IMGUI_API ImGuiDir ImGetDirQuadrantFromDelta(float dx, float dy);
|
IMGUI_API ImGuiDir ImGetDirQuadrantFromDelta(float dx, float dy);
|
||||||
|
|
||||||
// Helpers: Bit arrays
|
// Helper: ImVec1 (1D vector)
|
||||||
|
// (this odd construct is used to facilitate the transition between 1D and 2D, and the maintenance of some branches/patches)
|
||||||
|
struct ImVec1
|
||||||
|
{
|
||||||
|
float x;
|
||||||
|
ImVec1() { x = 0.0f; }
|
||||||
|
ImVec1(float _x) { x = _x; }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Helper: ImVec2ih (2D vector, half-size integer, for long-term packed storage)
|
||||||
|
struct ImVec2ih
|
||||||
|
{
|
||||||
|
short x, y;
|
||||||
|
ImVec2ih() { x = y = 0; }
|
||||||
|
ImVec2ih(short _x, short _y) { x = _x; y = _y; }
|
||||||
|
explicit ImVec2ih(const ImVec2& rhs) { x = (short)rhs.x; y = (short)rhs.y; }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Helper: ImRect (2D axis aligned bounding-box)
|
||||||
|
// NB: we can't rely on ImVec2 math operators being available here!
|
||||||
|
struct IMGUI_API ImRect
|
||||||
|
{
|
||||||
|
ImVec2 Min; // Upper-left
|
||||||
|
ImVec2 Max; // Lower-right
|
||||||
|
|
||||||
|
ImRect() : Min(0.0f, 0.0f), Max(0.0f, 0.0f) {}
|
||||||
|
ImRect(const ImVec2& min, const ImVec2& max) : Min(min), Max(max) {}
|
||||||
|
ImRect(const ImVec4& v) : Min(v.x, v.y), Max(v.z, v.w) {}
|
||||||
|
ImRect(float x1, float y1, float x2, float y2) : Min(x1, y1), Max(x2, y2) {}
|
||||||
|
|
||||||
|
ImVec2 GetCenter() const { return ImVec2((Min.x + Max.x) * 0.5f, (Min.y + Max.y) * 0.5f); }
|
||||||
|
ImVec2 GetSize() const { return ImVec2(Max.x - Min.x, Max.y - Min.y); }
|
||||||
|
float GetWidth() const { return Max.x - Min.x; }
|
||||||
|
float GetHeight() const { return Max.y - Min.y; }
|
||||||
|
ImVec2 GetTL() const { return Min; } // Top-left
|
||||||
|
ImVec2 GetTR() const { return ImVec2(Max.x, Min.y); } // Top-right
|
||||||
|
ImVec2 GetBL() const { return ImVec2(Min.x, Max.y); } // Bottom-left
|
||||||
|
ImVec2 GetBR() const { return Max; } // Bottom-right
|
||||||
|
bool Contains(const ImVec2& p) const { return p.x >= Min.x && p.y >= Min.y && p.x < Max.x && p.y < Max.y; }
|
||||||
|
bool Contains(const ImRect& r) const { return r.Min.x >= Min.x && r.Min.y >= Min.y && r.Max.x <= Max.x && r.Max.y <= Max.y; }
|
||||||
|
bool Overlaps(const ImRect& r) const { return r.Min.y < Max.y && r.Max.y > Min.y && r.Min.x < Max.x && r.Max.x > Min.x; }
|
||||||
|
void Add(const ImVec2& p) { if (Min.x > p.x) Min.x = p.x; if (Min.y > p.y) Min.y = p.y; if (Max.x < p.x) Max.x = p.x; if (Max.y < p.y) Max.y = p.y; }
|
||||||
|
void Add(const ImRect& r) { if (Min.x > r.Min.x) Min.x = r.Min.x; if (Min.y > r.Min.y) Min.y = r.Min.y; if (Max.x < r.Max.x) Max.x = r.Max.x; if (Max.y < r.Max.y) Max.y = r.Max.y; }
|
||||||
|
void Expand(const float amount) { Min.x -= amount; Min.y -= amount; Max.x += amount; Max.y += amount; }
|
||||||
|
void Expand(const ImVec2& amount) { Min.x -= amount.x; Min.y -= amount.y; Max.x += amount.x; Max.y += amount.y; }
|
||||||
|
void Translate(const ImVec2& d) { Min.x += d.x; Min.y += d.y; Max.x += d.x; Max.y += d.y; }
|
||||||
|
void TranslateX(float dx) { Min.x += dx; Max.x += dx; }
|
||||||
|
void TranslateY(float dy) { Min.y += dy; Max.y += dy; }
|
||||||
|
void ClipWith(const ImRect& r) { Min = ImMax(Min, r.Min); Max = ImMin(Max, r.Max); } // Simple version, may lead to an inverted rectangle, which is fine for Contains/Overlaps test but not for display.
|
||||||
|
void ClipWithFull(const ImRect& r) { Min = ImClamp(Min, r.Min, r.Max); Max = ImClamp(Max, r.Min, r.Max); } // Full version, ensure both points are fully clipped.
|
||||||
|
void Floor() { Min.x = IM_FLOOR(Min.x); Min.y = IM_FLOOR(Min.y); Max.x = IM_FLOOR(Max.x); Max.y = IM_FLOOR(Max.y); }
|
||||||
|
bool IsInverted() const { return Min.x > Max.x || Min.y > Max.y; }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Helper: ImBitArray
|
||||||
inline bool ImBitArrayTestBit(const ImU32* arr, int n) { ImU32 mask = (ImU32)1 << (n & 31); return (arr[n >> 5] & mask) != 0; }
|
inline bool ImBitArrayTestBit(const ImU32* arr, int n) { ImU32 mask = (ImU32)1 << (n & 31); return (arr[n >> 5] & mask) != 0; }
|
||||||
inline void ImBitArrayClearBit(ImU32* arr, int n) { ImU32 mask = (ImU32)1 << (n & 31); arr[n >> 5] &= ~mask; }
|
inline void ImBitArrayClearBit(ImU32* arr, int n) { ImU32 mask = (ImU32)1 << (n & 31); arr[n >> 5] &= ~mask; }
|
||||||
inline void ImBitArraySetBit(ImU32* arr, int n) { ImU32 mask = (ImU32)1 << (n & 31); arr[n >> 5] |= mask; }
|
inline void ImBitArraySetBit(ImU32* arr, int n) { ImU32 mask = (ImU32)1 << (n & 31); arr[n >> 5] |= mask; }
|
||||||
@ -446,9 +529,88 @@ struct IMGUI_API ImChunkStream
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Misc data structures
|
// [SECTION] ImDrawList support
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// ImDrawList: Helper function to calculate a circle's segment count given its radius and a "maximum error" value.
|
||||||
|
#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN 12
|
||||||
|
#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX 512
|
||||||
|
#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD,_MAXERROR) ImClamp((int)((IM_PI * 2.0f) / ImAcos(((_RAD) - (_MAXERROR)) / (_RAD))), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX)
|
||||||
|
|
||||||
|
// ImDrawList: You may set this to higher values (e.g. 2 or 3) to increase tessellation of fast rounded corners path.
|
||||||
|
#ifndef IM_DRAWLIST_ARCFAST_TESSELLATION_MULTIPLIER
|
||||||
|
#define IM_DRAWLIST_ARCFAST_TESSELLATION_MULTIPLIER 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
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 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()
|
||||||
|
ImDrawListFlags InitialFlags; // Initial flags at the beginning of the frame (it is possible to alter flags on a per-drawlist basis afterwards)
|
||||||
|
|
||||||
|
// [Internal] Lookup tables
|
||||||
|
ImVec2 ArcFastVtx[12 * IM_DRAWLIST_ARCFAST_TESSELLATION_MULTIPLIER]; // FIXME: Bake rounded corners fill/borders in atlas
|
||||||
|
ImU8 CircleSegmentCounts[64]; // Precomputed segment count for given radius (array index + 1) before we calculate it dynamically (to avoid calculation overhead)
|
||||||
|
|
||||||
|
ImDrawListSharedData();
|
||||||
|
void SetCircleSegmentMaxError(float max_error);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ImDrawDataBuilder
|
||||||
|
{
|
||||||
|
ImVector<ImDrawList*> Layers[2]; // Global layers for: regular, tooltip
|
||||||
|
|
||||||
|
void Clear() { for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n].resize(0); }
|
||||||
|
void ClearFreeMemory() { for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n].clear(); }
|
||||||
|
IMGUI_API void FlattenIntoSingleLayer();
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Widgets support: flags, enums, data structures
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Transient per-window flags, reset at the beginning of the frame. For child window, inherited from parent on first Begin().
|
||||||
|
// This is going to be exposed in imgui.h when stabilized enough.
|
||||||
|
enum ImGuiItemFlags_
|
||||||
|
{
|
||||||
|
ImGuiItemFlags_None = 0,
|
||||||
|
ImGuiItemFlags_NoTabStop = 1 << 0, // false
|
||||||
|
ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.
|
||||||
|
ImGuiItemFlags_Disabled = 1 << 2, // false // [BETA] Disable interactions but doesn't affect visuals yet. See github.com/ocornut/imgui/issues/211
|
||||||
|
ImGuiItemFlags_NoNav = 1 << 3, // false
|
||||||
|
ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false
|
||||||
|
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // MenuItem/Selectable() automatically closes current Popup window
|
||||||
|
ImGuiItemFlags_MixedValue = 1 << 6, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets)
|
||||||
|
ImGuiItemFlags_Default_ = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
// Storage for LastItem data
|
||||||
|
enum ImGuiItemStatusFlags_
|
||||||
|
{
|
||||||
|
ImGuiItemStatusFlags_None = 0,
|
||||||
|
ImGuiItemStatusFlags_HoveredRect = 1 << 0,
|
||||||
|
ImGuiItemStatusFlags_HasDisplayRect = 1 << 1,
|
||||||
|
ImGuiItemStatusFlags_Edited = 1 << 2, // Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
|
||||||
|
ImGuiItemStatusFlags_ToggledSelection = 1 << 3, // Set when Selectable(), TreeNode() reports toggling a selection. We can't report "Selected" because reporting the change allows us to handle clipping with less issues.
|
||||||
|
ImGuiItemStatusFlags_ToggledOpen = 1 << 4, // Set when TreeNode() reports toggling their open state.
|
||||||
|
ImGuiItemStatusFlags_HasDeactivated = 1 << 5, // Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
|
||||||
|
ImGuiItemStatusFlags_Deactivated = 1 << 6 // Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
|
||||||
|
|
||||||
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
|
, // [imgui_tests only]
|
||||||
|
ImGuiItemStatusFlags_Openable = 1 << 10, //
|
||||||
|
ImGuiItemStatusFlags_Opened = 1 << 11, //
|
||||||
|
ImGuiItemStatusFlags_Checkable = 1 << 12, //
|
||||||
|
ImGuiItemStatusFlags_Checked = 1 << 13 //
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
enum ImGuiButtonFlags_
|
enum ImGuiButtonFlags_
|
||||||
{
|
{
|
||||||
ImGuiButtonFlags_None = 0,
|
ImGuiButtonFlags_None = 0,
|
||||||
@ -491,17 +653,6 @@ enum ImGuiDragFlags_
|
|||||||
ImGuiDragFlags_Vertical = 1 << 0
|
ImGuiDragFlags_Vertical = 1 << 0
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiColumnsFlags_
|
|
||||||
{
|
|
||||||
// Default: 0
|
|
||||||
ImGuiColumnsFlags_None = 0,
|
|
||||||
ImGuiColumnsFlags_NoBorder = 1 << 0, // Disable column dividers
|
|
||||||
ImGuiColumnsFlags_NoResize = 1 << 1, // Disable resizing columns when clicking on the dividers
|
|
||||||
ImGuiColumnsFlags_NoPreserveWidths = 1 << 2, // Disable column width preservation when adjusting columns
|
|
||||||
ImGuiColumnsFlags_NoForceWithinWindow = 1 << 3, // Disable forcing columns to fit within window
|
|
||||||
ImGuiColumnsFlags_GrowParentContentsSize= 1 << 4 // (WIP) Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove.
|
|
||||||
};
|
|
||||||
|
|
||||||
// Extend ImGuiSelectableFlags_
|
// Extend ImGuiSelectableFlags_
|
||||||
enum ImGuiSelectableFlagsPrivate_
|
enum ImGuiSelectableFlagsPrivate_
|
||||||
{
|
{
|
||||||
@ -528,42 +679,6 @@ enum ImGuiSeparatorFlags_
|
|||||||
ImGuiSeparatorFlags_SpanAllColumns = 1 << 2
|
ImGuiSeparatorFlags_SpanAllColumns = 1 << 2
|
||||||
};
|
};
|
||||||
|
|
||||||
// Transient per-window flags, reset at the beginning of the frame. For child window, inherited from parent on first Begin().
|
|
||||||
// This is going to be exposed in imgui.h when stabilized enough.
|
|
||||||
enum ImGuiItemFlags_
|
|
||||||
{
|
|
||||||
ImGuiItemFlags_None = 0,
|
|
||||||
ImGuiItemFlags_NoTabStop = 1 << 0, // false
|
|
||||||
ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.
|
|
||||||
ImGuiItemFlags_Disabled = 1 << 2, // false // [BETA] Disable interactions but doesn't affect visuals yet. See github.com/ocornut/imgui/issues/211
|
|
||||||
ImGuiItemFlags_NoNav = 1 << 3, // false
|
|
||||||
ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false
|
|
||||||
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // MenuItem/Selectable() automatically closes current Popup window
|
|
||||||
ImGuiItemFlags_MixedValue = 1 << 6, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets)
|
|
||||||
ImGuiItemFlags_Default_ = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
// Storage for LastItem data
|
|
||||||
enum ImGuiItemStatusFlags_
|
|
||||||
{
|
|
||||||
ImGuiItemStatusFlags_None = 0,
|
|
||||||
ImGuiItemStatusFlags_HoveredRect = 1 << 0,
|
|
||||||
ImGuiItemStatusFlags_HasDisplayRect = 1 << 1,
|
|
||||||
ImGuiItemStatusFlags_Edited = 1 << 2, // Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
|
|
||||||
ImGuiItemStatusFlags_ToggledSelection = 1 << 3, // Set when Selectable(), TreeNode() reports toggling a selection. We can't report "Selected" because reporting the change allows us to handle clipping with less issues.
|
|
||||||
ImGuiItemStatusFlags_ToggledOpen = 1 << 4, // Set when TreeNode() reports toggling their open state.
|
|
||||||
ImGuiItemStatusFlags_HasDeactivated = 1 << 5, // Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
|
|
||||||
ImGuiItemStatusFlags_Deactivated = 1 << 6 // Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
|
|
||||||
|
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
|
||||||
, // [imgui_tests only]
|
|
||||||
ImGuiItemStatusFlags_Openable = 1 << 10, //
|
|
||||||
ImGuiItemStatusFlags_Opened = 1 << 11, //
|
|
||||||
ImGuiItemStatusFlags_Checkable = 1 << 12, //
|
|
||||||
ImGuiItemStatusFlags_Checked = 1 << 13 //
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImGuiTextFlags_
|
enum ImGuiTextFlags_
|
||||||
{
|
{
|
||||||
ImGuiTextFlags_None = 0,
|
ImGuiTextFlags_None = 0,
|
||||||
@ -677,59 +792,6 @@ enum ImGuiPopupPositionPolicy
|
|||||||
ImGuiPopupPositionPolicy_ComboBox
|
ImGuiPopupPositionPolicy_ComboBox
|
||||||
};
|
};
|
||||||
|
|
||||||
// 1D vector (this odd construct is used to facilitate the transition between 1D and 2D, and the maintenance of some branches/patches)
|
|
||||||
struct ImVec1
|
|
||||||
{
|
|
||||||
float x;
|
|
||||||
ImVec1() { x = 0.0f; }
|
|
||||||
ImVec1(float _x) { x = _x; }
|
|
||||||
};
|
|
||||||
|
|
||||||
// 2D vector (half-size integer)
|
|
||||||
struct ImVec2ih
|
|
||||||
{
|
|
||||||
short x, y;
|
|
||||||
ImVec2ih() { x = y = 0; }
|
|
||||||
ImVec2ih(short _x, short _y) { x = _x; y = _y; }
|
|
||||||
explicit ImVec2ih(const ImVec2& rhs) { x = (short)rhs.x; y = (short)rhs.y; }
|
|
||||||
};
|
|
||||||
|
|
||||||
// 2D axis aligned bounding-box
|
|
||||||
// NB: we can't rely on ImVec2 math operators being available here
|
|
||||||
struct IMGUI_API ImRect
|
|
||||||
{
|
|
||||||
ImVec2 Min; // Upper-left
|
|
||||||
ImVec2 Max; // Lower-right
|
|
||||||
|
|
||||||
ImRect() : Min(0.0f, 0.0f), Max(0.0f, 0.0f) {}
|
|
||||||
ImRect(const ImVec2& min, const ImVec2& max) : Min(min), Max(max) {}
|
|
||||||
ImRect(const ImVec4& v) : Min(v.x, v.y), Max(v.z, v.w) {}
|
|
||||||
ImRect(float x1, float y1, float x2, float y2) : Min(x1, y1), Max(x2, y2) {}
|
|
||||||
|
|
||||||
ImVec2 GetCenter() const { return ImVec2((Min.x + Max.x) * 0.5f, (Min.y + Max.y) * 0.5f); }
|
|
||||||
ImVec2 GetSize() const { return ImVec2(Max.x - Min.x, Max.y - Min.y); }
|
|
||||||
float GetWidth() const { return Max.x - Min.x; }
|
|
||||||
float GetHeight() const { return Max.y - Min.y; }
|
|
||||||
ImVec2 GetTL() const { return Min; } // Top-left
|
|
||||||
ImVec2 GetTR() const { return ImVec2(Max.x, Min.y); } // Top-right
|
|
||||||
ImVec2 GetBL() const { return ImVec2(Min.x, Max.y); } // Bottom-left
|
|
||||||
ImVec2 GetBR() const { return Max; } // Bottom-right
|
|
||||||
bool Contains(const ImVec2& p) const { return p.x >= Min.x && p.y >= Min.y && p.x < Max.x && p.y < Max.y; }
|
|
||||||
bool Contains(const ImRect& r) const { return r.Min.x >= Min.x && r.Min.y >= Min.y && r.Max.x <= Max.x && r.Max.y <= Max.y; }
|
|
||||||
bool Overlaps(const ImRect& r) const { return r.Min.y < Max.y && r.Max.y > Min.y && r.Min.x < Max.x && r.Max.x > Min.x; }
|
|
||||||
void Add(const ImVec2& p) { if (Min.x > p.x) Min.x = p.x; if (Min.y > p.y) Min.y = p.y; if (Max.x < p.x) Max.x = p.x; if (Max.y < p.y) Max.y = p.y; }
|
|
||||||
void Add(const ImRect& r) { if (Min.x > r.Min.x) Min.x = r.Min.x; if (Min.y > r.Min.y) Min.y = r.Min.y; if (Max.x < r.Max.x) Max.x = r.Max.x; if (Max.y < r.Max.y) Max.y = r.Max.y; }
|
|
||||||
void Expand(const float amount) { Min.x -= amount; Min.y -= amount; Max.x += amount; Max.y += amount; }
|
|
||||||
void Expand(const ImVec2& amount) { Min.x -= amount.x; Min.y -= amount.y; Max.x += amount.x; Max.y += amount.y; }
|
|
||||||
void Translate(const ImVec2& d) { Min.x += d.x; Min.y += d.y; Max.x += d.x; Max.y += d.y; }
|
|
||||||
void TranslateX(float dx) { Min.x += dx; Max.x += dx; }
|
|
||||||
void TranslateY(float dy) { Min.y += dy; Max.y += dy; }
|
|
||||||
void ClipWith(const ImRect& r) { Min = ImMax(Min, r.Min); Max = ImMin(Max, r.Max); } // Simple version, may lead to an inverted rectangle, which is fine for Contains/Overlaps test but not for display.
|
|
||||||
void ClipWithFull(const ImRect& r) { Min = ImClamp(Min, r.Min, r.Max); Max = ImClamp(Max, r.Min, r.Max); } // Full version, ensure both points are fully clipped.
|
|
||||||
void Floor() { Min.x = IM_FLOOR(Min.x); Min.y = IM_FLOOR(Min.y); Max.x = IM_FLOOR(Max.x); Max.y = IM_FLOOR(Max.y); }
|
|
||||||
bool IsInverted() const { return Min.x > Max.x || Min.y > Max.y; }
|
|
||||||
};
|
|
||||||
|
|
||||||
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
|
||||||
@ -830,41 +892,6 @@ struct IMGUI_API ImGuiInputTextState
|
|||||||
void SelectAll() { Stb.select_start = 0; Stb.cursor = Stb.select_end = CurLenW; Stb.has_preferred_x = 0; }
|
void SelectAll() { Stb.select_start = 0; Stb.cursor = Stb.select_end = CurLenW; Stb.has_preferred_x = 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Windows data saved in imgui.ini file
|
|
||||||
// Because we never destroy or rename ImGuiWindowSettings, we can store the names in a separate buffer easily.
|
|
||||||
// (this is designed to be stored in a ImChunkStream buffer, with the variable-length Name following our structure)
|
|
||||||
struct ImGuiWindowSettings
|
|
||||||
{
|
|
||||||
ImGuiID ID;
|
|
||||||
ImVec2ih Pos; // NB: Settings position are stored RELATIVE to the viewport! Whereas runtime ones are absolute positions.
|
|
||||||
ImVec2ih Size;
|
|
||||||
ImVec2ih ViewportPos;
|
|
||||||
ImGuiID ViewportId;
|
|
||||||
ImGuiID DockId; // ID of last known DockNode (even if the DockNode is invisible because it has only 1 active window), or 0 if none.
|
|
||||||
ImGuiID ClassId; // ID of window class if specified
|
|
||||||
short DockOrder; // Order of the last time the window was visible within its DockNode. This is used to reorder windows that are reappearing on the same frame. Same value between windows that were active and windows that were none are possible.
|
|
||||||
bool Collapsed;
|
|
||||||
bool WantApply; // Set when loaded from .ini data (to enable merging/loading .ini data into an already running context)
|
|
||||||
|
|
||||||
ImGuiWindowSettings() { ID = 0; Pos = Size = ViewportPos = ImVec2ih(0, 0); ViewportId = DockId = ClassId = 0; DockOrder = -1; Collapsed = WantApply = false; }
|
|
||||||
char* GetName() { return (char*)(this + 1); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ImGuiSettingsHandler
|
|
||||||
{
|
|
||||||
const char* TypeName; // Short description stored in .ini file. Disallowed characters: '[' ']'
|
|
||||||
ImGuiID TypeHash; // == ImHashStr(TypeName)
|
|
||||||
void (*ClearAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler); // Clear all settings data
|
|
||||||
void (*ReadInitFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler); // Read: Called before reading (in registration order)
|
|
||||||
void* (*ReadOpenFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, const char* name); // Read: Called when entering into a new ini entry e.g. "[Window][Name]"
|
|
||||||
void (*ReadLineFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, void* entry, const char* line); // Read: Called for every line of text within an ini entry
|
|
||||||
void (*ApplyAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler); // Read: Called after reading (in registration order)
|
|
||||||
void (*WriteAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* out_buf); // Write: Output every entries into 'out_buf'
|
|
||||||
void* UserData;
|
|
||||||
|
|
||||||
ImGuiSettingsHandler() { memset(this, 0, sizeof(*this)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
// Storage for current popup stack
|
// Storage for current popup stack
|
||||||
struct ImGuiPopupData
|
struct ImGuiPopupData
|
||||||
{
|
{
|
||||||
@ -879,120 +906,6 @@ struct ImGuiPopupData
|
|||||||
ImGuiPopupData() { PopupId = 0; Window = SourceWindow = NULL; OpenFrameCount = -1; OpenParentId = 0; }
|
ImGuiPopupData() { PopupId = 0; Window = SourceWindow = NULL; OpenFrameCount = -1; OpenParentId = 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiColumnData
|
|
||||||
{
|
|
||||||
float OffsetNorm; // Column start offset, normalized 0.0 (far left) -> 1.0 (far right)
|
|
||||||
float OffsetNormBeforeResize;
|
|
||||||
ImGuiColumnsFlags Flags; // Not exposed
|
|
||||||
ImRect ClipRect;
|
|
||||||
|
|
||||||
ImGuiColumnData() { OffsetNorm = OffsetNormBeforeResize = 0.0f; Flags = ImGuiColumnsFlags_None; }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ImGuiColumns
|
|
||||||
{
|
|
||||||
ImGuiID ID;
|
|
||||||
ImGuiColumnsFlags Flags;
|
|
||||||
bool IsFirstFrame;
|
|
||||||
bool IsBeingResized;
|
|
||||||
int Current;
|
|
||||||
int Count;
|
|
||||||
float OffMinX, OffMaxX; // Offsets from HostWorkRect.Min.x
|
|
||||||
float LineMinY, LineMaxY;
|
|
||||||
float HostCursorPosY; // Backup of CursorPos at the time of BeginColumns()
|
|
||||||
float HostCursorMaxPosX; // Backup of CursorMaxPos at the time of BeginColumns()
|
|
||||||
ImRect HostClipRect; // Backup of ClipRect at the time of BeginColumns()
|
|
||||||
ImRect HostWorkRect; // Backup of WorkRect at the time of BeginColumns()
|
|
||||||
ImVector<ImGuiColumnData> Columns;
|
|
||||||
ImDrawListSplitter Splitter;
|
|
||||||
|
|
||||||
ImGuiColumns() { Clear(); }
|
|
||||||
void Clear()
|
|
||||||
{
|
|
||||||
ID = 0;
|
|
||||||
Flags = ImGuiColumnsFlags_None;
|
|
||||||
IsFirstFrame = false;
|
|
||||||
IsBeingResized = false;
|
|
||||||
Current = 0;
|
|
||||||
Count = 1;
|
|
||||||
OffMinX = OffMaxX = 0.0f;
|
|
||||||
LineMinY = LineMaxY = 0.0f;
|
|
||||||
HostCursorPosY = 0.0f;
|
|
||||||
HostCursorMaxPosX = 0.0f;
|
|
||||||
Columns.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// ImDrawList: Helper function to calculate a circle's segment count given its radius and a "maximum error" value.
|
|
||||||
#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN 12
|
|
||||||
#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX 512
|
|
||||||
#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD,_MAXERROR) ImClamp((int)((IM_PI * 2.0f) / ImAcos(((_RAD) - (_MAXERROR)) / (_RAD))), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX)
|
|
||||||
|
|
||||||
// ImDrawList: You may set this to higher values (e.g. 2 or 3) to increase tessellation of fast rounded corners path.
|
|
||||||
#ifndef IM_DRAWLIST_ARCFAST_TESSELLATION_MULTIPLIER
|
|
||||||
#define IM_DRAWLIST_ARCFAST_TESSELLATION_MULTIPLIER 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// 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.
|
|
||||||
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 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()
|
|
||||||
ImDrawListFlags InitialFlags; // Initial flags at the beginning of the frame (it is possible to alter flags on a per-drawlist basis afterwards)
|
|
||||||
|
|
||||||
// [Internal] Lookup tables
|
|
||||||
ImVec2 ArcFastVtx[12 * IM_DRAWLIST_ARCFAST_TESSELLATION_MULTIPLIER]; // FIXME: Bake rounded corners fill/borders in atlas
|
|
||||||
ImU8 CircleSegmentCounts[64]; // Precomputed segment count for given radius (array index + 1) before we calculate it dynamically (to avoid calculation overhead)
|
|
||||||
|
|
||||||
ImDrawListSharedData();
|
|
||||||
void SetCircleSegmentMaxError(float max_error);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ImDrawDataBuilder
|
|
||||||
{
|
|
||||||
ImVector<ImDrawList*> Layers[2]; // Global layers for: regular, tooltip
|
|
||||||
|
|
||||||
void Clear() { for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n].resize(0); }
|
|
||||||
void ClearFreeMemory() { for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n].clear(); }
|
|
||||||
IMGUI_API void FlattenIntoSingleLayer();
|
|
||||||
};
|
|
||||||
|
|
||||||
// ImGuiViewport Private/Internals fields (cardinal sin: we are using inheritance!)
|
|
||||||
// Note that every instance of ImGuiViewport is in fact a ImGuiViewportP.
|
|
||||||
struct ImGuiViewportP : public ImGuiViewport
|
|
||||||
{
|
|
||||||
int Idx;
|
|
||||||
int LastFrameActive; // Last frame number this viewport was activated by a window
|
|
||||||
int LastFrameDrawLists[2]; // Last frame number the background (0) and foreground (1) draw lists were used
|
|
||||||
int LastFrontMostStampCount; // Last stamp number from when a window hosted by this viewport was made front-most (by comparing this value between two viewport we have an implicit viewport z-order
|
|
||||||
ImGuiID LastNameHash;
|
|
||||||
ImVec2 LastPos;
|
|
||||||
float Alpha; // Window opacity (when dragging dockable windows/viewports we make them transparent)
|
|
||||||
float LastAlpha;
|
|
||||||
short PlatformMonitor;
|
|
||||||
bool PlatformWindowCreated;
|
|
||||||
ImGuiWindow* Window; // Set when the viewport is owned by a window (and ImGuiViewportFlags_CanHostOtherWindows is NOT set)
|
|
||||||
ImDrawList* DrawLists[2]; // Convenience background (0) and foreground (1) draw lists. We use them to draw software mouser cursor when io.MouseDrawCursor is set and to draw most debug overlays.
|
|
||||||
ImDrawData DrawDataP;
|
|
||||||
ImDrawDataBuilder DrawDataBuilder;
|
|
||||||
ImVec2 LastPlatformPos;
|
|
||||||
ImVec2 LastPlatformSize;
|
|
||||||
ImVec2 LastRendererSize;
|
|
||||||
ImVec2 CurrWorkOffsetMin; // Work area top-left offset being increased during the frame
|
|
||||||
ImVec2 CurrWorkOffsetMax; // Work area bottom-right offset being decreased during the frame
|
|
||||||
|
|
||||||
ImGuiViewportP() { Idx = -1; LastFrameActive = LastFrameDrawLists[0] = LastFrameDrawLists[1] = LastFrontMostStampCount = -1; LastNameHash = 0; Alpha = LastAlpha = 1.0f; PlatformMonitor = -1; PlatformWindowCreated = false; Window = NULL; DrawLists[0] = DrawLists[1] = NULL; LastPlatformPos = LastPlatformSize = LastRendererSize = ImVec2(FLT_MAX, FLT_MAX); }
|
|
||||||
~ImGuiViewportP() { if (DrawLists[0]) IM_DELETE(DrawLists[0]); if (DrawLists[1]) IM_DELETE(DrawLists[1]); }
|
|
||||||
ImRect GetMainRect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }
|
|
||||||
ImRect GetWorkRect() const { return ImRect(Pos.x + WorkOffsetMin.x, Pos.y + WorkOffsetMin.y, Pos.x + Size.x + WorkOffsetMax.x, Pos.y + Size.y + WorkOffsetMax.y); }
|
|
||||||
void ClearRequestFlags() { PlatformRequestClose = PlatformRequestMove = PlatformRequestResize = false; }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ImGuiNavMoveResult
|
struct ImGuiNavMoveResult
|
||||||
{
|
{
|
||||||
ImGuiWindow* Window; // Best candidate window
|
ImGuiWindow* Window; // Best candidate window
|
||||||
@ -1070,10 +983,6 @@ struct ImGuiNextItemData
|
|||||||
inline void ClearFlags() { Flags = ImGuiNextItemDataFlags_None; } // Also cleared manually by ItemAdd()!
|
inline void ClearFlags() { Flags = ImGuiNextItemDataFlags_None; } // Also cleared manually by ItemAdd()!
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Tabs
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
struct ImGuiShrinkWidthItem
|
struct ImGuiShrinkWidthItem
|
||||||
{
|
{
|
||||||
int Index;
|
int Index;
|
||||||
@ -1090,9 +999,78 @@ struct ImGuiPtrOrIndex
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Docking
|
// [SECTION] Columns support
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
enum ImGuiColumnsFlags_
|
||||||
|
{
|
||||||
|
// Default: 0
|
||||||
|
ImGuiColumnsFlags_None = 0,
|
||||||
|
ImGuiColumnsFlags_NoBorder = 1 << 0, // Disable column dividers
|
||||||
|
ImGuiColumnsFlags_NoResize = 1 << 1, // Disable resizing columns when clicking on the dividers
|
||||||
|
ImGuiColumnsFlags_NoPreserveWidths = 1 << 2, // Disable column width preservation when adjusting columns
|
||||||
|
ImGuiColumnsFlags_NoForceWithinWindow = 1 << 3, // Disable forcing columns to fit within window
|
||||||
|
ImGuiColumnsFlags_GrowParentContentsSize= 1 << 4 // (WIP) Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove.
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ImGuiColumnData
|
||||||
|
{
|
||||||
|
float OffsetNorm; // Column start offset, normalized 0.0 (far left) -> 1.0 (far right)
|
||||||
|
float OffsetNormBeforeResize;
|
||||||
|
ImGuiColumnsFlags Flags; // Not exposed
|
||||||
|
ImRect ClipRect;
|
||||||
|
|
||||||
|
ImGuiColumnData() { OffsetNorm = OffsetNormBeforeResize = 0.0f; Flags = ImGuiColumnsFlags_None; }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ImGuiColumns
|
||||||
|
{
|
||||||
|
ImGuiID ID;
|
||||||
|
ImGuiColumnsFlags Flags;
|
||||||
|
bool IsFirstFrame;
|
||||||
|
bool IsBeingResized;
|
||||||
|
int Current;
|
||||||
|
int Count;
|
||||||
|
float OffMinX, OffMaxX; // Offsets from HostWorkRect.Min.x
|
||||||
|
float LineMinY, LineMaxY;
|
||||||
|
float HostCursorPosY; // Backup of CursorPos at the time of BeginColumns()
|
||||||
|
float HostCursorMaxPosX; // Backup of CursorMaxPos at the time of BeginColumns()
|
||||||
|
ImRect HostClipRect; // Backup of ClipRect at the time of BeginColumns()
|
||||||
|
ImRect HostWorkRect; // Backup of WorkRect at the time of BeginColumns()
|
||||||
|
ImVector<ImGuiColumnData> Columns;
|
||||||
|
ImDrawListSplitter Splitter;
|
||||||
|
|
||||||
|
ImGuiColumns() { Clear(); }
|
||||||
|
void Clear()
|
||||||
|
{
|
||||||
|
ID = 0;
|
||||||
|
Flags = ImGuiColumnsFlags_None;
|
||||||
|
IsFirstFrame = false;
|
||||||
|
IsBeingResized = false;
|
||||||
|
Current = 0;
|
||||||
|
Count = 1;
|
||||||
|
OffMinX = OffMaxX = 0.0f;
|
||||||
|
LineMinY = LineMaxY = 0.0f;
|
||||||
|
HostCursorPosY = 0.0f;
|
||||||
|
HostCursorMaxPosX = 0.0f;
|
||||||
|
Columns.clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Multi-select support
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef IMGUI_HAS_MULTI_SELECT
|
||||||
|
// <this is filled in 'range_select' branch>
|
||||||
|
#endif // #ifdef IMGUI_HAS_MULTI_SELECT
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Docking support
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef IMGUI_HAS_DOCK
|
||||||
|
|
||||||
// Extend ImGuiDockNodeFlags_
|
// Extend ImGuiDockNodeFlags_
|
||||||
enum ImGuiDockNodeFlagsPrivate_
|
enum ImGuiDockNodeFlagsPrivate_
|
||||||
{
|
{
|
||||||
@ -1183,8 +1161,88 @@ struct ImGuiDockNode
|
|||||||
ImRect Rect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }
|
ImRect Rect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // #ifdef IMGUI_HAS_DOCK
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Main Dear ImGui context
|
// [SECTION] Viewport support
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef IMGUI_HAS_VIEWPORT
|
||||||
|
|
||||||
|
// ImGuiViewport Private/Internals fields (cardinal sin: we are using inheritance!)
|
||||||
|
// Note that every instance of ImGuiViewport is in fact a ImGuiViewportP.
|
||||||
|
struct ImGuiViewportP : public ImGuiViewport
|
||||||
|
{
|
||||||
|
int Idx;
|
||||||
|
int LastFrameActive; // Last frame number this viewport was activated by a window
|
||||||
|
int LastFrameDrawLists[2]; // Last frame number the background (0) and foreground (1) draw lists were used
|
||||||
|
int LastFrontMostStampCount; // Last stamp number from when a window hosted by this viewport was made front-most (by comparing this value between two viewport we have an implicit viewport z-order
|
||||||
|
ImGuiID LastNameHash;
|
||||||
|
ImVec2 LastPos;
|
||||||
|
float Alpha; // Window opacity (when dragging dockable windows/viewports we make them transparent)
|
||||||
|
float LastAlpha;
|
||||||
|
short PlatformMonitor;
|
||||||
|
bool PlatformWindowCreated;
|
||||||
|
ImGuiWindow* Window; // Set when the viewport is owned by a window (and ImGuiViewportFlags_CanHostOtherWindows is NOT set)
|
||||||
|
ImDrawList* DrawLists[2]; // Convenience background (0) and foreground (1) draw lists. We use them to draw software mouser cursor when io.MouseDrawCursor is set and to draw most debug overlays.
|
||||||
|
ImDrawData DrawDataP;
|
||||||
|
ImDrawDataBuilder DrawDataBuilder;
|
||||||
|
ImVec2 LastPlatformPos;
|
||||||
|
ImVec2 LastPlatformSize;
|
||||||
|
ImVec2 LastRendererSize;
|
||||||
|
ImVec2 CurrWorkOffsetMin; // Work area top-left offset being increased during the frame
|
||||||
|
ImVec2 CurrWorkOffsetMax; // Work area bottom-right offset being decreased during the frame
|
||||||
|
|
||||||
|
ImGuiViewportP() { Idx = -1; LastFrameActive = LastFrameDrawLists[0] = LastFrameDrawLists[1] = LastFrontMostStampCount = -1; LastNameHash = 0; Alpha = LastAlpha = 1.0f; PlatformMonitor = -1; PlatformWindowCreated = false; Window = NULL; DrawLists[0] = DrawLists[1] = NULL; LastPlatformPos = LastPlatformSize = LastRendererSize = ImVec2(FLT_MAX, FLT_MAX); }
|
||||||
|
~ImGuiViewportP() { if (DrawLists[0]) IM_DELETE(DrawLists[0]); if (DrawLists[1]) IM_DELETE(DrawLists[1]); }
|
||||||
|
ImRect GetMainRect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }
|
||||||
|
ImRect GetWorkRect() const { return ImRect(Pos.x + WorkOffsetMin.x, Pos.y + WorkOffsetMin.y, Pos.x + Size.x + WorkOffsetMax.x, Pos.y + Size.y + WorkOffsetMax.y); }
|
||||||
|
void ClearRequestFlags() { PlatformRequestClose = PlatformRequestMove = PlatformRequestResize = false; }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // #ifdef IMGUI_HAS_VIEWPORT
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Settings support
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Windows data saved in imgui.ini file
|
||||||
|
// Because we never destroy or rename ImGuiWindowSettings, we can store the names in a separate buffer easily.
|
||||||
|
// (this is designed to be stored in a ImChunkStream buffer, with the variable-length Name following our structure)
|
||||||
|
struct ImGuiWindowSettings
|
||||||
|
{
|
||||||
|
ImGuiID ID;
|
||||||
|
ImVec2ih Pos; // NB: Settings position are stored RELATIVE to the viewport! Whereas runtime ones are absolute positions.
|
||||||
|
ImVec2ih Size;
|
||||||
|
ImVec2ih ViewportPos;
|
||||||
|
ImGuiID ViewportId;
|
||||||
|
ImGuiID DockId; // ID of last known DockNode (even if the DockNode is invisible because it has only 1 active window), or 0 if none.
|
||||||
|
ImGuiID ClassId; // ID of window class if specified
|
||||||
|
short DockOrder; // Order of the last time the window was visible within its DockNode. This is used to reorder windows that are reappearing on the same frame. Same value between windows that were active and windows that were none are possible.
|
||||||
|
bool Collapsed;
|
||||||
|
bool WantApply; // Set when loaded from .ini data (to enable merging/loading .ini data into an already running context)
|
||||||
|
|
||||||
|
ImGuiWindowSettings() { ID = 0; Pos = Size = ViewportPos = ImVec2ih(0, 0); ViewportId = DockId = ClassId = 0; DockOrder = -1; Collapsed = WantApply = false; }
|
||||||
|
char* GetName() { return (char*)(this + 1); }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ImGuiSettingsHandler
|
||||||
|
{
|
||||||
|
const char* TypeName; // Short description stored in .ini file. Disallowed characters: '[' ']'
|
||||||
|
ImGuiID TypeHash; // == ImHashStr(TypeName)
|
||||||
|
void (*ClearAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler); // Clear all settings data
|
||||||
|
void (*ReadInitFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler); // Read: Called before reading (in registration order)
|
||||||
|
void* (*ReadOpenFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, const char* name); // Read: Called when entering into a new ini entry e.g. "[Window][Name]"
|
||||||
|
void (*ReadLineFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, void* entry, const char* line); // Read: Called for every line of text within an ini entry
|
||||||
|
void (*ApplyAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler); // Read: Called after reading (in registration order)
|
||||||
|
void (*WriteAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* out_buf); // Write: Output every entries into 'out_buf'
|
||||||
|
void* UserData;
|
||||||
|
|
||||||
|
ImGuiSettingsHandler() { memset(this, 0, sizeof(*this)); }
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] ImGuiContext (main imgui context)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
struct ImGuiContext
|
struct ImGuiContext
|
||||||
@ -1279,7 +1337,7 @@ struct ImGuiContext
|
|||||||
// Gamepad/keyboard Navigation
|
// Gamepad/keyboard Navigation
|
||||||
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusWindow'
|
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusWindow'
|
||||||
ImGuiID NavId; // Focused item for navigation
|
ImGuiID NavId; // Focused item for navigation
|
||||||
ImGuiID NavFocusScopeId;
|
ImGuiID NavFocusScopeId; // Identify a selection scope (selection code often wants to "clear other items" when landing on an item of the selection set)
|
||||||
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem()
|
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem()
|
||||||
ImGuiID NavActivateDownId; // ~~ IsNavInputDown(ImGuiNavInput_Activate) ? NavId : 0
|
ImGuiID NavActivateDownId; // ~~ IsNavInputDown(ImGuiNavInput_Activate) ? NavId : 0
|
||||||
ImGuiID NavActivatePressedId; // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0
|
ImGuiID NavActivatePressedId; // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0
|
||||||
@ -1301,8 +1359,8 @@ struct ImGuiContext
|
|||||||
bool NavAnyRequest; // ~~ NavMoveRequest || NavInitRequest
|
bool NavAnyRequest; // ~~ NavMoveRequest || NavInitRequest
|
||||||
bool NavInitRequest; // Init request for appearing window to select first item
|
bool NavInitRequest; // Init request for appearing window to select first item
|
||||||
bool NavInitRequestFromMove;
|
bool NavInitRequestFromMove;
|
||||||
ImGuiID NavInitResultId;
|
ImGuiID NavInitResultId; // Init request result (first item of the window, or one for which SetItemDefaultFocus() was called)
|
||||||
ImRect NavInitResultRectRel;
|
ImRect NavInitResultRectRel; // Init request result rectangle (relative to parent window)
|
||||||
bool NavMoveFromClampedRefRect; // Set by manual scrolling, if we scroll to a point where NavId isn't visible we reset navigation from visible items
|
bool NavMoveFromClampedRefRect; // Set by manual scrolling, if we scroll to a point where NavId isn't visible we reset navigation from visible items
|
||||||
bool NavMoveRequest; // Move request for this frame
|
bool NavMoveRequest; // Move request for this frame
|
||||||
ImGuiNavMoveFlags NavMoveRequestFlags;
|
ImGuiNavMoveFlags NavMoveRequestFlags;
|
||||||
@ -1314,10 +1372,10 @@ struct ImGuiContext
|
|||||||
ImGuiNavMoveResult NavMoveResultLocalVisibleSet; // Best move request candidate within NavWindow that are mostly visible (when using ImGuiNavMoveFlags_AlsoScoreVisibleSet flag)
|
ImGuiNavMoveResult NavMoveResultLocalVisibleSet; // Best move request candidate within NavWindow that are mostly visible (when using ImGuiNavMoveFlags_AlsoScoreVisibleSet flag)
|
||||||
ImGuiNavMoveResult NavMoveResultOther; // Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags_NavFlattened flag)
|
ImGuiNavMoveResult NavMoveResultOther; // Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags_NavFlattened flag)
|
||||||
|
|
||||||
// Navigation: Windowing (CTRL+TAB, holding Menu button + directional pads to move/resize)
|
// Navigation: Windowing (CTRL+TAB for list, or Menu button + keys or directional pads to move/resize)
|
||||||
ImGuiWindow* NavWindowingTarget; // When selecting a window (holding Menu+FocusPrev/Next, or equivalent of CTRL-TAB) 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
|
ImGuiWindow* NavWindowingTargetAnim; // Record of last valid NavWindowingTarget until DimBgRatio and NavWindowingHighlightAlpha becomes 0.0f, so the fade-out can stay on it.
|
||||||
ImGuiWindow* NavWindowingList;
|
ImGuiWindow* NavWindowingListWindow; // Internal window actually listing the CTRL+Tab contents
|
||||||
float NavWindowingTimer;
|
float NavWindowingTimer;
|
||||||
float NavWindowingHighlightAlpha;
|
float NavWindowingHighlightAlpha;
|
||||||
bool NavWindowingToggleLayer;
|
bool NavWindowingToggleLayer;
|
||||||
@ -1395,8 +1453,8 @@ struct ImGuiContext
|
|||||||
ImChunkStream<ImGuiWindowSettings> SettingsWindows; // ImGuiWindow .ini settings entries
|
ImChunkStream<ImGuiWindowSettings> SettingsWindows; // ImGuiWindow .ini settings entries
|
||||||
|
|
||||||
// Capture/Logging
|
// Capture/Logging
|
||||||
bool LogEnabled;
|
bool LogEnabled; // Currently capturing
|
||||||
ImGuiLogType LogType;
|
ImGuiLogType LogType; // Capture target
|
||||||
ImFileHandle LogFile; // If != NULL log to stdout/ file
|
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.
|
ImGuiTextBuffer LogBuffer; // Accumulation buffer when log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators.
|
||||||
float LogLinePosY;
|
float LogLinePosY;
|
||||||
@ -1406,7 +1464,7 @@ struct ImGuiContext
|
|||||||
int LogDepthToExpandDefault; // Default/stored value for LogDepthMaxExpand if not specified in the LogXXX function call.
|
int LogDepthToExpandDefault; // Default/stored value for LogDepthMaxExpand if not specified in the LogXXX function call.
|
||||||
|
|
||||||
// Debug Tools
|
// Debug Tools
|
||||||
bool DebugItemPickerActive;
|
bool DebugItemPickerActive; // Item picker is active (started with DebugStartItemPicker())
|
||||||
ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this id
|
ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this id
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
@ -1499,7 +1557,7 @@ struct ImGuiContext
|
|||||||
NavMoveRequestKeyMods = ImGuiKeyModFlags_None;
|
NavMoveRequestKeyMods = ImGuiKeyModFlags_None;
|
||||||
NavMoveDir = NavMoveDirLast = NavMoveClipDir = ImGuiDir_None;
|
NavMoveDir = NavMoveDirLast = NavMoveClipDir = ImGuiDir_None;
|
||||||
|
|
||||||
NavWindowingTarget = NavWindowingTargetAnim = NavWindowingList = NULL;
|
NavWindowingTarget = NavWindowingTargetAnim = NavWindowingListWindow = NULL;
|
||||||
NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f;
|
NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f;
|
||||||
NavWindowingToggleLayer = false;
|
NavWindowingToggleLayer = false;
|
||||||
|
|
||||||
@ -1564,7 +1622,7 @@ struct ImGuiContext
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ImGuiWindow
|
// [SECTION] ImGuiWindowTempData, ImGuiWindow
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Transient per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the DC variable name in ImGuiWindow.
|
// Transient per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the DC variable name in ImGuiWindow.
|
||||||
@ -1752,8 +1810,8 @@ struct IMGUI_API ImGuiWindow
|
|||||||
ImGuiID NavLastIds[ImGuiNavLayer_COUNT]; // Last known NavId for this window, per layer (0/1)
|
ImGuiID NavLastIds[ImGuiNavLayer_COUNT]; // Last known NavId for this window, per layer (0/1)
|
||||||
ImRect NavRectRel[ImGuiNavLayer_COUNT]; // Reference rectangle, in window relative space
|
ImRect NavRectRel[ImGuiNavLayer_COUNT]; // Reference rectangle, in window relative space
|
||||||
|
|
||||||
bool MemoryCompacted;
|
bool MemoryCompacted; // Set when window extraneous data have been garbage collected
|
||||||
int MemoryDrawListIdxCapacity;
|
int MemoryDrawListIdxCapacity; // Backup of last idx/vtx count, so when waking up the window we can preallocate and avoid iterative alloc/copy
|
||||||
int MemoryDrawListVtxCapacity;
|
int MemoryDrawListVtxCapacity;
|
||||||
|
|
||||||
// Docking
|
// Docking
|
||||||
@ -1802,7 +1860,7 @@ struct ImGuiItemHoveredDataBackup
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Tab bar, tab item
|
// [SECTION] Tab bar, Tab item support
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Extend ImGuiTabBarFlags_
|
// Extend ImGuiTabBarFlags_
|
||||||
@ -1877,8 +1935,16 @@ struct ImGuiTabBar
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Internal API
|
// [SECTION] Table support
|
||||||
// No guarantee of forward compatibility here.
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef IMGUI_HAS_TABLE
|
||||||
|
// <this is filled in 'tables' branch>
|
||||||
|
#endif // #ifdef IMGUI_HAS_TABLE
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Internal API
|
||||||
|
// No guarantee of forward compatibility here!
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
@ -1948,7 +2014,7 @@ namespace ImGui
|
|||||||
IMGUI_API ImVec2 ScrollToBringRectIntoView(ImGuiWindow* window, const ImRect& item_rect);
|
IMGUI_API ImVec2 ScrollToBringRectIntoView(ImGuiWindow* window, const ImRect& item_rect);
|
||||||
|
|
||||||
// Basic Accessors
|
// Basic Accessors
|
||||||
inline ImGuiID GetItemID() { ImGuiContext& g = *GImGui; return g.CurrentWindow->DC.LastItemId; }
|
inline ImGuiID GetItemID() { ImGuiContext& g = *GImGui; return g.CurrentWindow->DC.LastItemId; } // Get ID of last item (~~ often same ImGui::GetID(label) beforehand)
|
||||||
inline ImGuiItemStatusFlags GetItemStatusFlags() { ImGuiContext& g = *GImGui; return g.CurrentWindow->DC.LastItemStatusFlags; }
|
inline ImGuiItemStatusFlags GetItemStatusFlags() { ImGuiContext& g = *GImGui; return g.CurrentWindow->DC.LastItemStatusFlags; }
|
||||||
inline ImGuiID GetActiveID() { ImGuiContext& g = *GImGui; return g.ActiveId; }
|
inline ImGuiID GetActiveID() { ImGuiContext& g = *GImGui; return g.ActiveId; }
|
||||||
inline ImGuiID GetFocusID() { ImGuiContext& g = *GImGui; return g.NavId; }
|
inline ImGuiID GetFocusID() { ImGuiContext& g = *GImGui; return g.NavId; }
|
||||||
@ -1959,7 +2025,7 @@ namespace ImGui
|
|||||||
IMGUI_API void SetHoveredID(ImGuiID id);
|
IMGUI_API void SetHoveredID(ImGuiID id);
|
||||||
IMGUI_API void KeepAliveID(ImGuiID id);
|
IMGUI_API void KeepAliveID(ImGuiID id);
|
||||||
IMGUI_API void MarkItemEdited(ImGuiID id); // Mark data associated to given item as "edited", used by IsItemDeactivatedAfterEdit() function.
|
IMGUI_API void MarkItemEdited(ImGuiID id); // Mark data associated to given item as "edited", used by IsItemDeactivatedAfterEdit() function.
|
||||||
IMGUI_API void PushOverrideID(ImGuiID id); // Push given value at the top of the ID stack (whereas PushID combines old and new hashes)
|
IMGUI_API void PushOverrideID(ImGuiID id); // Push given value as-is at the top of the ID stack (whereas PushID combines old and new hashes)
|
||||||
|
|
||||||
// Basic Helpers for widget code
|
// Basic Helpers for widget code
|
||||||
IMGUI_API void ItemSize(const ImVec2& size, float text_baseline_y = -1.0f);
|
IMGUI_API void ItemSize(const ImVec2& size, float text_baseline_y = -1.0f);
|
||||||
@ -1987,14 +2053,14 @@ namespace ImGui
|
|||||||
IMGUI_API void OpenPopupEx(ImGuiID id);
|
IMGUI_API void OpenPopupEx(ImGuiID id);
|
||||||
IMGUI_API void ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup);
|
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 ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup);
|
||||||
IMGUI_API bool IsPopupOpen(ImGuiID id); // Test for id within current popup stack level (currently begin-ed into); this doesn't scan the whole popup stack!
|
IMGUI_API bool IsPopupOpen(ImGuiID id); // Test for id at current popup stack level (currently begin-ed into); this doesn't scan the whole popup stack!
|
||||||
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
|
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
|
||||||
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, ImGuiTooltipFlags tooltip_flags);
|
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, ImGuiTooltipFlags tooltip_flags);
|
||||||
IMGUI_API ImGuiWindow* GetTopMostPopupModal();
|
IMGUI_API ImGuiWindow* GetTopMostPopupModal();
|
||||||
IMGUI_API ImVec2 FindBestWindowPosForPopup(ImGuiWindow* window);
|
IMGUI_API ImVec2 FindBestWindowPosForPopup(ImGuiWindow* window);
|
||||||
IMGUI_API ImVec2 FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy = ImGuiPopupPositionPolicy_Default);
|
IMGUI_API ImVec2 FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy = ImGuiPopupPositionPolicy_Default);
|
||||||
|
|
||||||
// Navigation
|
// Gamepad/Keyboard Navigation
|
||||||
IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit);
|
IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit);
|
||||||
IMGUI_API bool NavMoveRequestButNoResultYet();
|
IMGUI_API bool NavMoveRequestButNoResultYet();
|
||||||
IMGUI_API void NavMoveRequestCancel();
|
IMGUI_API void NavMoveRequestCancel();
|
||||||
@ -2007,8 +2073,10 @@ namespace ImGui
|
|||||||
IMGUI_API void SetNavID(ImGuiID id, int nav_layer, ImGuiID focus_scope_id);
|
IMGUI_API void SetNavID(ImGuiID id, int nav_layer, ImGuiID focus_scope_id);
|
||||||
IMGUI_API void SetNavIDWithRectRel(ImGuiID id, int nav_layer, ImGuiID focus_scope_id, const ImRect& rect_rel);
|
IMGUI_API void SetNavIDWithRectRel(ImGuiID id, int nav_layer, ImGuiID focus_scope_id, const ImRect& rect_rel);
|
||||||
|
|
||||||
// Focus scope (WIP)
|
// Focus Scope (WIP)
|
||||||
IMGUI_API void PushFocusScope(ImGuiID id); // Note: this is storing in same stack as IDStack, so Push/Pop mismatch will be reported there.
|
// 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 an item of the set.
|
||||||
|
IMGUI_API void PushFocusScope(ImGuiID id);
|
||||||
IMGUI_API void PopFocusScope();
|
IMGUI_API void PopFocusScope();
|
||||||
inline ImGuiID GetFocusScopeID() { ImGuiContext& g = *GImGui; return g.NavFocusScopeId; }
|
inline ImGuiID GetFocusScopeID() { ImGuiContext& g = *GImGui; return g.NavFocusScopeId; }
|
||||||
|
|
||||||
@ -2073,7 +2141,7 @@ namespace ImGui
|
|||||||
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 transitioning to the Tables api)
|
// Internal Columns API (this is not exposed because we will encourage transitioning to the Tables API)
|
||||||
IMGUI_API void BeginColumns(const char* str_id, int count, ImGuiColumnsFlags flags = 0); // setup number of columns. use an identifier to distinguish multiple column sets. close with EndColumns().
|
IMGUI_API void BeginColumns(const char* str_id, int count, ImGuiColumnsFlags flags = 0); // setup number of columns. use an identifier to distinguish multiple column sets. close with EndColumns().
|
||||||
IMGUI_API void EndColumns(); // close columns
|
IMGUI_API void EndColumns(); // close columns
|
||||||
IMGUI_API void PushColumnClipRect(int column_index);
|
IMGUI_API void PushColumnClipRect(int column_index);
|
||||||
@ -2203,19 +2271,10 @@ IMGUI_API void ImFontAtlasBuildFinish(ImFontAtlas* atlas);
|
|||||||
IMGUI_API void ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[256], float in_multiply_factor);
|
IMGUI_API void ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[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);
|
||||||
|
|
||||||
// Debug Tools
|
//-----------------------------------------------------------------------------
|
||||||
// Use 'Metrics->Tools->Item Picker' to break into the call-stack of a specific item.
|
// [SECTION] Test Engine Hooks (imgui_test_engine)
|
||||||
#ifndef IM_DEBUG_BREAK
|
//-----------------------------------------------------------------------------
|
||||||
#if defined(__clang__)
|
|
||||||
#define IM_DEBUG_BREAK() __builtin_debugtrap()
|
|
||||||
#elif defined (_MSC_VER)
|
|
||||||
#define IM_DEBUG_BREAK() __debugbreak()
|
|
||||||
#else
|
|
||||||
#define IM_DEBUG_BREAK() IM_ASSERT(0) // It is expected that you define IM_DEBUG_BREAK() into something that will break nicely in a debugger!
|
|
||||||
#endif
|
|
||||||
#endif // #ifndef IM_DEBUG_BREAK
|
|
||||||
|
|
||||||
// Test Engine Hooks (imgui_tests)
|
|
||||||
//#define IMGUI_ENABLE_TEST_ENGINE
|
//#define IMGUI_ENABLE_TEST_ENGINE
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
extern void ImGuiTestEngineHook_PreNewFrame(ImGuiContext* ctx);
|
extern void ImGuiTestEngineHook_PreNewFrame(ImGuiContext* ctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user