|
@@ -297,22 +297,21 @@ IMGUI_API void* ImFileLoadToMemory(const char* filename, const char*
|
|
|
// Helpers: Maths
|
|
// Helpers: Maths
|
|
|
// - Wrapper for standard libs functions. (Note that imgui_demo.cpp does _not_ use them to keep the code easy to copy)
|
|
// - Wrapper for standard libs functions. (Note that imgui_demo.cpp does _not_ use them to keep the code easy to copy)
|
|
|
#ifndef IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS
|
|
#ifndef IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS
|
|
|
-static inline float ImFabs(float x) { return fabsf(x); }
|
|
|
|
|
-static inline float ImSqrt(float x) { return sqrtf(x); }
|
|
|
|
|
-static inline float ImPow(float x, float y) { return powf(x, y); }
|
|
|
|
|
-static inline double ImPow(double x, double y) { return pow(x, y); }
|
|
|
|
|
-static inline float ImFmod(float x, float y) { return fmodf(x, y); }
|
|
|
|
|
-static inline double ImFmod(double x, double y) { return fmod(x, y); }
|
|
|
|
|
-static inline float ImCos(float x) { return cosf(x); }
|
|
|
|
|
-static inline float ImSin(float x) { return sinf(x); }
|
|
|
|
|
-static inline float ImAcos(float x) { return acosf(x); }
|
|
|
|
|
-static inline float ImAtan2(float y, float x) { return atan2f(y, x); }
|
|
|
|
|
-static inline double ImAtof(const char* s) { return atof(s); }
|
|
|
|
|
-static inline float ImFloorStd(float x) { return floorf(x); } // we already uses our own ImFloor() { return (float)(int)v } internally so the standard one wrapper is named differently (it's used by stb_truetype)
|
|
|
|
|
-static inline float ImCeil(float x) { return ceilf(x); }
|
|
|
|
|
|
|
+#define ImFabs(X) fabsf(X)
|
|
|
|
|
+#define ImSqrt(X) sqrtf(X)
|
|
|
|
|
+#define ImFmod(X, Y) fmodf((X), (Y))
|
|
|
|
|
+#define ImCos(X) cosf(X)
|
|
|
|
|
+#define ImSin(X) sinf(X)
|
|
|
|
|
+#define ImAcos(X) acosf(X)
|
|
|
|
|
+#define ImAtan2(Y, X) atan2f((Y), (X))
|
|
|
|
|
+#define ImAtof(STR) atof(STR)
|
|
|
|
|
+#define ImFloorStd(X) floorf(X) // We already uses our own ImFloor() { return (float)(int)v } internally so the standard one wrapper is named differently (it's used by e.g. stb_truetype)
|
|
|
|
|
+#define ImCeil(X) ceilf(X)
|
|
|
|
|
+static inline float ImPow(float x, float y) { return powf(x, y); } // DragBehaviorT/SliderBehaviorT uses ImPow with either float/double and need the precision
|
|
|
|
|
+static inline double ImPow(double x, double y) { return pow(x, y); }
|
|
|
#endif
|
|
#endif
|
|
|
-// - ImMin/ImMax/ImClamp/ImLerp/ImSwap are used by widgets which support for variety of types: signed/unsigned int/long long float/double
|
|
|
|
|
-// (Exceptionally using templates here but we could also redefine them for variety of types)
|
|
|
|
|
|
|
+// - ImMin/ImMax/ImClamp/ImLerp/ImSwap are used by widgets which support variety of types: signed/unsigned int/long long float/double
|
|
|
|
|
+// (Exceptionally using templates here but we could also redefine them for those types)
|
|
|
template<typename T> static inline T ImMin(T lhs, T rhs) { return lhs < rhs ? lhs : rhs; }
|
|
template<typename T> static inline T ImMin(T lhs, T rhs) { return lhs < rhs ? lhs : rhs; }
|
|
|
template<typename T> static inline T ImMax(T lhs, T rhs) { return lhs >= rhs ? lhs : rhs; }
|
|
template<typename T> static inline T ImMax(T lhs, T rhs) { return lhs >= rhs ? lhs : rhs; }
|
|
|
template<typename T> static inline T ImClamp(T v, T mn, T mx) { return (v < mn) ? mn : (v > mx) ? mx : v; }
|
|
template<typename T> static inline T ImClamp(T v, T mn, T mx) { return (v < mn) ? mn : (v > mx) ? mx : v; }
|
|
@@ -1047,17 +1046,10 @@ struct ImGuiContext
|
|
|
ImGuiID NavJustTabbedId; // Just tabbed to this id.
|
|
ImGuiID NavJustTabbedId; // Just tabbed to this id.
|
|
|
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest).
|
|
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest).
|
|
|
ImGuiID NavJustMovedToFocusScopeId; // Just navigated to this focus scope id (result of a successfully MoveRequest).
|
|
ImGuiID NavJustMovedToFocusScopeId; // Just navigated to this focus scope id (result of a successfully MoveRequest).
|
|
|
-
|
|
|
|
|
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame.
|
|
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame.
|
|
|
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard.
|
|
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard.
|
|
|
ImRect NavScoringRectScreen; // Rectangle used for scoring, in screen space. Based of window->DC.NavRefRectRel[], modified for directional navigation scoring.
|
|
ImRect NavScoringRectScreen; // Rectangle used for scoring, in screen space. Based of window->DC.NavRefRectRel[], modified for directional navigation scoring.
|
|
|
int NavScoringCount; // Metrics for debugging
|
|
int NavScoringCount; // Metrics for debugging
|
|
|
- ImGuiWindow* NavWindowingTarget; // When selecting a window (holding Menu+FocusPrev/Next, or equivalent of CTRL-TAB) this window is temporarily displayed top-most.
|
|
|
|
|
- ImGuiWindow* NavWindowingTargetAnim; // Record of last valid NavWindowingTarget until DimBgRatio and NavWindowingHighlightAlpha becomes 0.0f
|
|
|
|
|
- ImGuiWindow* NavWindowingList;
|
|
|
|
|
- float NavWindowingTimer;
|
|
|
|
|
- float NavWindowingHighlightAlpha;
|
|
|
|
|
- bool NavWindowingToggleLayer;
|
|
|
|
|
ImGuiNavLayer NavLayer; // Layer we are navigating on. For now the system is hard-coded for 0=main contents and 1=menu/title bar, may expose layers later.
|
|
ImGuiNavLayer NavLayer; // Layer we are navigating on. For now the system is hard-coded for 0=main contents and 1=menu/title bar, may expose layers later.
|
|
|
int NavIdTabCounter; // == NavWindow->DC.FocusIdxTabCounter at time of NavId processing
|
|
int NavIdTabCounter; // == NavWindow->DC.FocusIdxTabCounter at time of NavId processing
|
|
|
bool NavIdIsAlive; // Nav widget has been seen this frame ~~ NavRefRectRel is valid
|
|
bool NavIdIsAlive; // Nav widget has been seen this frame ~~ NavRefRectRel is valid
|
|
@@ -1079,6 +1071,14 @@ 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)
|
|
|
|
|
+ ImGuiWindow* NavWindowingTarget; // When selecting a window (holding Menu+FocusPrev/Next, or equivalent of CTRL-TAB) this window is temporarily displayed top-most.
|
|
|
|
|
+ ImGuiWindow* NavWindowingTargetAnim; // Record of last valid NavWindowingTarget until DimBgRatio and NavWindowingHighlightAlpha becomes 0.0f
|
|
|
|
|
+ ImGuiWindow* NavWindowingList;
|
|
|
|
|
+ float NavWindowingTimer;
|
|
|
|
|
+ float NavWindowingHighlightAlpha;
|
|
|
|
|
+ bool NavWindowingToggleLayer;
|
|
|
|
|
+
|
|
|
// Legacy Focus/Tabbing system (older than Nav, active even if Nav is disabled, misnamed. FIXME-NAV: This needs a redesign!)
|
|
// Legacy Focus/Tabbing system (older than Nav, active even if Nav is disabled, misnamed. FIXME-NAV: This needs a redesign!)
|
|
|
ImGuiWindow* FocusRequestCurrWindow; //
|
|
ImGuiWindow* FocusRequestCurrWindow; //
|
|
|
ImGuiWindow* FocusRequestNextWindow; //
|
|
ImGuiWindow* FocusRequestNextWindow; //
|
|
@@ -1222,9 +1222,6 @@ struct ImGuiContext
|
|
|
NavInputSource = ImGuiInputSource_None;
|
|
NavInputSource = ImGuiInputSource_None;
|
|
|
NavScoringRectScreen = ImRect();
|
|
NavScoringRectScreen = ImRect();
|
|
|
NavScoringCount = 0;
|
|
NavScoringCount = 0;
|
|
|
- NavWindowingTarget = NavWindowingTargetAnim = NavWindowingList = NULL;
|
|
|
|
|
- NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f;
|
|
|
|
|
- NavWindowingToggleLayer = false;
|
|
|
|
|
NavLayer = ImGuiNavLayer_Main;
|
|
NavLayer = ImGuiNavLayer_Main;
|
|
|
NavIdTabCounter = INT_MAX;
|
|
NavIdTabCounter = INT_MAX;
|
|
|
NavIdIsAlive = false;
|
|
NavIdIsAlive = false;
|
|
@@ -1241,6 +1238,10 @@ struct ImGuiContext
|
|
|
NavMoveRequestForward = ImGuiNavForward_None;
|
|
NavMoveRequestForward = ImGuiNavForward_None;
|
|
|
NavMoveDir = NavMoveDirLast = NavMoveClipDir = ImGuiDir_None;
|
|
NavMoveDir = NavMoveDirLast = NavMoveClipDir = ImGuiDir_None;
|
|
|
|
|
|
|
|
|
|
+ NavWindowingTarget = NavWindowingTargetAnim = NavWindowingList = NULL;
|
|
|
|
|
+ NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f;
|
|
|
|
|
+ NavWindowingToggleLayer = false;
|
|
|
|
|
+
|
|
|
FocusRequestCurrWindow = FocusRequestNextWindow = NULL;
|
|
FocusRequestCurrWindow = FocusRequestNextWindow = NULL;
|
|
|
FocusRequestCurrCounterRegular = FocusRequestCurrCounterTabStop = INT_MAX;
|
|
FocusRequestCurrCounterRegular = FocusRequestCurrCounterTabStop = INT_MAX;
|
|
|
FocusRequestNextCounterRegular = FocusRequestNextCounterTabStop = INT_MAX;
|
|
FocusRequestNextCounterRegular = FocusRequestNextCounterTabStop = INT_MAX;
|
|
@@ -1779,7 +1780,7 @@ namespace ImGui
|
|
|
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0);
|
|
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0);
|
|
|
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos);
|
|
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos);
|
|
|
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos);
|
|
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos);
|
|
|
- IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags);
|
|
|
|
|
|
|
+ IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
|
|
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
|
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
|
|
IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* p_scroll_v, float avail_v, float contents_v, ImDrawCornerFlags rounding_corners);
|
|
IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* p_scroll_v, float avail_v, float contents_v, ImDrawCornerFlags rounding_corners);
|
|
|
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
|
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|