dear-imgui-rs 0.12.0

High-level Rust bindings to Dear ImGui v1.92.7 with docking, WGPU/GL backends, and extensions (ImPlot/ImPlot3D, ImNodes, ImGuizmo, file browser, reflection-based UI)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
//! IO: inputs, configuration and backend capabilities
//!
//! This module wraps Dear ImGui's `ImGuiIO` and related flag types. Access the
//! per-frame IO object via [`Ui::io`], then read inputs or tweak configuration
//! and backend capability flags.
//!
//! Example: enable docking and multi-viewports, and set renderer flags.
//! ```no_run
//! # use dear_imgui_rs::*;
//! # let mut ctx = Context::create();
//! // Configure IO before starting a frame
//! let io = ctx.io_mut();
//! io.set_config_flags(io.config_flags() | ConfigFlags::DOCKING_ENABLE | ConfigFlags::VIEWPORTS_ENABLE);
//! io.set_backend_flags(io.backend_flags() | BackendFlags::RENDERER_HAS_TEXTURES);
//! # let _ = ctx.frame();
//! ```
//!
#![allow(
    clippy::cast_possible_truncation,
    clippy::cast_sign_loss,
    clippy::as_conversions
)]
use bitflags::bitflags;

use crate::sys;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::cell::UnsafeCell;
use std::ffi::{CStr, c_void};

#[cfg(feature = "serde")]
impl Serialize for ConfigFlags {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_i32(self.bits())
    }
}

#[cfg(feature = "serde")]
impl<'de> Deserialize<'de> for ConfigFlags {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let bits = i32::deserialize(deserializer)?;
        Ok(ConfigFlags::from_bits_truncate(bits))
    }
}

#[cfg(feature = "serde")]
impl Serialize for BackendFlags {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_i32(self.bits())
    }
}

#[cfg(feature = "serde")]
impl<'de> Deserialize<'de> for BackendFlags {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let bits = i32::deserialize(deserializer)?;
        Ok(BackendFlags::from_bits_truncate(bits))
    }
}

#[cfg(all(feature = "serde", feature = "multi-viewport"))]
impl Serialize for ViewportFlags {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_i32(self.bits())
    }
}

#[cfg(all(feature = "serde", feature = "multi-viewport"))]
impl<'de> Deserialize<'de> for ViewportFlags {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let bits = i32::deserialize(deserializer)?;
        Ok(ViewportFlags::from_bits_truncate(bits))
    }
}

bitflags! {
    /// Configuration flags
    #[repr(transparent)]
    pub struct ConfigFlags: i32 {
        /// Master keyboard navigation enable flag.
        const NAV_ENABLE_KEYBOARD = sys::ImGuiConfigFlags_NavEnableKeyboard as i32;
        /// Master gamepad navigation enable flag.
        const NAV_ENABLE_GAMEPAD = sys::ImGuiConfigFlags_NavEnableGamepad as i32;
        /// Instruction imgui-rs to clear mouse position/buttons in `frame()`.
        const NO_MOUSE = sys::ImGuiConfigFlags_NoMouse as i32;
        /// Instruction backend to not alter mouse cursor shape and visibility.
        const NO_MOUSE_CURSOR_CHANGE = sys::ImGuiConfigFlags_NoMouseCursorChange as i32;
        /// Application is SRGB-aware.
        const IS_SRGB = sys::ImGuiConfigFlags_IsSRGB as i32;
        /// Application is using a touch screen instead of a mouse.
        const IS_TOUCH_SCREEN = sys::ImGuiConfigFlags_IsTouchScreen as i32;

        const DOCKING_ENABLE = sys::ImGuiConfigFlags_DockingEnable as i32;

        const VIEWPORTS_ENABLE = sys::ImGuiConfigFlags_ViewportsEnable as i32;
    }
}

bitflags! {
    /// Backend capabilities
    #[repr(transparent)]
    pub struct BackendFlags: i32 {
        /// Backend supports gamepad and currently has one connected
        const HAS_GAMEPAD = sys::ImGuiBackendFlags_HasGamepad as i32;
        /// Backend supports honoring `get_mouse_cursor` value to change the OS cursor shape
        const HAS_MOUSE_CURSORS = sys::ImGuiBackendFlags_HasMouseCursors as i32;
        /// Backend supports `io.want_set_mouse_pos` requests to reposition the OS mouse position.
        const HAS_SET_MOUSE_POS = sys::ImGuiBackendFlags_HasSetMousePos as i32;
        /// Backend can report which viewport the OS mouse is hovering via `add_mouse_viewport_event`
        const HAS_MOUSE_HOVERED_VIEWPORT =
            sys::ImGuiBackendFlags_HasMouseHoveredViewport as i32;
        /// Backend renderer supports DrawCmd::vtx_offset.
        const RENDERER_HAS_VTX_OFFSET = sys::ImGuiBackendFlags_RendererHasVtxOffset as i32;
        /// Backend renderer supports ImTextureData requests to create/update/destroy textures.
        const RENDERER_HAS_TEXTURES = sys::ImGuiBackendFlags_RendererHasTextures as i32;

        #[cfg(feature = "multi-viewport")]
        /// Set if the platform backend supports viewports.
        const PLATFORM_HAS_VIEWPORTS = sys::ImGuiBackendFlags_PlatformHasViewports as i32;
        #[cfg(feature = "multi-viewport")]
        /// Set if the renderer backend supports viewports.
        const RENDERER_HAS_VIEWPORTS = sys::ImGuiBackendFlags_RendererHasViewports as i32;
    }
}

