mirror of
https://github.com/xemu-project/imgui.git
synced 2024-11-27 04:00:22 +00:00
Added IsRootWindowFocused(), IsRootWindowOrAnyChildFocused(). Renamed GetWindowIsFocused() to IsWindowFocused()
This commit is contained in:
parent
e2734d23ef
commit
1c1a55f6b1
29
imgui.cpp
29
imgui.cpp
@ -129,8 +129,9 @@
|
||||
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.
|
||||
|
||||
- 2015/03/13 (1.36) - renamed GetWindowIsFocused() to IsWindowFocused(). Kept inline redirection function.
|
||||
- 2015/03/08 (1.35) - renamed style.ScrollBarWidth to style.ScrollbarWidth
|
||||
- 2015/02/27 (1.34) - renamed OpenNextNode(bool) to SetNextTreeNodeOpened(bool, ImGuiSetCond), kept inline redirection function.
|
||||
- 2015/02/27 (1.34) - renamed OpenNextNode(bool) to SetNextTreeNodeOpened(bool, ImGuiSetCond). Kept inline redirection function.
|
||||
- 2015/02/27 (1.34) - renamed ImGuiSetCondition_*** to ImGuiSetCond_***, and _FirstUseThisSession becomes _Once.
|
||||
- 2015/02/11 (1.32) - changed text input callback ImGuiTextEditCallback return type from void-->int. reserved for future use, return 0 for now.
|
||||
- 2015/02/10 (1.32) - renamed GetItemWidth() to CalcItemWidth() to clarify its evolving behavior
|
||||
@ -1138,12 +1139,12 @@ struct ImGuiWindow
|
||||
bool SkipItems; // == Visible && !Collapsed
|
||||
int AutoFitFrames;
|
||||
bool AutoFitOnlyGrows;
|
||||
int SetWindowPosAllowFlags; // bit ImGuiSetCond_*** specify if SetWindowPos() call is allowed with this particular flag.
|
||||
int SetWindowSizeAllowFlags; // bit ImGuiSetCond_*** specify if SetWindowSize() call is allowed with this particular flag.
|
||||
int SetWindowCollapsedAllowFlags; // bit ImGuiSetCond_*** specify if SetWindowCollapsed() call is allowed with this particular flag.
|
||||
int SetWindowPosAllowFlags; // bit ImGuiSetCond_*** specify if SetWindowPos() call will succeed with this particular flag.
|
||||
int SetWindowSizeAllowFlags; // bit ImGuiSetCond_*** specify if SetWindowSize() call will succeed with this particular flag.
|
||||
int SetWindowCollapsedAllowFlags; // bit ImGuiSetCond_*** specify if SetWindowCollapsed() call will succeed with this particular flag.
|
||||
|
||||
ImGuiDrawContext DC;
|
||||
ImVector<ImGuiID> IDStack;
|
||||
ImGuiDrawContext DC; // Temporary per-window data, reset at the beginning of the frame
|
||||
ImVector<ImGuiID> IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack
|
||||
ImVector<ImVec4> ClipRectStack; // Scissoring / clipping rectangle. x1, y1, x2, y2.
|
||||
ImGuiAabb ClippedAabb; // = ClipRectStack.front() after setup in Begin()
|
||||
int LastFrameDrawn;
|
||||
@ -3481,13 +3482,27 @@ const char* ImGui::GetStyleColName(ImGuiCol idx)
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
bool ImGui::GetWindowIsFocused()
|
||||
bool ImGui::IsWindowFocused()
|
||||
{
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
return g.FocusedWindow == window;
|
||||
}
|
||||
|
||||
bool ImGui::IsRootWindowFocused()
|
||||
{
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* root_window = GetCurrentWindow()->RootWindow;
|
||||
return g.FocusedWindow == root_window;
|
||||
}
|
||||
|
||||
bool ImGui::IsRootWindowOrAnyChildFocused()
|
||||
{
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* root_window = GetCurrentWindow()->RootWindow;
|
||||
return g.FocusedWindow->RootWindow == root_window;
|
||||
}
|
||||
|
||||
float ImGui::GetWindowWidth()
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
|
5
imgui.h
5
imgui.h
@ -166,7 +166,6 @@ namespace ImGui
|
||||
IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). on each axis.
|
||||
IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // "
|
||||
IMGUI_API void EndChild();
|
||||
IMGUI_API bool GetWindowIsFocused();
|
||||
IMGUI_API ImVec2 GetContentRegionMax(); // window or current column boundaries, in windows coordinates
|
||||
IMGUI_API ImVec2 GetWindowContentRegionMin(); // window boundaries, in windows coordinates
|
||||
IMGUI_API ImVec2 GetWindowContentRegionMax();
|
||||
@ -346,6 +345,9 @@ namespace ImGui
|
||||
IMGUI_API bool IsItemHovered(); // was the last item hovered by mouse?
|
||||
IMGUI_API bool IsItemActive(); // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false)
|
||||
IMGUI_API bool IsAnyItemActive(); //
|
||||
IMGUI_API bool IsWindowFocused(); // is current window focused (differentiate child windows from each others)
|
||||
IMGUI_API bool IsRootWindowFocused(); // is current root window focused
|
||||
IMGUI_API bool IsRootWindowOrAnyChildFocused(); // is current root window or any of its child (including current window) focused
|
||||
IMGUI_API ImVec2 GetItemBoxMin(); // get bounding box of last item
|
||||
IMGUI_API ImVec2 GetItemBoxMax(); // get bounding box of last item
|
||||
IMGUI_API bool IsClipped(const ImVec2& item_size); // to perform coarse clipping on user's side (as an optimization)
|
||||
@ -379,6 +381,7 @@ namespace ImGui
|
||||
// Obsolete (will be removed)
|
||||
IMGUI_API void GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size);
|
||||
static inline void OpenNextNode(bool open) { ImGui::SetNextTreeNodeOpened(open, 0); }
|
||||
static inline bool GetWindowIsFocused() { return ImGui::IsWindowFocused(); }
|
||||
|
||||
} // namespace ImGui
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user