From f2752584e2001cb9106b1df123fe427127ee4de6 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 18 Feb 2015 17:17:06 +0000 Subject: [PATCH] Added IsAnyItemActive() --- imgui.cpp | 7 +++++++ imgui.h | 1 + 2 files changed, 8 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index 67fc5da3..541dc484 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -295,6 +295,7 @@ ! style: store rounded corners in texture to use 1 quad per corner (filled and wireframe). so rounding have minor cost. - style: checkbox: padding for "active" color should be a multiplier of the - style: colorbox not always square? + - text: simple markup language for color change? - log: LogButtons() options for specifying depth and/or hiding depth slider - log: have more control over the log scope (e.g. stop logging when leaving current tree node scope) - log: be able to right-click and log a window or tree-node into tty/file/clipboard / generalized context menu? @@ -2437,6 +2438,12 @@ bool ImGui::IsItemActive() return false; } +bool ImGui::IsAnyItemActive() +{ + ImGuiState& g = *GImGui; + return g.ActiveId != 0; +} + ImVec2 ImGui::GetItemBoxMin() { ImGuiWindow* window = GetCurrentWindow(); diff --git a/imgui.h b/imgui.h index 71c87ca0..bbe5d13b 100644 --- a/imgui.h +++ b/imgui.h @@ -327,6 +327,7 @@ namespace ImGui // Utilities 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 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)