#[cfg(feature = "multi-viewport")]
bitflags! {
    /// Viewport flags for multi-viewport support
    #[repr(transparent)]
    pub struct ViewportFlags: i32 {
        /// No flags
        const NONE = 0;
        /// Represent a Platform Window
        const IS_PLATFORM_WINDOW = sys::ImGuiViewportFlags_IsPlatformWindow as i32;
        /// Represent a Platform Monitor (unused in our implementation)
        const IS_PLATFORM_MONITOR = sys::ImGuiViewportFlags_IsPlatformMonitor as i32;
        /// Platform Window: is created/managed by the application (rather than a dear imgui backend)
        const OWNED_BY_APP = sys::ImGuiViewportFlags_OwnedByApp as i32;
        /// Platform Window: Disable platform decorations: title bar, borders, etc.
        const NO_DECORATION = sys::ImGuiViewportFlags_NoDecoration as i32;
        /// Platform Window: Disable platform task bar icon (generally set on popups/tooltips, or all windows if ImGuiConfigFlags_ViewportsNoTaskBarIcon is set)
        const NO_TASK_BAR_ICON = sys::ImGuiViewportFlags_NoTaskBarIcon as i32;
        /// Platform Window: Don't take focus when created.
        const NO_FOCUS_ON_APPEARING = sys::ImGuiViewportFlags_NoFocusOnAppearing as i32;
        /// Platform Window: Don't take focus when clicked on.
        const NO_FOCUS_ON_CLICK = sys::ImGuiViewportFlags_NoFocusOnClick as i32;
        /// Platform Window: Make mouse pass through so we can drag this window while peaking behind it.
        const NO_INPUTS = sys::ImGuiViewportFlags_NoInputs as i32;
        /// Platform Window: Renderer doesn't need to clear the framebuffer ahead (because we will fill it entirely).
        const NO_RENDERER_CLEAR = sys::ImGuiViewportFlags_NoRendererClear as i32;
        /// Platform Window: Avoid merging this window into another host window. This can only be set via ImGuiWindowClass viewport flags override (because we need to now ahead if we are going to create a viewport in the first place!).
        const NO_AUTO_MERGE = sys::ImGuiViewportFlags_NoAutoMerge as i32;
        /// Platform Window: Display on top (for tooltips only).
        const TOP_MOST = sys::ImGuiViewportFlags_TopMost as i32;
        /// Viewport can host multiple imgui windows (secondary viewports are associated to a single window).
        const CAN_HOST_OTHER_WINDOWS = sys::ImGuiViewportFlags_CanHostOtherWindows as i32;
        /// Platform Window: Window is minimized, can skip render. When minimized we tend to avoid using the viewport pos/size for clipping rectangle computation.
        const IS_MINIMIZED = sys::ImGuiViewportFlags_IsMinimized as i32;
        /// Platform Window: Window is focused (last call to Platform_GetWindowFocus() returned true)
        const IS_FOCUSED = sys::ImGuiViewportFlags_IsFocused as i32;
    }
}

/// Settings and inputs/outputs for imgui-rs
/// This is a transparent wrapper around ImGuiIO
#[repr(transparent)]
pub struct Io(UnsafeCell<sys::ImGuiIO>);

// Ensure the wrapper stays layout-compatible with the sys bindings.
const _: [(); std::mem::size_of::<sys::ImGuiIO>()] = [(); std::mem::size_of::<Io>()];
const _: [(); std::mem::align_of::<sys::ImGuiIO>()] = [(); std::mem::align_of::<Io>()];

impl Io {
    #[inline]
    fn inner(&self) -> &sys::ImGuiIO {
        // Safety: `Io` is a transparent wrapper around the sys `ImGuiIO` value which is owned by
        // Dear ImGui. The value may be mutated by Dear ImGui even while Rust holds `&Io`, so we
        // store it behind `UnsafeCell` to make that interior mutability explicit.
        unsafe { &*self.0.get() }
    }

    #[inline]
    fn inner_mut(&mut self) -> &mut sys::ImGuiIO {
        // Safety: caller has `&mut Io`, so this is a unique Rust borrow for this wrapper.
        unsafe { &mut *self.0.get() }
    }

    /// Main display size in pixels
    pub fn display_size(&self) -> [f32; 2] {
        [self.inner().DisplaySize.x, self.inner().DisplaySize.y]
    }

    /// Set main display size in pixels
    pub fn set_display_size(&mut self, size: [f32; 2]) {
        self.inner_mut().DisplaySize.x = size[0];
        self.inner_mut().DisplaySize.y = size[1];
    }

    /// Time elapsed since last frame, in seconds
    pub fn delta_time(&self) -> f32 {
        self.inner().DeltaTime
    }

    /// Set time elapsed since last frame, in seconds
    pub fn set_delta_time(&mut self, delta_time: f32) {
        self.inner_mut().DeltaTime = delta_time;
    }

    /// Auto-save interval for `.ini` settings, in seconds.
    #[doc(alias = "IniSavingRate")]
    pub fn ini_saving_rate(&self) -> f32 {
        self.inner().IniSavingRate
    }

    /// Set auto-save interval for `.ini` settings, in seconds.
    #[doc(alias = "IniSavingRate")]
    pub fn set_ini_saving_rate(&mut self, seconds: f32) {
        self.inner_mut().IniSavingRate = seconds;
    }

    /// Returns the current `.ini` filename, or `None` if disabled.
    ///
    /// Note: to set this safely, use `Context::set_ini_filename()`.
    #[doc(alias = "IniFilename")]
    pub fn ini_filename(&self) -> Option<&CStr> {
        let ptr = self.inner().IniFilename;
        unsafe { (!ptr.is_null()).then(|| CStr::from_ptr(ptr)) }
    }

    /// Returns the current `.log` filename, or `None` if disabled.
    ///
    /// Note: to set this safely, use `Context::set_log_filename()`.
    #[doc(alias = "LogFilename")]
    pub fn log_filename(&self) -> Option<&CStr> {
        let ptr = self.inner().LogFilename;
        unsafe { (!ptr.is_null()).then(|| CStr::from_ptr(ptr)) }
    }

    /// Returns user data pointer stored in `ImGuiIO`.
    #[doc(alias = "UserData")]
    pub fn user_data(&self) -> *mut c_void {
        self.inner().UserData
    }

    /// Set user data pointer stored in `ImGuiIO`.
    #[doc(alias = "UserData")]
    pub fn set_user_data(&mut self, user_data: *mut c_void) {
        self.inner_mut().UserData = user_data;
    }

    /// Returns whether font scaling via Ctrl+MouseWheel is enabled.
    #[doc(alias = "FontAllowUserScaling")]
    pub fn font_allow_user_scaling(&self) -> bool {
        self.inner().FontAllowUserScaling
    }

    /// Set whether font scaling via Ctrl+MouseWheel is enabled.
    #[doc(alias = "FontAllowUserScaling")]
    pub fn set_font_allow_user_scaling(&mut self, enabled: bool) {
        self.inner_mut().FontAllowUserScaling = enabled;
    }

    /// Mouse position, in pixels
    pub fn mouse_pos(&self) -> [f32; 2] {
        [self.inner().MousePos.x, self.inner().MousePos.y]
    }

