dear_imgui_rs/
input.rs

1//! Input types (mouse, keyboard, cursors)
2//!
3//! Strongly-typed identifiers for mouse buttons, mouse cursors and keyboard
4//! keys used by Dear ImGui. Backends typically translate platform events into
5//! these enums when feeding input into `Io`.
6//!
7//! See [`io`] for the per-frame input state and configuration.
8//!
9#![allow(
10    clippy::cast_possible_truncation,
11    clippy::cast_sign_loss,
12    clippy::as_conversions
13)]
14use crate::sys;
15use bitflags::bitflags;
16#[cfg(feature = "serde")]
17use serde::{Deserialize, Serialize};
18
19/// Mouse button identifier
20#[repr(i32)]
21#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
22#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
23pub enum MouseButton {
24    /// Left mouse button
25    Left = sys::ImGuiMouseButton_Left as i32,
26    /// Right mouse button
27    Right = sys::ImGuiMouseButton_Right as i32,
28    /// Middle mouse button
29    Middle = sys::ImGuiMouseButton_Middle as i32,
30    /// Extra mouse button 1 (typically Back)
31    Extra1 = 3,
32    /// Extra mouse button 2 (typically Forward)
33    Extra2 = 4,
34}
35
36/// Mouse cursor types
37#[repr(i32)]
38#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
39#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
40pub enum MouseCursor {
41    /// No cursor
42    None = sys::ImGuiMouseCursor_None,
43    /// Arrow cursor
44    Arrow = sys::ImGuiMouseCursor_Arrow,
45    /// Text input I-beam cursor
46    TextInput = sys::ImGuiMouseCursor_TextInput,
47    /// Resize all directions cursor
48    ResizeAll = sys::ImGuiMouseCursor_ResizeAll,
49    /// Resize north-south cursor
50    ResizeNS = sys::ImGuiMouseCursor_ResizeNS,
51    /// Resize east-west cursor
52    ResizeEW = sys::ImGuiMouseCursor_ResizeEW,
53    /// Resize northeast-southwest cursor
54    ResizeNESW = sys::ImGuiMouseCursor_ResizeNESW,
55    /// Resize northwest-southeast cursor
56    ResizeNWSE = sys::ImGuiMouseCursor_ResizeNWSE,
57    /// Hand cursor
58    Hand = sys::ImGuiMouseCursor_Hand,
59    /// Not allowed cursor
60    NotAllowed = sys::ImGuiMouseCursor_NotAllowed,
61}
62
63/// Source of mouse-like input events.
64///
65/// Backends can use this to mark whether a mouse event originates from a
66/// physical mouse, a touch screen, or a pen/stylus so Dear ImGui can
67/// correctly handle multiple input sources.
68#[repr(i32)]
69#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
70#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
71pub enum MouseSource {
72    /// Events coming from a physical mouse
73    Mouse = sys::ImGuiMouseSource_Mouse as i32,
74    /// Events coming from a touch screen
75    TouchScreen = sys::ImGuiMouseSource_TouchScreen as i32,
76    /// Events coming from a pen or stylus
77    Pen = sys::ImGuiMouseSource_Pen as i32,
78}
79
80/// Key identifier for keyboard input
81#[repr(i32)]
82#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
83#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
84pub enum Key {
85    /// No key
86    None = sys::ImGuiKey_None as i32,
87    /// Tab key
88    Tab = sys::ImGuiKey_Tab as i32,
89    /// Left arrow key
90    LeftArrow = sys::ImGuiKey_LeftArrow as i32,
91    /// Right arrow key
92    RightArrow = sys::ImGuiKey_RightArrow as i32,
93    /// Up arrow key
94    UpArrow = sys::ImGuiKey_UpArrow as i32,
95    /// Down arrow key
96    DownArrow = sys::ImGuiKey_DownArrow as i32,
97    /// Page up key
98    PageUp = sys::ImGuiKey_PageUp as i32,
99    /// Page down key
100    PageDown = sys::ImGuiKey_PageDown as i32,
101    /// Home key
102    Home = sys::ImGuiKey_Home as i32,
103    /// End key
104    End = sys::ImGuiKey_End as i32,
105    /// Insert key
106    Insert = sys::ImGuiKey_Insert as i32,
107    /// Delete key
108    Delete = sys::ImGuiKey_Delete as i32,
109    /// Backspace key
110    Backspace = sys::ImGuiKey_Backspace as i32,
111    /// Space key
112    Space = sys::ImGuiKey_Space as i32,
113    /// Enter key
114    Enter = sys::ImGuiKey_Enter as i32,
115    /// Escape key
116    Escape = sys::ImGuiKey_Escape as i32,
117    /// Left Ctrl key
118    LeftCtrl = sys::ImGuiKey_LeftCtrl as i32,
119    /// Left Shift key
120    LeftShift = sys::ImGuiKey_LeftShift as i32,
121    /// Left Alt key
122    LeftAlt = sys::ImGuiKey_LeftAlt as i32,
123    /// Left Super key
124    LeftSuper = sys::ImGuiKey_LeftSuper as i32,
125    /// Right Ctrl key
126    RightCtrl = sys::ImGuiKey_RightCtrl as i32,
127    /// Right Shift key
128    RightShift = sys::ImGuiKey_RightShift as i32,
129    /// Right Alt key
130    RightAlt = sys::ImGuiKey_RightAlt as i32,
131    /// Right Super key
132    RightSuper = sys::ImGuiKey_RightSuper as i32,
133    /// Ctrl modifier (for `io.KeyMods` / `io.KeyCtrl`)
134    ModCtrl = sys::ImGuiMod_Ctrl as i32,
135    /// Shift modifier (for `io.KeyMods` / `io.KeyShift`)
136    ModShift = sys::ImGuiMod_Shift as i32,
137    /// Alt modifier (for `io.KeyMods` / `io.KeyAlt`)
138    ModAlt = sys::ImGuiMod_Alt as i32,
139    /// Super/Cmd modifier (for `io.KeyMods` / `io.KeySuper`)
140    ModSuper = sys::ImGuiMod_Super as i32,
141    /// Menu key
142    Menu = sys::ImGuiKey_Menu as i32,
143    /// 0 key
144    Key0 = sys::ImGuiKey_0 as i32,
145    /// 1 key
146    Key1 = sys::ImGuiKey_1 as i32,
147    /// 2 key
148    Key2 = sys::ImGuiKey_2 as i32,
149    /// 3 key
150    Key3 = sys::ImGuiKey_3 as i32,
151    /// 4 key
152    Key4 = sys::ImGuiKey_4 as i32,
153    /// 5 key
154    Key5 = sys::ImGuiKey_5 as i32,
155    /// 6 key
156    Key6 = sys::ImGuiKey_6 as i32,
157    /// 7 key
158    Key7 = sys::ImGuiKey_7 as i32,
159    /// 8 key
160    Key8 = sys::ImGuiKey_8 as i32,
161    /// 9 key
162    Key9 = sys::ImGuiKey_9 as i32,
163    /// A key
164    A = sys::ImGuiKey_A as i32,
165    /// B key
166    B = sys::ImGuiKey_B as i32,
167    /// C key
168    C = sys::ImGuiKey_C as i32,
169    /// D key
170    D = sys::ImGuiKey_D as i32,
171    /// E key
172    E = sys::ImGuiKey_E as i32,
173    /// F key
174    F = sys::ImGuiKey_F as i32,
175    /// G key
176    G = sys::ImGuiKey_G as i32,
177    /// H key
178    H = sys::ImGuiKey_H as i32,
179    /// I key
180    I = sys::ImGuiKey_I as i32,
181    /// J key
182    J = sys::ImGuiKey_J as i32,
183    /// K key
184    K = sys::ImGuiKey_K as i32,
185    /// L key
186    L = sys::ImGuiKey_L as i32,
187    /// M key
188    M = sys::ImGuiKey_M as i32,
189    /// N key
190    N = sys::ImGuiKey_N as i32,
191    /// O key
192    O = sys::ImGuiKey_O as i32,
193    /// P key
194    P = sys::ImGuiKey_P as i32,
195    /// Q key
196    Q = sys::ImGuiKey_Q as i32,
197    /// R key
198    R = sys::ImGuiKey_R as i32,
199    /// S key
200    S = sys::ImGuiKey_S as i32,
201    /// T key
202    T = sys::ImGuiKey_T as i32,
203    /// U key
204    U = sys::ImGuiKey_U as i32,
205    /// V key
206    V = sys::ImGuiKey_V as i32,
207    /// W key
208    W = sys::ImGuiKey_W as i32,
209    /// X key
210    X = sys::ImGuiKey_X as i32,
211    /// Y key
212    Y = sys::ImGuiKey_Y as i32,
213    /// Z key
214    Z = sys::ImGuiKey_Z as i32,
215    /// F1 key
216    F1 = sys::ImGuiKey_F1 as i32,
217    /// F2 key
218    F2 = sys::ImGuiKey_F2 as i32,
219    /// F3 key
220    F3 = sys::ImGuiKey_F3 as i32,
221    /// F4 key
222    F4 = sys::ImGuiKey_F4 as i32,
223    /// F5 key
224    F5 = sys::ImGuiKey_F5 as i32,
225    /// F6 key
226    F6 = sys::ImGuiKey_F6 as i32,
227    /// F7 key
228    F7 = sys::ImGuiKey_F7 as i32,
229    /// F8 key
230    F8 = sys::ImGuiKey_F8 as i32,
231    /// F9 key
232    F9 = sys::ImGuiKey_F9 as i32,
233    /// F10 key
234    F10 = sys::ImGuiKey_F10 as i32,
235    /// F11 key
236    F11 = sys::ImGuiKey_F11 as i32,
237    /// F12 key
238    F12 = sys::ImGuiKey_F12 as i32,
239
240    // --- Punctuation and extra named keys ---
241    /// Apostrophe (') key
242    Apostrophe = sys::ImGuiKey_Apostrophe as i32,
243    /// Comma (,) key
244    Comma = sys::ImGuiKey_Comma as i32,
245    /// Minus (-) key
246    Minus = sys::ImGuiKey_Minus as i32,
247    /// Period (.) key
248    Period = sys::ImGuiKey_Period as i32,
249    /// Slash (/) key
250    Slash = sys::ImGuiKey_Slash as i32,
251    /// Semicolon (;) key
252    Semicolon = sys::ImGuiKey_Semicolon as i32,
253    /// Equal (=) key
254    Equal = sys::ImGuiKey_Equal as i32,
255    /// Left bracket ([) key
256    LeftBracket = sys::ImGuiKey_LeftBracket as i32,
257    /// Backslash (\) key
258    Backslash = sys::ImGuiKey_Backslash as i32,
259    /// Right bracket (]) key
260    RightBracket = sys::ImGuiKey_RightBracket as i32,
261    /// Grave accent (`) key
262    GraveAccent = sys::ImGuiKey_GraveAccent as i32,
263    /// CapsLock key
264    CapsLock = sys::ImGuiKey_CapsLock as i32,
265    /// ScrollLock key
266    ScrollLock = sys::ImGuiKey_ScrollLock as i32,
267    /// NumLock key
268    NumLock = sys::ImGuiKey_NumLock as i32,
269    /// PrintScreen key
270    PrintScreen = sys::ImGuiKey_PrintScreen as i32,
271    /// Pause key
272    Pause = sys::ImGuiKey_Pause as i32,
273
274    // --- Keypad ---
275    /// Numpad 0
276    Keypad0 = sys::ImGuiKey_Keypad0 as i32,
277    /// Numpad 1
278    Keypad1 = sys::ImGuiKey_Keypad1 as i32,
279    /// Numpad 2
280    Keypad2 = sys::ImGuiKey_Keypad2 as i32,
281    /// Numpad 3
282    Keypad3 = sys::ImGuiKey_Keypad3 as i32,
283    /// Numpad 4
284    Keypad4 = sys::ImGuiKey_Keypad4 as i32,
285    /// Numpad 5
286    Keypad5 = sys::ImGuiKey_Keypad5 as i32,
287    /// Numpad 6
288    Keypad6 = sys::ImGuiKey_Keypad6 as i32,
289    /// Numpad 7
290    Keypad7 = sys::ImGuiKey_Keypad7 as i32,
291    /// Numpad 8
292    Keypad8 = sys::ImGuiKey_Keypad8 as i32,
293    /// Numpad 9
294    Keypad9 = sys::ImGuiKey_Keypad9 as i32,
295    /// Numpad decimal
296    KeypadDecimal = sys::ImGuiKey_KeypadDecimal as i32,
297    /// Numpad divide
298    KeypadDivide = sys::ImGuiKey_KeypadDivide as i32,
299    /// Numpad multiply
300    KeypadMultiply = sys::ImGuiKey_KeypadMultiply as i32,
301    /// Numpad subtract
302    KeypadSubtract = sys::ImGuiKey_KeypadSubtract as i32,
303    /// Numpad add
304    KeypadAdd = sys::ImGuiKey_KeypadAdd as i32,
305    /// Numpad enter
306    KeypadEnter = sys::ImGuiKey_KeypadEnter as i32,
307    /// Numpad equal
308    KeypadEqual = sys::ImGuiKey_KeypadEqual as i32,
309
310    /// OEM 102 key (ISO < > |)
311    Oem102 = sys::ImGuiKey_Oem102 as i32,
312}
313
314impl From<MouseButton> for sys::ImGuiMouseButton {
315    #[inline]
316    fn from(value: MouseButton) -> sys::ImGuiMouseButton {
317        value as sys::ImGuiMouseButton
318    }
319}
320
321impl From<MouseSource> for sys::ImGuiMouseSource {
322    #[inline]
323    fn from(value: MouseSource) -> sys::ImGuiMouseSource {
324        value as sys::ImGuiMouseSource
325    }
326}
327
328impl From<Key> for sys::ImGuiKey {
329    #[inline]
330    fn from(value: Key) -> sys::ImGuiKey {
331        value as sys::ImGuiKey
332    }
333}
334
335// Key modifier flags are available via io.KeyCtrl/KeyShift/KeyAlt/KeySuper.
336// Backends should submit modifier state via `Key::ModCtrl`/`ModShift`/`ModAlt`/`ModSuper` using `Io::add_key_event`.
337
338bitflags! {
339    /// Input text flags for text input widgets
340    #[repr(transparent)]
341    #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
342    pub struct InputTextFlags: i32 {
343        /// No flags
344        const NONE = sys::ImGuiInputTextFlags_None as i32;
345        /// Allow 0123456789.+-*/
346        const CHARS_DECIMAL = sys::ImGuiInputTextFlags_CharsDecimal as i32;
347        /// Allow 0123456789ABCDEFabcdef
348        const CHARS_HEXADECIMAL = sys::ImGuiInputTextFlags_CharsHexadecimal as i32;
349        /// Turn a..z into A..Z
350        const CHARS_UPPERCASE = sys::ImGuiInputTextFlags_CharsUppercase as i32;
351        /// Filter out spaces, tabs
352        const CHARS_NO_BLANK = sys::ImGuiInputTextFlags_CharsNoBlank as i32;
353        /// Select entire text when first taking mouse focus
354        const AUTO_SELECT_ALL = sys::ImGuiInputTextFlags_AutoSelectAll as i32;
355        /// Return 'true' when Enter is pressed (as opposed to every time the value was modified)
356        const ENTER_RETURNS_TRUE = sys::ImGuiInputTextFlags_EnterReturnsTrue as i32;
357        /// Callback on pressing TAB (for completion handling)
358        const CALLBACK_COMPLETION = sys::ImGuiInputTextFlags_CallbackCompletion as i32;
359        /// Callback on pressing Up/Down arrows (for history handling)
360        const CALLBACK_HISTORY = sys::ImGuiInputTextFlags_CallbackHistory as i32;
361        /// Callback on each iteration (user can query cursor and modify text)
362        const CALLBACK_ALWAYS = sys::ImGuiInputTextFlags_CallbackAlways as i32;
363        /// Callback on character inputs to replace or discard them
364        const CALLBACK_CHAR_FILTER = sys::ImGuiInputTextFlags_CallbackCharFilter as i32;
365        /// Pressing TAB input a '\t' character into the text field
366        const ALLOW_TAB_INPUT = sys::ImGuiInputTextFlags_AllowTabInput as i32;
367        /// In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter
368        const CTRL_ENTER_FOR_NEW_LINE = sys::ImGuiInputTextFlags_CtrlEnterForNewLine as i32;
369        /// Disable following the cursor horizontally
370        const NO_HORIZONTAL_SCROLL = sys::ImGuiInputTextFlags_NoHorizontalScroll as i32;
371        /// Overwrite mode
372        const ALWAYS_OVERWRITE = sys::ImGuiInputTextFlags_AlwaysOverwrite as i32;
373        /// Read-only mode
374        const READ_ONLY = sys::ImGuiInputTextFlags_ReadOnly as i32;
375        /// Password mode, display all characters as '*'
376        const PASSWORD = sys::ImGuiInputTextFlags_Password as i32;
377        /// Disable undo/redo
378        const NO_UNDO_REDO = sys::ImGuiInputTextFlags_NoUndoRedo as i32;
379        /// Allow 0123456789.+-*/eE (Scientific notation input)
380        const CHARS_SCIENTIFIC = sys::ImGuiInputTextFlags_CharsScientific as i32;
381        /// Callback on buffer capacity changes request
382        const CALLBACK_RESIZE = sys::ImGuiInputTextFlags_CallbackResize as i32;
383        /// Callback on any edit (note that InputText() already returns true on edit)
384        const CALLBACK_EDIT = sys::ImGuiInputTextFlags_CallbackEdit as i32;
385    }
386}
387
388#[cfg(feature = "serde")]
389impl Serialize for InputTextFlags {
390    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
391    where
392        S: serde::Serializer,
393    {
394        serializer.serialize_i32(self.bits())
395    }
396}
397
398#[cfg(feature = "serde")]
399impl<'de> Deserialize<'de> for InputTextFlags {
400    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
401    where
402        D: serde::Deserializer<'de>,
403    {
404        let bits = i32::deserialize(deserializer)?;
405        Ok(InputTextFlags::from_bits_truncate(bits))
406    }
407}
408
409// TODO: Add NavInput enum once we have proper constants in sys crate
410
411impl crate::Ui {
412    /// Check if a key is being held down
413    #[doc(alias = "IsKeyDown")]
414    pub fn is_key_down(&self, key: Key) -> bool {
415        unsafe { sys::igIsKeyDown_Nil(key as sys::ImGuiKey) }
416    }
417
418    /// Check if a key was pressed (went from !Down to Down)
419    #[doc(alias = "IsKeyPressed")]
420    pub fn is_key_pressed(&self, key: Key) -> bool {
421        unsafe { sys::igIsKeyPressed_Bool(key as sys::ImGuiKey, true) }
422    }
423
424    /// Check if a key was pressed (went from !Down to Down), with repeat
425    #[doc(alias = "IsKeyPressed")]
426    pub fn is_key_pressed_with_repeat(&self, key: Key, repeat: bool) -> bool {
427        unsafe { sys::igIsKeyPressed_Bool(key as sys::ImGuiKey, repeat) }
428    }
429
430    /// Check if a key was released (went from Down to !Down)
431    #[doc(alias = "IsKeyReleased")]
432    pub fn is_key_released(&self, key: Key) -> bool {
433        unsafe { sys::igIsKeyReleased_Nil(key as sys::ImGuiKey) }
434    }
435
436    /// Check if a mouse button is being held down
437    #[doc(alias = "IsMouseDown")]
438    pub fn is_mouse_down(&self, button: MouseButton) -> bool {
439        unsafe { sys::igIsMouseDown_Nil(button.into()) }
440    }
441
442    /// Check if a mouse button was clicked (went from !Down to Down)
443    #[doc(alias = "IsMouseClicked")]
444    pub fn is_mouse_clicked(&self, button: MouseButton) -> bool {
445        unsafe { sys::igIsMouseClicked_Bool(button.into(), false) }
446    }
447
448    /// Check if a mouse button was clicked, with repeat
449    #[doc(alias = "IsMouseClicked")]
450    pub fn is_mouse_clicked_with_repeat(&self, button: MouseButton, repeat: bool) -> bool {
451        unsafe { sys::igIsMouseClicked_Bool(button.into(), repeat) }
452    }
453
454    /// Check if a mouse button was released (went from Down to !Down)
455    #[doc(alias = "IsMouseReleased")]
456    pub fn is_mouse_released(&self, button: MouseButton) -> bool {
457        unsafe { sys::igIsMouseReleased_Nil(button.into()) }
458    }
459
460    /// Check if a mouse button was double-clicked
461    #[doc(alias = "IsMouseDoubleClicked")]
462    pub fn is_mouse_double_clicked(&self, button: MouseButton) -> bool {
463        unsafe { sys::igIsMouseDoubleClicked_Nil(button.into()) }
464    }
465
466    /// Get mouse position in screen coordinates
467    #[doc(alias = "GetMousePos")]
468    pub fn mouse_pos(&self) -> [f32; 2] {
469        let pos = unsafe { sys::igGetMousePos() };
470        [pos.x, pos.y]
471    }
472
473    /// Get mouse position when a specific button was clicked
474    #[doc(alias = "GetMousePosOnOpeningCurrentPopup")]
475    pub fn mouse_pos_on_opening_current_popup(&self) -> [f32; 2] {
476        let pos = unsafe { sys::igGetMousePosOnOpeningCurrentPopup() };
477        [pos.x, pos.y]
478    }
479
480    /// Check if mouse is hovering given rectangle
481    #[doc(alias = "IsMouseHoveringRect")]
482    pub fn is_mouse_hovering_rect(&self, r_min: [f32; 2], r_max: [f32; 2]) -> bool {
483        unsafe {
484            sys::igIsMouseHoveringRect(
485                sys::ImVec2::new(r_min[0], r_min[1]),
486                sys::ImVec2::new(r_max[0], r_max[1]),
487                true,
488            )
489        }
490    }
491
492    /// Check if mouse is hovering given rectangle (with clipping test)
493    #[doc(alias = "IsMouseHoveringRect")]
494    pub fn is_mouse_hovering_rect_with_clip(
495        &self,
496        r_min: [f32; 2],
497        r_max: [f32; 2],
498        clip: bool,
499    ) -> bool {
500        unsafe {
501            sys::igIsMouseHoveringRect(
502                sys::ImVec2::new(r_min[0], r_min[1]),
503                sys::ImVec2::new(r_max[0], r_max[1]),
504                clip,
505            )
506        }
507    }
508
509    /// Check if mouse is dragging
510    #[doc(alias = "IsMouseDragging")]
511    pub fn is_mouse_dragging(&self, button: MouseButton) -> bool {
512        unsafe { sys::igIsMouseDragging(button as i32, -1.0) }
513    }
514
515    /// Check if mouse is dragging with threshold
516    #[doc(alias = "IsMouseDragging")]
517    pub fn is_mouse_dragging_with_threshold(
518        &self,
519        button: MouseButton,
520        lock_threshold: f32,
521    ) -> bool {
522        unsafe { sys::igIsMouseDragging(button as i32, lock_threshold) }
523    }
524
525    /// Get mouse drag delta
526    #[doc(alias = "GetMouseDragDelta")]
527    pub fn mouse_drag_delta(&self, button: MouseButton) -> [f32; 2] {
528        let delta = unsafe { sys::igGetMouseDragDelta(button as i32, -1.0) };
529        [delta.x, delta.y]
530    }
531
532    /// Get mouse drag delta with threshold
533    #[doc(alias = "GetMouseDragDelta")]
534    pub fn mouse_drag_delta_with_threshold(
535        &self,
536        button: MouseButton,
537        lock_threshold: f32,
538    ) -> [f32; 2] {
539        let delta = unsafe { sys::igGetMouseDragDelta(button as i32, lock_threshold) };
540        [delta.x, delta.y]
541    }
542
543    /// Reset mouse drag delta for a specific button
544    #[doc(alias = "ResetMouseDragDelta")]
545    pub fn reset_mouse_drag_delta(&self, button: MouseButton) {
546        unsafe { sys::igResetMouseDragDelta(button as i32) }
547    }
548
549    /// Returns true if the last item toggled its selection state in a multi-select scope.
550    ///
551    /// This only makes sense when used between `BeginMultiSelect()` /
552    /// `EndMultiSelect()` (or helpers built on top of them).
553    #[doc(alias = "IsItemToggledSelection")]
554    pub fn is_item_toggled_selection(&self) -> bool {
555        unsafe { sys::igIsItemToggledSelection() }
556    }
557}