mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 03:47:00 +00:00
Internals: add window to FocusScopeStack. (#6798)
This commit is contained in:
parent
2156db7a07
commit
4b20a0217e
21
imgui.cpp
21
imgui.cpp
@ -3075,7 +3075,7 @@ void ImGui::PopStyleColor(int count)
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.ColorStack.Size < count)
|
||||
{
|
||||
IM_ASSERT_USER_ERROR(g.ColorStack.Size > count, "Calling PopStyleColor() too many times: stack underflow.");
|
||||
IM_ASSERT_USER_ERROR(g.ColorStack.Size > count, "Calling PopStyleColor() too many times!");
|
||||
count = g.ColorStack.Size;
|
||||
}
|
||||
while (count > 0)
|
||||
@ -3138,7 +3138,7 @@ void ImGui::PushStyleVar(ImGuiStyleVar idx, float val)
|
||||
*pvar = val;
|
||||
return;
|
||||
}
|
||||
IM_ASSERT_USER_ERROR(0, "Called PushStyleVar() variant with wrong type!");
|
||||
IM_ASSERT_USER_ERROR(0, "Calling PushStyleVar() variant with wrong type!");
|
||||
}
|
||||
|
||||
void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val)
|
||||
@ -3152,7 +3152,7 @@ void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val)
|
||||
*pvar = val;
|
||||
return;
|
||||
}
|
||||
IM_ASSERT_USER_ERROR(0, "Called PushStyleVar() variant with wrong type!");
|
||||
IM_ASSERT_USER_ERROR(0, "Calling PushStyleVar() variant with wrong type!");
|
||||
}
|
||||
|
||||
void ImGui::PopStyleVar(int count)
|
||||
@ -3160,7 +3160,7 @@ void ImGui::PopStyleVar(int count)
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.StyleVarStack.Size < count)
|
||||
{
|
||||
IM_ASSERT_USER_ERROR(g.StyleVarStack.Size > count, "Calling PopStyleVar() too many times: stack underflow.");
|
||||
IM_ASSERT_USER_ERROR(g.StyleVarStack.Size > count, "Calling PopStyleVar() too many times!");
|
||||
count = g.StyleVarStack.Size;
|
||||
}
|
||||
while (count > 0)
|
||||
@ -7798,16 +7798,23 @@ void ImGui::SetWindowFontScale(float scale)
|
||||
void ImGui::PushFocusScope(ImGuiID id)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.FocusScopeStack.push_back(id);
|
||||
ImGuiFocusScopeData data;
|
||||
data.ID = id;
|
||||
data.WindowID = g.CurrentWindow->ID;
|
||||
g.FocusScopeStack.push_back(data);
|
||||
g.CurrentFocusScopeId = id;
|
||||
}
|
||||
|
||||
void ImGui::PopFocusScope()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(g.FocusScopeStack.Size > 0); // Too many PopFocusScope() ?
|
||||
if (g.FocusScopeStack.Size == 0)
|
||||
{
|
||||
IM_ASSERT_USER_ERROR(g.FocusScopeStack.Size > 0, "Calling PopFocusScope() too many times!");
|
||||
return;
|
||||
}
|
||||
g.FocusScopeStack.pop_back();
|
||||
g.CurrentFocusScopeId = g.FocusScopeStack.Size ? g.FocusScopeStack.back() : 0;
|
||||
g.CurrentFocusScopeId = g.FocusScopeStack.Size ? g.FocusScopeStack.back().ID : 0;
|
||||
}
|
||||
|
||||
// Focus = move navigation cursor, set scrolling, set focus window.
|
||||
|
@ -1571,6 +1571,12 @@ struct ImGuiNavItemData
|
||||
void Clear() { Window = NULL; ID = FocusScopeId = 0; InFlags = 0; SelectionUserData = -1; DistBox = DistCenter = DistAxial = FLT_MAX; }
|
||||
};
|
||||
|
||||
struct ImGuiFocusScopeData
|
||||
{
|
||||
ImGuiID ID;
|
||||
ImGuiID WindowID;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Typing-select support
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1981,7 +1987,7 @@ struct ImGuiContext
|
||||
ImVector<ImGuiColorMod> ColorStack; // Stack for PushStyleColor()/PopStyleColor() - inherited by Begin()
|
||||
ImVector<ImGuiStyleMod> StyleVarStack; // Stack for PushStyleVar()/PopStyleVar() - inherited by Begin()
|
||||
ImVector<ImFont*> FontStack; // Stack for PushFont()/PopFont() - inherited by Begin()
|
||||
ImVector<ImGuiID> FocusScopeStack; // Stack for PushFocusScope()/PopFocusScope() - inherited by BeginChild(), pushed into by Begin()
|
||||
ImVector<ImGuiFocusScopeData> FocusScopeStack; // Stack for PushFocusScope()/PopFocusScope() - inherited by BeginChild(), pushed into by Begin()
|
||||
ImVector<ImGuiItemFlags> ItemFlagsStack; // Stack for PushItemFlag()/PopItemFlag() - inherited by Begin()
|
||||
ImVector<ImGuiGroupData> GroupStack; // Stack for BeginGroup()/EndGroup() - not inherited by Begin()
|
||||
ImVector<ImGuiPopupData> OpenPopupStack; // Which popups are open (persistent)
|
||||
|
Loading…
Reference in New Issue
Block a user