    /// Set mouse position, in pixels
    pub fn set_mouse_pos(&mut self, pos: [f32; 2]) {
        self.inner_mut().MousePos.x = pos[0];
        self.inner_mut().MousePos.y = pos[1];
    }

    /// Mouse wheel vertical scrolling
    pub fn mouse_wheel(&self) -> f32 {
        self.inner().MouseWheel
    }

    /// Set mouse wheel vertical scrolling
    pub fn set_mouse_wheel(&mut self, wheel: f32) {
        self.inner_mut().MouseWheel = wheel;
    }

    /// Mouse wheel horizontal scrolling
    pub fn mouse_wheel_h(&self) -> f32 {
        self.inner().MouseWheelH
    }

    /// Set mouse wheel horizontal scrolling
    pub fn set_mouse_wheel_h(&mut self, wheel_h: f32) {
        self.inner_mut().MouseWheelH = wheel_h;
    }

    /// Check if a mouse button is down
    pub fn mouse_down(&self, button: usize) -> bool {
        if button < 5 {
            self.inner().MouseDown[button]
        } else {
            false
        }
    }

    /// Check if a mouse button is down (typed).
    pub fn mouse_down_button(&self, button: crate::input::MouseButton) -> bool {
        self.mouse_down(button as i32 as usize)
    }

    /// Set mouse button state
    pub fn set_mouse_down(&mut self, button: usize, down: bool) {
        if button < 5 {
            self.inner_mut().MouseDown[button] = down;
        }
    }

    /// Set mouse button state (typed).
    pub fn set_mouse_down_button(&mut self, button: crate::input::MouseButton, down: bool) {
        self.set_mouse_down(button as i32 as usize, down);
    }

    /// Check if imgui wants to capture mouse input
    pub fn want_capture_mouse(&self) -> bool {
        self.inner().WantCaptureMouse
    }

    /// Returns whether ImGui wants to capture mouse, unless a popup is closing.
    #[doc(alias = "WantCaptureMouseUnlessPopupClose")]
    pub fn want_capture_mouse_unless_popup_close(&self) -> bool {
        self.inner().WantCaptureMouseUnlessPopupClose
    }

    /// Check if imgui wants to capture keyboard input
    pub fn want_capture_keyboard(&self) -> bool {
        self.inner().WantCaptureKeyboard
    }

    /// Check if imgui wants to use text input
    pub fn want_text_input(&self) -> bool {
        self.inner().WantTextInput
    }

    /// Check if imgui wants to set mouse position
    pub fn want_set_mouse_pos(&self) -> bool {
        self.inner().WantSetMousePos
    }
    /// Whether ImGui requests software-drawn mouse cursor
    pub fn mouse_draw_cursor(&self) -> bool {
        self.inner().MouseDrawCursor
    }
    /// Enable or disable software-drawn mouse cursor
    pub fn set_mouse_draw_cursor(&mut self, draw: bool) {
        self.inner_mut().MouseDrawCursor = draw;
    }

    /// Check if imgui wants to save ini settings
    pub fn want_save_ini_settings(&self) -> bool {
        self.inner().WantSaveIniSettings
    }

    /// Framerate estimation, in frames per second
    pub fn framerate(&self) -> f32 {
        self.inner().Framerate
    }

    /// Vertices output during last call to render
    pub fn metrics_render_vertices(&self) -> i32 {
        self.inner().MetricsRenderVertices
    }

    /// Indices output during last call to render
    pub fn metrics_render_indices(&self) -> i32 {
        self.inner().MetricsRenderIndices
    }

    /// Number of visible windows
    pub fn metrics_render_windows(&self) -> i32 {
        self.inner().MetricsRenderWindows
    }

    /// Number of active windows
    pub fn metrics_active_windows(&self) -> i32 {
        self.inner().MetricsActiveWindows
    }

    /// Configuration flags
    pub fn config_flags(&self) -> ConfigFlags {
        ConfigFlags::from_bits_truncate(self.inner().ConfigFlags)
    }

    /// Set configuration flags
    pub fn set_config_flags(&mut self, flags: ConfigFlags) {
        self.inner_mut().ConfigFlags = flags.bits();
    }

    /// Returns whether to swap gamepad buttons for navigation.
    #[doc(alias = "ConfigNavSwapGamepadButtons")]
    pub fn config_nav_swap_gamepad_buttons(&self) -> bool {
        self.inner().ConfigNavSwapGamepadButtons
    }

    /// Set whether to swap gamepad buttons for navigation.
    #[doc(alias = "ConfigNavSwapGamepadButtons")]
    pub fn set_config_nav_swap_gamepad_buttons(&mut self, enabled: bool) {
        self.inner_mut().ConfigNavSwapGamepadButtons = enabled;
    }

    /// Returns whether navigation can move the mouse cursor.
    #[doc(alias = "ConfigNavMoveSetMousePos")]
    pub fn config_nav_move_set_mouse_pos(&self) -> bool {
        self.inner().ConfigNavMoveSetMousePos
    }

    /// Set whether navigation can move the mouse cursor.
    #[doc(alias = "ConfigNavMoveSetMousePos")]
    pub fn set_config_nav_move_set_mouse_pos(&mut self, enabled: bool) {
        self.inner_mut().ConfigNavMoveSetMousePos = enabled;
    }

    /// Returns whether to capture keyboard inputs during navigation.
    #[doc(alias = "ConfigNavCaptureKeyboard")]
    pub fn config_nav_capture_keyboard(&self) -> bool {
        self.inner().ConfigNavCaptureKeyboard
    }

    /// Set whether to capture keyboard inputs during navigation.
    #[doc(alias = "ConfigNavCaptureKeyboard")]
    pub fn set_config_nav_capture_keyboard(&mut self, enabled: bool) {
        self.inner_mut().ConfigNavCaptureKeyboard = enabled;
    }

    /// Returns whether Escape clears the focused item.
    #[doc(alias = "ConfigNavEscapeClearFocusItem")]
    pub fn config_nav_escape_clear_focus_item(&self) -> bool {
        self.inner().ConfigNavEscapeClearFocusItem
    }

    /// Set whether Escape clears the focused item.
    #[doc(alias = "ConfigNavEscapeClearFocusItem")]
    pub fn set_config_nav_escape_clear_focus_item(&mut self, enabled: bool) {
        self.inner_mut().ConfigNavEscapeClearFocusItem = enabled;
    }

