mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Allow SetWindowFocus(NULL) to remove focus
This commit is contained in:
parent
73e2d56acc
commit
fe64da6197
11
imgui.cpp
11
imgui.cpp
@ -3519,6 +3519,10 @@ static void FocusWindow(ImGuiWindow* window)
|
|||||||
// Always mark the window we passed as focused. This is used for keyboard interactions such as tabbing.
|
// Always mark the window we passed as focused. This is used for keyboard interactions such as tabbing.
|
||||||
g.FocusedWindow = window;
|
g.FocusedWindow = window;
|
||||||
|
|
||||||
|
// Passing NULL allow to disable keyboard focus
|
||||||
|
if (!window)
|
||||||
|
return;
|
||||||
|
|
||||||
// And move its root window to the top of the pile
|
// And move its root window to the top of the pile
|
||||||
if (window->RootWindow)
|
if (window->RootWindow)
|
||||||
window = window->RootWindow;
|
window = window->RootWindow;
|
||||||
@ -3902,11 +3906,18 @@ void ImGui::SetWindowFocus()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::SetWindowFocus(const char* name)
|
void ImGui::SetWindowFocus(const char* name)
|
||||||
|
{
|
||||||
|
if (name)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = FindWindowByName(name);
|
ImGuiWindow* window = FindWindowByName(name);
|
||||||
if (window)
|
if (window)
|
||||||
FocusWindow(window);
|
FocusWindow(window);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FocusWindow(NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond)
|
void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond)
|
||||||
{
|
{
|
||||||
|
2
imgui.h
2
imgui.h
@ -191,7 +191,7 @@ namespace ImGui
|
|||||||
IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0); // set named window position - call within Begin()/End(). may incur tearing
|
IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0); // set named window position - call within Begin()/End(). may incur tearing
|
||||||
IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond = 0); // set named window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing
|
IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond = 0); // set named window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing
|
||||||
IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond = 0); // set named window collapsed state
|
IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond = 0); // set named window collapsed state
|
||||||
IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most
|
IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most. use NULL to remove focus.
|
||||||
|
|
||||||
IMGUI_API float GetScrollPosY(); // get scrolling position [0..GetScrollMaxY()]
|
IMGUI_API float GetScrollPosY(); // get scrolling position [0..GetScrollMaxY()]
|
||||||
IMGUI_API float GetScrollMaxY(); // get maximum scrolling position == ContentSize.Y - WindowSize.Y
|
IMGUI_API float GetScrollMaxY(); // get maximum scrolling position == ContentSize.Y - WindowSize.Y
|
||||||
|
Loading…
Reference in New Issue
Block a user