Merge pull request #156 from malikolivier/patch-wrap-is-window-focus

[ImGui] Wrap igIsWindowFocused
This commit is contained in:
Malik Olivier Boussejra 2018-09-19 08:37:55 +09:00 committed by GitHub
commit c2f3936879
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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() }