    /// Returns whether Escape clears the focused window.
    #[doc(alias = "ConfigNavEscapeClearFocusWindow")]
    pub fn config_nav_escape_clear_focus_window(&self) -> bool {
        self.inner().ConfigNavEscapeClearFocusWindow
    }

    /// Set whether Escape clears the focused window.
    #[doc(alias = "ConfigNavEscapeClearFocusWindow")]
    pub fn set_config_nav_escape_clear_focus_window(&mut self, enabled: bool) {
        self.inner_mut().ConfigNavEscapeClearFocusWindow = enabled;
    }

    /// Returns whether the navigation cursor visibility is automatically managed.
    #[doc(alias = "ConfigNavCursorVisibleAuto")]
    pub fn config_nav_cursor_visible_auto(&self) -> bool {
        self.inner().ConfigNavCursorVisibleAuto
    }

    /// Set whether the navigation cursor visibility is automatically managed.
    #[doc(alias = "ConfigNavCursorVisibleAuto")]
    pub fn set_config_nav_cursor_visible_auto(&mut self, enabled: bool) {
        self.inner_mut().ConfigNavCursorVisibleAuto = enabled;
    }

    /// Returns whether the navigation cursor is always visible.
    #[doc(alias = "ConfigNavCursorVisibleAlways")]
    pub fn config_nav_cursor_visible_always(&self) -> bool {
        self.inner().ConfigNavCursorVisibleAlways
    }

    /// Set whether the navigation cursor is always visible.
    #[doc(alias = "ConfigNavCursorVisibleAlways")]
    pub fn set_config_nav_cursor_visible_always(&mut self, enabled: bool) {
        self.inner_mut().ConfigNavCursorVisibleAlways = enabled;
    }

    /// Returns whether docking is prevented from splitting nodes.
    #[doc(alias = "ConfigDockingNoSplit")]
    pub fn config_docking_no_split(&self) -> bool {
        self.inner().ConfigDockingNoSplit
    }

    /// Set whether docking is prevented from splitting nodes.
    #[doc(alias = "ConfigDockingNoSplit")]
    pub fn set_config_docking_no_split(&mut self, enabled: bool) {
        self.inner_mut().ConfigDockingNoSplit = enabled;
    }

    /// Returns whether docking over other windows is disabled.
    #[doc(alias = "ConfigDockingNoDockingOver")]
    pub fn config_docking_no_docking_over(&self) -> bool {
        self.inner().ConfigDockingNoDockingOver
    }

    /// Set whether docking over other windows is disabled.
    #[doc(alias = "ConfigDockingNoDockingOver")]
    pub fn set_config_docking_no_docking_over(&mut self, enabled: bool) {
        self.inner_mut().ConfigDockingNoDockingOver = enabled;
    }

    /// Returns whether docking requires holding Shift.
    #[doc(alias = "ConfigDockingWithShift")]
    pub fn config_docking_with_shift(&self) -> bool {
        self.inner().ConfigDockingWithShift
    }

    /// Set whether docking requires holding Shift.
    #[doc(alias = "ConfigDockingWithShift")]
    pub fn set_config_docking_with_shift(&mut self, enabled: bool) {
        self.inner_mut().ConfigDockingWithShift = enabled;
    }

    /// Returns whether docking uses a tab bar when possible.
    #[doc(alias = "ConfigDockingAlwaysTabBar")]
    pub fn config_docking_always_tab_bar(&self) -> bool {
        self.inner().ConfigDockingAlwaysTabBar
    }

    /// Set whether docking uses a tab bar when possible.
    #[doc(alias = "ConfigDockingAlwaysTabBar")]
    pub fn set_config_docking_always_tab_bar(&mut self, enabled: bool) {
        self.inner_mut().ConfigDockingAlwaysTabBar = enabled;
    }

    /// Returns whether docking payloads are rendered transparently.
    #[doc(alias = "ConfigDockingTransparentPayload")]
    pub fn config_docking_transparent_payload(&self) -> bool {
        self.inner().ConfigDockingTransparentPayload
    }

    /// Set whether docking payloads are rendered transparently.
    #[doc(alias = "ConfigDockingTransparentPayload")]
    pub fn set_config_docking_transparent_payload(&mut self, enabled: bool) {
        self.inner_mut().ConfigDockingTransparentPayload = enabled;
    }

    /// Returns whether viewports should avoid auto-merging.
    #[doc(alias = "ConfigViewportsNoAutoMerge")]
    pub fn config_viewports_no_auto_merge(&self) -> bool {
        self.inner().ConfigViewportsNoAutoMerge
    }

    /// Set whether viewports should avoid auto-merging.
    #[doc(alias = "ConfigViewportsNoAutoMerge")]
    pub fn set_config_viewports_no_auto_merge(&mut self, enabled: bool) {
        self.inner_mut().ConfigViewportsNoAutoMerge = enabled;
    }

    /// Returns whether viewports should avoid task bar icons.
    #[doc(alias = "ConfigViewportsNoTaskBarIcon")]
    pub fn config_viewports_no_task_bar_icon(&self) -> bool {
        self.inner().ConfigViewportsNoTaskBarIcon
    }

    /// Set whether viewports should avoid task bar icons.
    #[doc(alias = "ConfigViewportsNoTaskBarIcon")]
    pub fn set_config_viewports_no_task_bar_icon(&mut self, enabled: bool) {
        self.inner_mut().ConfigViewportsNoTaskBarIcon = enabled;
    }

    /// Returns whether viewports should avoid platform window decorations.
    #[doc(alias = "ConfigViewportsNoDecoration")]
    pub fn config_viewports_no_decoration(&self) -> bool {
        self.inner().ConfigViewportsNoDecoration
    }

    /// Set whether viewports should avoid platform window decorations.
    #[doc(alias = "ConfigViewportsNoDecoration")]
    pub fn set_config_viewports_no_decoration(&mut self, enabled: bool) {
        self.inner_mut().ConfigViewportsNoDecoration = enabled;
    }

    /// Returns whether viewports should not have a default parent.
    #[doc(alias = "ConfigViewportsNoDefaultParent")]
    pub fn config_viewports_no_default_parent(&self) -> bool {
        self.inner().ConfigViewportsNoDefaultParent
    }

