Browse Source

Added IsAnyItemActive()

ocornut 10 years ago
parent
commit
f2752584e2
2 changed files with 8 additions and 0 deletions
  1. 7 0
      imgui.cpp
  2. 1 0
      imgui.h

+ 7 - 0
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();

+ 1 - 0
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)