|
@@ -136,6 +136,8 @@
|
|
|
Occasionally introducing changes that are breaking the API. The breakage are generally minor and easy to fix.
|
|
Occasionally introducing changes that are breaking the API. The breakage are generally minor and easy to fix.
|
|
|
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
|
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
|
|
|
|
|
|
|
|
|
+ - 2015/07/02 (1.42) - renamed SetScrollPosHere() to SetScrollFromCursorPos(). Kept inline redirection function (will obsolete).
|
|
|
|
|
+ - 2015/07/02 (1.42) - renamed GetScrollPosY() to GetScrollY(). Necessary to reduce confusion along with other scrolling functions, because positions (e.g. cursor position) are not equivalent to scrolling amount.
|
|
|
- 2015/06/14 (1.41) - changed ImageButton() default bg_col parameter from (0,0,0,1) (black) to (0,0,0,0) (transparent) - makes a difference when texture have transparence
|
|
- 2015/06/14 (1.41) - changed ImageButton() default bg_col parameter from (0,0,0,1) (black) to (0,0,0,0) (transparent) - makes a difference when texture have transparence
|
|
|
- 2015/06/14 (1.41) - changed Selectable() API from (label, selected, size) to (label, selected, flags, size). Size override should have been rarely be used. Sorry!
|
|
- 2015/06/14 (1.41) - changed Selectable() API from (label, selected, size) to (label, selected, flags, size). Size override should have been rarely be used. Sorry!
|
|
|
- 2015/05/31 (1.40) - renamed GetWindowCollapsed() to IsWindowCollapsed() for consistency. Kept inline redirection function (will obsolete).
|
|
- 2015/05/31 (1.40) - renamed GetWindowCollapsed() to IsWindowCollapsed() for consistency. Kept inline redirection function (will obsolete).
|
|
@@ -338,7 +340,6 @@
|
|
|
- window: resizing from any sides? + mouse cursor directives for app.
|
|
- window: resizing from any sides? + mouse cursor directives for app.
|
|
|
- window: get size/pos helpers given names (see discussion in #249)
|
|
- window: get size/pos helpers given names (see discussion in #249)
|
|
|
- scrolling: add horizontal scroll
|
|
- scrolling: add horizontal scroll
|
|
|
-!- scrolling: set scrolling given a position.
|
|
|
|
|
!- scrolling: allow immediately effective change of scroll if we haven't appended items yet
|
|
!- scrolling: allow immediately effective change of scroll if we haven't appended items yet
|
|
|
- widgets: display mode: widget-label, label-widget (aligned on column or using fixed size), label-newline-tab-widget etc.
|
|
- widgets: display mode: widget-label, label-widget (aligned on column or using fixed size), label-newline-tab-widget etc.
|
|
|
- widgets: clean up widgets internal toward exposing everything.
|
|
- widgets: clean up widgets internal toward exposing everything.
|
|
@@ -372,7 +373,6 @@
|
|
|
- listbox: scrolling should track modified selection.
|
|
- listbox: scrolling should track modified selection.
|
|
|
- menus: local shortcuts, global shortcuts (#126)
|
|
- menus: local shortcuts, global shortcuts (#126)
|
|
|
- menus: icons
|
|
- menus: icons
|
|
|
- - menus: see we can allow for click-menu-hold-release-on-item to work (like Windows does)
|
|
|
|
|
- menus: menubars: some sort of priority / effect of main menu-bar on desktop size?
|
|
- menus: menubars: some sort of priority / effect of main menu-bar on desktop size?
|
|
|
- tabs
|
|
- tabs
|
|
|
- separator: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y)
|
|
- separator: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y)
|
|
@@ -386,6 +386,7 @@
|
|
|
- slider: allow using the [-]/[+] buttons used by InputFloat()/InputInt()
|
|
- slider: allow using the [-]/[+] buttons used by InputFloat()/InputInt()
|
|
|
- slider: initial absolute click is imprecise. change to relative movement slider (same as scrollbar).
|
|
- slider: initial absolute click is imprecise. change to relative movement slider (same as scrollbar).
|
|
|
- slider: add dragging-based widgets to edit values with mouse (on 2 axises), saving screen real-estate.
|
|
- slider: add dragging-based widgets to edit values with mouse (on 2 axises), saving screen real-estate.
|
|
|
|
|
+ - dragfloat: up/down axis
|
|
|
- text edit: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now.
|
|
- text edit: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now.
|
|
|
- text edit: centered text for slider as input text so it matches typical positioning.
|
|
- text edit: centered text for slider as input text so it matches typical positioning.
|
|
|
- text edit: flag to disable live update of the user buffer.
|
|
- text edit: flag to disable live update of the user buffer.
|
|
@@ -681,6 +682,8 @@ ImGuiIO::ImGuiIO()
|
|
|
MouseDoubleClickTime = 0.30f;
|
|
MouseDoubleClickTime = 0.30f;
|
|
|
MouseDoubleClickMaxDist = 6.0f;
|
|
MouseDoubleClickMaxDist = 6.0f;
|
|
|
MouseDragThreshold = 6.0f;
|
|
MouseDragThreshold = 6.0f;
|
|
|
|
|
+ for (int i = 0; i < ImGuiKey_COUNT; i++)
|
|
|
|
|
+ KeyMap[i] = -1;
|
|
|
KeyRepeatDelay = 0.250f;
|
|
KeyRepeatDelay = 0.250f;
|
|
|
KeyRepeatRate = 0.050f;
|
|
KeyRepeatRate = 0.050f;
|
|
|
UserData = NULL;
|
|
UserData = NULL;
|
|
@@ -739,7 +742,7 @@ static inline ImVec2 operator-(const ImVec2& lhs, const ImVec2& rhs)
|
|
|
static inline ImVec2 operator*(const ImVec2& lhs, const ImVec2 rhs) { return ImVec2(lhs.x*rhs.x, lhs.y*rhs.y); }
|
|
static inline ImVec2 operator*(const ImVec2& lhs, const ImVec2 rhs) { return ImVec2(lhs.x*rhs.x, lhs.y*rhs.y); }
|
|
|
static inline ImVec2 operator/(const ImVec2& lhs, const ImVec2 rhs) { return ImVec2(lhs.x/rhs.x, lhs.y/rhs.y); }
|
|
static inline ImVec2 operator/(const ImVec2& lhs, const ImVec2 rhs) { return ImVec2(lhs.x/rhs.x, lhs.y/rhs.y); }
|
|
|
static inline ImVec2& operator+=(ImVec2& lhs, const ImVec2& rhs) { lhs.x += rhs.x; lhs.y += rhs.y; return lhs; }
|
|
static inline ImVec2& operator+=(ImVec2& lhs, const ImVec2& rhs) { lhs.x += rhs.x; lhs.y += rhs.y; return lhs; }
|
|
|
-static inline ImVec2& operator-=(ImVec2& lhs, const ImVec2& rhs) { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; }
|
|
|
|
|
|
|
+//static inline ImVec2& operator-=(ImVec2& lhs, const ImVec2& rhs) { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; }
|
|
|
static inline ImVec2& operator*=(ImVec2& lhs, const float rhs) { lhs.x *= rhs; lhs.y *= rhs; return lhs; }
|
|
static inline ImVec2& operator*=(ImVec2& lhs, const float rhs) { lhs.x *= rhs; lhs.y *= rhs; return lhs; }
|
|
|
//static inline ImVec2& operator/=(ImVec2& lhs, const float rhs) { lhs.x /= rhs; lhs.y /= rhs; return lhs; }
|
|
//static inline ImVec2& operator/=(ImVec2& lhs, const float rhs) { lhs.x /= rhs; lhs.y /= rhs; return lhs; }
|
|
|
static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x-rhs.x, lhs.y-rhs.y, lhs.z-rhs.z, lhs.w-lhs.w); }
|
|
static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x-rhs.x, lhs.y-rhs.y, lhs.z-rhs.z, lhs.w-lhs.w); }
|
|
@@ -1000,18 +1003,21 @@ enum ImGuiLayoutType_
|
|
|
enum ImGuiButtonFlags_
|
|
enum ImGuiButtonFlags_
|
|
|
{
|
|
{
|
|
|
ImGuiButtonFlags_Repeat = 1 << 0,
|
|
ImGuiButtonFlags_Repeat = 1 << 0,
|
|
|
- ImGuiButtonFlags_PressedOnClick = 1 << 1,
|
|
|
|
|
- ImGuiButtonFlags_FlattenChilds = 1 << 2,
|
|
|
|
|
- ImGuiButtonFlags_DontClosePopups = 1 << 3,
|
|
|
|
|
- ImGuiButtonFlags_Disabled = 1 << 4
|
|
|
|
|
|
|
+ ImGuiButtonFlags_PressedOnClick = 1 << 1, // return pressed on click only (default requires click+release)
|
|
|
|
|
+ ImGuiButtonFlags_PressedOnRelease = 1 << 2, // return pressed on release only (default requires click+release)
|
|
|
|
|
+ ImGuiButtonFlags_FlattenChilds = 1 << 3,
|
|
|
|
|
+ ImGuiButtonFlags_DontClosePopups = 1 << 4,
|
|
|
|
|
+ ImGuiButtonFlags_Disabled = 1 << 5,
|
|
|
|
|
+ ImGuiButtonFlags_AlignTextBaseLine = 1 << 6
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
enum ImGuiSelectableFlagsPrivate_
|
|
enum ImGuiSelectableFlagsPrivate_
|
|
|
{
|
|
{
|
|
|
// NB: need to be in sync with last value of ImGuiSelectableFlags_
|
|
// NB: need to be in sync with last value of ImGuiSelectableFlags_
|
|
|
- ImGuiSelectableFlags_MenuItem = 1 << 2,
|
|
|
|
|
- ImGuiSelectableFlags_Disabled = 1 << 3,
|
|
|
|
|
- ImGuiSelectableFlags_DrawFillAvailWidth = 1 << 4
|
|
|
|
|
|
|
+ ImGuiSelectableFlags_Menu = 1 << 2,
|
|
|
|
|
+ ImGuiSelectableFlags_MenuItem = 1 << 3,
|
|
|
|
|
+ ImGuiSelectableFlags_Disabled = 1 << 4,
|
|
|
|
|
+ ImGuiSelectableFlags_DrawFillAvailWidth = 1 << 5
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1334,6 +1340,8 @@ struct ImGuiState
|
|
|
float FramerateSecPerFrame[120]; // calculate estimate of framerate for user
|
|
float FramerateSecPerFrame[120]; // calculate estimate of framerate for user
|
|
|
int FramerateSecPerFrameIdx;
|
|
int FramerateSecPerFrameIdx;
|
|
|
float FramerateSecPerFrameAccum;
|
|
float FramerateSecPerFrameAccum;
|
|
|
|
|
+ bool CaptureMouseNextFrame; // explicit capture via CaptureInputs() sets those flags
|
|
|
|
|
+ bool CaptureKeyboardNextFrame;
|
|
|
char TempBuffer[1024*3+1]; // temporary text buffer
|
|
char TempBuffer[1024*3+1]; // temporary text buffer
|
|
|
|
|
|
|
|
ImGuiState()
|
|
ImGuiState()
|
|
@@ -1395,6 +1403,7 @@ struct ImGuiState
|
|
|
memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame));
|
|
memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame));
|
|
|
FramerateSecPerFrameIdx = 0;
|
|
FramerateSecPerFrameIdx = 0;
|
|
|
FramerateSecPerFrameAccum = 0.0f;
|
|
FramerateSecPerFrameAccum = 0.0f;
|
|
|
|
|
+ CaptureMouseNextFrame = CaptureKeyboardNextFrame = false;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -1411,9 +1420,11 @@ struct ImGuiWindow
|
|
|
ImVec2 Size; // Current size (==SizeFull or collapsed title bar size)
|
|
ImVec2 Size; // Current size (==SizeFull or collapsed title bar size)
|
|
|
ImVec2 SizeFull; // Size when non collapsed
|
|
ImVec2 SizeFull; // Size when non collapsed
|
|
|
ImVec2 SizeContents; // Size of contents (== extents reach of the drawing cursor) from previous frame
|
|
ImVec2 SizeContents; // Size of contents (== extents reach of the drawing cursor) from previous frame
|
|
|
|
|
+ ImVec2 WindowPadding; // Window padding at the time of begin. We need to lock it, in particular manipulation of the ShowBorder would have an effect
|
|
|
ImGuiID MoveID; // == window->GetID("#MOVE")
|
|
ImGuiID MoveID; // == window->GetID("#MOVE")
|
|
|
float ScrollY;
|
|
float ScrollY;
|
|
|
- float ScrollTargetCenterY; // position which we aim to center on
|
|
|
|
|
|
|
+ float ScrollTargetRelY; // target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)
|
|
|
|
|
+ float ScrollTargetCenterRatioY; // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
|
|
|
bool ScrollbarY;
|
|
bool ScrollbarY;
|
|
|
bool Active; // Set to true on Begin()
|
|
bool Active; // Set to true on Begin()
|
|
|
bool WasActive;
|
|
bool WasActive;
|
|
@@ -1468,7 +1479,6 @@ public:
|
|
|
ImRect TitleBarRect() const { return ImRect(Pos, Pos + ImVec2(SizeFull.x, TitleBarHeight())); }
|
|
ImRect TitleBarRect() const { return ImRect(Pos, Pos + ImVec2(SizeFull.x, TitleBarHeight())); }
|
|
|
float MenuBarHeight() const { return (Flags & ImGuiWindowFlags_MenuBar) ? CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f : 0.0f; }
|
|
float MenuBarHeight() const { return (Flags & ImGuiWindowFlags_MenuBar) ? CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f : 0.0f; }
|
|
|
ImRect MenuBarRect() const { float y1 = Pos.y + TitleBarHeight(); return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight()); }
|
|
ImRect MenuBarRect() const { float y1 = Pos.y + TitleBarHeight(); return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight()); }
|
|
|
- ImVec2 WindowPadding() const { return ((Flags & ImGuiWindowFlags_ChildWindow) && !(Flags & (ImGuiWindowFlags_ShowBorders | ImGuiWindowFlags_ComboBox | ImGuiWindowFlags_Popup))) ? ImVec2(0,0) : GImGui->Style.WindowPadding; }
|
|
|
|
|
float ScrollbarWidth() const { return ScrollbarY ? GImGui->Style.ScrollbarWidth : 0.0f; }
|
|
float ScrollbarWidth() const { return ScrollbarY ? GImGui->Style.ScrollbarWidth : 0.0f; }
|
|
|
ImU32 Color(ImGuiCol idx, float a=1.f) const { ImVec4 c = GImGui->Style.Colors[idx]; c.w *= GImGui->Style.Alpha * a; return ImGui::ColorConvertFloat4ToU32(c); }
|
|
ImU32 Color(ImGuiCol idx, float a=1.f) const { ImVec4 c = GImGui->Style.Colors[idx]; c.w *= GImGui->Style.Alpha * a; return ImGui::ColorConvertFloat4ToU32(c); }
|
|
|
ImU32 Color(const ImVec4& col) const { ImVec4 c = col; c.w *= GImGui->Style.Alpha; return ImGui::ColorConvertFloat4ToU32(c); }
|
|
ImU32 Color(const ImVec4& col) const { ImVec4 c = col; c.w *= GImGui->Style.Alpha; return ImGui::ColorConvertFloat4ToU32(c); }
|
|
@@ -1778,8 +1788,10 @@ ImGuiWindow::ImGuiWindow(const char* name)
|
|
|
PosFloat = Pos = ImVec2(0.0f, 0.0f);
|
|
PosFloat = Pos = ImVec2(0.0f, 0.0f);
|
|
|
Size = SizeFull = ImVec2(0.0f, 0.0f);
|
|
Size = SizeFull = ImVec2(0.0f, 0.0f);
|
|
|
SizeContents = ImVec2(0.0f, 0.0f);
|
|
SizeContents = ImVec2(0.0f, 0.0f);
|
|
|
|
|
+ WindowPadding = ImVec2(0.0f, 0.0f);
|
|
|
ScrollY = 0.0f;
|
|
ScrollY = 0.0f;
|
|
|
- ScrollTargetCenterY = -1.0f;
|
|
|
|
|
|
|
+ ScrollTargetRelY = FLT_MAX;
|
|
|
|
|
+ ScrollTargetCenterRatioY = 0.5f;
|
|
|
ScrollbarY = false;
|
|
ScrollbarY = false;
|
|
|
Active = WasActive = false;
|
|
Active = WasActive = false;
|
|
|
Accessed = false;
|
|
Accessed = false;
|
|
@@ -2187,9 +2199,10 @@ void ImGui::NewFrame()
|
|
|
mouse_earliest_button_down = i;
|
|
mouse_earliest_button_down = i;
|
|
|
}
|
|
}
|
|
|
bool mouse_owned_by_application = mouse_earliest_button_down != -1 && !g.IO.MouseDownOwned[mouse_earliest_button_down];
|
|
bool mouse_owned_by_application = mouse_earliest_button_down != -1 && !g.IO.MouseDownOwned[mouse_earliest_button_down];
|
|
|
- g.IO.WantCaptureMouse = (!mouse_owned_by_application && g.HoveredWindow != NULL) || (!mouse_owned_by_application && mouse_any_down) || (g.ActiveId != 0) || (!g.OpenedPopupStack.empty());
|
|
|
|
|
- g.IO.WantCaptureKeyboard = (g.ActiveId != 0);
|
|
|
|
|
|
|
+ g.IO.WantCaptureMouse = (!mouse_owned_by_application && g.HoveredWindow != NULL) || (!mouse_owned_by_application && mouse_any_down) || (g.ActiveId != 0) || (!g.OpenedPopupStack.empty()) || (g.CaptureMouseNextFrame);
|
|
|
|
|
+ g.IO.WantCaptureKeyboard = (g.ActiveId != 0) || (g.CaptureKeyboardNextFrame);
|
|
|
g.MouseCursor = ImGuiMouseCursor_Arrow;
|
|
g.MouseCursor = ImGuiMouseCursor_Arrow;
|
|
|
|
|
+ g.CaptureMouseNextFrame = g.CaptureKeyboardNextFrame = false;
|
|
|
|
|
|
|
|
// If mouse was first clicked outside of ImGui bounds we also cancel out hovering.
|
|
// If mouse was first clicked outside of ImGui bounds we also cancel out hovering.
|
|
|
if (mouse_owned_by_application)
|
|
if (mouse_owned_by_application)
|
|
@@ -2879,21 +2892,27 @@ bool ImGui::IsPosHoveringAnyWindow(const ImVec2& pos)
|
|
|
|
|
|
|
|
static bool IsKeyPressedMap(ImGuiKey key, bool repeat)
|
|
static bool IsKeyPressedMap(ImGuiKey key, bool repeat)
|
|
|
{
|
|
{
|
|
|
- ImGuiState& g = *GImGui;
|
|
|
|
|
- const int key_index = g.IO.KeyMap[key];
|
|
|
|
|
|
|
+ const int key_index = GImGui->IO.KeyMap[key];
|
|
|
return ImGui::IsKeyPressed(key_index, repeat);
|
|
return ImGui::IsKeyPressed(key_index, repeat);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+int ImGui::GetKeyIndex(ImGuiKey key)
|
|
|
|
|
+{
|
|
|
|
|
+ IM_ASSERT(key >= 0 && key < ImGuiKey_COUNT);
|
|
|
|
|
+ return GImGui->IO.KeyMap[key];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
bool ImGui::IsKeyDown(int key_index)
|
|
bool ImGui::IsKeyDown(int key_index)
|
|
|
{
|
|
{
|
|
|
- ImGuiState& g = *GImGui;
|
|
|
|
|
- IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown));
|
|
|
|
|
- return g.IO.KeysDown[key_index];
|
|
|
|
|
|
|
+ if (key_index < 0) return false;
|
|
|
|
|
+ IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(GImGui->IO.KeysDown));
|
|
|
|
|
+ return GImGui->IO.KeysDown[key_index];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool ImGui::IsKeyPressed(int key_index, bool repeat)
|
|
bool ImGui::IsKeyPressed(int key_index, bool repeat)
|
|
|
{
|
|
{
|
|
|
ImGuiState& g = *GImGui;
|
|
ImGuiState& g = *GImGui;
|
|
|
|
|
+ if (key_index < 0) return false;
|
|
|
IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown));
|
|
IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown));
|
|
|
const float t = g.IO.KeysDownDuration[key_index];
|
|
const float t = g.IO.KeysDownDuration[key_index];
|
|
|
if (t == 0.0f)
|
|
if (t == 0.0f)
|
|
@@ -2911,10 +2930,10 @@ bool ImGui::IsKeyPressed(int key_index, bool repeat)
|
|
|
bool ImGui::IsKeyReleased(int key_index)
|
|
bool ImGui::IsKeyReleased(int key_index)
|
|
|
{
|
|
{
|
|
|
ImGuiState& g = *GImGui;
|
|
ImGuiState& g = *GImGui;
|
|
|
|
|
+ if (key_index < 0) return false;
|
|
|
IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown));
|
|
IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown));
|
|
|
if (g.IO.KeysDownDurationPrev[key_index] >= 0.0f && !g.IO.KeysDown[key_index])
|
|
if (g.IO.KeysDownDurationPrev[key_index] >= 0.0f && !g.IO.KeysDown[key_index])
|
|
|
return true;
|
|
return true;
|
|
|
-
|
|
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2961,6 +2980,8 @@ bool ImGui::IsMouseDragging(int button, float lock_threshold)
|
|
|
{
|
|
{
|
|
|
ImGuiState& g = *GImGui;
|
|
ImGuiState& g = *GImGui;
|
|
|
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
|
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
|
|
|
|
+ if (!g.IO.MouseDown[button])
|
|
|
|
|
+ return false;
|
|
|
if (lock_threshold < 0.0f)
|
|
if (lock_threshold < 0.0f)
|
|
|
lock_threshold = g.IO.MouseDragThreshold;
|
|
lock_threshold = g.IO.MouseDragThreshold;
|
|
|
return g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold;
|
|
return g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold;
|
|
@@ -3001,6 +3022,16 @@ void ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type)
|
|
|
GImGui->MouseCursor = cursor_type;
|
|
GImGui->MouseCursor = cursor_type;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+void ImGui::CaptureKeyboardFromApp()
|
|
|
|
|
+{
|
|
|
|
|
+ GImGui->CaptureKeyboardNextFrame = true;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void ImGui::CaptureMouseFromApp()
|
|
|
|
|
+{
|
|
|
|
|
+ GImGui->CaptureMouseNextFrame = true;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
bool ImGui::IsItemHovered()
|
|
bool ImGui::IsItemHovered()
|
|
|
{
|
|
{
|
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
@@ -3693,17 +3724,19 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Lock window padding so that altering the ShowBorders flag for childs doesn't have side-effects.
|
|
|
|
|
+ window->WindowPadding = ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_ShowBorders | ImGuiWindowFlags_ComboBox | ImGuiWindowFlags_Popup))) ? ImVec2(0,0) : style.WindowPadding;
|
|
|
|
|
+
|
|
|
// Calculate auto-fit size
|
|
// Calculate auto-fit size
|
|
|
ImVec2 size_auto_fit;
|
|
ImVec2 size_auto_fit;
|
|
|
- ImVec2 window_padding = window->WindowPadding();
|
|
|
|
|
if ((flags & ImGuiWindowFlags_Tooltip) != 0)
|
|
if ((flags & ImGuiWindowFlags_Tooltip) != 0)
|
|
|
{
|
|
{
|
|
|
// Tooltip always resize. We keep the spacing symmetric on both axises for aesthetic purpose.
|
|
// Tooltip always resize. We keep the spacing symmetric on both axises for aesthetic purpose.
|
|
|
- size_auto_fit = window->SizeContents + window_padding - ImVec2(0.0f, style.ItemSpacing.y);
|
|
|
|
|
|
|
+ size_auto_fit = window->SizeContents + window->WindowPadding - ImVec2(0.0f, style.ItemSpacing.y);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- size_auto_fit = ImClamp(window->SizeContents + window_padding, style.WindowMinSize, ImMax(style.WindowMinSize, g.IO.DisplaySize - window_padding));
|
|
|
|
|
|
|
+ size_auto_fit = ImClamp(window->SizeContents + window->WindowPadding, style.WindowMinSize, ImMax(style.WindowMinSize, g.IO.DisplaySize - window->WindowPadding));
|
|
|
if (size_auto_fit.y < window->SizeContents.y && !(flags & ImGuiWindowFlags_NoScrollbar))
|
|
if (size_auto_fit.y < window->SizeContents.y && !(flags & ImGuiWindowFlags_NoScrollbar))
|
|
|
size_auto_fit.x += style.ScrollbarWidth;
|
|
size_auto_fit.x += style.ScrollbarWidth;
|
|
|
size_auto_fit.y = ImMax(size_auto_fit.y - style.ItemSpacing.y, 0.0f);
|
|
size_auto_fit.y = ImMax(size_auto_fit.y - style.ItemSpacing.y, 0.0f);
|
|
@@ -3837,10 +3870,11 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
window->FocusIdxAllRequestNext = window->FocusIdxTabRequestNext = IM_INT_MAX;
|
|
window->FocusIdxAllRequestNext = window->FocusIdxTabRequestNext = IM_INT_MAX;
|
|
|
|
|
|
|
|
// Apply scrolling
|
|
// Apply scrolling
|
|
|
- if (window->ScrollTargetCenterY >= 0.0f)
|
|
|
|
|
|
|
+ if (window->ScrollTargetRelY < FLT_MAX)
|
|
|
{
|
|
{
|
|
|
- window->ScrollY = window->ScrollTargetCenterY - (window->Pos.y + (window->SizeFull.y + window->TitleBarHeight() + window->WindowPadding().y) * 0.5f);
|
|
|
|
|
- window->ScrollTargetCenterY = -1.0f;
|
|
|
|
|
|
|
+ float center_ratio_y = window->ScrollTargetCenterRatioY;
|
|
|
|
|
+ window->ScrollY = window->ScrollTargetRelY - ((1.0f - center_ratio_y) * window->TitleBarHeight()) - (center_ratio_y * window->SizeFull.y);
|
|
|
|
|
+ window->ScrollTargetRelY = FLT_MAX;
|
|
|
}
|
|
}
|
|
|
window->ScrollY = ImMax(window->ScrollY, 0.0f);
|
|
window->ScrollY = ImMax(window->ScrollY, 0.0f);
|
|
|
if (!window->Collapsed && !window->SkipItems)
|
|
if (!window->Collapsed && !window->SkipItems)
|
|
@@ -3963,9 +3997,9 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Setup drawing context
|
|
// Setup drawing context
|
|
|
- window->DC.ColumnsStartX = window->WindowPadding().x;
|
|
|
|
|
|
|
+ window->DC.ColumnsStartX = window->WindowPadding.x;
|
|
|
window->DC.ColumnsOffsetX = 0.0f;
|
|
window->DC.ColumnsOffsetX = 0.0f;
|
|
|
- window->DC.CursorStartPos = window->Pos + ImVec2(window->DC.ColumnsStartX + window->DC.ColumnsOffsetX, window->TitleBarHeight() + window->MenuBarHeight() + window->WindowPadding().y) - ImVec2(0.0f, window->ScrollY);
|
|
|
|
|
|
|
+ window->DC.CursorStartPos = window->Pos + ImVec2(window->DC.ColumnsStartX + window->DC.ColumnsOffsetX, window->TitleBarHeight() + window->MenuBarHeight() + window->WindowPadding.y) - ImVec2(0.0f, window->ScrollY);
|
|
|
window->DC.CursorPos = window->DC.CursorStartPos;
|
|
window->DC.CursorPos = window->DC.CursorStartPos;
|
|
|
window->DC.CursorPosPrevLine = window->DC.CursorPos;
|
|
window->DC.CursorPosPrevLine = window->DC.CursorPos;
|
|
|
window->DC.CursorMaxPos = window->DC.CursorStartPos;
|
|
window->DC.CursorMaxPos = window->DC.CursorStartPos;
|
|
@@ -4039,7 +4073,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
// We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame
|
|
// We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame
|
|
|
// Note that if our window is collapsed we will end up with a null clipping rectangle which is the correct behavior.
|
|
// Note that if our window is collapsed we will end up with a null clipping rectangle which is the correct behavior.
|
|
|
const ImRect title_bar_rect = window->TitleBarRect();
|
|
const ImRect title_bar_rect = window->TitleBarRect();
|
|
|
- ImVec4 clip_rect(title_bar_rect.Min.x+0.5f+window->WindowPadding().x*0.5f, title_bar_rect.Max.y+window->MenuBarHeight()+0.5f, window->Rect().Max.x+0.5f-window->WindowPadding().x*0.5f, window->Rect().Max.y-1.5f);
|
|
|
|
|
|
|
+ ImVec4 clip_rect(title_bar_rect.Min.x+0.5f+window->WindowPadding.x*0.5f, title_bar_rect.Max.y+window->MenuBarHeight()+0.5f, window->Rect().Max.x+0.5f-window->WindowPadding.x*0.5f, window->Rect().Max.y-1.5f);
|
|
|
if (window->ScrollbarY)
|
|
if (window->ScrollbarY)
|
|
|
clip_rect.z -= style.ScrollbarWidth;
|
|
clip_rect.z -= style.ScrollbarWidth;
|
|
|
PushClipRect(clip_rect);
|
|
PushClipRect(clip_rect);
|
|
@@ -4483,8 +4517,7 @@ bool ImGui::IsRootWindowOrAnyChildFocused()
|
|
|
|
|
|
|
|
float ImGui::GetWindowWidth()
|
|
float ImGui::GetWindowWidth()
|
|
|
{
|
|
{
|
|
|
- ImGuiState& g = *GImGui;
|
|
|
|
|
- ImGuiWindow* window = g.CurrentWindow;
|
|
|
|
|
|
|
+ ImGuiWindow* window = GImGui->CurrentWindow;
|
|
|
return window->Size.x;
|
|
return window->Size.x;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -4666,12 +4699,11 @@ void ImGui::SetNextWindowFocus()
|
|
|
ImVec2 ImGui::GetContentRegionMax()
|
|
ImVec2 ImGui::GetContentRegionMax()
|
|
|
{
|
|
{
|
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
|
- ImVec2 window_padding = window->WindowPadding();
|
|
|
|
|
- ImVec2 mx = window->Size - window_padding;
|
|
|
|
|
|
|
+ ImVec2 mx = window->Size - window->WindowPadding;
|
|
|
if (window->DC.ColumnsCount != 1)
|
|
if (window->DC.ColumnsCount != 1)
|
|
|
{
|
|
{
|
|
|
mx.x = ImGui::GetColumnOffset(window->DC.ColumnsCurrent + 1);
|
|
mx.x = ImGui::GetColumnOffset(window->DC.ColumnsCurrent + 1);
|
|
|
- mx.x -= window_padding.x;
|
|
|
|
|
|
|
+ mx.x -= window->WindowPadding.x;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -4683,13 +4715,13 @@ ImVec2 ImGui::GetContentRegionMax()
|
|
|
ImVec2 ImGui::GetWindowContentRegionMin()
|
|
ImVec2 ImGui::GetWindowContentRegionMin()
|
|
|
{
|
|
{
|
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
|
- return ImVec2(0, window->TitleBarHeight() + window->MenuBarHeight()) + window->WindowPadding();
|
|
|
|
|
|
|
+ return ImVec2(0, window->TitleBarHeight() + window->MenuBarHeight()) + window->WindowPadding;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
ImVec2 ImGui::GetWindowContentRegionMax()
|
|
ImVec2 ImGui::GetWindowContentRegionMax()
|
|
|
{
|
|
{
|
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
|
- ImVec2 m = window->Size - window->WindowPadding();
|
|
|
|
|
|
|
+ ImVec2 m = window->Size - window->WindowPadding;
|
|
|
m.x -= window->ScrollbarWidth();
|
|
m.x -= window->ScrollbarWidth();
|
|
|
return m;
|
|
return m;
|
|
|
}
|
|
}
|
|
@@ -4738,8 +4770,8 @@ void ImGui::SetWindowFontScale(float scale)
|
|
|
g.FontSize = window->CalcFontSize();
|
|
g.FontSize = window->CalcFontSize();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// NB: internally we store CursorPos in absolute screen coordinates because it is more convenient.
|
|
|
|
|
-// Conversion happens as we pass the value to user, but it makes our naming convention dodgy. May want to rename 'DC.CursorPos'.
|
|
|
|
|
|
|
+// User generally sees positions in window coordinates. Internally we store CursorPos in absolute screen coordinates because it is more convenient.
|
|
|
|
|
+// Conversion happens as we pass the value to user, but it makes our naming convention confusing because GetCursorPos() == (DC.CursorPos - window.Pos). May want to rename 'DC.CursorPos'.
|
|
|
ImVec2 ImGui::GetCursorPos()
|
|
ImVec2 ImGui::GetCursorPos()
|
|
|
{
|
|
{
|
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
@@ -4777,6 +4809,12 @@ void ImGui::SetCursorPosY(float y)
|
|
|
window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y);
|
|
window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ImVec2 ImGui::GetCursorStartPos()
|
|
|
|
|
+{
|
|
|
|
|
+ ImGuiWindow* window = GetCurrentWindow();
|
|
|
|
|
+ return window->DC.CursorStartPos - window->Pos;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
ImVec2 ImGui::GetCursorScreenPos()
|
|
ImVec2 ImGui::GetCursorScreenPos()
|
|
|
{
|
|
{
|
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
@@ -4789,7 +4827,7 @@ void ImGui::SetCursorScreenPos(const ImVec2& screen_pos)
|
|
|
window->DC.CursorPos = screen_pos;
|
|
window->DC.CursorPos = screen_pos;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-float ImGui::GetScrollPosY()
|
|
|
|
|
|
|
+float ImGui::GetScrollY()
|
|
|
{
|
|
{
|
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
|
return window->ScrollY;
|
|
return window->ScrollY;
|
|
@@ -4801,10 +4839,29 @@ float ImGui::GetScrollMaxY()
|
|
|
return window->SizeContents.y - window->SizeFull.y;
|
|
return window->SizeContents.y - window->SizeFull.y;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void ImGui::SetScrollPosHere()
|
|
|
|
|
|
|
+void ImGui::SetScrollY(float scroll_y)
|
|
|
{
|
|
{
|
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
|
- window->ScrollTargetCenterY = (float)(int)(window->DC.CursorPos.y + window->ScrollY - window->DC.PrevLineHeight * 0.5f);
|
|
|
|
|
|
|
+ window->ScrollTargetRelY = scroll_y + window->TitleBarHeight(); // title bar height cancelled out when using ScrollTargetRelY
|
|
|
|
|
+ window->ScrollTargetCenterRatioY = 0.0f;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void ImGui::SetScrollFromPosY(float pos_y, float center_y_ratio)
|
|
|
|
|
+{
|
|
|
|
|
+ // We store a target position so centering can occur on the next frame when we are guaranteed to have a known window size
|
|
|
|
|
+ ImGuiWindow* window = GetCurrentWindow();
|
|
|
|
|
+ IM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f);
|
|
|
|
|
+ window->ScrollTargetRelY = (float)(int)(pos_y + window->ScrollY);
|
|
|
|
|
+ if (center_y_ratio <= 0.0f && window->ScrollTargetRelY <= window->WindowPadding.y) // Minor hack to make "scroll to top" take account of WindowPadding, else it would scroll to (WindowPadding.y - ItemSpacing.y)
|
|
|
|
|
+ window->ScrollTargetRelY = 0.0f;
|
|
|
|
|
+ window->ScrollTargetCenterRatioY = center_y_ratio;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void ImGui::SetScrollHere(float center_y_ratio)
|
|
|
|
|
+{
|
|
|
|
|
+ ImGuiWindow* window = GetCurrentWindow();
|
|
|
|
|
+ float target_y = window->DC.CursorPosPrevLine.y + (window->DC.PrevLineHeight * center_y_ratio) + (GImGui->Style.ItemSpacing.y * (center_y_ratio - 0.5f) * 2.0f); // Precisely aim above, in the middle or below the last line.
|
|
|
|
|
+ ImGui::SetScrollFromPosY(target_y - window->Pos.y, center_y_ratio);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void ImGui::SetKeyboardFocusHere(int offset)
|
|
void ImGui::SetKeyboardFocusHere(int offset)
|
|
@@ -4923,11 +4980,11 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
|
|
|
// Lines to skip (can't skip when logging text)
|
|
// Lines to skip (can't skip when logging text)
|
|
|
if (!g.LogEnabled)
|
|
if (!g.LogEnabled)
|
|
|
{
|
|
{
|
|
|
- int lines_skippable = (int)((clip_rect.y - text_pos.y) / line_height) - 1;
|
|
|
|
|
|
|
+ int lines_skippable = (int)((clip_rect.y - text_pos.y) / line_height);
|
|
|
if (lines_skippable > 0)
|
|
if (lines_skippable > 0)
|
|
|
{
|
|
{
|
|
|
int lines_skipped = 0;
|
|
int lines_skipped = 0;
|
|
|
- while (line < text_end && lines_skipped <= lines_skippable)
|
|
|
|
|
|
|
+ while (line < text_end && lines_skipped < lines_skippable)
|
|
|
{
|
|
{
|
|
|
const char* line_end = strchr(line, '\n');
|
|
const char* line_end = strchr(line, '\n');
|
|
|
line = line_end + 1;
|
|
line = line_end + 1;
|
|
@@ -5046,7 +5103,7 @@ static inline bool IsWindowContentHoverable(ImGuiWindow* window)
|
|
|
{
|
|
{
|
|
|
// An active popup disable hovering on other windows (apart from its own children)
|
|
// An active popup disable hovering on other windows (apart from its own children)
|
|
|
ImGuiState& g = *GImGui;
|
|
ImGuiState& g = *GImGui;
|
|
|
- if (ImGuiWindow* focused_window = g.FocusedWindow)
|
|
|
|
|
|
|
+ if (ImGuiWindow* focused_window = g.FocusedWindow)
|
|
|
if (ImGuiWindow* focused_root_window = focused_window->RootWindow)
|
|
if (ImGuiWindow* focused_root_window = focused_window->RootWindow)
|
|
|
if ((focused_root_window->Flags & ImGuiWindowFlags_Popup) != 0 && focused_root_window->WasActive && focused_root_window != window->RootWindow)
|
|
if ((focused_root_window->Flags & ImGuiWindowFlags_Popup) != 0 && focused_root_window->WasActive && focused_root_window != window->RootWindow)
|
|
|
return false;
|
|
return false;
|
|
@@ -5101,6 +5158,11 @@ static bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|
|
}
|
|
}
|
|
|
FocusWindow(window);
|
|
FocusWindow(window);
|
|
|
}
|
|
}
|
|
|
|
|
+ else if (g.IO.MouseReleased[0] && (flags & ImGuiButtonFlags_PressedOnRelease))
|
|
|
|
|
+ {
|
|
|
|
|
+ pressed = true;
|
|
|
|
|
+ SetActiveId(0);
|
|
|
|
|
+ }
|
|
|
else if ((flags & ImGuiButtonFlags_Repeat) && g.ActiveId == id && ImGui::IsMouseClicked(0, true))
|
|
else if ((flags & ImGuiButtonFlags_Repeat) && g.ActiveId == id && ImGui::IsMouseClicked(0, true))
|
|
|
{
|
|
{
|
|
|
pressed = true;
|
|
pressed = true;
|
|
@@ -5140,8 +5202,12 @@ static bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), Im
|
|
|
const ImGuiID id = window->GetID(label);
|
|
const ImGuiID id = window->GetID(label);
|
|
|
const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
|
|
const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
|
|
|
|
|
|
|
|
|
|
+ ImVec2 pos = window->DC.CursorPos;
|
|
|
|
|
+ if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrentLineTextBaseOffset)
|
|
|
|
|
+ pos.y += window->DC.CurrentLineTextBaseOffset - style.FramePadding.y;
|
|
|
const ImVec2 size(size_arg.x != 0.0f ? size_arg.x : (label_size.x + style.FramePadding.x*2), size_arg.y != 0.0f ? size_arg.y : (label_size.y + style.FramePadding.y*2));
|
|
const ImVec2 size(size_arg.x != 0.0f ? size_arg.x : (label_size.x + style.FramePadding.x*2), size_arg.y != 0.0f ? size_arg.y : (label_size.y + style.FramePadding.y*2));
|
|
|
- const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const ImRect bb(pos, pos + size);
|
|
|
ItemSize(bb, style.FramePadding.y);
|
|
ItemSize(bb, style.FramePadding.y);
|
|
|
if (!ItemAdd(bb, &id))
|
|
if (!ItemAdd(bb, &id))
|
|
|
return false;
|
|
return false;
|
|
@@ -5173,7 +5239,7 @@ bool ImGui::SmallButton(const char* label)
|
|
|
ImGuiState& g = *GImGui;
|
|
ImGuiState& g = *GImGui;
|
|
|
float backup_padding_y = g.Style.FramePadding.y;
|
|
float backup_padding_y = g.Style.FramePadding.y;
|
|
|
g.Style.FramePadding.y = 0.0f;
|
|
g.Style.FramePadding.y = 0.0f;
|
|
|
- bool pressed = ButtonEx(label);
|
|
|
|
|
|
|
+ bool pressed = ButtonEx(label, ImVec2(0,0), ImGuiButtonFlags_AlignTextBaseLine);
|
|
|
g.Style.FramePadding.y = backup_padding_y;
|
|
g.Style.FramePadding.y = backup_padding_y;
|
|
|
return pressed;
|
|
return pressed;
|
|
|
}
|
|
}
|
|
@@ -5448,7 +5514,7 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, bool display
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Framed header expand a little outside the default padding
|
|
// Framed header expand a little outside the default padding
|
|
|
- const ImVec2 window_padding = window->WindowPadding();
|
|
|
|
|
|
|
+ const ImVec2 window_padding = window->WindowPadding;
|
|
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
|
const ImVec2 pos_min = window->DC.CursorPos;
|
|
const ImVec2 pos_min = window->DC.CursorPos;
|
|
|
const ImVec2 pos_max = window->Pos + GetContentRegionMax();
|
|
const ImVec2 pos_max = window->Pos + GetContentRegionMax();
|
|
@@ -6351,6 +6417,31 @@ bool ImGui::DragFloat4(const char* label, float v[2], float v_speed, float v_min
|
|
|
return DragFloatN(label, v, 4, v_speed, v_min, v_max, display_format, power);
|
|
return DragFloatN(label, v, 4, v_speed, v_min, v_max, display_format, power);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+bool ImGui::DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed, float v_min, float v_max, const char* display_format, const char* display_format_max, float power)
|
|
|
|
|
+{
|
|
|
|
|
+ ImGuiState& g = *GImGui;
|
|
|
|
|
+ ImGuiWindow* window = GetCurrentWindow();
|
|
|
|
|
+ if (window->SkipItems)
|
|
|
|
|
+ return false;
|
|
|
|
|
+
|
|
|
|
|
+ ImGui::PushID(label);
|
|
|
|
|
+ ImGui::BeginGroup();
|
|
|
|
|
+ PushMultiItemsWidths(2);
|
|
|
|
|
+
|
|
|
|
|
+ bool value_changed = ImGui::DragFloat("##min", v_current_min, v_speed, (v_min >= v_max) ? -FLT_MAX : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), display_format, power);
|
|
|
|
|
+ ImGui::PopItemWidth();
|
|
|
|
|
+ ImGui::SameLine(0, (int)g.Style.ItemInnerSpacing.x);
|
|
|
|
|
+ value_changed |= ImGui::DragFloat("##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? FLT_MAX : v_max, display_format_max ? display_format_max : display_format, power);
|
|
|
|
|
+ ImGui::PopItemWidth();
|
|
|
|
|
+ ImGui::SameLine(0, (int)g.Style.ItemInnerSpacing.x);
|
|
|
|
|
+
|
|
|
|
|
+ ImGui::TextUnformatted(label, FindTextDisplayEnd(label));
|
|
|
|
|
+ ImGui::EndGroup();
|
|
|
|
|
+ ImGui::PopID();
|
|
|
|
|
+
|
|
|
|
|
+ return value_changed;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// NB: v_speed is float to allow adjusting the drag speed with more precision
|
|
// NB: v_speed is float to allow adjusting the drag speed with more precision
|
|
|
bool ImGui::DragInt(const char* label, int* v, float v_speed, int v_min, int v_max, const char* display_format)
|
|
bool ImGui::DragInt(const char* label, int* v, float v_speed, int v_min, int v_max, const char* display_format)
|
|
|
{
|
|
{
|
|
@@ -6404,6 +6495,31 @@ bool ImGui::DragInt4(const char* label, int v[4], float v_speed, int v_min, int
|
|
|
return DragIntN(label, v, 4, v_speed, v_min, v_max, display_format);
|
|
return DragIntN(label, v, 4, v_speed, v_min, v_max, display_format);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+bool ImGui::DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed, int v_min, int v_max, const char* display_format, const char* display_format_max)
|
|
|
|
|
+{
|
|
|
|
|
+ ImGuiState& g = *GImGui;
|
|
|
|
|
+ ImGuiWindow* window = GetCurrentWindow();
|
|
|
|
|
+ if (window->SkipItems)
|
|
|
|
|
+ return false;
|
|
|
|
|
+
|
|
|
|
|
+ ImGui::PushID(label);
|
|
|
|
|
+ ImGui::BeginGroup();
|
|
|
|
|
+ PushMultiItemsWidths(2);
|
|
|
|
|
+
|
|
|
|
|
+ bool value_changed = ImGui::DragInt("##min", v_current_min, v_speed, (v_min >= v_max) ? IM_INT_MIN : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), display_format);
|
|
|
|
|
+ ImGui::PopItemWidth();
|
|
|
|
|
+ ImGui::SameLine(0, (int)g.Style.ItemInnerSpacing.x);
|
|
|
|
|
+ value_changed |= ImGui::DragInt("##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? IM_INT_MAX : v_max, display_format_max ? display_format_max : display_format);
|
|
|
|
|
+ ImGui::PopItemWidth();
|
|
|
|
|
+ ImGui::SameLine(0, (int)g.Style.ItemInnerSpacing.x);
|
|
|
|
|
+
|
|
|
|
|
+ ImGui::TextUnformatted(label, FindTextDisplayEnd(label));
|
|
|
|
|
+ ImGui::EndGroup();
|
|
|
|
|
+ ImGui::PopID();
|
|
|
|
|
+
|
|
|
|
|
+ return value_changed;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
enum ImGuiPlotType
|
|
enum ImGuiPlotType
|
|
|
{
|
|
{
|
|
|
ImGuiPlotType_Lines,
|
|
ImGuiPlotType_Lines,
|
|
@@ -6457,7 +6573,7 @@ static void Plot(ImGuiPlotType plot_type, const char* label, float (*values_gett
|
|
|
|
|
|
|
|
// Tooltip on hover
|
|
// Tooltip on hover
|
|
|
int v_hovered = -1;
|
|
int v_hovered = -1;
|
|
|
- if (IsMouseHoveringRect(inner_bb))
|
|
|
|
|
|
|
+ if (IsHovered(inner_bb, 0))
|
|
|
{
|
|
{
|
|
|
const float t = ImClamp((g.IO.MousePos.x - inner_bb.Min.x) / (inner_bb.Max.x - inner_bb.Min.x), 0.0f, 0.9999f);
|
|
const float t = ImClamp((g.IO.MousePos.x - inner_bb.Min.x) / (inner_bb.Max.x - inner_bb.Min.x), 0.0f, 0.9999f);
|
|
|
const int v_idx = (int)(t * (values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0)));
|
|
const int v_idx = (int)(t * (values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0)));
|
|
@@ -7713,7 +7829,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
|
|
|
*current_item = i;
|
|
*current_item = i;
|
|
|
}
|
|
}
|
|
|
if (item_selected && menu_toggled)
|
|
if (item_selected && menu_toggled)
|
|
|
- ImGui::SetScrollPosHere();
|
|
|
|
|
|
|
+ ImGui::SetScrollHere();
|
|
|
ImGui::PopID();
|
|
ImGui::PopID();
|
|
|
}
|
|
}
|
|
|
ImGui::EndPopup();
|
|
ImGui::EndPopup();
|
|
@@ -7745,7 +7861,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|
|
ItemSize(bb);
|
|
ItemSize(bb);
|
|
|
|
|
|
|
|
// Fill horizontal space.
|
|
// Fill horizontal space.
|
|
|
- ImVec2 window_padding = window->WindowPadding();
|
|
|
|
|
|
|
+ ImVec2 window_padding = window->WindowPadding;
|
|
|
float max_x = (flags & ImGuiSelectableFlags_SpanAllColumns) ? ImGui::GetWindowContentRegionMax().x : ImGui::GetContentRegionMax().x;
|
|
float max_x = (flags & ImGuiSelectableFlags_SpanAllColumns) ? ImGui::GetWindowContentRegionMax().x : ImGui::GetContentRegionMax().x;
|
|
|
float w_draw = ImMax(label_size.x, window->Pos.x + max_x - window_padding.x - window->DC.CursorPos.x);
|
|
float w_draw = ImMax(label_size.x, window->Pos.x + max_x - window_padding.x - window->DC.CursorPos.x);
|
|
|
ImVec2 size_draw((size_arg.x != 0 && !(flags & ImGuiSelectableFlags_DrawFillAvailWidth)) ? size_arg.x : w_draw, size_arg.y != 0.0f ? size_arg.y : size.y);
|
|
ImVec2 size_draw((size_arg.x != 0 && !(flags & ImGuiSelectableFlags_DrawFillAvailWidth)) ? size_arg.x : w_draw, size_arg.y != 0.0f ? size_arg.y : size.y);
|
|
@@ -7769,8 +7885,12 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ ImGuiButtonFlags button_flags = 0;
|
|
|
|
|
+ if (flags & ImGuiSelectableFlags_Menu) button_flags |= ImGuiButtonFlags_PressedOnClick;
|
|
|
|
|
+ if (flags & ImGuiSelectableFlags_MenuItem) button_flags |= ImGuiButtonFlags_PressedOnClick|ImGuiButtonFlags_PressedOnRelease;
|
|
|
|
|
+ if (flags & ImGuiSelectableFlags_Disabled) button_flags |= ImGuiButtonFlags_Disabled;
|
|
|
bool hovered, held;
|
|
bool hovered, held;
|
|
|
- bool pressed = ButtonBehavior(bb_with_spacing, id, &hovered, &held, true, ((flags & ImGuiSelectableFlags_MenuItem) ? ImGuiButtonFlags_PressedOnClick : 0) | ((flags & ImGuiSelectableFlags_Disabled) ? ImGuiButtonFlags_Disabled : 0));
|
|
|
|
|
|
|
+ bool pressed = ButtonBehavior(bb_with_spacing, id, &hovered, &held, true, button_flags);
|
|
|
if (flags & ImGuiSelectableFlags_Disabled)
|
|
if (flags & ImGuiSelectableFlags_Disabled)
|
|
|
selected = false;
|
|
selected = false;
|
|
|
|
|
|
|
@@ -8024,11 +8144,11 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
|
|
ImVec2 popup_pos, pos = window->DC.CursorPos;
|
|
ImVec2 popup_pos, pos = window->DC.CursorPos;
|
|
|
if (window->DC.LayoutType == ImGuiLayoutType_Horizontal)
|
|
if (window->DC.LayoutType == ImGuiLayoutType_Horizontal)
|
|
|
{
|
|
{
|
|
|
- popup_pos = ImVec2(pos.x - window->WindowPadding().x, pos.y - style.FramePadding.y + window->MenuBarHeight());
|
|
|
|
|
|
|
+ popup_pos = ImVec2(pos.x - window->WindowPadding.x, pos.y - style.FramePadding.y + window->MenuBarHeight());
|
|
|
window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f);
|
|
window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f);
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f);
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f);
|
|
|
float w = label_size.x;
|
|
float w = label_size.x;
|
|
|
- pressed = ImGui::Selectable(label, opened, ImGuiSelectableFlags_MenuItem | ImGuiSelectableFlags_DontClosePopups | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f));
|
|
|
|
|
|
|
+ pressed = ImGui::Selectable(label, opened, ImGuiSelectableFlags_Menu | ImGuiSelectableFlags_DontClosePopups | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f));
|
|
|
ImGui::PopStyleVar();
|
|
ImGui::PopStyleVar();
|
|
|
ImGui::SameLine();
|
|
ImGui::SameLine();
|
|
|
window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f);
|
|
window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f);
|
|
@@ -8038,7 +8158,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
|
|
popup_pos = ImVec2(pos.x, pos.y - style.WindowPadding.y);
|
|
popup_pos = ImVec2(pos.x, pos.y - style.WindowPadding.y);
|
|
|
float w = window->MenuColumns.DeclColumns(label_size.x, 0.0f, (float)(int)(g.FontSize * 1.20f)); // Feedback to next frame
|
|
float w = window->MenuColumns.DeclColumns(label_size.x, 0.0f, (float)(int)(g.FontSize * 1.20f)); // Feedback to next frame
|
|
|
float extra_w = ImMax(0.0f, window->Pos.x + ImGui::GetContentRegionMax().x - pos.x - w);
|
|
float extra_w = ImMax(0.0f, window->Pos.x + ImGui::GetContentRegionMax().x - pos.x - w);
|
|
|
- pressed = ImGui::Selectable(label, opened, ImGuiSelectableFlags_MenuItem | ImGuiSelectableFlags_DontClosePopups | ImGuiSelectableFlags_DrawFillAvailWidth | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f));
|
|
|
|
|
|
|
+ pressed = ImGui::Selectable(label, opened, ImGuiSelectableFlags_Menu | ImGuiSelectableFlags_DontClosePopups | ImGuiSelectableFlags_DrawFillAvailWidth | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f));
|
|
|
if (!enabled) ImGui::PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);
|
|
if (!enabled) ImGui::PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);
|
|
|
RenderCollapseTriangle(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.20f, 0.0f), false);
|
|
RenderCollapseTriangle(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.20f, 0.0f), false);
|
|
|
if (!enabled) ImGui::PopStyleColor();
|
|
if (!enabled) ImGui::PopStyleColor();
|
|
@@ -9301,19 +9421,6 @@ void ImFontAtlas::Clear()
|
|
|
ClearFonts();
|
|
ClearFonts();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
|
|
|
-void ImGui::GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size)
|
|
|
|
|
-{
|
|
|
|
|
- printf("GetDefaultFontData() is obsoleted in ImGui 1.30.\n");
|
|
|
|
|
- printf("Please use ImGui::GetIO().Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8() functions to retrieve uncompressed texture data.\n");
|
|
|
|
|
- if (fnt_data) *fnt_data = NULL;
|
|
|
|
|
- if (fnt_size) *fnt_size = 0;
|
|
|
|
|
- if (png_data) *png_data = NULL;
|
|
|
|
|
- if (png_size) *png_size = 0;
|
|
|
|
|
- IM_ASSERT(false);
|
|
|
|
|
-}
|
|
|
|
|
-#endif
|
|
|
|
|
-
|
|
|
|
|
void ImFontAtlas::GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)
|
|
void ImFontAtlas::GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)
|
|
|
{
|
|
{
|
|
|
// Lazily build
|
|
// Lazily build
|
|
@@ -10884,7 +10991,7 @@ void ImGui::ShowTestWindow(bool* opened)
|
|
|
if (ImGui::TreeNode("Clipping"))
|
|
if (ImGui::TreeNode("Clipping"))
|
|
|
{
|
|
{
|
|
|
static ImVec2 size(100, 100), offset(50, 20);
|
|
static ImVec2 size(100, 100), offset(50, 20);
|
|
|
- ImGui::TextWrapped("On a per-widget basis we are occasionally clipping text if it won't fit in its frame. Otherwise we are doing coarser clipping + passing a scissor rectangle to the renderer. The system is designed to try minimizing both execution and CPU/GPU rendering cost.");
|
|
|
|
|
|
|
+ ImGui::TextWrapped("On a per-widget basis we are occasionally clipping text CPU-side if it won't fit in its frame. Otherwise we are doing coarser clipping + passing a scissor rectangle to the renderer. The system is designed to try minimizing both execution and CPU/GPU rendering cost.");
|
|
|
ImGui::DragFloat2("size", (float*)&size, 0.5f, 0.0f, 200.0f, "%.0f");
|
|
ImGui::DragFloat2("size", (float*)&size, 0.5f, 0.0f, 200.0f, "%.0f");
|
|
|
ImGui::DragFloat2("offset", (float*)&offset, 0.5f, -200, 200.0f, "%.0f");
|
|
ImGui::DragFloat2("offset", (float*)&offset, 0.5f, -200, 200.0f, "%.0f");
|
|
|
ImVec2 pos = ImGui::GetCursorScreenPos();
|
|
ImVec2 pos = ImGui::GetCursorScreenPos();
|
|
@@ -11125,6 +11232,19 @@ void ImGui::ShowTestWindow(bool* opened)
|
|
|
//ImGui::ListBox("##listbox2", &listbox_item_current2, listbox_items, IM_ARRAYSIZE(listbox_items), 4);
|
|
//ImGui::ListBox("##listbox2", &listbox_item_current2, listbox_items, IM_ARRAYSIZE(listbox_items), 4);
|
|
|
//ImGui::PopItemWidth();
|
|
//ImGui::PopItemWidth();
|
|
|
|
|
|
|
|
|
|
+ if (ImGui::TreeNode("Ranges"))
|
|
|
|
|
+ {
|
|
|
|
|
+ ImGui::Unindent();
|
|
|
|
|
+
|
|
|
|
|
+ static float begin = 10, end = 90;
|
|
|
|
|
+ static int begin_i = 100, end_i = 1000;
|
|
|
|
|
+ ImGui::DragFloatRange2("range", &begin, &end, 0.25f, 0.0f, 100.0f, "Min: %.1f %%", "Max: %.1f %%");
|
|
|
|
|
+ ImGui::DragIntRange2("range int (no bounds)", &begin_i, &end_i, 5, 0, 0, "Min: %.0f units", "Max: %.0f units");
|
|
|
|
|
+
|
|
|
|
|
+ ImGui::Indent();
|
|
|
|
|
+ ImGui::TreePop();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (ImGui::TreeNode("Multi-component Widgets"))
|
|
if (ImGui::TreeNode("Multi-component Widgets"))
|
|
|
{
|
|
{
|
|
|
ImGui::Unindent();
|
|
ImGui::Unindent();
|
|
@@ -11271,10 +11391,10 @@ void ImGui::ShowTestWindow(bool* opened)
|
|
|
{
|
|
{
|
|
|
ImGui::Text("%04d: scrollable region", i);
|
|
ImGui::Text("%04d: scrollable region", i);
|
|
|
if (goto_line && line == i)
|
|
if (goto_line && line == i)
|
|
|
- ImGui::SetScrollPosHere();
|
|
|
|
|
|
|
+ ImGui::SetScrollHere();
|
|
|
}
|
|
}
|
|
|
if (goto_line && line >= 100)
|
|
if (goto_line && line >= 100)
|
|
|
- ImGui::SetScrollPosHere();
|
|
|
|
|
|
|
+ ImGui::SetScrollHere();
|
|
|
ImGui::EndChild();
|
|
ImGui::EndChild();
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
ImGui::SameLine();
|
|
@@ -11465,6 +11585,43 @@ void ImGui::ShowTestWindow(bool* opened)
|
|
|
|
|
|
|
|
ImGui::TreePop();
|
|
ImGui::TreePop();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (ImGui::TreeNode("Scrolling"))
|
|
|
|
|
+ {
|
|
|
|
|
+ ImGui::TextWrapped("Use SetScrollHere() or SetScrollFromPosY() to scroll to a given position.");
|
|
|
|
|
+ static bool track = true;
|
|
|
|
|
+ static int track_line = 50, scroll_to_px = 200;
|
|
|
|
|
+ ImGui::Checkbox("Track", &track);
|
|
|
|
|
+ ImGui::SameLine(130); track |= ImGui::DragInt("##line", &track_line, 0.25f, 0, 9999, "Line %.0f");
|
|
|
|
|
+ bool scroll_to = ImGui::Button("Scroll To");
|
|
|
|
|
+ ImGui::SameLine(130); scroll_to |= ImGui::DragInt("##pos_y", &scroll_to_px, 1.00f, 0, 9999, "y = %.0f px");
|
|
|
|
|
+ if (scroll_to) track = false;
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < 5; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (i > 0) ImGui::SameLine();
|
|
|
|
|
+ ImGui::BeginGroup();
|
|
|
|
|
+ ImGui::Text("%s", i == 0 ? "Top" : i == 1 ? "25%" : i == 2 ? "Center" : i == 3 ? "75%" : "Bottom");
|
|
|
|
|
+ ImGui::BeginChild(ImGui::GetID((void *)(intptr_t)i), ImVec2(ImGui::GetWindowWidth() * 0.17f, 200.0f), true);
|
|
|
|
|
+ if (scroll_to)
|
|
|
|
|
+ ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + scroll_to_px, i * 0.25f);
|
|
|
|
|
+ for (int line = 0; line < 100; line++)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (track && line == track_line)
|
|
|
|
|
+ {
|
|
|
|
|
+ ImGui::TextColored(ImColor(255,255,0), "Line %d", line);
|
|
|
|
|
+ ImGui::SetScrollHere(i * 0.25f); // 0.0f:top, 0.5f:center, 1.0f:bottom
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ ImGui::Text("Line %d", line);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ImGui::EndChild();
|
|
|
|
|
+ ImGui::EndGroup();
|
|
|
|
|
+ }
|
|
|
|
|
+ ImGui::TreePop();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (ImGui::CollapsingHeader("Popups & Modal windows"))
|
|
if (ImGui::CollapsingHeader("Popups & Modal windows"))
|
|
@@ -11829,6 +11986,10 @@ void ImGui::ShowTestWindow(bool* opened)
|
|
|
ImGui::Text("WantCaptureMouse: %s", io.WantCaptureMouse ? "true" : "false");
|
|
ImGui::Text("WantCaptureMouse: %s", io.WantCaptureMouse ? "true" : "false");
|
|
|
ImGui::Text("WantCaptureKeyboard: %s", io.WantCaptureKeyboard ? "true" : "false");
|
|
ImGui::Text("WantCaptureKeyboard: %s", io.WantCaptureKeyboard ? "true" : "false");
|
|
|
|
|
|
|
|
|
|
+ ImGui::Button("Hover me\nto enforce\ninputs capture");
|
|
|
|
|
+ if (ImGui::IsItemHovered())
|
|
|
|
|
+ ImGui::CaptureKeyboardFromApp();
|
|
|
|
|
+
|
|
|
ImGui::TreePop();
|
|
ImGui::TreePop();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -12213,7 +12374,7 @@ struct ExampleAppConsole
|
|
|
ImGui::PopStyleColor();
|
|
ImGui::PopStyleColor();
|
|
|
}
|
|
}
|
|
|
if (ScrollToBottom)
|
|
if (ScrollToBottom)
|
|
|
- ImGui::SetScrollPosHere();
|
|
|
|
|
|
|
+ ImGui::SetScrollHere();
|
|
|
ScrollToBottom = false;
|
|
ScrollToBottom = false;
|
|
|
ImGui::PopStyleVar();
|
|
ImGui::PopStyleVar();
|
|
|
ImGui::EndChild();
|
|
ImGui::EndChild();
|