    /// Set whether viewports should not have a default parent.
    #[doc(alias = "ConfigViewportsNoDefaultParent")]
    pub fn set_config_viewports_no_default_parent(&mut self, enabled: bool) {
        self.inner_mut().ConfigViewportsNoDefaultParent = enabled;
    }

    /// Returns whether platform focus also sets ImGui focus in viewports.
    #[doc(alias = "ConfigViewportsPlatformFocusSetsImGuiFocus")]
    pub fn config_viewports_platform_focus_sets_imgui_focus(&self) -> bool {
        self.inner().ConfigViewportsPlatformFocusSetsImGuiFocus
    }

    /// Set whether platform focus also sets ImGui focus in viewports.
    #[doc(alias = "ConfigViewportsPlatformFocusSetsImGuiFocus")]
    pub fn set_config_viewports_platform_focus_sets_imgui_focus(&mut self, enabled: bool) {
        self.inner_mut().ConfigViewportsPlatformFocusSetsImGuiFocus = enabled;
    }

    /// Returns whether fonts are scaled by DPI.
    #[doc(alias = "ConfigDpiScaleFonts")]
    pub fn config_dpi_scale_fonts(&self) -> bool {
        self.inner().ConfigDpiScaleFonts
    }

    /// Set whether fonts are scaled by DPI.
    #[doc(alias = "ConfigDpiScaleFonts")]
    pub fn set_config_dpi_scale_fonts(&mut self, enabled: bool) {
        self.inner_mut().ConfigDpiScaleFonts = enabled;
    }

    /// Returns whether viewports are scaled by DPI.
    #[doc(alias = "ConfigDpiScaleViewports")]
    pub fn config_dpi_scale_viewports(&self) -> bool {
        self.inner().ConfigDpiScaleViewports
    }

    /// Set whether viewports are scaled by DPI.
    #[doc(alias = "ConfigDpiScaleViewports")]
    pub fn set_config_dpi_scale_viewports(&mut self, enabled: bool) {
        self.inner_mut().ConfigDpiScaleViewports = enabled;
    }

    /// Returns whether to use MacOSX-style behaviors.
    #[doc(alias = "ConfigMacOSXBehaviors")]
    pub fn config_macosx_behaviors(&self) -> bool {
        self.inner().ConfigMacOSXBehaviors
    }

    /// Set whether to use MacOSX-style behaviors.
    #[doc(alias = "ConfigMacOSXBehaviors")]
    pub fn set_config_macosx_behaviors(&mut self, enabled: bool) {
        self.inner_mut().ConfigMacOSXBehaviors = enabled;
    }

    /// Returns whether to trickle input events through the queue.
    #[doc(alias = "ConfigInputTrickleEventQueue")]
    pub fn config_input_trickle_event_queue(&self) -> bool {
        self.inner().ConfigInputTrickleEventQueue
    }

    /// Set whether to trickle input events through the queue.
    #[doc(alias = "ConfigInputTrickleEventQueue")]
    pub fn set_config_input_trickle_event_queue(&mut self, enabled: bool) {
        self.inner_mut().ConfigInputTrickleEventQueue = enabled;
    }

    /// Returns whether the input text cursor blinks.
    #[doc(alias = "ConfigInputTextCursorBlink")]
    pub fn config_input_text_cursor_blink(&self) -> bool {
        self.inner().ConfigInputTextCursorBlink
    }

    /// Set whether the input text cursor blinks.
    #[doc(alias = "ConfigInputTextCursorBlink")]
    pub fn set_config_input_text_cursor_blink(&mut self, enabled: bool) {
        self.inner_mut().ConfigInputTextCursorBlink = enabled;
    }

    /// Returns whether Enter keeps the input text active.
    #[doc(alias = "ConfigInputTextEnterKeepActive")]
    pub fn config_input_text_enter_keep_active(&self) -> bool {
        self.inner().ConfigInputTextEnterKeepActive
    }

    /// Set whether Enter keeps the input text active.
    #[doc(alias = "ConfigInputTextEnterKeepActive")]
    pub fn set_config_input_text_enter_keep_active(&mut self, enabled: bool) {
        self.inner_mut().ConfigInputTextEnterKeepActive = enabled;
    }

    /// Returns whether click-drag on numeric widgets turns into text input.
    #[doc(alias = "ConfigDragClickToInputText")]
    pub fn config_drag_click_to_input_text(&self) -> bool {
        self.inner().ConfigDragClickToInputText
    }

    /// Set whether click-drag on numeric widgets turns into text input.
    #[doc(alias = "ConfigDragClickToInputText")]
    pub fn set_config_drag_click_to_input_text(&mut self, enabled: bool) {
        self.inner_mut().ConfigDragClickToInputText = enabled;
    }

    /// Returns whether windows can be moved only from their title bar.
    ///
    /// When enabled, click-dragging on empty window content will no longer move the window.
    /// This can be useful in multi-viewport setups to avoid accidental platform window moves
    /// while interacting with in-window widgets (e.g. gizmos in a scene view).
    #[doc(alias = "ConfigWindowsMoveFromTitleBarOnly")]
    pub fn config_windows_move_from_title_bar_only(&self) -> bool {
        self.inner().ConfigWindowsMoveFromTitleBarOnly
    }

    /// Set whether windows can be moved only from their title bar.
    ///
    /// Note: This is typically latched by Dear ImGui at the start of the frame. Prefer setting it
    /// during initialization or before calling `Context::frame()`.
    #[doc(alias = "ConfigWindowsMoveFromTitleBarOnly")]
    pub fn set_config_windows_move_from_title_bar_only(&mut self, enabled: bool) {
        self.inner_mut().ConfigWindowsMoveFromTitleBarOnly = enabled;
    }

    /// Returns whether windows can be resized from their edges.
    #[doc(alias = "ConfigWindowsResizeFromEdges")]
    pub fn config_windows_resize_from_edges(&self) -> bool {
        self.inner().ConfigWindowsResizeFromEdges
    }

    /// Set whether windows can be resized from their edges.
    #[doc(alias = "ConfigWindowsResizeFromEdges")]
    pub fn set_config_windows_resize_from_edges(&mut self, enabled: bool) {
        self.inner_mut().ConfigWindowsResizeFromEdges = enabled;
    }

    /// Returns whether Ctrl+C copies window contents.
    #[doc(alias = "ConfigWindowsCopyContentsWithCtrlC")]
    pub fn config_windows_copy_contents_with_ctrl_c(&self) -> bool {
        self.inner().ConfigWindowsCopyContentsWithCtrlC
    }

