mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Merge remote-tracking branch 'origin' into 2015-03-antialiased-primitives
This commit is contained in:
127
imgui.cpp
127
imgui.cpp
@ -631,6 +631,7 @@ ImGuiStyle::ImGuiStyle()
|
||||
Colors[ImGuiCol_FrameBgActive] = ImVec4(0.90f, 0.65f, 0.65f, 0.45f);
|
||||
Colors[ImGuiCol_TitleBg] = ImVec4(0.50f, 0.50f, 1.00f, 0.45f);
|
||||
Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.40f, 0.40f, 0.80f, 0.20f);
|
||||
Colors[ImGuiCol_TitleBgActive] = ImVec4(0.50f, 0.50f, 1.00f, 0.55f);
|
||||
Colors[ImGuiCol_MenuBarBg] = ImVec4(0.40f, 0.40f, 0.55f, 0.60f);
|
||||
Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.40f, 0.40f, 0.80f, 0.15f);
|
||||
Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.40f, 0.80f, 0.30f);
|
||||
@ -1338,6 +1339,8 @@ struct ImGuiState
|
||||
float FramerateSecPerFrame[120]; // calculate estimate of framerate for user
|
||||
int FramerateSecPerFrameIdx;
|
||||
float FramerateSecPerFrameAccum;
|
||||
bool CaptureMouseNextFrame; // explicit capture via CaptureInputs() sets those flags
|
||||
bool CaptureKeyboardNextFrame;
|
||||
char TempBuffer[1024*3+1]; // temporary text buffer
|
||||
|
||||
ImGuiState()
|
||||
@ -1399,6 +1402,7 @@ struct ImGuiState
|
||||
memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame));
|
||||
FramerateSecPerFrameIdx = 0;
|
||||
FramerateSecPerFrameAccum = 0.0f;
|
||||
CaptureMouseNextFrame = CaptureKeyboardNextFrame = false;
|
||||
}
|
||||
};
|
||||
|
||||
@ -1415,9 +1419,11 @@ struct ImGuiWindow
|
||||
ImVec2 Size; // Current size (==SizeFull or collapsed title bar size)
|
||||
ImVec2 SizeFull; // Size when non collapsed
|
||||
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")
|
||||
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. (-1.0f 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 Active; // Set to true on Begin()
|
||||
bool WasActive;
|
||||
@ -1446,6 +1452,7 @@ struct ImGuiWindow
|
||||
float FontWindowScale; // Scale multiplier per-window
|
||||
ImDrawList* DrawList;
|
||||
ImGuiWindow* RootWindow;
|
||||
ImGuiWindow* RootNonPopupWindow;
|
||||
|
||||
// Focus
|
||||
int FocusIdxAllCounter; // Start at -1 and increase as assigned via FocusItemRegister()
|
||||
@ -1471,7 +1478,6 @@ public:
|
||||
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; }
|
||||
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; }
|
||||
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); }
|
||||
@ -1781,8 +1787,10 @@ ImGuiWindow::ImGuiWindow(const char* name)
|
||||
PosFloat = Pos = ImVec2(0.0f, 0.0f);
|
||||
Size = SizeFull = ImVec2(0.0f, 0.0f);
|
||||
SizeContents = ImVec2(0.0f, 0.0f);
|
||||
WindowPadding = ImVec2(0.0f, 0.0f);
|
||||
ScrollY = 0.0f;
|
||||
ScrollTargetCenterY = -1.0f;
|
||||
ScrollTargetRelY = -1.0f;
|
||||
ScrollTargetCenterRatioY = 0.5f;
|
||||
ScrollbarY = false;
|
||||
Active = WasActive = false;
|
||||
Accessed = false;
|
||||
@ -1804,6 +1812,7 @@ ImGuiWindow::ImGuiWindow(const char* name)
|
||||
DrawList = (ImDrawList*)ImGui::MemAlloc(sizeof(ImDrawList));
|
||||
new(DrawList) ImDrawList();
|
||||
RootWindow = NULL;
|
||||
RootNonPopupWindow = NULL;
|
||||
|
||||
FocusIdxAllCounter = FocusIdxTabCounter = -1;
|
||||
FocusIdxAllRequestCurrent = FocusIdxTabRequestCurrent = IM_INT_MAX;
|
||||
@ -2190,9 +2199,10 @@ void ImGui::NewFrame()
|
||||
mouse_earliest_button_down = i;
|
||||
}
|
||||
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.CaptureMouseNextFrame = g.CaptureKeyboardNextFrame = false;
|
||||
|
||||
// If mouse was first clicked outside of ImGui bounds we also cancel out hovering.
|
||||
if (mouse_owned_by_application)
|
||||
@ -3004,6 +3014,16 @@ void ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type)
|
||||
GImGui->MouseCursor = cursor_type;
|
||||
}
|
||||
|
||||
void ImGui::CaptureKeyboardFromApp()
|
||||
{
|
||||
GImGui->CaptureKeyboardNextFrame = true;
|
||||
}
|
||||
|
||||
void ImGui::CaptureMouseFromApp()
|
||||
{
|
||||
GImGui->CaptureMouseNextFrame = true;
|
||||
}
|
||||
|
||||
bool ImGui::IsItemHovered()
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
@ -3612,14 +3632,15 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
||||
}
|
||||
|
||||
// Update known root window (if we are a child window, otherwise window == window->RootWindow)
|
||||
size_t root_idx = g.CurrentWindowStack.size() - 1;
|
||||
while (root_idx > 0)
|
||||
{
|
||||
if ((g.CurrentWindowStack[root_idx]->Flags & ImGuiWindowFlags_ChildWindow) == 0)
|
||||
size_t root_idx, root_non_popup_idx;
|
||||
for (root_idx = g.CurrentWindowStack.size() - 1; root_idx > 0; root_idx--)
|
||||
if (!(g.CurrentWindowStack[root_idx]->Flags & ImGuiWindowFlags_ChildWindow))
|
||||
break;
|
||||
for (root_non_popup_idx = root_idx; root_non_popup_idx > 0; root_non_popup_idx--)
|
||||
if (!(g.CurrentWindowStack[root_non_popup_idx]->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))
|
||||
break;
|
||||
root_idx--;
|
||||
}
|
||||
window->RootWindow = g.CurrentWindowStack[root_idx];
|
||||
window->RootNonPopupWindow = g.CurrentWindowStack[root_non_popup_idx]; // This is merely for displaying the TitleBgActive color.
|
||||
|
||||
// Default alpha
|
||||
if (bg_alpha < 0.0f)
|
||||
@ -3695,17 +3716,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
|
||||
ImVec2 size_auto_fit;
|
||||
ImVec2 window_padding = window->WindowPadding();
|
||||
if ((flags & ImGuiWindowFlags_Tooltip) != 0)
|
||||
{
|
||||
// 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
|
||||
{
|
||||
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))
|
||||
size_auto_fit.x += style.ScrollbarWidth;
|
||||
size_auto_fit.y = ImMax(size_auto_fit.y - style.ItemSpacing.y, 0.0f);
|
||||
@ -3839,10 +3862,11 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
||||
window->FocusIdxAllRequestNext = window->FocusIdxTabRequestNext = IM_INT_MAX;
|
||||
|
||||
// Apply scrolling
|
||||
if (window->ScrollTargetCenterY >= 0.0f)
|
||||
if (window->ScrollTargetRelY >= 0.0f)
|
||||
{
|
||||
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 = -1.0f;
|
||||
}
|
||||
window->ScrollY = ImMax(window->ScrollY, 0.0f);
|
||||
if (!window->Collapsed && !window->SkipItems)
|
||||
@ -3922,7 +3946,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
||||
|
||||
// Title bar
|
||||
if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
||||
window->DrawList->AddRectFilled(title_bar_rect.GetTL(), title_bar_rect.GetBR(), window->Color(ImGuiCol_TitleBg), window_rounding, 1|2);
|
||||
window->DrawList->AddRectFilled(title_bar_rect.GetTL(), title_bar_rect.GetBR(), window->Color((g.FocusedWindow && window->RootNonPopupWindow == g.FocusedWindow->RootNonPopupWindow) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg), window_rounding, 1|2);
|
||||
|
||||
// Menu bar
|
||||
if (flags & ImGuiWindowFlags_MenuBar)
|
||||
@ -3960,9 +3984,9 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
||||
}
|
||||
|
||||
// Setup drawing context
|
||||
window->DC.ColumnsStartX = window->WindowPadding().x;
|
||||
window->DC.ColumnsStartX = window->WindowPadding.x;
|
||||
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.CursorPosPrevLine = window->DC.CursorPos;
|
||||
window->DC.CursorMaxPos = window->DC.CursorStartPos;
|
||||
@ -4036,7 +4060,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
|
||||
// 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();
|
||||
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)
|
||||
clip_rect.z -= style.ScrollbarWidth;
|
||||
PushClipRect(clip_rect);
|
||||
@ -4415,6 +4439,7 @@ const char* ImGui::GetStyleColName(ImGuiCol idx)
|
||||
case ImGuiCol_FrameBgActive: return "FrameBgActive";
|
||||
case ImGuiCol_TitleBg: return "TitleBg";
|
||||
case ImGuiCol_TitleBgCollapsed: return "TitleBgCollapsed";
|
||||
case ImGuiCol_TitleBgActive: return "TitleBgActive";
|
||||
case ImGuiCol_MenuBarBg: return "MenuBarBg";
|
||||
case ImGuiCol_ScrollbarBg: return "ScrollbarBg";
|
||||
case ImGuiCol_ScrollbarGrab: return "ScrollbarGrab";
|
||||
@ -4662,12 +4687,11 @@ void ImGui::SetNextWindowFocus()
|
||||
ImVec2 ImGui::GetContentRegionMax()
|
||||
{
|
||||
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)
|
||||
{
|
||||
mx.x = ImGui::GetColumnOffset(window->DC.ColumnsCurrent + 1);
|
||||
mx.x -= window_padding.x;
|
||||
mx.x -= window->WindowPadding.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4679,13 +4703,13 @@ ImVec2 ImGui::GetContentRegionMax()
|
||||
ImVec2 ImGui::GetWindowContentRegionMin()
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
return ImVec2(0, window->TitleBarHeight() + window->MenuBarHeight()) + window->WindowPadding();
|
||||
return ImVec2(0, window->TitleBarHeight() + window->MenuBarHeight()) + window->WindowPadding;
|
||||
}
|
||||
|
||||
ImVec2 ImGui::GetWindowContentRegionMax()
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
ImVec2 m = window->Size - window->WindowPadding();
|
||||
ImVec2 m = window->Size - window->WindowPadding;
|
||||
m.x -= window->ScrollbarWidth();
|
||||
return m;
|
||||
}
|
||||
@ -4797,10 +4821,17 @@ float ImGui::GetScrollMaxY()
|
||||
return window->SizeContents.y - window->SizeFull.y;
|
||||
}
|
||||
|
||||
void ImGui::SetScrollPosHere()
|
||||
void ImGui::SetScrollPosHere(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
|
||||
ImGuiState& g = *GImGui;
|
||||
IM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f);
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
window->ScrollTargetCenterY = (float)(int)(window->DC.CursorPos.y + window->ScrollY - window->DC.PrevLineHeight * 0.5f);
|
||||
window->ScrollTargetRelY = (float)(int)(window->ScrollY + window->DC.CursorPosPrevLine.y - window->Pos.y + (window->DC.PrevLineHeight) * center_y_ratio);
|
||||
window->ScrollTargetRelY += g.Style.ItemSpacing.y * (center_y_ratio - 0.5f) * 2.0f;
|
||||
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::SetKeyboardFocusHere(int offset)
|
||||
@ -4919,11 +4950,11 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
|
||||
// Lines to skip (can't skip when logging text)
|
||||
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)
|
||||
{
|
||||
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');
|
||||
line = line_end + 1;
|
||||
@ -5444,7 +5475,7 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, bool display
|
||||
}
|
||||
|
||||
// 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 pos_min = window->DC.CursorPos;
|
||||
const ImVec2 pos_max = window->Pos + GetContentRegionMax();
|
||||
@ -7741,7 +7772,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
||||
ItemSize(bb);
|
||||
|
||||
// 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 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);
|
||||
@ -8020,7 +8051,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
||||
ImVec2 popup_pos, pos = window->DC.CursorPos;
|
||||
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);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f);
|
||||
float w = label_size.x;
|
||||
@ -11631,6 +11662,32 @@ void ImGui::ShowTestWindow(bool* opened)
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Scrolling"))
|
||||
{
|
||||
ImGui::TextWrapped("Use SetScrollPosHere() to scroll to a given position.");
|
||||
static bool track = true;
|
||||
static int track_line = 50;
|
||||
ImGui::Checkbox("Track", &track);
|
||||
ImGui::SameLine(); ImGui::SliderInt("##line", &track_line, 0, 99, "Line %.0f");
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (i > 0) ImGui::SameLine();
|
||||
ImGui::BeginGroup();
|
||||
ImGui::Text(i == 0 ? "Top" : i == 1 ? "Center" : "Bottom");
|
||||
ImGui::BeginChild(ImGui::GetID((void *)i), ImVec2(ImGui::GetWindowWidth() * 0.25f, 200.0f), true);
|
||||
for (int line = 0; line < 100; line++)
|
||||
{
|
||||
ImGui::Text("Line %d", line);
|
||||
if (track && line == track_line)
|
||||
ImGui::SetScrollPosHere(i * 0.50f); // 0.0f,0.5f,1.0f
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Popups & Modal windows"))
|
||||
@ -11995,6 +12052,10 @@ void ImGui::ShowTestWindow(bool* opened)
|
||||
ImGui::Text("WantCaptureMouse: %s", io.WantCaptureMouse ? "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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user