mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 13:38:35 +00:00
added mouse cursor state to the context
This commit is contained in:
parent
6eb56529da
commit
f00b5707c0
@ -9,8 +9,8 @@ use crate::clipboard::{ClipboardBackend, ClipboardContext};
|
|||||||
use crate::fonts::atlas::{FontAtlas, FontId, SharedFontAtlas};
|
use crate::fonts::atlas::{FontAtlas, FontId, SharedFontAtlas};
|
||||||
use crate::io::Io;
|
use crate::io::Io;
|
||||||
use crate::style::Style;
|
use crate::style::Style;
|
||||||
use crate::Ui;
|
|
||||||
use crate::{sys, DrawData};
|
use crate::{sys, DrawData};
|
||||||
|
use crate::{MouseCursor, Ui};
|
||||||
|
|
||||||
/// An imgui-rs context.
|
/// An imgui-rs context.
|
||||||
///
|
///
|
||||||
@ -543,4 +543,28 @@ impl Context {
|
|||||||
&*(sys::igGetDrawData() as *mut DrawData)
|
&*(sys::igGetDrawData() as *mut DrawData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the currently desired mouse cursor type.
|
||||||
|
///
|
||||||
|
/// This was set *last frame* by the [Ui] object, and will be reset when
|
||||||
|
/// [new_frame] is called.
|
||||||
|
///
|
||||||
|
/// Returns `None` if no cursor should be displayed
|
||||||
|
///
|
||||||
|
/// [new_frame]: Self::new_frame
|
||||||
|
#[doc(alias = "GetMouseCursor")]
|
||||||
|
pub fn mouse_cursor(&self) -> Option<MouseCursor> {
|
||||||
|
match unsafe { sys::igGetMouseCursor() } {
|
||||||
|
sys::ImGuiMouseCursor_Arrow => Some(MouseCursor::Arrow),
|
||||||
|
sys::ImGuiMouseCursor_TextInput => Some(MouseCursor::TextInput),
|
||||||
|
sys::ImGuiMouseCursor_ResizeAll => Some(MouseCursor::ResizeAll),
|
||||||
|
sys::ImGuiMouseCursor_ResizeNS => Some(MouseCursor::ResizeNS),
|
||||||
|
sys::ImGuiMouseCursor_ResizeEW => Some(MouseCursor::ResizeEW),
|
||||||
|
sys::ImGuiMouseCursor_ResizeNESW => Some(MouseCursor::ResizeNESW),
|
||||||
|
sys::ImGuiMouseCursor_ResizeNWSE => Some(MouseCursor::ResizeNWSE),
|
||||||
|
sys::ImGuiMouseCursor_Hand => Some(MouseCursor::Hand),
|
||||||
|
sys::ImGuiMouseCursor_NotAllowed => Some(MouseCursor::NotAllowed),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user