    /// Set whether Ctrl+C copies window contents.
    #[doc(alias = "ConfigWindowsCopyContentsWithCtrlC")]
    pub fn set_config_windows_copy_contents_with_ctrl_c(&mut self, enabled: bool) {
        self.inner_mut().ConfigWindowsCopyContentsWithCtrlC = enabled;
    }

    /// Returns whether scrollbars scroll by page.
    #[doc(alias = "ConfigScrollbarScrollByPage")]
    pub fn config_scrollbar_scroll_by_page(&self) -> bool {
        self.inner().ConfigScrollbarScrollByPage
    }

    /// Set whether scrollbars scroll by page.
    #[doc(alias = "ConfigScrollbarScrollByPage")]
    pub fn set_config_scrollbar_scroll_by_page(&mut self, enabled: bool) {
        self.inner_mut().ConfigScrollbarScrollByPage = enabled;
    }

    /// Returns the memory compact timer (seconds).
    #[doc(alias = "ConfigMemoryCompactTimer")]
    pub fn config_memory_compact_timer(&self) -> f32 {
        self.inner().ConfigMemoryCompactTimer
    }

    /// Set the memory compact timer (seconds).
    #[doc(alias = "ConfigMemoryCompactTimer")]
    pub fn set_config_memory_compact_timer(&mut self, seconds: f32) {
        self.inner_mut().ConfigMemoryCompactTimer = seconds;
    }

    /// Returns the time for a double-click (seconds).
    #[doc(alias = "MouseDoubleClickTime")]
    pub fn mouse_double_click_time(&self) -> f32 {
        self.inner().MouseDoubleClickTime
    }

    /// Set the time for a double-click (seconds).
    #[doc(alias = "MouseDoubleClickTime")]
    pub fn set_mouse_double_click_time(&mut self, seconds: f32) {
        self.inner_mut().MouseDoubleClickTime = seconds;
    }

    /// Returns the maximum distance to qualify as a double-click (pixels).
    #[doc(alias = "MouseDoubleClickMaxDist")]
    pub fn mouse_double_click_max_dist(&self) -> f32 {
        self.inner().MouseDoubleClickMaxDist
    }

    /// Set the maximum distance to qualify as a double-click (pixels).
    #[doc(alias = "MouseDoubleClickMaxDist")]
    pub fn set_mouse_double_click_max_dist(&mut self, pixels: f32) {
        self.inner_mut().MouseDoubleClickMaxDist = pixels;
    }

    /// Returns the distance threshold for starting a drag (pixels).
    #[doc(alias = "MouseDragThreshold")]
    pub fn mouse_drag_threshold(&self) -> f32 {
        self.inner().MouseDragThreshold
    }

    /// Set the distance threshold for starting a drag (pixels).
    #[doc(alias = "MouseDragThreshold")]
    pub fn set_mouse_drag_threshold(&mut self, pixels: f32) {
        self.inner_mut().MouseDragThreshold = pixels;
    }

    /// Returns the key repeat delay (seconds).
    #[doc(alias = "KeyRepeatDelay")]
    pub fn key_repeat_delay(&self) -> f32 {
        self.inner().KeyRepeatDelay
    }

    /// Set the key repeat delay (seconds).
    #[doc(alias = "KeyRepeatDelay")]
    pub fn set_key_repeat_delay(&mut self, seconds: f32) {
        self.inner_mut().KeyRepeatDelay = seconds;
    }

    /// Returns the key repeat rate (seconds).
    #[doc(alias = "KeyRepeatRate")]
    pub fn key_repeat_rate(&self) -> f32 {
        self.inner().KeyRepeatRate
    }

    /// Set the key repeat rate (seconds).
    #[doc(alias = "KeyRepeatRate")]
    pub fn set_key_repeat_rate(&mut self, seconds: f32) {
        self.inner_mut().KeyRepeatRate = seconds;
    }

    /// Returns whether error recovery is enabled.
    #[doc(alias = "ConfigErrorRecovery")]
    pub fn config_error_recovery(&self) -> bool {
        self.inner().ConfigErrorRecovery
    }

    /// Set whether error recovery is enabled.
    #[doc(alias = "ConfigErrorRecovery")]
    pub fn set_config_error_recovery(&mut self, enabled: bool) {
        self.inner_mut().ConfigErrorRecovery = enabled;
    }

    /// Returns whether error recovery enables asserts.
    #[doc(alias = "ConfigErrorRecoveryEnableAssert")]
    pub fn config_error_recovery_enable_assert(&self) -> bool {
        self.inner().ConfigErrorRecoveryEnableAssert
    }

    /// Set whether error recovery enables asserts.
    #[doc(alias = "ConfigErrorRecoveryEnableAssert")]
    pub fn set_config_error_recovery_enable_assert(&mut self, enabled: bool) {
        self.inner_mut().ConfigErrorRecoveryEnableAssert = enabled;
    }

    /// Returns whether error recovery enables debug logs.
    #[doc(alias = "ConfigErrorRecoveryEnableDebugLog")]
    pub fn config_error_recovery_enable_debug_log(&self) -> bool {
        self.inner().ConfigErrorRecoveryEnableDebugLog
    }

    /// Set whether error recovery enables debug logs.
    #[doc(alias = "ConfigErrorRecoveryEnableDebugLog")]
    pub fn set_config_error_recovery_enable_debug_log(&mut self, enabled: bool) {
        self.inner_mut().ConfigErrorRecoveryEnableDebugLog = enabled;
    }

    /// Returns whether error recovery enables tooltips.
    #[doc(alias = "ConfigErrorRecoveryEnableTooltip")]
    pub fn config_error_recovery_enable_tooltip(&self) -> bool {
        self.inner().ConfigErrorRecoveryEnableTooltip
    }

    /// Set whether error recovery enables tooltips.
    #[doc(alias = "ConfigErrorRecoveryEnableTooltip")]
    pub fn set_config_error_recovery_enable_tooltip(&mut self, enabled: bool) {
        self.inner_mut().ConfigErrorRecoveryEnableTooltip = enabled;
    }

    /// Returns whether Dear ImGui thinks a debugger is present.
    #[doc(alias = "ConfigDebugIsDebuggerPresent")]
    pub fn config_debug_is_debugger_present(&self) -> bool {
        self.inner().ConfigDebugIsDebuggerPresent
    }

