[ImGui] Wrap igIsWindowFocused
Wrap with three different functions, one for each of the possible values of
ImGuiFocusedFlags given as argument to igIsWindowFocused.
@@ -33,9 +33,9 @@ pub use sliders::{
pub use string::{ImStr, ImString};
pub use style::StyleVar;
pub use sys::{
- ImDrawIdx, ImDrawVert, ImGuiCol, ImGuiColorEditFlags, ImGuiCond, ImGuiHoveredFlags,
- ImGuiInputTextFlags, ImGuiKey, ImGuiMouseCursor, ImGuiSelectableFlags, ImGuiStyle,
- ImGuiTreeNodeFlags, ImGuiWindowFlags, ImVec2, ImVec4,
+ ImDrawIdx, ImDrawVert, ImGuiCol, ImGuiColorEditFlags, ImGuiCond, ImGuiFocusedFlags,
+ ImGuiHoveredFlags, ImGuiInputTextFlags, ImGuiKey, ImGuiMouseCursor, ImGuiSelectableFlags,
+ ImGuiStyle, ImGuiTreeNodeFlags, ImGuiWindowFlags, ImVec2, ImVec4,
};
pub use trees::{CollapsingHeader, TreeNode};
pub use window::Window;
@@ -1558,6 +1558,21 @@ impl<'ui> Ui<'ui> {
unsafe { sys::igIsWindowHovered(ImGuiHoveredFlags::empty()) }
}
+ /// Return `true` if the current window is currently focused.
+ pub fn is_window_focused(&self) -> bool {
+ unsafe { sys::igIsWindowFocused(ImGuiFocusedFlags::RootAndChildWindows) }
+ }
+
+ /// Return `true` if the current root window is currently focused.
+ pub fn is_root_window_focused(&self) -> bool {
+ unsafe { sys::igIsWindowFocused(ImGuiFocusedFlags::RootWindow) }
+ }
+
+ /// Return `true` if the current child window is currently focused.
+ pub fn is_child_window_focused(&self) -> bool {
+ unsafe { sys::igIsWindowFocused(ImGuiFocusedFlags::ChildWindows) }
+ }
+
/// Returns `true` if the last item is being active.
pub fn is_item_active(&self) -> bool {
unsafe { sys::igIsItemActive() }