    /// Set whether Dear ImGui thinks a debugger is present.
    #[doc(alias = "ConfigDebugIsDebuggerPresent")]
    pub fn set_config_debug_is_debugger_present(&mut self, enabled: bool) {
        self.inner_mut().ConfigDebugIsDebuggerPresent = enabled;
    }

    /// Returns whether to highlight ID conflicts.
    #[doc(alias = "ConfigDebugHighlightIdConflicts")]
    pub fn config_debug_highlight_id_conflicts(&self) -> bool {
        self.inner().ConfigDebugHighlightIdConflicts
    }

    /// Set whether to highlight ID conflicts.
    #[doc(alias = "ConfigDebugHighlightIdConflicts")]
    pub fn set_config_debug_highlight_id_conflicts(&mut self, enabled: bool) {
        self.inner_mut().ConfigDebugHighlightIdConflicts = enabled;
    }

    /// Returns whether to show the item picker when highlighting ID conflicts.
    #[doc(alias = "ConfigDebugHighlightIdConflictsShowItemPicker")]
    pub fn config_debug_highlight_id_conflicts_show_item_picker(&self) -> bool {
        self.inner().ConfigDebugHighlightIdConflictsShowItemPicker
    }

    /// Set whether to show the item picker when highlighting ID conflicts.
    #[doc(alias = "ConfigDebugHighlightIdConflictsShowItemPicker")]
    pub fn set_config_debug_highlight_id_conflicts_show_item_picker(&mut self, enabled: bool) {
        self.inner_mut()
            .ConfigDebugHighlightIdConflictsShowItemPicker = enabled;
    }

    /// Returns whether `Begin()` returns `true` once.
    #[doc(alias = "ConfigDebugBeginReturnValueOnce")]
    pub fn config_debug_begin_return_value_once(&self) -> bool {
        self.inner().ConfigDebugBeginReturnValueOnce
    }

    /// Set whether `Begin()` returns `true` once.
    #[doc(alias = "ConfigDebugBeginReturnValueOnce")]
    pub fn set_config_debug_begin_return_value_once(&mut self, enabled: bool) {
        self.inner_mut().ConfigDebugBeginReturnValueOnce = enabled;
    }

    /// Returns whether `Begin()` returns `true` in a loop.
    #[doc(alias = "ConfigDebugBeginReturnValueLoop")]
    pub fn config_debug_begin_return_value_loop(&self) -> bool {
        self.inner().ConfigDebugBeginReturnValueLoop
    }

    /// Set whether `Begin()` returns `true` in a loop.
    #[doc(alias = "ConfigDebugBeginReturnValueLoop")]
    pub fn set_config_debug_begin_return_value_loop(&mut self, enabled: bool) {
        self.inner_mut().ConfigDebugBeginReturnValueLoop = enabled;
    }

    /// Returns whether to ignore focus loss.
    #[doc(alias = "ConfigDebugIgnoreFocusLoss")]
    pub fn config_debug_ignore_focus_loss(&self) -> bool {
        self.inner().ConfigDebugIgnoreFocusLoss
    }

    /// Set whether to ignore focus loss.
    #[doc(alias = "ConfigDebugIgnoreFocusLoss")]
    pub fn set_config_debug_ignore_focus_loss(&mut self, enabled: bool) {
        self.inner_mut().ConfigDebugIgnoreFocusLoss = enabled;
    }

    /// Returns whether to display ini settings debug tools.
    #[doc(alias = "ConfigDebugIniSettings")]
    pub fn config_debug_ini_settings(&self) -> bool {
        self.inner().ConfigDebugIniSettings
    }

    /// Set whether to display ini settings debug tools.
    #[doc(alias = "ConfigDebugIniSettings")]
    pub fn set_config_debug_ini_settings(&mut self, enabled: bool) {
        self.inner_mut().ConfigDebugIniSettings = enabled;
    }

    /// Returns the backend platform name, if set.
    ///
    /// Note: to set this safely, use `Context::set_platform_name()`.
    #[doc(alias = "BackendPlatformName")]
    pub fn backend_platform_name(&self) -> Option<&CStr> {
        let ptr = self.inner().BackendPlatformName;
        unsafe { (!ptr.is_null()).then(|| CStr::from_ptr(ptr)) }
    }

    /// Returns the backend renderer name, if set.
    ///
    /// Note: to set this safely, use `Context::set_renderer_name()`.
    #[doc(alias = "BackendRendererName")]
    pub fn backend_renderer_name(&self) -> Option<&CStr> {
        let ptr = self.inner().BackendRendererName;
        unsafe { (!ptr.is_null()).then(|| CStr::from_ptr(ptr)) }
    }

    /// Returns the backend platform user data pointer.
    #[doc(alias = "BackendPlatformUserData")]
    pub fn backend_platform_user_data(&self) -> *mut c_void {
        self.inner().BackendPlatformUserData
    }

    /// Set the backend platform user data pointer.
    #[doc(alias = "BackendPlatformUserData")]
    pub fn set_backend_platform_user_data(&mut self, user_data: *mut c_void) {
        self.inner_mut().BackendPlatformUserData = user_data;
    }

    /// Returns the backend renderer user data pointer.
    #[doc(alias = "BackendRendererUserData")]
    pub fn backend_renderer_user_data(&self) -> *mut c_void {
        self.inner().BackendRendererUserData
    }

    /// Set the backend renderer user data pointer.
    #[doc(alias = "BackendRendererUserData")]
    pub fn set_backend_renderer_user_data(&mut self, user_data: *mut c_void) {
        self.inner_mut().BackendRendererUserData = user_data;
    }

    /// Returns the backend language user data pointer.
    #[doc(alias = "BackendLanguageUserData")]
    pub fn backend_language_user_data(&self) -> *mut c_void {
        self.inner().BackendLanguageUserData
    }

    /// Set the backend language user data pointer.
    #[doc(alias = "BackendLanguageUserData")]
    pub fn set_backend_language_user_data(&mut self, user_data: *mut c_void) {
        self.inner_mut().BackendLanguageUserData = user_data;
    }

    /// Backend flags
    pub fn backend_flags(&self) -> BackendFlags {
        BackendFlags::from_bits_truncate(self.inner().BackendFlags)
    }

    /// Set backend flags
    pub fn set_backend_flags(&mut self, flags: BackendFlags) {
        self.inner_mut().BackendFlags = flags.bits();
    }

    /// Add a key event to the input queue
    pub fn add_key_event(&mut self, key: crate::Key, down: bool) {
        unsafe {
            sys::ImGuiIO_AddKeyEvent(self.inner_mut() as *mut _, key.into(), down);
        }
    }

    /// Add a character input event to the input queue
    pub fn add_input_character(&mut self, character: char) {
        unsafe {
            sys::ImGuiIO_AddInputCharacter(self.inner_mut() as *mut _, character as u32);
        }
    }

    /// Add a mouse position event to the input queue
    pub fn add_mouse_pos_event(&mut self, pos: [f32; 2]) {
        unsafe {
            sys::ImGuiIO_AddMousePosEvent(self.inner_mut() as *mut _, pos[0], pos[1]);
        }
    }

    /// Add a mouse button event to the input queue
    pub fn add_mouse_button_event(&mut self, button: crate::input::MouseButton, down: bool) {
        unsafe {
            sys::ImGuiIO_AddMouseButtonEvent(self.inner_mut() as *mut _, button.into(), down);
        }
    }

    /// Add a mouse wheel event to the input queue
    pub fn add_mouse_wheel_event(&mut self, wheel: [f32; 2]) {
        unsafe {
            sys::ImGuiIO_AddMouseWheelEvent(self.inner_mut() as *mut _, wheel[0], wheel[1]);
        }
    }

    /// Add a mouse source event to the input queue.
    ///
    /// When the input source switches between mouse / touch screen / pen,
    /// backends should call this before submitting other mouse events for
    /// the frame.
    pub fn add_mouse_source_event(&mut self, source: crate::input::MouseSource) {
        unsafe {
            sys::ImGuiIO_AddMouseSourceEvent(self.inner_mut() as *mut _, source.into());
        }
    }

    /// Queue the hovered viewport id for the current frame.
    ///
    /// When multi-viewport is enabled and the backend can reliably obtain
    /// the ImGui viewport hovered by the OS mouse, it should set
    /// `BackendFlags::HAS_MOUSE_HOVERED_VIEWPORT` and call this once per
    /// frame.
    pub fn add_mouse_viewport_event(&mut self, viewport_id: crate::Id) {
        unsafe {
            sys::ImGuiIO_AddMouseViewportEvent(self.inner_mut() as *mut _, viewport_id.raw());
        }
    }

    /// Notify Dear ImGui that the application window gained or lost focus
    /// This mirrors `io.AddFocusEvent()` in Dear ImGui and is used by platform backends.
    pub fn add_focus_event(&mut self, focused: bool) {
        unsafe {
            sys::ImGuiIO_AddFocusEvent(self.inner_mut() as *mut _, focused);
        }
    }

    /// Get the global font scale (not available in current Dear ImGui version)
    /// Compatibility shim: maps to style.FontScaleMain (Dear ImGui 1.92+)
    pub fn font_global_scale(&self) -> f32 {
        unsafe { (*sys::igGetStyle()).FontScaleMain }
    }

    /// Set the global font scale (not available in current Dear ImGui version)
    /// Compatibility shim: maps to style.FontScaleMain (Dear ImGui 1.92+)
    pub fn set_font_global_scale(&mut self, _scale: f32) {
        unsafe {
            (*sys::igGetStyle()).FontScaleMain = _scale;
        }
    }

    /// Get the display framebuffer scale
    pub fn display_framebuffer_scale(&self) -> [f32; 2] {
        let scale = self.inner().DisplayFramebufferScale;
        [scale.x, scale.y]
    }

    /// Returns the mouse delta from the previous frame, in pixels.
    #[doc(alias = "MouseDelta")]
    pub fn mouse_delta(&self) -> [f32; 2] {
        let delta = self.inner().MouseDelta;
        [delta.x, delta.y]
    }

    /// Returns whether Ctrl modifier is held.
    #[doc(alias = "KeyCtrl")]
    pub fn key_ctrl(&self) -> bool {
        self.inner().KeyCtrl
    }

    /// Returns whether Shift modifier is held.
    #[doc(alias = "KeyShift")]
    pub fn key_shift(&self) -> bool {
        self.inner().KeyShift
    }

    /// Returns whether Alt modifier is held.
    #[doc(alias = "KeyAlt")]
    pub fn key_alt(&self) -> bool {
        self.inner().KeyAlt
    }

    /// Returns whether Super/Command modifier is held.
    #[doc(alias = "KeySuper")]
    pub fn key_super(&self) -> bool {
        self.inner().KeySuper
    }

    /// Returns the current mouse input source.
    #[doc(alias = "MouseSource")]
    pub fn mouse_source(&self) -> crate::input::MouseSource {
        match self.inner().MouseSource {
            sys::ImGuiMouseSource_Mouse => crate::input::MouseSource::Mouse,
            sys::ImGuiMouseSource_TouchScreen => crate::input::MouseSource::TouchScreen,
            sys::ImGuiMouseSource_Pen => crate::input::MouseSource::Pen,
            _ => crate::input::MouseSource::Mouse,
        }
    }

    /// Returns the viewport id hovered by the OS mouse (if supported by the backend).
    #[doc(alias = "MouseHoveredViewport")]
    pub fn mouse_hovered_viewport(&self) -> crate::Id {
        crate::Id::from(self.inner().MouseHoveredViewport)
    }

    /// Returns whether Ctrl+LeftClick should be treated as RightClick.
    #[doc(alias = "MouseCtrlLeftAsRightClick")]
    pub fn mouse_ctrl_left_as_right_click(&self) -> bool {
        self.inner().MouseCtrlLeftAsRightClick
    }

    /// Set whether Ctrl+LeftClick should be treated as RightClick.
    #[doc(alias = "MouseCtrlLeftAsRightClick")]
    pub fn set_mouse_ctrl_left_as_right_click(&mut self, enabled: bool) {
        self.inner_mut().MouseCtrlLeftAsRightClick = enabled;
    }

    /// Set the display framebuffer scale
    /// This is important for HiDPI displays to ensure proper rendering
    pub fn set_display_framebuffer_scale(&mut self, scale: [f32; 2]) {
        self.inner_mut().DisplayFramebufferScale.x = scale[0];
        self.inner_mut().DisplayFramebufferScale.y = scale[1];
    }
}