aflak_imgui_sys/
lib.rs

1#![allow(non_upper_case_globals)]
2
3#[macro_use]
4extern crate bitflags;
5
6extern crate libc;
7
8#[cfg(feature = "gfx")]
9#[macro_use]
10extern crate gfx;
11
12#[cfg(feature = "glium")]
13extern crate glium;
14
15use std::convert::From;
16use std::mem;
17use std::os::raw::{c_char, c_float, c_int, c_short, c_uchar, c_uint, c_ushort, c_void};
18use std::slice;
19
20#[cfg(feature = "gfx")]
21mod gfx_support;
22
23#[cfg(feature = "glium")]
24mod glium_support;
25
26/// ImGui context (opaque)
27pub enum ImGuiContext { }
28
29/// 32-bit unsigned integer (typically used to store packed colors)
30pub type ImU32 = c_uint;
31
32/// Character for keyboard input/display
33pub type ImWchar = c_ushort;
34
35/// User data to identify a texture
36pub type ImTextureID = *mut c_void;
37
38/// Unique ID used by widgets (typically hashed from a stack of string)
39pub type ImGuiID = ImU32;
40
41/// A color identifier for styling
42#[repr(C)]
43#[derive(Copy, Clone, Debug, PartialEq, Eq)]
44pub enum ImGuiCol {
45    Text,
46    TextDisabled,
47    WindowBg,
48    ChildBg,
49    PopupBg,
50    Border,
51    BorderShadow,
52    FrameBg,
53    FrameBgHovered,
54    FrameBgActive,
55    TitleBg,
56    TitleBgActive,
57    TitleBgCollapsed,
58    MenuBarBg,
59    ScrollbarBg,
60    ScrollbarGrab,
61    ScrollbarGrabHovered,
62    ScrollbarGrabActive,
63    CheckMark,
64    SliderGrab,
65    SliderGrabActive,
66    Button,
67    ButtonHovered,
68    ButtonActive,
69    Header,
70    HeaderHovered,
71    HeaderActive,
72    Separator,
73    SeparatorHovered,
74    SeparatorActive,
75    ResizeGrip,
76    ResizeGripHovered,
77    ResizeGripActive,
78    CloseButton,
79    CloseButtonHovered,
80    CloseButtonActive,
81    PlotLines,
82    PlotLinesHovered,
83    PlotHistogram,
84    PlotHistogramHovered,
85    TextSelectedBg,
86    ModalWindowDarkening,
87    DragDropTarget,
88}
89impl ImGuiCol {
90    #[deprecated(since = "0.0.19", note = "ComboBg has been merged with PopupBg. Please use PopupBg instead")]
91    pub const ComboBg: ImGuiCol = ImGuiCol::PopupBg;
92    #[deprecated(since = "0.0.19", note = "please use ChildBg instead")]
93    pub const ChildWindowBg: ImGuiCol = ImGuiCol::ChildBg;
94
95    pub fn values() -> &'static [ImGuiCol] {
96        use ImGuiCol::*;
97        static values: &'static [ImGuiCol] = &[
98            Text,
99            TextDisabled,
100            WindowBg,
101            ChildBg,
102            PopupBg,
103            Border,
104            BorderShadow,
105            FrameBg,
106            FrameBgHovered,
107            FrameBgActive,
108            TitleBg,
109            TitleBgActive,
110            TitleBgCollapsed,
111            MenuBarBg,
112            ScrollbarBg,
113            ScrollbarGrab,
114            ScrollbarGrabHovered,
115            ScrollbarGrabActive,
116            CheckMark,
117            SliderGrab,
118            SliderGrabActive,
119            Button,
120            ButtonHovered,
121            ButtonActive,
122            Header,
123            HeaderHovered,
124            HeaderActive,
125            Separator,
126            SeparatorHovered,
127            SeparatorActive,
128            ResizeGrip,
129            ResizeGripHovered,
130            ResizeGripActive,
131            CloseButton,
132            CloseButtonHovered,
133            CloseButtonActive,
134            PlotLines,
135            PlotLinesHovered,
136            PlotHistogram,
137            PlotHistogramHovered,
138            TextSelectedBg,
139            ModalWindowDarkening,
140            DragDropTarget,
141        ];
142        values
143    }
144}
145pub const ImGuiCol_COUNT: usize = 43;
146
147/// A variable identifier for styling
148#[repr(C)]
149#[derive(Copy, Clone, Debug, PartialEq, Eq)]
150pub enum ImGuiStyleVar {
151    Alpha,
152    WindowPadding,
153    WindowRounding,
154    WindowBorderSize,
155    WindowMinSize,
156    ChildRounding,
157    ChildBorderSize,
158    PopupRounding,
159    PopupBorderSize,
160    FramePadding,
161    FrameRounding,
162    FrameBorderSize,
163    ItemSpacing,
164    ItemInnerSpacing,
165    IndentSpacing,
166    GrabMinSize,
167    ButtonTextAlign,
168}
169pub const ImGuiStyleVar_COUNT: usize = 17;
170
171impl ImGuiStyleVar {
172    #[deprecated(since = "0.0.19", note = "please use ChildRounding instead")]
173    pub const ChildWindowRounding: ImGuiStyleVar = ImGuiStyleVar::ChildRounding;
174}
175
176/// A key identifier (ImGui-side enum)
177#[repr(C)]
178#[derive(Copy, Clone, Debug, PartialEq, Eq)]
179pub enum ImGuiKey {
180    Tab,
181    LeftArrow,
182    RightArrow,
183    UpArrow,
184    DownArrow,
185    PageUp,
186    PageDown,
187    Home,
188    End,
189    Delete,
190    Backspace,
191    Enter,
192    Escape,
193    A,
194    C,
195    V,
196    X,
197    Y,
198    Z,
199}
200pub const ImGuiKey_COUNT: usize = 19;
201
202bitflags!(
203    /// Color edit flags
204    #[repr(C)]
205    pub struct ImGuiColorEditFlags: c_int {
206        const NoAlpha          = 1 << 1;
207        const NoPicker         = 1 << 2;
208        const NoOptions        = 1 << 3;
209        const NoSmallPreview   = 1 << 4;
210        const NoInputs         = 1 << 5;
211        const NoTooltip        = 1 << 6;
212        const NoLabel          = 1 << 7;
213        const NoSidePreview    = 1 << 8;
214        const AlphaBar         = 1 << 9;
215        const AlphaPreview     = 1 << 10;
216        const AlphaPreviewHalf = 1 << 11;
217        const HDR              = 1 << 12;
218        const RGB              = 1 << 13;
219        const HSV              = 1 << 14;
220        const HEX              = 1 << 15;
221        const Uint8            = 1 << 16;
222        const Float            = 1 << 17;
223        const PickerHueBar     = 1 << 18;
224        const PickerHueWheel   = 1 << 19;
225    }
226);
227
228/// A mouse cursor identifier
229#[repr(C)]
230#[derive(Copy, Clone, Debug, PartialEq, Eq)]
231pub enum ImGuiMouseCursor {
232    None = -1,
233    Arrow,
234    TextInput,
235    Move,
236    ResizeNS,
237    ResizeEW,
238    ResizeNESW,
239    ResizeNWSE,
240}
241pub const ImGuiMouseCursor_COUNT: usize = 7;
242
243bitflags!(
244    /// Window flags
245    #[repr(C)]
246    pub struct ImGuiWindowFlags: c_int {
247        const NoTitleBar                = 1;
248        const NoResize                  = 1 << 1;
249        const NoMove                    = 1 << 2;
250        const NoScrollbar               = 1 << 3;
251        const NoScrollWithMouse         = 1 << 4;
252        const NoCollapse                = 1 << 5;
253        const AlwaysAutoResize          = 1 << 6;
254        const NoSavedSettings           = 1 << 8;
255        const NoInputs                  = 1 << 9;
256        const MenuBar                   = 1 << 10;
257        const HorizontalScrollbar       = 1 << 11;
258        const NoFocusOnAppearing        = 1 << 12;
259        const NoBringToFrontOnFocus     = 1 << 13;
260        const AlwaysVerticalScrollbar   = 1 << 14;
261        const AlwaysHorizontalScrollbar = 1 << 15;
262        const AlwaysUseWindowPadding    = 1 << 16;
263        const ResizeFromAnySide         = 1 << 17;
264    }
265);
266
267bitflags!(
268    /// Condition flags
269    #[repr(C)]
270    pub struct ImGuiCond: c_int {
271        const Always       = 1;
272        const Once         = 1 << 1;
273        const FirstUseEver = 1 << 2;
274        const Appearing    = 1 << 3;
275    }
276);
277
278bitflags!(
279    /// Flags for text inputs
280    #[repr(C)]
281    pub struct ImGuiInputTextFlags: c_int {
282        const CharsDecimal        = 1;
283        const CharsHexadecimal    = 1 << 1;
284        const CharsUppercase      = 1 << 2;
285        const CharsNoBlank        = 1 << 3;
286        const AutoSelectAll       = 1 << 4;
287        const EnterReturnsTrue    = 1 << 5;
288        const CallbackCompletion  = 1 << 6;
289        const CallbackHistory     = 1 << 7;
290        const CallbackAlways      = 1 << 8;
291        const CallbackCharFilter  = 1 << 9;
292        const AllowTabInput       = 1 << 10;
293        const CtrlEnterForNewLine = 1 << 11;
294        const NoHorizontalScroll  = 1 << 12;
295        const AlwaysInsertMode    = 1 << 13;
296        const ReadOnly            = 1 << 14;
297        const Password            = 1 << 15;
298        const NoUndoRedo          = 1 << 16;
299    }
300);
301
302bitflags!(
303    /// Flags for selectables
304    #[repr(C)]
305    pub struct ImGuiSelectableFlags: c_int {
306        const DontClosePopups  = 1;
307        const SpanAllColumns   = 1 << 1;
308        const AllowDoubleClick = 1 << 2;
309    }
310);
311
312bitflags!(
313    /// Flags for trees and collapsing headers
314    #[repr(C)]
315    pub struct ImGuiTreeNodeFlags: c_int {
316        const Selected          = 1;
317        const Framed            = 1 << 1;
318        #[deprecated(since = "0.0.19", note = "please use AllowItemOverlap instead")]
319        const AllowOverlapMode  = 1 << 2;
320        const AllowItemOverlap  = 1 << 2;
321        const NoTreePushOnOpen  = 1 << 3;
322        const NoAutoOpenOnLog   = 1 << 4;
323        const DefaultOpen       = 1 << 5;
324        const OpenOnDoubleClick = 1 << 6;
325        const OpenOnArrow       = 1 << 7;
326        const Leaf              = 1 << 8;
327        const Bullet            = 1 << 9;
328        const FramePadding      = 1 << 10;
329        const CollapsingHeader  =
330            ImGuiTreeNodeFlags::Framed.bits | ImGuiTreeNodeFlags::NoAutoOpenOnLog.bits;
331    }
332);
333
334bitflags!(
335    /// Flags for window focus check
336    #[repr(C)]
337    pub struct ImGuiFocusedFlags: c_int {
338        const ChildWindows = 1 << 0;
339        const RootWindow = 1 << 1;
340        const RootAndChildWindows =
341            ImGuiFocusedFlags::RootWindow.bits | ImGuiFocusedFlags::ChildWindows.bits;
342    }
343);
344
345bitflags!(
346    /// Flags for hover checks
347    #[repr(C)]
348    pub struct ImGuiHoveredFlags: c_int {
349        const ChildWindows                 = 1 << 0;
350        const RootWindow                   = 1 << 1;
351        const AllowWhenBlockedByPopup      = 1 << 2;
352        const AllowWhenBlockedByActiveItem = 1 << 4;
353        const AllowWhenOverlapped          = 1 << 5;
354        const RectOnly = ImGuiHoveredFlags::AllowWhenBlockedByPopup.bits
355            | ImGuiHoveredFlags::AllowWhenBlockedByActiveItem.bits
356            | ImGuiHoveredFlags::AllowWhenOverlapped.bits;
357        const RootAndChildWindows = ImGuiFocusedFlags::RootWindow.bits
358            | ImGuiFocusedFlags::ChildWindows.bits;
359    }
360);
361
362bitflags!(
363    /// Flags for igBeginCombo
364    #[repr(C)]
365    pub struct ImGuiComboFlags: c_int {
366        /// Align the popup toward the left by default
367        const PopupAlignLeft = 1 << 0;
368        /// Max ~4 items visible.
369        /// Tip: If you want your combo popup to be a specific size you can use
370        /// igSetNextWindowSizeConstraints() prior to calling igBeginCombo()
371        const HeightSmall    = 1 << 1;
372        /// Max ~8 items visible (default)
373        const HeightRegular  = 1 << 2;
374        /// Max ~20 items visible
375        const HeightLarge    = 1 << 3;
376        /// As many fitting items as possible
377        const HeightLargest  = 1 << 4;
378        const HeightMask     = ImGuiComboFlags::HeightSmall.bits
379            | ImGuiComboFlags::HeightRegular.bits
380            | ImGuiComboFlags::HeightLarge.bits
381            | ImGuiComboFlags::HeightLargest.bits;
382    }
383);
384
385bitflags!(
386    /// Flags for igBeginDragDropSource(), igAcceptDragDropPayload()
387    #[repr(C)]
388    pub struct ImGuiDragDropFlags: c_int {
389        // BeginDragDropSource() flags
390        /// By default, a successful call to igBeginDragDropSource opens a
391        /// tooltip so you can display a preview or description of the source
392        /// contents. This flag disable this behavior.
393        const SourceNoPreviewTooltip   = 1 << 0;
394        /// By default, when dragging we clear data so that igIsItemHovered()
395        /// will return true, to avoid subsequent user code submitting tooltips.
396        /// This flag disable this behavior so you can still call
397        /// igIsItemHovered() on the source item.
398        const SourceNoDisableHover     = 1 << 1;
399        /// Disable the behavior that allows to open tree nodes and collapsing
400        /// header by holding over them while dragging a source item.
401        const SourceNoHoldToOpenOthers = 1 << 2;
402        /// Allow items such as igText(), igImage() that have no unique
403        /// identifier to be used as drag source, by manufacturing a temporary
404        /// identifier based on their window-relative position. This is
405        /// extremely unusual within the dear imgui ecosystem and so we made it
406        /// explicit.
407        const SourceAllowNullID        = 1 << 3;
408        /// External source (from outside of imgui), won't attempt to read
409        /// current item/window info. Will always return true. Only one Extern
410        /// source can be active simultaneously.
411        const SourceExtern             = 1 << 4;
412        // AcceptDragDropPayload() flags
413        /// igAcceptDragDropPayload() will returns true even before the mouse
414        /// button is released. You can then call igIsDelivery() to test if the
415        /// payload needs to be delivered.
416        const AcceptBeforeDelivery     = 1 << 10;
417        /// Do not draw the default highlight rectangle when hovering over target.
418        const AcceptNoDrawDefaultRect  = 1 << 11;
419        /// For peeking ahead and inspecting the payload before delivery.
420        const AcceptPeekOnly           = ImGuiDragDropFlags::AcceptBeforeDelivery.bits
421            | ImGuiDragDropFlags::AcceptNoDrawDefaultRect.bits;
422    }
423);
424
425bitflags!(
426    /// Flags for indictating which corner of a rectangle should be rounded
427    #[repr(C)]
428    pub struct ImDrawCornerFlags: c_int {
429        const TopLeft  = 1 << 0;
430        const TopRight = 1 << 1;
431        const BotLeft  = 1 << 2;
432        const BotRight = 1 << 3;
433        const Top      = ImDrawCornerFlags::TopLeft.bits
434                       | ImDrawCornerFlags::TopRight.bits;
435        const Bot      = ImDrawCornerFlags::BotLeft.bits
436                       | ImDrawCornerFlags::BotRight.bits;
437        const Left     = ImDrawCornerFlags::TopLeft.bits
438                       | ImDrawCornerFlags::BotLeft.bits;
439        const Right    = ImDrawCornerFlags::TopRight.bits
440                       | ImDrawCornerFlags::BotRight.bits;
441        const All      = 0xF;
442    }
443);
444
445bitflags!(
446    #[repr(C)]
447    pub struct ImDrawListFlags: c_int {
448        const AntiAliasedLines = 1 << 0;
449        const AntiAliasedFill  = 1 << 1;
450    }
451);
452
453pub type ImGuiTextEditCallback = Option<
454    extern "C" fn(data: *mut ImGuiTextEditCallbackData) -> c_int,
455>;
456
457pub type ImGuiSizeConstraintCallback =
458    Option<extern "C" fn(data: *mut ImGuiSizeConstraintCallbackData)>;
459
460/// A tuple of 2 floating-point values
461#[repr(C)]
462#[derive(Copy, Clone, Debug, Default, PartialEq)]
463pub struct ImVec2 {
464    pub x: c_float,
465    pub y: c_float,
466}
467
468impl ImVec2 {
469    pub fn new(x: f32, y: f32) -> ImVec2 {
470        ImVec2 {
471            x: x as c_float,
472            y: y as c_float,
473        }
474    }
475    pub fn zero() -> ImVec2 {
476        ImVec2 {
477            x: 0.0 as c_float,
478            y: 0.0 as c_float,
479        }
480    }
481}
482
483impl From<[f32; 2]> for ImVec2 {
484    fn from(array: [f32; 2]) -> ImVec2 { ImVec2::new(array[0], array[1]) }
485}
486
487impl From<(f32, f32)> for ImVec2 {
488    fn from((x, y): (f32, f32)) -> ImVec2 { ImVec2::new(x, y) }
489}
490
491impl Into<[f32; 2]> for ImVec2 {
492    fn into(self) -> [f32; 2] { [self.x, self.y] }
493}
494
495impl Into<(f32, f32)> for ImVec2 {
496    fn into(self) -> (f32, f32) { (self.x, self.y) }
497}
498
499/// A tuple of 4 floating-point values
500#[repr(C)]
501#[derive(Copy, Clone, Debug, Default, PartialEq)]
502pub struct ImVec4 {
503    pub x: c_float,
504    pub y: c_float,
505    pub z: c_float,
506    pub w: c_float,
507}
508
509impl ImVec4 {
510    pub fn new(x: f32, y: f32, z: f32, w: f32) -> ImVec4 {
511        ImVec4 {
512            x: x as c_float,
513            y: y as c_float,
514            z: z as c_float,
515            w: w as c_float,
516        }
517    }
518    pub fn zero() -> ImVec4 {
519        ImVec4 {
520            x: 0.0 as c_float,
521            y: 0.0 as c_float,
522            z: 0.0 as c_float,
523            w: 0.0 as c_float,
524        }
525    }
526}
527
528impl From<[f32; 4]> for ImVec4 {
529    fn from(array: [f32; 4]) -> ImVec4 { ImVec4::new(array[0], array[1], array[2], array[3]) }
530}
531
532impl From<(f32, f32, f32, f32)> for ImVec4 {
533    fn from((x, y, z, w): (f32, f32, f32, f32)) -> ImVec4 { ImVec4::new(x, y, z, w) }
534}
535
536impl Into<[f32; 4]> for ImVec4 {
537    fn into(self) -> [f32; 4] { [self.x, self.y, self.z, self.w] }
538}
539
540impl Into<(f32, f32, f32, f32)> for ImVec4 {
541    fn into(self) -> (f32, f32, f32, f32) { (self.x, self.y, self.z, self.w) }
542}
543
544/// Runtime data for styling/colors
545#[repr(C)]
546pub struct ImGuiStyle {
547    /// Global alpha applies to everything in ImGui
548    pub alpha: c_float,
549    /// Padding within a window
550    pub window_padding: ImVec2,
551    /// Radius of window corners rounding. Set to 0.0f to have rectangular windows
552    pub window_rounding: c_float,
553    /// Thickness of border around windows. Generally set to 0.0f or 1.0f. Other values not well tested.
554    pub window_border_size: c_float,
555    /// Minimum window size
556    pub window_min_size: ImVec2,
557    /// Alignment for title bar text. Defaults to (0.0f, 0.5f) for left-aligned, vertically centered
558    pub window_title_align: ImVec2,
559    /// Radius of child window corners rounding. Set to 0.0f to have rectangular child windows
560    pub child_rounding: c_float,
561    /// Thickness of border around child windows. Generally set to 0.0f or 1.0f. Other values not well tested.
562    pub child_border_size: c_float,
563    /// Radius of popup window corners rounding. Set to 0.0f to have rectangular child windows
564    pub popup_rounding: c_float,
565    /// Thickness of border around popup or tooltip windows. Generally set to 0.0f or 1.0f. Other values not well tested.
566    pub popup_border_size: c_float,
567    /// Padding within a framed rectangle (used by most widgets)
568    pub frame_padding: ImVec2,
569    /// Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most
570    /// widgets).
571    pub frame_rounding: c_float,
572    /// Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested.
573    pub frame_border_size: c_float,
574    /// Horizontal and vertical spacing between widgets/lines
575    pub item_spacing: ImVec2,
576    /// Horizontal and vertical spacing between within elements of a composed
577    /// widget (e.g. a slider and its label)
578    pub item_inner_spacing: ImVec2,
579    /// Expand reactive bounding box for touch-based system where touch position is not accurate
580    /// enough. Unfortunately we don't sort widgets so priority on overlap will always be given
581    /// to the first widget. So don't grow this too much!
582    pub touch_extra_padding: ImVec2,
583    /// Horizontal spacing when e.g. entering a tree node.
584    /// Generally == (FontSize + FramePadding.x*2).
585    pub indent_spacing: c_float,
586    /// Minimum horizontal spacing between two columns
587    pub columns_min_spacing: c_float,
588    /// Width of the vertical scrollbar, Height of the horizontal scrollbar
589    pub scrollbar_size: c_float,
590    /// Width of the vertical scrollbar, Height of the horizontal scrollbar
591    pub scrollbar_rounding: c_float,
592    /// Minimum width/height of a grab box for slider/scrollbar
593    pub grab_min_size: c_float,
594    /// Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
595    pub grab_rounding: c_float,
596    /// Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f)
597    /// for horizontally + vertically centered
598    pub button_text_align: ImVec2,
599    /// Window positions are clamped to be visible within the display area by at least this
600    /// amount. Only covers regular windows.
601    pub display_window_padding: ImVec2,
602    /// If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding.
603    /// Covers popups/tooltips as well regular windows.
604    pub display_safe_area_padding: ImVec2,
605    /// Enable anti-aliasing on lines/borders. Disable if you are really short on CPU/GPU.
606    pub anti_aliased_lines: bool,
607    /// Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)
608    pub anti_aliased_fill: bool,
609    /// Tessellation tolerance. Decrease for highly tessellated curves (higher quality, more
610    /// polygons), increase to reduce quality.
611    pub curve_tessellation_tol: c_float,
612    /// Colors for the user interface
613    pub colors: [ImVec4; ImGuiCol_COUNT],
614}
615
616/// Main configuration and I/O between your application and ImGui
617#[repr(C)]
618pub struct ImGuiIO {
619    pub display_size: ImVec2,
620    pub delta_time: c_float,
621    pub ini_saving_rate: c_float,
622    pub ini_filename: *const c_char,
623    pub log_filename: *const c_char,
624    pub mouse_double_click_time: c_float,
625    pub mouse_double_click_max_dist: c_float,
626    pub mouse_drag_threshold: c_float,
627    pub key_map: [c_int; ImGuiKey_COUNT],
628    pub key_repeat_delay: c_float,
629    pub key_repeat_rate: c_float,
630    pub user_data: *mut c_void,
631
632    pub fonts: *mut ImFontAtlas,
633    pub font_global_scale: c_float,
634    pub font_allow_user_scaling: bool,
635    pub font_default: *mut ImFont,
636    pub display_framebuffer_scale: ImVec2,
637    pub display_visible_min: ImVec2,
638    pub display_visible_max: ImVec2,
639
640    pub opt_mac_osx_behaviors: bool,
641    pub opt_cursor_blink: bool,
642
643    pub render_draw_lists_fn: Option<extern "C" fn(data: *mut ImDrawData)>,
644
645    pub get_clipboard_text_fn: Option<extern "C" fn(user_data: *mut c_void) -> *const c_char>,
646    pub set_clipboard_text_fn: Option<extern "C" fn(user_data: *mut c_void, text: *const c_char)>,
647    pub clipboard_user_data: *mut c_void,
648
649    pub mem_alloc_fn: Option<extern "C" fn(sz: usize) -> *mut c_void>,
650    pub mem_free_fn: Option<extern "C" fn(ptr: *mut c_void)>,
651
652    pub ime_set_input_screen_pos_fn: Option<extern "C" fn(x: c_int, y: c_int)>,
653    pub ime_window_handle: *mut c_void,
654
655    pub mouse_pos: ImVec2,
656    pub mouse_down: [bool; 5],
657    pub mouse_wheel: c_float,
658    pub mouse_draw_cursor: bool,
659    pub key_ctrl: bool,
660    pub key_shift: bool,
661    pub key_alt: bool,
662    pub key_super: bool,
663    pub keys_down: [bool; 512],
664    pub input_characters: [ImWchar; 16 + 1],
665
666    pub want_capture_mouse: bool,
667    pub want_capture_keyboard: bool,
668    pub want_text_input: bool,
669    pub want_move_mouse: bool,
670    pub framerate: c_float,
671    pub metrics_allocs: c_int,
672    pub metrics_render_vertices: c_int,
673    pub metrics_render_indices: c_int,
674    pub metrics_active_windows: c_int,
675    pub mouse_delta: ImVec2,
676
677    mouse_pos_prev: ImVec2,
678    mouse_clicked_pos: [ImVec2; 5],
679    mouse_clicked_time: [c_float; 5],
680    mouse_clicked: [bool; 5],
681    mouse_double_clicked: [bool; 5],
682    mouse_released: [bool; 5],
683    mouse_down_owned: [bool; 5],
684    mouse_down_duration: [c_float; 5],
685    mouse_down_duration_prev: [c_float; 5],
686    mouse_drag_max_distance_abs: [ImVec2; 5],
687    mouse_drag_max_distance_sqr: [c_float; 5],
688    keys_down_duration: [c_float; 512],
689    keys_down_duration_prev: [c_float; 512],
690}
691
692/// Lightweight vector struct
693#[repr(C)]
694pub struct ImVector<T> {
695    pub size: c_int,
696    pub capacity: c_int,
697    pub data: *mut T,
698}
699
700impl<T> ImVector<T> {
701    pub unsafe fn as_slice(&self) -> &[T] { slice::from_raw_parts(self.data, self.size as usize) }
702}
703
704#[repr(C)]
705pub struct TextRange {
706    pub begin: *const c_char,
707    pub end: *const c_char,
708}
709
710#[repr(C)]
711pub struct ImGuiTextFilter {
712    pub input_buf: [c_char; 256],
713    pub filters: ImVector<TextRange>,
714    pub count_grep: c_int,
715}
716
717/// Data payload for Drag and Drop operations
718#[repr(C)]
719pub struct ImGuiPayload {
720    /// Data (copied and owned by dear imgui)
721    pub data: *const c_void,
722    /// Data size
723    pub data_size: c_int,
724
725    /// Source item id
726    source_id: ImGuiID,
727    /// Source parent id (if available)
728    source_parent_id: ImGuiID,
729    /// Data timestamp
730    data_frame_count: c_int,
731    /// Data type tag (short user-supplied string)
732    data_type: [c_char; 8 + 1],
733    /// Set when AcceptDragDropPayload() was called and mouse has been hovering the target item (nb: handle overlapping drag targets)
734    preview: bool,
735    /// Set when AcceptDragDropPayload() was called and mouse button is released over the target item.
736    delivery: bool,
737}
738
739#[repr(C)]
740pub struct ImGuiTextBuffer {
741    pub buf: ImVector<c_char>,
742}
743
744#[repr(C)]
745pub struct Pair {
746    pub key: ImGuiID,
747    pub value: PairValue,
748}
749
750#[repr(C)]
751pub union PairValue {
752    val_i: c_int,
753    val_f: c_float,
754    val_p: *mut c_void,
755}
756
757#[repr(C)]
758pub struct ImGuiStorage {
759    pub data: ImVector<Pair>,
760}
761
762#[repr(C)]
763pub struct ImGuiTextEditCallbackData {
764    pub event_flag: ImGuiInputTextFlags,
765    pub flags: ImGuiInputTextFlags,
766    pub user_data: *mut c_void,
767    pub read_only: bool,
768
769    pub event_char: ImWchar,
770
771    pub event_key: ImGuiKey,
772    pub buf: *mut c_char,
773    pub buf_text_len: c_int,
774    pub buf_size: c_int,
775    pub buf_dirty: bool,
776    pub cursor_pos: c_int,
777    pub selection_start: c_int,
778    pub selection_end: c_int,
779}
780
781#[repr(C)]
782pub struct ImGuiSizeConstraintCallbackData {
783    pub user_data: *mut c_void,
784    pub pos: ImVec2,
785    pub current_size: ImVec2,
786    pub desired_size: ImVec2,
787}
788
789#[repr(C)]
790#[derive(Copy, Clone, Debug, Default)]
791pub struct ImColor {
792    pub value: ImVec4,
793}
794
795/// Helper to manually clip large list of items
796#[repr(C)]
797#[derive(Copy, Clone, Debug)]
798pub struct ImGuiListClipper {
799    pub start_pos_y: c_float,
800    pub items_height: c_float,
801    pub items_count: c_int,
802    pub step_no: c_int,
803    pub display_start: c_int,
804    pub display_end: c_int,
805}
806
807pub type ImDrawCallback = Option<
808    extern "C" fn(parent_list: *const ImDrawList,
809                  cmd: *const ImDrawCmd),
810>;
811
812/// A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call)
813#[repr(C)]
814pub struct ImDrawCmd {
815    pub elem_count: c_uint,
816    pub clip_rect: ImVec4,
817    pub texture_id: ImTextureID,
818    pub user_callback: ImDrawCallback,
819    pub user_callback_data: *mut c_void,
820}
821
822/// Vertex index
823pub type ImDrawIdx = c_ushort;
824
825/// A single vertex
826#[repr(C)]
827#[derive(Copy, Clone, Debug, Default)]
828pub struct ImDrawVert {
829    pub pos: ImVec2,
830    pub uv: ImVec2,
831    pub col: ImU32,
832}
833
834/// Temporary storage for outputting drawing commands out of order
835#[repr(C)]
836pub struct ImDrawChannel {
837    pub cmd_buffer: ImVector<ImDrawCmd>,
838    pub idx_buffer: ImVector<ImDrawIdx>,
839}
840
841/// A single draw command list (generally one per window)
842#[repr(C)]
843pub struct ImDrawList {
844    pub cmd_buffer: ImVector<ImDrawCmd>,
845    pub idx_buffer: ImVector<ImDrawIdx>,
846    pub vtx_buffer: ImVector<ImDrawVert>,
847
848    flags: ImDrawListFlags,
849    data: *const ImDrawListSharedData,
850    owner_name: *const c_char,
851    vtx_current_idx: c_uint,
852    vtx_write_ptr: *mut ImDrawVert,
853    idx_write_ptr: *mut ImDrawIdx,
854    clip_rect_stack: ImVector<ImVec4>,
855    texture_id_stack: ImVector<ImTextureID>,
856    path: ImVector<ImVec2>,
857    channels_current: c_int,
858    channels_count: c_int,
859    channels: ImVector<ImDrawChannel>,
860}
861
862#[repr(C)]
863pub struct ImDrawListSharedData {
864    /// UV of white pixel in the atlas
865    tex_uv_white_pixel: ImVec2,
866    /// Current/default font (optional, for simplified AddText overload)
867    font: *mut ImFont,
868    /// Current/default font size (optional, for simplified AddText overload)
869    font_size: c_float,
870    curve_tessellation_tol: c_float,
871    /// Value for PushClipRectFullscreen()
872    clip_rect_fullscreen: ImVec4,
873    circle_vtx12: [ImVec2; 12],
874}
875
876/// All draw command lists required to render the frame
877#[repr(C)]
878pub struct ImDrawData {
879    pub valid: bool,
880    pub cmd_lists: *mut *mut ImDrawList,
881    pub cmd_lists_count: c_int,
882    pub total_vtx_count: c_int,
883    pub total_idx_count: c_int,
884}
885
886impl ImDrawData {
887    pub unsafe fn cmd_lists(&self) -> &[*const ImDrawList] {
888        let cmd_lists: *const *const ImDrawList = mem::transmute(self.cmd_lists);
889        slice::from_raw_parts(cmd_lists, self.cmd_lists_count as usize)
890    }
891}
892
893/// Configuration data when adding a font or merging fonts
894#[repr(C)]
895pub struct ImFontConfig {
896    pub font_data: *mut c_void,
897    pub font_data_size: c_int,
898    pub font_data_owned_by_atlas: bool,
899    pub font_no: c_int,
900    pub size_pixels: c_float,
901    pub oversample_h: c_int,
902    pub oversample_v: c_int,
903    pub pixel_snap_h: bool,
904    pub glyph_extra_spacing: ImVec2,
905    pub glyph_offset: ImVec2,
906    pub glyph_ranges: *const ImWchar,
907    pub merge_mode: bool,
908    pub rasterizer_flags: c_uint,
909    pub rasterizer_multiply: c_float,
910
911    name: [c_char; 32],
912    dst_font: *mut ImFont,
913}
914
915#[repr(C)]
916#[derive(Copy, Clone, Debug, Default)]
917pub struct ImFontGlyph {
918    codepoint: ImWchar,
919    advance_x: c_float,
920    x0: c_float,
921    y0: c_float,
922    x1: c_float,
923    y1: c_float,
924    u0: c_float,
925    v0: c_float,
926    u1: c_float,
927    v1: c_float,
928}
929
930#[repr(C)]
931pub struct CustomRect {
932    pub id: c_uint,
933    pub width: c_ushort,
934    pub height: c_ushort,
935    pub x: c_ushort,
936    pub y: c_ushort,
937    pub glyph_advance_x: c_float,
938    pub glyph_offset: ImVec2,
939    pub font: *mut ImFont,
940}
941
942/// Runtime data for multiple fonts, bake multiple fonts into a single texture, TTF/OTF font loader
943#[repr(C)]
944pub struct ImFontAtlas {
945    pub tex_id: *mut c_void,
946    pub tex_desired_width: c_int,
947    pub tex_glyph_padding: c_int,
948
949    tex_pixels_alpha8: *mut c_uchar,
950    tex_pixels_rgba32: *mut c_uint,
951    pub tex_width: c_int,
952    pub tex_height: c_int,
953    tex_uv_white_pixel: ImVec2,
954    fonts: ImVector<*mut ImFont>,
955    custom_rects: ImVector<CustomRect>,
956    config_data: ImVector<ImFontConfig>,
957    custom_rect_ids: [c_int; 1],
958}
959
960/// Runtime data for a single font within a parent ImFontAtlas
961#[repr(C)]
962pub struct ImFont {
963    font_size: c_float,
964    scale: c_float,
965    display_offset: ImVec2,
966    glyphs: ImVector<ImFontGlyph>,
967    index_advance_x: ImVector<c_float>,
968    index_lookup: ImVector<c_ushort>,
969    fallback_glyph: *const ImFontGlyph,
970    fallback_advance_x: c_float,
971    fallback_char: ImWchar,
972
973    config_data_count: c_short,
974    config_data: *mut ImFontConfig,
975    container_atlas: *mut ImFontAtlas,
976    ascent: c_float,
977    descent: c_float,
978    metrics_total_surface: c_int,
979}
980
981// Main
982extern "C" {
983    pub fn igGetIO() -> *mut ImGuiIO;
984    pub fn igGetStyle() -> *mut ImGuiStyle;
985    pub fn igGetDrawData() -> *mut ImDrawData;
986    pub fn igNewFrame();
987    pub fn igRender();
988    pub fn igEndFrame();
989    pub fn igShutdown();
990}
991
992// Demo/Debug/Info
993extern "C" {
994    pub fn igShowDemoWindow(opened: *mut bool);
995    pub fn igShowMetricsWindow(opened: *mut bool);
996    pub fn igShowStyleEditor(style: *mut ImGuiStyle);
997    pub fn igShowStyleSelector(label: *const c_char);
998    pub fn igShowFontSelector(label: *const c_char);
999    pub fn igShowUserGuide();
1000}
1001
1002#[allow(non_snake_case)]
1003#[deprecated(since = "0.0.19", note = "please use igShowDemoWindow instead")]
1004pub unsafe fn igShowTestWindow(opened: *mut bool) {
1005   igShowDemoWindow(opened)
1006}
1007
1008// Window
1009extern "C" {
1010    pub fn igBegin(name: *const c_char, open: *mut bool, flags: ImGuiWindowFlags) -> bool;
1011    pub fn igEnd();
1012    pub fn igBeginChild(
1013        str_id: *const c_char,
1014        size: ImVec2,
1015        border: bool,
1016        extra_flags: ImGuiWindowFlags,
1017    ) -> bool;
1018    pub fn igBeginChildEx(
1019        id: ImGuiID,
1020        size: ImVec2,
1021        border: bool,
1022        extra_flags: ImGuiWindowFlags,
1023    ) -> bool;
1024    pub fn igEndChild();
1025    pub fn igGetContentRegionMax(out: *mut ImVec2);
1026    pub fn igGetContentRegionAvail(out: *mut ImVec2);
1027    pub fn igGetContentRegionAvailWidth() -> c_float;
1028    pub fn igGetWindowContentRegionMin(out: *mut ImVec2);
1029    pub fn igGetWindowContentRegionMax(out: *mut ImVec2);
1030    pub fn igGetWindowContentRegionWidth() -> c_float;
1031    pub fn igGetWindowDrawList() -> *mut ImDrawList;
1032    pub fn igGetWindowPos(out: *mut ImVec2);
1033    pub fn igGetWindowSize(out: *mut ImVec2);
1034    pub fn igGetWindowWidth() -> c_float;
1035    pub fn igGetWindowHeight() -> c_float;
1036    pub fn igIsWindowCollapsed() -> bool;
1037    pub fn igIsWindowAppearing() -> bool;
1038    pub fn igSetWindowFontScale(scale: c_float);
1039
1040    pub fn igSetNextWindowPos(pos: ImVec2, cond: ImGuiCond, pivot: ImVec2);
1041    pub fn igSetNextWindowSize(size: ImVec2, cond: ImGuiCond);
1042    pub fn igSetNextWindowConstraints(
1043        size_min: ImVec2,
1044        size_max: ImVec2,
1045        custom_callback: ImGuiSizeConstraintCallback,
1046        custom_callback_data: *mut c_void,
1047    );
1048    pub fn igSetNextWindowContentSize(size: ImVec2);
1049    pub fn igSetNextWindowCollapsed(collapsed: bool, cond: ImGuiCond);
1050    pub fn igSetNextWindowFocus();
1051    pub fn igSetWindowPos(pos: ImVec2, cond: ImGuiCond);
1052    pub fn igSetWindowSize(size: ImVec2, cond: ImGuiCond);
1053    pub fn igSetWindowCollapsed(collapsed: bool, cond: ImGuiCond);
1054    pub fn igSetWindowFocus();
1055    pub fn igSetWindowPosByName(name: *const c_char, pos: ImVec2, cond: ImGuiCond);
1056    pub fn igSetWindowSize2(name: *const c_char, size: ImVec2, cond: ImGuiCond);
1057    pub fn igSetWindowCollapsed2(name: *const c_char, collapsed: bool, cond: ImGuiCond);
1058    pub fn igSetWindowFocus2(name: *const c_char);
1059
1060    pub fn igGetScrollX() -> c_float;
1061    pub fn igGetScrollY() -> c_float;
1062    pub fn igGetScrollMaxX() -> c_float;
1063    pub fn igGetScrollMaxY() -> c_float;
1064    pub fn igSetScrollX(scroll_x: c_float);
1065    pub fn igSetScrollY(scroll_y: c_float);
1066    pub fn igSetScrollHere(center_y_ratio: c_float);
1067    pub fn igSetScrollFromPosY(pos_y: c_float, center_y_ratio: c_float);
1068    pub fn igSetStateStorage(tree: *mut ImGuiStorage);
1069    pub fn igGetStateStorage() -> *mut ImGuiStorage;
1070}
1071
1072/// Set next window content's width.
1073///
1074/// Original non-deprecated version preserved last Y value set by
1075/// [`igSetNextWindowContentSize`].
1076#[allow(non_snake_case)]
1077#[deprecated(since = "0.0.19", note = "please use igSetNextWindowContentSize instead")]
1078pub unsafe fn igSetNextWindowContentWidth(width: c_float) {
1079    igSetNextWindowContentSize(ImVec2 { x: width, y: 0.0 })
1080}
1081
1082// Parameter stack (shared)
1083extern "C" {
1084    pub fn igPushFont(font: *mut ImFont);
1085    pub fn igPopFont();
1086    pub fn igPushStyleColorU32(idx: ImGuiCol, col: ImU32);
1087    pub fn igPushStyleColor(idx: ImGuiCol, col: ImVec4);
1088    pub fn igPopStyleColor(count: c_int);
1089    pub fn igPushStyleVar(idx: ImGuiStyleVar, val: c_float);
1090    pub fn igPushStyleVarVec(idx: ImGuiStyleVar, val: ImVec2);
1091    pub fn igPopStyleVar(count: c_int);
1092    pub fn igGetStyleColorVec4(out: *mut ImVec4, idx: ImGuiCol);
1093    pub fn igGetFont() -> *mut ImFont;
1094    pub fn igGetFontSize() -> c_float;
1095    pub fn igGetFontTexUvWhitePixel(out: *mut ImVec2);
1096    pub fn igGetColorU32(idx: ImGuiCol, alpha_mul: c_float) -> ImU32;
1097    pub fn igGetColorU32Vec(col: *const ImVec4) -> ImU32;
1098    pub fn igGetColorU32U32(col: ImU32) -> ImU32;
1099}
1100
1101// Parameter stack (current window)
1102extern "C" {
1103    pub fn igPushItemWidth(item_width: c_float);
1104    pub fn igPopItemWidth();
1105    pub fn igCalcItemWidth() -> c_float;
1106    pub fn igPushTextWrapPos(wrap_pos_x: c_float);
1107    pub fn igPopTextWrapPos();
1108    pub fn igPushAllowKeyboardFocus(allow_keyboard_focus: bool);
1109    pub fn igPopAllowKeyboardFocus();
1110    pub fn igPushButtonRepeat(repeat: bool);
1111    pub fn igPopButtonRepeat();
1112}
1113
1114// Cursor / Layout
1115extern "C" {
1116    pub fn igSeparator();
1117    pub fn igSameLine(pos_x: c_float, spacing_w: c_float);
1118    pub fn igNewLine();
1119    pub fn igSpacing();
1120    pub fn igDummy(size: *const ImVec2);
1121    pub fn igIndent(indent_w: c_float);
1122    pub fn igUnindent(indent_w: c_float);
1123    pub fn igBeginGroup();
1124    pub fn igEndGroup();
1125    pub fn igGetCursorPos(out: *mut ImVec2);
1126    pub fn igGetCursorPosX() -> c_float;
1127    pub fn igGetCursorPosY() -> c_float;
1128    pub fn igSetCursorPos(local_pos: ImVec2);
1129    pub fn igSetCursorPosX(x: c_float);
1130    pub fn igSetCursorPosY(y: c_float);
1131    pub fn igGetCursorStartPos(out: *mut ImVec2);
1132    pub fn igGetCursorScreenPos(out: *mut ImVec2);
1133    pub fn igSetCursorScreenPos(pos: ImVec2);
1134    pub fn igAlignTextToFramePadding();
1135    pub fn igGetTextLineHeight() -> c_float;
1136    pub fn igGetTextLineHeightWithSpacing() -> c_float;
1137    pub fn igGetFrameHeight() -> c_float;
1138    pub fn igGetFrameHeightWithSpacing() -> c_float;
1139}
1140
1141#[allow(non_snake_case)]
1142#[deprecated(since = "0.0.19", note = "please use igGetFrameHeightWithSpacing instead")]
1143pub unsafe fn igGetItemsLineHeightWithSpacing() -> c_float {
1144    igGetFrameHeightWithSpacing()
1145}
1146
1147// Columns
1148extern "C" {
1149    pub fn igColumns(count: c_int, id: *const c_char, border: bool);
1150    pub fn igNextColumn();
1151    pub fn igGetColumnIndex() -> c_int;
1152    pub fn igGetColumnWidth(column_index: c_int) -> c_float;
1153    pub fn igSetColumnWidth(column_index: c_int, width: c_float);
1154    pub fn igGetColumnOffset(column_index: c_int) -> c_float;
1155    pub fn igSetColumnOffset(column_index: c_int, offset_x: c_float);
1156    pub fn igGetColumnsCount() -> c_int;
1157}
1158
1159// ID scopes
1160extern "C" {
1161    pub fn igPushIDStr(str_id: *const c_char);
1162    pub fn igPushIDStrRange(str_begin: *const c_char, str_end: *const c_char);
1163    pub fn igPushIDPtr(ptr_id: *const c_void);
1164    pub fn igPushIDInt(int_id: c_int);
1165    pub fn igPopID();
1166    pub fn igGetIDStr(str_id: *const c_char) -> ImGuiID;
1167    pub fn igGetIDStrRange(str_begin: *const c_char, str_end: *const c_char) -> ImGuiID;
1168    pub fn igGetIDPtr(ptr_id: *const c_void) -> ImGuiID;
1169}
1170
1171// Widgets
1172extern "C" {
1173    pub fn igTextUnformatted(text: *const c_char, text_end: *const c_char);
1174    pub fn igText(fmt: *const c_char, ...);
1175    // pub fn igTextV(fmt: *const c_char, args: va_list);
1176    pub fn igTextColored(col: ImVec4, fmt: *const c_char, ...);
1177    // pub fn igTextColoredV(col: ImVec4, fmt: *const c_char, args: va_list);
1178    pub fn igTextDisabled(fmt: *const c_char, ...);
1179    // pub fn igTextDisabledV(fmt: *const c_char, args: va_list);
1180    pub fn igTextWrapped(fmt: *const c_char, ...);
1181    // pub fn igTextWrappedV(fmt: *const c_char, args: va_list);
1182    pub fn igLabelText(label: *const c_char, fmt: *const c_char, ...);
1183    // pub fn igLabelTextV(label: *const c_char, fmt: *const c_char, args: va_list);
1184    pub fn igBulletText(fmt: *const c_char, ...);
1185    // pub fn igBulletTextV(fmt: *const c_char, args: va_list);
1186    pub fn igBullet();
1187    pub fn igButton(label: *const c_char, size: ImVec2) -> bool;
1188    pub fn igSmallButton(label: *const c_char) -> bool;
1189    pub fn igInvisibleButton(str_id: *const c_char, size: ImVec2) -> bool;
1190    pub fn igImage(
1191        user_texture_id: ImTextureID,
1192        size: ImVec2,
1193        uv0: ImVec2,
1194        uv1: ImVec2,
1195        tint_col: ImVec4,
1196        border_col: ImVec4,
1197    );
1198    pub fn igImageButton(
1199        user_texture_id: ImTextureID,
1200        size: ImVec2,
1201        uv0: ImVec2,
1202        uv1: ImVec2,
1203        frame_padding: c_int,
1204        bg_col: ImVec4,
1205        tint_col: ImVec4,
1206    ) -> bool;
1207    pub fn igCheckbox(label: *const c_char, v: *mut bool) -> bool;
1208    pub fn igCheckboxFlags(label: *const c_char, flags: *mut c_uint, flags_value: c_uint) -> bool;
1209    pub fn igRadioButtonBool(label: *const c_char, active: bool) -> bool;
1210    pub fn igRadioButton(label: *const c_char, v: *mut c_int, v_button: c_int) -> bool;
1211    pub fn igPlotLines(
1212        label: *const c_char,
1213        values: *const c_float,
1214        values_count: c_int,
1215        values_offset: c_int,
1216        overlay_text: *const c_char,
1217        scale_min: c_float,
1218        scale_max: c_float,
1219        graph_size: ImVec2,
1220        stride: c_int,
1221    );
1222    pub fn igPlotLines2(
1223        label: *const c_char,
1224        values_getter: extern "C" fn(data: *mut c_void, idx: c_int) -> c_float,
1225        data: *mut c_void,
1226        values_count: c_int,
1227        values_offset: c_int,
1228        overlay_text: *const c_char,
1229        scale_min: c_float,
1230        scale_max: c_float,
1231        graph_size: ImVec2,
1232    );
1233    pub fn igPlotHistogram(
1234        label: *const c_char,
1235        values: *const c_float,
1236        values_count: c_int,
1237        values_offset: c_int,
1238        overlay_text: *const c_char,
1239        scale_min: c_float,
1240        scale_max: c_float,
1241        graph_size: ImVec2,
1242        stride: c_int,
1243    );
1244    pub fn igPlotHistogram2(
1245        label: *const c_char,
1246        values_getter: extern "C" fn(data: *mut c_void, idx: c_int) -> c_float,
1247        data: *mut c_void,
1248        values_count: c_int,
1249        values_offset: c_int,
1250        overlay_text: *const c_char,
1251        scale_min: c_float,
1252        scale_max: c_float,
1253        graph_size: ImVec2,
1254    );
1255    pub fn igProgressBar(fraction: c_float, size_arg: *const ImVec2, overlay: *const c_char);
1256}
1257
1258// Combo
1259extern "C" {
1260    pub fn igBeginCombo(
1261        label: *const c_char,
1262        preview_value: *const c_char,
1263        flags: ImGuiComboFlags,
1264    ) -> bool;
1265    pub fn igEndCombo();
1266    pub fn igCombo(
1267        label: *const c_char,
1268        current_item: *mut c_int,
1269        items: *const *const c_char,
1270        items_count: c_int,
1271        height_in_items: c_int,
1272    ) -> bool;
1273    pub fn igCombo2(
1274        label: *const c_char,
1275        current_item: *mut c_int,
1276        items_separated_by_zeros: *const c_char,
1277        height_in_items: c_int,
1278    ) -> bool;
1279    pub fn igCombo3(
1280        label: *const c_char,
1281        current_item: *mut c_int,
1282        items_getter: extern "C" fn(data: *mut c_void, idx: c_int, out_text: *mut *const c_char) -> bool,
1283        data: *mut c_void,
1284        items_count: c_int,
1285        height_in_items: c_int,
1286    ) -> bool;
1287}
1288
1289// Widgets: Color Editor/Picker
1290extern "C" {
1291    pub fn igColorEdit3(
1292        label: *const c_char,
1293        col: *mut c_float,
1294        flags: ImGuiColorEditFlags,
1295    ) -> bool;
1296    pub fn igColorEdit4(
1297        label: *const c_char,
1298        col: *mut c_float,
1299        flags: ImGuiColorEditFlags,
1300    ) -> bool;
1301    pub fn igColorPicker3(
1302        label: *const c_char,
1303        col: *mut c_float,
1304        flags: ImGuiColorEditFlags,
1305    ) -> bool;
1306    pub fn igColorPicker4(
1307        label: *const c_char,
1308        col: *mut c_float,
1309        flags: ImGuiColorEditFlags,
1310        ref_col: *const c_float,
1311    ) -> bool;
1312    pub fn igColorButton(
1313        desc_id: *const c_char,
1314        col: ImVec4,
1315        flags: ImGuiColorEditFlags,
1316        size: ImVec2,
1317    ) -> bool;
1318    pub fn igSetColorEditOptions(flags: ImGuiColorEditFlags);
1319}
1320
1321// Widgets: Drags
1322extern "C" {
1323    pub fn igDragFloat(
1324        label: *const c_char,
1325        v: *mut c_float,
1326        v_speed: c_float,
1327        v_min: c_float,
1328        v_max: c_float,
1329        display_format: *const c_char,
1330        power: c_float,
1331    ) -> bool;
1332    pub fn igDragFloat2(
1333        label: *const c_char,
1334        v: *mut c_float,
1335        v_speed: c_float,
1336        v_min: c_float,
1337        v_max: c_float,
1338        display_format: *const c_char,
1339        power: c_float,
1340    ) -> bool;
1341    pub fn igDragFloat3(
1342        label: *const c_char,
1343        v: *mut c_float,
1344        v_speed: c_float,
1345        v_min: c_float,
1346        v_max: c_float,
1347        display_format: *const c_char,
1348        power: c_float,
1349    ) -> bool;
1350    pub fn igDragFloat4(
1351        label: *const c_char,
1352        v: *mut c_float,
1353        v_speed: c_float,
1354        v_min: c_float,
1355        v_max: c_float,
1356        display_format: *const c_char,
1357        power: c_float,
1358    ) -> bool;
1359    pub fn igDragFloatRange2(
1360        label: *const c_char,
1361        v_current_min: *mut c_float,
1362        v_current_max: *mut c_float,
1363        v_speed: c_float,
1364        v_min: c_float,
1365        v_max: c_float,
1366        display_format: *const c_char,
1367        display_format_max: *const c_char,
1368        power: c_float,
1369    ) -> bool;
1370    pub fn igDragInt(
1371        label: *const c_char,
1372        v: *mut c_int,
1373        v_speed: c_float,
1374        v_min: c_int,
1375        v_max: c_int,
1376        display_format: *const c_char,
1377    ) -> bool;
1378    pub fn igDragInt2(
1379        label: *const c_char,
1380        v: *mut c_int,
1381        v_speed: c_float,
1382        v_min: c_int,
1383        v_max: c_int,
1384        display_format: *const c_char,
1385    ) -> bool;
1386    pub fn igDragInt3(
1387        label: *const c_char,
1388        v: *mut c_int,
1389        v_speed: c_float,
1390        v_min: c_int,
1391        v_max: c_int,
1392        display_format: *const c_char,
1393    ) -> bool;
1394    pub fn igDragInt4(
1395        label: *const c_char,
1396        v: *mut c_int,
1397        v_speed: c_float,
1398        v_min: c_int,
1399        v_max: c_int,
1400        display_format: *const c_char,
1401    ) -> bool;
1402    pub fn igDragIntRange2(
1403        label: *const c_char,
1404        v_current_min: *mut c_int,
1405        v_current_max: *mut c_int,
1406        v_speed: c_float,
1407        v_min: c_int,
1408        v_max: c_int,
1409        display_format: *const c_char,
1410        display_format_max: *const c_char,
1411    ) -> bool;
1412}
1413
1414// Widgets: Input with Keyboard
1415extern "C" {
1416    pub fn igInputText(
1417        label: *const c_char,
1418        buf: *mut c_char,
1419        buf_size: usize,
1420        flags: ImGuiInputTextFlags,
1421        callback: ImGuiTextEditCallback,
1422        user_data: *mut c_void,
1423    ) -> bool;
1424    pub fn igInputTextMultiline(
1425        label: *const c_char,
1426        buf: *mut c_char,
1427        buf_size: usize,
1428        size: ImVec2,
1429        flags: ImGuiInputTextFlags,
1430        callback: ImGuiTextEditCallback,
1431        user_data: *mut c_void,
1432    ) -> bool;
1433    pub fn igInputFloat(
1434        label: *const c_char,
1435        v: *mut c_float,
1436        step: c_float,
1437        step_fast: c_float,
1438        decimal_precision: c_int,
1439        extra_flags: ImGuiInputTextFlags,
1440    ) -> bool;
1441    pub fn igInputFloat2(
1442        label: *const c_char,
1443        v: *mut c_float,
1444        decimal_precision: c_int,
1445        extra_flags: ImGuiInputTextFlags,
1446    ) -> bool;
1447    pub fn igInputFloat3(
1448        label: *const c_char,
1449        v: *mut c_float,
1450        decimal_precision: c_int,
1451        extra_flags: ImGuiInputTextFlags,
1452    ) -> bool;
1453    pub fn igInputFloat4(
1454        label: *const c_char,
1455        v: *mut c_float,
1456        decimal_precision: c_int,
1457        extra_flags: ImGuiInputTextFlags,
1458    ) -> bool;
1459    pub fn igInputInt(
1460        label: *const c_char,
1461        v: *mut c_int,
1462        step: c_int,
1463        step_fast: c_int,
1464        extra_flags: ImGuiInputTextFlags,
1465    ) -> bool;
1466    pub fn igInputInt2(
1467        label: *const c_char,
1468        v: *mut c_int,
1469        extra_flags: ImGuiInputTextFlags,
1470    ) -> bool;
1471    pub fn igInputInt3(
1472        label: *const c_char,
1473        v: *mut c_int,
1474        extra_flags: ImGuiInputTextFlags,
1475    ) -> bool;
1476    pub fn igInputInt4(
1477        label: *const c_char,
1478        v: *mut c_int,
1479        extra_flags: ImGuiInputTextFlags,
1480    ) -> bool;
1481}
1482
1483// Widgets: Sliders
1484extern "C" {
1485    pub fn igSliderFloat(
1486        label: *const c_char,
1487        v: *mut c_float,
1488        v_min: c_float,
1489        v_max: c_float,
1490        display_format: *const c_char,
1491        power: c_float,
1492    ) -> bool;
1493    pub fn igSliderFloat2(
1494        label: *const c_char,
1495        v: *mut c_float,
1496        v_min: c_float,
1497        v_max: c_float,
1498        display_format: *const c_char,
1499        power: c_float,
1500    ) -> bool;
1501    pub fn igSliderFloat3(
1502        label: *const c_char,
1503        v: *mut c_float,
1504        v_min: c_float,
1505        v_max: c_float,
1506        display_format: *const c_char,
1507        power: c_float,
1508    ) -> bool;
1509    pub fn igSliderFloat4(
1510        label: *const c_char,
1511        v: *mut c_float,
1512        v_min: c_float,
1513        v_max: c_float,
1514        display_format: *const c_char,
1515        power: c_float,
1516    ) -> bool;
1517    pub fn igSliderAngle(
1518        label: *const c_char,
1519        v_rad: *mut c_float,
1520        v_degrees_min: c_float,
1521        v_degrees_max: c_float,
1522    ) -> bool;
1523    pub fn igSliderInt(
1524        label: *const c_char,
1525        v: *mut c_int,
1526        v_min: c_int,
1527        v_max: c_int,
1528        display_format: *const c_char,
1529    ) -> bool;
1530    pub fn igSliderInt2(
1531        label: *const c_char,
1532        v: *mut c_int,
1533        v_min: c_int,
1534        v_max: c_int,
1535        display_format: *const c_char,
1536    ) -> bool;
1537    pub fn igSliderInt3(
1538        label: *const c_char,
1539        v: *mut c_int,
1540        v_min: c_int,
1541        v_max: c_int,
1542        display_format: *const c_char,
1543    ) -> bool;
1544    pub fn igSliderInt4(
1545        label: *const c_char,
1546        v: *mut c_int,
1547        v_min: c_int,
1548        v_max: c_int,
1549        display_format: *const c_char,
1550    ) -> bool;
1551    pub fn igVSliderFloat(
1552        label: *const c_char,
1553        size: ImVec2,
1554        v: *mut c_float,
1555        v_min: c_float,
1556        v_max: c_float,
1557        display_format: *const c_char,
1558        power: c_float,
1559    ) -> bool;
1560    pub fn igVSliderInt(
1561        label: *const c_char,
1562        size: ImVec2,
1563        v: *mut c_int,
1564        v_min: c_int,
1565        v_max: c_int,
1566        display_format: *const c_char,
1567    ) -> bool;
1568}
1569
1570// Widgets: Trees
1571extern "C" {
1572    pub fn igTreeNode(label: *const c_char) -> bool;
1573    pub fn igTreeNodeStr(str_id: *const c_char, fmt: *const c_char, ...) -> bool;
1574    pub fn igTreeNodePtr(ptr_id: *const c_void, fmt: *const c_char, ...) -> bool;
1575    // pub fn igTreeNodeStrV(str_id: *const c_char, fmt: *const c_char, args: va_list) -> bool;
1576    // pub fn igTreeNodePtrV(ptr_id: *const c_void, fmt: *const c_char, args: va_list) -> bool;
1577    pub fn igTreeNodeEx(label: *const c_char, flags: ImGuiTreeNodeFlags) -> bool;
1578    pub fn igTreeNodeExStr(
1579        str_id: *const c_char,
1580        flags: ImGuiTreeNodeFlags,
1581        fmt: *const c_char,
1582        ...
1583    ) -> bool;
1584    pub fn igTreeNodeExPtr(
1585        ptr_id: *const c_void,
1586        flags: ImGuiTreeNodeFlags,
1587        fmt: *const c_char,
1588        ...
1589    ) -> bool;
1590    // pub fn igTreeNodeExV(str_id: *const c_char, flags: ImGuiTreeNodeFlags,
1591    //                      fmt: *const c_char, args: va_list) -> bool;
1592    // pub fn igTreeNodeExVPtr(ptr_id: *const c_void, flags: ImGuiTreeNodeFlags,
1593    //                      fmt: *const c_char, args: va_list) -> bool;
1594    pub fn igTreePushStr(str_id: *const c_char);
1595    pub fn igTreePushPtr(ptr_id: *const c_void);
1596    pub fn igTreePop();
1597    pub fn igTreeAdvanceToLabelPos();
1598    pub fn igGetTreeNodeToLabelSpacing() -> c_float;
1599    pub fn igSetNextTreeNodeOpen(opened: bool, cond: ImGuiCond);
1600    pub fn igCollapsingHeader(label: *const c_char, flags: ImGuiTreeNodeFlags) -> bool;
1601    pub fn igCollapsingHeaderEx(
1602        label: *const c_char,
1603        open: *mut bool,
1604        flags: ImGuiTreeNodeFlags,
1605    ) -> bool;
1606}
1607
1608// Widgets: Selectable / Lists
1609extern "C" {
1610    pub fn igSelectable(
1611        label: *const c_char,
1612        selected: bool,
1613        flags: ImGuiSelectableFlags,
1614        size: ImVec2,
1615    ) -> bool;
1616    pub fn igSelectableEx(
1617        label: *const c_char,
1618        p_selected: *mut bool,
1619        flags: ImGuiSelectableFlags,
1620        size: ImVec2,
1621    ) -> bool;
1622    pub fn igListBox(
1623        label: *const c_char,
1624        current_item: *mut c_int,
1625        items: *const *const c_char,
1626        items_count: c_int,
1627        height_in_items: c_int,
1628    ) -> bool;
1629    pub fn igListBox2(
1630        label: *const c_char,
1631        current_item: *mut c_int,
1632        items_getter: extern "C" fn(data: *mut c_void, idx: c_int, out_text: *mut *const c_char)
1633                                    -> bool,
1634        data: *mut c_void,
1635        items_count: c_int,
1636        height_in_items: c_int,
1637    ) -> bool;
1638    pub fn igListBoxHeader(label: *const c_char, size: ImVec2) -> bool;
1639    pub fn igListBoxHeader2(
1640        label: *const c_char,
1641        items_count: c_int,
1642        height_in_items: c_int,
1643    ) -> bool;
1644    pub fn igListBoxFooter();
1645}
1646
1647// Widgets: Value() Helpers
1648extern "C" {
1649    pub fn igValueBool(prefix: *const c_char, b: bool);
1650    pub fn igValueInt(prefix: *const c_char, v: c_int);
1651    pub fn igValueUInt(prefix: *const c_char, v: c_uint);
1652    pub fn igValueFloat(prefix: *const c_char, v: c_float, float_format: *const c_char);
1653}
1654
1655// Tooltip
1656extern "C" {
1657    pub fn igSetTooltip(fmt: *const c_char, ...);
1658    // pub fn igSetTooltipV(fmt: *const c_char, args: va_list);
1659    pub fn igBeginTooltip();
1660    pub fn igEndTooltip();
1661}
1662
1663// Widgets: Menus
1664extern "C" {
1665    pub fn igBeginMainMenuBar() -> bool;
1666    pub fn igEndMainMenuBar();
1667    pub fn igBeginMenuBar() -> bool;
1668    pub fn igEndMenuBar();
1669    pub fn igBeginMenu(label: *const c_char, enabled: bool) -> bool;
1670    pub fn igEndMenu();
1671    pub fn igMenuItem(
1672        label: *const c_char,
1673        shortcut: *const c_char,
1674        selected: bool,
1675        enabled: bool,
1676    ) -> bool;
1677    pub fn igMenuItemPtr(
1678        label: *const c_char,
1679        shortcut: *const c_char,
1680        p_selected: *mut bool,
1681        enabled: bool,
1682    ) -> bool;
1683}
1684
1685// Popup
1686extern "C" {
1687    pub fn igOpenPopup(str_id: *const c_char);
1688    pub fn igOpenPopupOnItemClick(str_id: *const c_char, mouse_button: c_int) -> bool;
1689    pub fn igBeginPopup(str_id: *const c_char) -> bool;
1690    pub fn igBeginPopupModal(
1691        name: *const c_char,
1692        open: *mut bool,
1693        extra_flags: ImGuiWindowFlags,
1694    ) -> bool;
1695    pub fn igBeginPopupContextItem(str_id: *const c_char, mouse_button: c_int) -> bool;
1696    pub fn igBeginPopupContextWindow(
1697        str_id: *const c_char,
1698        mouse_button: c_int,
1699        also_over_items: bool,
1700    ) -> bool;
1701    pub fn igBeginPopupContextVoid(str_id: *const c_char, mouse_button: c_int) -> bool;
1702    pub fn igEndPopup();
1703    pub fn igIsPopupOpen(str_id: *const c_char) -> bool;
1704    pub fn igCloseCurrentPopup();
1705}
1706
1707// Logging
1708extern "C" {
1709    pub fn igLogToTTY(max_depth: c_int);
1710    pub fn igLogToFile(max_depth: c_int, filename: *const c_char);
1711    pub fn igLogToClipboard(max_depth: c_int);
1712    pub fn igLogFinish();
1713    pub fn igLogButtons();
1714    pub fn igLogText(fmt: *const c_char, ...);
1715}
1716
1717// DragDrop
1718extern "C" {
1719    /// Call when current ID is active.
1720    ///
1721    /// When this returns true you need to:
1722    ///
1723    /// 1. call [`igSetDragDropPayload`] exactly once,
1724    /// 2. you may render the payload visual/description,
1725    /// 3. pcall [`igEndDragDropSource`]
1726    pub fn igBeginDragDropSource(flags: ImGuiDragDropFlags, mouse_button: c_int) -> bool;
1727    /// Use 'cond' to choose to submit payload on drag start or every frame
1728    pub fn igSetDragDropPayload(type_: *const c_char, data: *const c_void, size: libc::size_t, cond: ImGuiCond) -> bool;
1729    pub fn igEndDragDropSource();
1730    pub fn igBeginDragDropTarget() -> bool;
1731    pub fn igAcceptDragDropPayload(type_: *const c_char, flags: ImGuiDragDropFlags) -> *const ImGuiPayload;
1732    pub fn igEndDragDropTarget();
1733}
1734
1735// Clipping
1736extern "C" {
1737    pub fn igPushClipRect(
1738        clip_rect_min: ImVec2,
1739        clip_rect_max: ImVec2,
1740        intersect_with_current_clip_rect: bool,
1741    );
1742    pub fn igPopClipRect();
1743}
1744
1745// Styles
1746extern "C" {
1747    pub fn igStyleColorsClassic(dst: *mut ImGuiStyle);
1748    pub fn igStyleColorsDark(dst: *mut ImGuiStyle);
1749    pub fn igStyleColorsLight(dst: *mut ImGuiStyle);
1750}
1751
1752// Focus
1753extern "C" {
1754    pub fn igSetItemDefaultFocus();
1755    pub fn igSetKeyboardFocusHere(offset: c_int);
1756}
1757
1758// Utilities
1759extern "C" {
1760    pub fn igIsItemHovered(flags: ImGuiHoveredFlags) -> bool;
1761    pub fn igIsItemActive() -> bool;
1762    pub fn igIsItemClicked(mouse_button: c_int) -> bool;
1763    pub fn igIsItemVisible() -> bool;
1764    pub fn igIsAnyItemHovered() -> bool;
1765    pub fn igIsAnyItemActive() -> bool;
1766    pub fn igGetItemRectMin(out: *mut ImVec2);
1767    pub fn igGetItemRectMax(out: *mut ImVec2);
1768    pub fn igGetItemRectSize(out: *mut ImVec2);
1769    pub fn igSetItemAllowOverlap();
1770    pub fn igIsWindowFocused(flags: ImGuiFocusedFlags) -> bool;
1771    pub fn igIsWindowHovered(flags: ImGuiHoveredFlags) -> bool;
1772    pub fn igIsAnyWindowHovered() -> bool;
1773    pub fn igIsRectVisible(item_size: ImVec2) -> bool;
1774    pub fn igIsRectVisible2(rect_min: *const ImVec2, rect_max: *const ImVec2) -> bool;
1775    pub fn igGetTime() -> c_float;
1776    pub fn igGetFrameCount() -> c_int;
1777    pub fn igGetStyleColorName(idx: ImGuiCol) -> *const c_char;
1778    pub fn igCalcItemRectClosestPoint(
1779        out: *mut ImVec2,
1780        pos: ImVec2,
1781        on_edge: bool,
1782        outward: c_float,
1783    );
1784    pub fn igCalcTextSize(
1785        out: *mut ImVec2,
1786        text: *const c_char,
1787        text_end: *const c_char,
1788        hide_text_after_double_hash: bool,
1789        wrap_width: c_float,
1790    );
1791    pub fn igCalcListClipping(
1792        items_count: c_int,
1793        items_height: c_float,
1794        out_items_display_start: *mut c_int,
1795        out_items_display_end: *mut c_int,
1796    );
1797
1798    pub fn igBeginChildFrame(id: ImGuiID, size: ImVec2, extra_flags: ImGuiWindowFlags) -> bool;
1799    pub fn igEndChildFrame();
1800
1801    pub fn igColorConvertU32ToFloat4(out: *mut ImVec4, color: ImU32);
1802    pub fn igColorConvertFloat4ToU32(color: ImVec4) -> ImU32;
1803    pub fn igColorConvertRGBtoHSV(
1804        r: c_float,
1805        g: c_float,
1806        b: c_float,
1807        out_h: *mut c_float,
1808        out_s: *mut c_float,
1809        out_v: *mut c_float,
1810    );
1811    pub fn igColorConvertHSVtoRGB(
1812        h: c_float,
1813        s: c_float,
1814        v: c_float,
1815        out_r: *mut c_float,
1816        out_g: *mut c_float,
1817        out_b: *mut c_float,
1818    );
1819}
1820
1821#[allow(non_snake_case)]
1822#[deprecated(since = "0.0.19", note = "please use igIsWindowFocused(ImGuiFocusedFlags::RootWindow) instead")]
1823pub unsafe fn igIsRootWindowFocused() -> bool {
1824    igIsWindowFocused(ImGuiFocusedFlags::RootWindow)
1825}
1826#[allow(non_snake_case)]
1827#[deprecated(since = "0.0.19", note = "please use igIsWindowFocused(ImGuiFocusedFlags::RootAndChildWindows) instead")]
1828pub unsafe fn igIsRootWindowOrAnyChildFocused() -> bool {
1829    igIsWindowFocused(ImGuiFocusedFlags::RootAndChildWindows)
1830}
1831#[allow(non_snake_case)]
1832#[deprecated(since = "0.0.19", note = "please use igIsWindowFocused(ImGuiFocusedFlags::RootAndChildWindows) instead")]
1833pub unsafe fn igIsRootWindowOrAnyChildHovered(_flags: ImGuiHoveredFlags) -> bool {
1834    igIsWindowHovered(ImGuiHoveredFlags::RootAndChildWindows)
1835}
1836
1837// DrawList
1838extern "C" {
1839    pub fn igGetOverlayDrawList() -> *mut ImDrawList;
1840    pub fn igGetDrawListSharedData() -> *mut ImDrawListSharedData;
1841}
1842
1843// Inputs
1844extern "C" {
1845    pub fn igGetKeyIndex(imgui_key: ImGuiKey) -> c_int;
1846    pub fn igIsKeyDown(user_key_index: c_int) -> bool;
1847    pub fn igIsKeyPressed(user_key_index: c_int, repeat: bool) -> bool;
1848    pub fn igIsKeyReleased(user_key_index: c_int) -> bool;
1849    pub fn igGetKeyPressedAmount(key_index: c_int, repeat_delay: c_float, rate: c_float) -> c_int;
1850    pub fn igIsMouseDown(button: c_int) -> bool;
1851    pub fn igIsMouseClicked(button: c_int, repeat: bool) -> bool;
1852    pub fn igIsMouseDoubleClicked(button: c_int) -> bool;
1853    pub fn igIsMouseReleased(button: c_int) -> bool;
1854    pub fn igIsMouseDragging(button: c_int, lock_threshold: c_float) -> bool;
1855    pub fn igIsMouseHoveringRect(r_min: ImVec2, r_max: ImVec2, clip: bool) -> bool;
1856    pub fn igIsMousePosValid(mouse_pos: *const ImVec2) -> bool;
1857    pub fn igGetMousePos(out: *mut ImVec2);
1858    pub fn igGetMousePosOnOpeningCurrentPopup(out: *mut ImVec2);
1859    pub fn igGetMouseDragDelta(out: *mut ImVec2, button: c_int, lock_threshold: c_float);
1860    pub fn igResetMouseDragDelta(button: c_int);
1861    pub fn igGetMouseCursor() -> ImGuiMouseCursor;
1862    pub fn igSetMouseCursor(cursor: ImGuiMouseCursor);
1863    pub fn igCaptureKeyboardFromApp(capture: bool);
1864    pub fn igCaptureMouseFromApp(capture: bool);
1865}
1866
1867// Helpers functions to access functions pointers in ImGui::GetIO()
1868extern "C" {
1869    pub fn igMemAlloc(sz: usize) -> *mut c_void;
1870    pub fn igMemFree(ptr: *mut c_void);
1871    pub fn igGetClipboardText() -> *const c_char;
1872    pub fn igSetClipboardText(text: *const c_char);
1873}
1874
1875// Internal state access
1876extern "C" {
1877    pub fn igGetVersion() -> *const c_char;
1878    pub fn igCreateContext(
1879        malloc_fn: Option<extern "C" fn(size: usize) -> *mut c_void>,
1880        free_fn: Option<extern "C" fn(ptr: *mut c_void)>,
1881    ) -> *mut ImGuiContext;
1882    pub fn igDestroyContext(ctx: *mut ImGuiContext);
1883    pub fn igGetCurrentContext() -> *mut ImGuiContext;
1884    pub fn igSetCurrentContext(ctx: *mut ImGuiContext);
1885}
1886
1887extern "C" {
1888    pub fn ImFontConfig_DefaultConstructor(config: *mut ImFontConfig);
1889}
1890
1891// ImGuiIO
1892extern "C" {
1893    pub fn ImGuiIO_AddInputCharacter(c: c_ushort);
1894    pub fn ImGuiIO_AddInputCharactersUTF8(utf8_chars: *const c_char);
1895    pub fn ImGuiIO_ClearInputCharacters();
1896}
1897
1898// ImGuiTextFilter
1899extern "C" {
1900    pub fn ImGuiTextFilter_Create(default_filter: *const c_char) -> *mut ImGuiTextFilter;
1901    pub fn ImGuiTextFilter_Destroy(filter: *mut ImGuiTextFilter);
1902    pub fn ImGuiTextFilter_Clear(filter: *mut ImGuiTextFilter);
1903    pub fn ImGuiTextFilter_Draw(
1904        filter: *mut ImGuiTextFilter,
1905        label: *const c_char,
1906        width: c_float,
1907    ) -> bool;
1908    pub fn ImGuiTextFilter_PassFilter(
1909        filter: *const ImGuiTextFilter,
1910        text: *const c_char,
1911        text_end: *const c_char,
1912    ) -> bool;
1913    pub fn ImGuiTextFilter_IsActive(filter: *const ImGuiTextFilter) -> bool;
1914    pub fn ImGuiTextFilter_Build(filter: *const ImGuiTextFilter);
1915    pub fn ImGuiTextFilter_GetInputBuf(filter: *mut ImGuiTextFilter) -> *const c_char;
1916}
1917
1918// ImGuiTextBuffer
1919extern "C" {
1920    pub fn ImGuiTextBuffer_Create() -> *mut ImGuiTextBuffer;
1921    pub fn ImGuiTextBuffer_Destroy(buffer: *mut ImGuiTextBuffer);
1922    pub fn ImGuiTextBuffer_index(buffer: *mut ImGuiTextBuffer, i: c_int) -> c_char;
1923    pub fn ImGuiTextBuffer_begin(buffer: *const ImGuiTextBuffer) -> *const c_char;
1924    pub fn ImGuiTextBuffer_end(buffer: *const ImGuiTextBuffer) -> *const c_char;
1925    pub fn ImGuiTextBuffer_size(buffer: *const ImGuiTextBuffer) -> c_int;
1926    pub fn ImGuiTextBuffer_empty(buffer: *mut ImGuiTextBuffer) -> bool;
1927    pub fn ImGuiTextBuffer_clear(buffer: *mut ImGuiTextBuffer);
1928    pub fn ImGuiTextBuffer_c_str(buffer: *const ImGuiTextBuffer) -> *const c_char;
1929    pub fn ImGuiTextBuffer_appendf(buffer: *const ImGuiTextBuffer, fmt: *const c_char, ...);
1930// pub fn ImGuiTextBuffer_appendv(
1931//     buffer: *const ImGuiTextBuffer,
1932//     fmt: *const c_char,
1933//     args: va_list
1934// );
1935}
1936
1937// ImGuiStorage
1938extern "C" {
1939    pub fn ImGuiStorage_Create() -> *mut ImGuiStorage;
1940    pub fn ImGuiStorage_Destroy(storage: *mut ImGuiStorage);
1941    pub fn ImGuiStorage_GetInt(
1942        storage: *mut ImGuiStorage,
1943        key: ImGuiID,
1944        default_val: c_int,
1945    ) -> c_int;
1946    pub fn ImGuiStorage_SetInt(storage: *mut ImGuiStorage, key: ImGuiID, val: c_int);
1947    pub fn ImGuiStorage_GetBool(
1948        storage: *mut ImGuiStorage,
1949        key: ImGuiID,
1950        default_val: bool,
1951    ) -> bool;
1952    pub fn ImGuiStorage_SetBool(storage: *mut ImGuiStorage, key: ImGuiID, val: bool);
1953    pub fn ImGuiStorage_GetFloat(
1954        storage: *mut ImGuiStorage,
1955        key: ImGuiID,
1956        default_val: c_float,
1957    ) -> c_float;
1958    pub fn ImGuiStorage_SetFloat(storage: *mut ImGuiStorage, key: ImGuiID, val: c_float);
1959    pub fn ImGuiStorage_GetVoidPtr(storage: *mut ImGuiStorage, key: ImGuiID);
1960    pub fn ImGuiStorage_SetVoidPtr(storage: *mut ImGuiStorage, key: ImGuiID, val: *mut c_void);
1961    pub fn ImGuiStorage_GetIntRef(
1962        storage: *mut ImGuiStorage,
1963        key: ImGuiID,
1964        default_val: c_int,
1965    ) -> *mut c_int;
1966    pub fn ImGuiStorage_GetBoolRef(
1967        storage: *mut ImGuiStorage,
1968        key: ImGuiID,
1969        default_val: bool,
1970    ) -> *mut bool;
1971    pub fn ImGuiStorage_GetFloatRef(
1972        storage: *mut ImGuiStorage,
1973        key: ImGuiID,
1974        default_val: c_float,
1975    ) -> *mut c_float;
1976    pub fn ImGuiStorage_GetVoidPtrRef(
1977        storage: *mut ImGuiStorage,
1978        key: ImGuiID,
1979        default_val: *mut c_void,
1980    ) -> *mut *mut c_void;
1981    pub fn ImGuiStorage_SetAllInt(storage: *mut ImGuiStorage, val: c_int);
1982}
1983
1984// ImGuiTextEditCallbackData
1985extern "C" {
1986    pub fn ImGuiTextEditCallbackData_DeleteChars(
1987        data: *mut ImGuiTextEditCallbackData,
1988        pos: c_int,
1989        bytes_count: c_int,
1990    );
1991    pub fn ImGuiTextEditCallbackData_InsertChars(
1992        data: *mut ImGuiTextEditCallbackData,
1993        pos: c_int,
1994        text: *const c_char,
1995        text_end: *const c_char,
1996    );
1997    pub fn ImGuiTextEditCallbackData_HasSelection(data: *mut ImGuiTextEditCallbackData) -> bool;
1998}
1999
2000// ImGuiListClipper
2001extern "C" {
2002    pub fn ImGuiListClipper_Step(clipper: *mut ImGuiListClipper) -> bool;
2003    pub fn ImGuiListClipper_Begin(
2004        clipper: *mut ImGuiListClipper,
2005        count: c_int,
2006        items_height: c_float,
2007    );
2008    pub fn ImGuiListClipper_End(clipper: *mut ImGuiListClipper);
2009    pub fn ImGuiListClipper_GetDisplayStart(clipper: *mut ImGuiListClipper) -> c_int;
2010    pub fn ImGuiListClipper_GetDisplayEnd(clipper: *mut ImGuiListClipper) -> c_int;
2011}
2012
2013// ImDrawList
2014extern "C" {
2015    pub fn ImDrawList_GetVertexBufferSize(list: *mut ImDrawList) -> c_int;
2016    pub fn ImDrawList_GetVertexPtr(list: *mut ImDrawList, n: c_int) -> *mut ImDrawVert;
2017    pub fn ImDrawList_GetIndexBufferSize(list: *mut ImDrawList) -> c_int;
2018    pub fn ImDrawList_GetIndexPtr(list: *mut ImDrawList, n: c_int) -> *mut ImDrawIdx;
2019    pub fn ImDrawList_GetCmdSize(list: *mut ImDrawList) -> c_int;
2020    pub fn ImDrawList_GetCmdPtr(list: *mut ImDrawList, n: c_int) -> *mut ImDrawCmd;
2021
2022    pub fn ImDrawList_Clear(list: *mut ImDrawList);
2023    pub fn ImDrawList_ClearFreeMemory(list: *mut ImDrawList);
2024    pub fn ImDrawList_PushClipRect(
2025        list: *mut ImDrawList,
2026        clip_rect_min: ImVec2,
2027        clip_rect_max: ImVec2,
2028        intersect_with_current_: bool,
2029    );
2030    pub fn ImDrawList_PushClipRectFullScreen(list: *mut ImDrawList);
2031    pub fn ImDrawList_PopClipRect(list: *mut ImDrawList);
2032    pub fn ImDrawList_PushTextureID(list: *mut ImDrawList, texture_id: ImTextureID);
2033    pub fn ImDrawList_PopTextureID(list: *mut ImDrawList);
2034    pub fn ImDrawList_GetClipRectMin(out: *mut ImVec2, list: *mut ImDrawList);
2035    pub fn ImDrawList_GetClipRectMax(out: *mut ImVec2, list: *mut ImDrawList);
2036
2037    pub fn ImDrawList_AddLine(
2038        list: *mut ImDrawList,
2039        a: ImVec2,
2040        b: ImVec2,
2041        col: ImU32,
2042        thickness: c_float,
2043    );
2044    pub fn ImDrawList_AddRect(
2045        list: *mut ImDrawList,
2046        a: ImVec2,
2047        b: ImVec2,
2048        col: ImU32,
2049        rounding: c_float,
2050        rounding_corners_flags: ImDrawCornerFlags,
2051        thickness: c_float,
2052    );
2053    pub fn ImDrawList_AddRectFilled(
2054        list: *mut ImDrawList,
2055        a: ImVec2,
2056        b: ImVec2,
2057        col: ImU32,
2058        rounding: c_float,
2059        rounding_corners_flags: ImDrawCornerFlags,
2060    );
2061    pub fn ImDrawList_AddRectFilledMultiColor(
2062        list: *mut ImDrawList,
2063        a: ImVec2,
2064        b: ImVec2,
2065        col_upr_left: ImU32,
2066        col_upr_right: ImU32,
2067        col_bot_right: ImU32,
2068        col_bot_left: ImU32,
2069    );
2070    pub fn ImDrawList_AddQuad(
2071        list: *mut ImDrawList,
2072        a: ImVec2,
2073        b: ImVec2,
2074        c: ImVec2,
2075        d: ImVec2,
2076        col: ImU32,
2077        thickness: c_float,
2078    );
2079    pub fn ImDrawList_AddQuadFilled(
2080        list: *mut ImDrawList,
2081        a: ImVec2,
2082        b: ImVec2,
2083        c: ImVec2,
2084        d: ImVec2,
2085        col: ImU32,
2086    );
2087    pub fn ImDrawList_AddTriangle(
2088        list: *mut ImDrawList,
2089        a: ImVec2,
2090        b: ImVec2,
2091        c: ImVec2,
2092        col: ImU32,
2093        thickness: c_float,
2094    );
2095    pub fn ImDrawList_AddTriangleFilled(
2096        list: *mut ImDrawList,
2097        a: ImVec2,
2098        b: ImVec2,
2099        c: ImVec2,
2100        col: ImU32,
2101    );
2102    pub fn ImDrawList_AddCircle(
2103        list: *mut ImDrawList,
2104        centre: ImVec2,
2105        radius: c_float,
2106        col: ImU32,
2107        num_segments: c_int,
2108        thickness: c_float,
2109    );
2110    pub fn ImDrawList_AddCircleFilled(
2111        list: *mut ImDrawList,
2112        centre: ImVec2,
2113        radius: c_float,
2114        col: ImU32,
2115        num_segments: c_int,
2116    );
2117    pub fn ImDrawList_AddText(
2118        list: *mut ImDrawList,
2119        pos: ImVec2,
2120        col: ImU32,
2121        text_begin: *const c_char,
2122        text_end: *const c_char,
2123    );
2124    pub fn ImDrawList_AddTextExt(
2125        list: *mut ImDrawList,
2126        font: *const ImFont,
2127        font_size: c_float,
2128        pos: ImVec2,
2129        col: ImU32,
2130        text_begin: *const c_char,
2131        text_end: *const c_char,
2132        wrap_width: c_float,
2133        cpu_fine_clip_rect: *const ImVec4,
2134    );
2135    pub fn ImDrawList_AddImage(
2136        list: *mut ImDrawList,
2137        user_texture_id: ImTextureID,
2138        a: ImVec2,
2139        b: ImVec2,
2140        uv_a: ImVec2,
2141        uv_b: ImVec2,
2142        col: ImU32,
2143    );
2144    pub fn ImDrawList_AddImageQuad(
2145        list: *mut ImDrawList,
2146        user_texture_id: ImTextureID,
2147        a: ImVec2,
2148        b: ImVec2,
2149        c: ImVec2,
2150        d: ImVec2,
2151        uv_a: ImVec2,
2152        uv_b: ImVec2,
2153        uv_c: ImVec2,
2154        uv_d: ImVec2,
2155        col: ImU32,
2156    );
2157    pub fn ImDrawList_AddImageRounded(
2158        list: *mut ImDrawList,
2159        user_texture_id: ImTextureID,
2160        a: ImVec2,
2161        b: ImVec2,
2162        uv_a: ImVec2,
2163        uv_b: ImVec2,
2164        col: ImU32,
2165        rounding: c_float,
2166        rounding_corners: c_int,
2167    );
2168    pub fn ImDrawList_AddPolyLine(
2169        list: *mut ImDrawList,
2170        points: *const ImVec2,
2171        num_points: c_int,
2172        col: ImU32,
2173        closed: bool,
2174        thickness: c_float,
2175    );
2176    pub fn ImDrawList_AddConvexPolyFilled(
2177        list: *mut ImDrawList,
2178        points: *const ImVec2,
2179        num_points: c_int,
2180        col: ImU32,
2181    );
2182    pub fn ImDrawList_AddBezierCurve(
2183        list: *mut ImDrawList,
2184        pos0: ImVec2,
2185        cp0: ImVec2,
2186        cp1: ImVec2,
2187        pos1: ImVec2,
2188        col: ImU32,
2189        thickness: c_float,
2190        num_segments: c_int,
2191    );
2192
2193    pub fn ImDrawList_PathClear(list: *mut ImDrawList);
2194    pub fn ImDrawList_PathLineTo(list: *mut ImDrawList, pos: ImVec2);
2195    pub fn ImDrawList_PathLineToMergeDuplicate(list: *mut ImDrawList, pos: ImVec2);
2196    pub fn ImDrawList_PathFillConvex(list: *mut ImDrawList, col: ImU32);
2197    pub fn ImDrawList_PathStroke(
2198        list: *mut ImDrawList,
2199        col: ImU32,
2200        closed: bool,
2201        thickness: c_float,
2202    );
2203    pub fn ImDrawList_PathArcTo(
2204        list: *mut ImDrawList,
2205        centre: ImVec2,
2206        radius: c_float,
2207        a_min: c_float,
2208        a_max: c_float,
2209        num_segments: c_int,
2210    );
2211    pub fn ImDrawList_PathArcToFast(
2212        list: *mut ImDrawList,
2213        centre: ImVec2,
2214        radius: c_float,
2215        a_min_of_12: c_int,
2216        a_max_of_12: c_int,
2217    );
2218    pub fn ImDrawList_PathBezierCurveTo(
2219        list: *mut ImDrawList,
2220        p1: ImVec2,
2221        p2: ImVec2,
2222        p3: ImVec2,
2223        num_segments: c_int,
2224    );
2225    pub fn ImDrawList_PathRect(
2226        list: *mut ImDrawList,
2227        rect_min: ImVec2,
2228        rect_max: ImVec2,
2229        rounding: c_float,
2230        rounding_corners_flags: c_int,
2231    );
2232
2233    pub fn ImDrawList_ChannelsSplit(list: *mut ImDrawList, channels_count: c_int);
2234    pub fn ImDrawList_ChannelsMerge(list: *mut ImDrawList);
2235    pub fn ImDrawList_ChannelsSetCurrent(list: *mut ImDrawList, channel_index: c_int);
2236
2237    pub fn ImDrawList_AddCallback(
2238        list: *mut ImDrawList,
2239        callback: ImDrawCallback,
2240        callback_data: *mut c_void,
2241    );
2242    pub fn ImDrawList_AddDrawCmd(list: *mut ImDrawList);
2243
2244    pub fn ImDrawList_PrimReserve(list: *mut ImDrawList, idx_count: c_int, vtx_count: c_int);
2245    pub fn ImDrawList_PrimRect(list: *mut ImDrawList, a: ImVec2, b: ImVec2, col: ImU32);
2246    pub fn ImDrawList_PrimRectUV(
2247        list: *mut ImDrawList,
2248        a: ImVec2,
2249        b: ImVec2,
2250        uv_a: ImVec2,
2251        uv_b: ImVec2,
2252        col: ImU32,
2253    );
2254    pub fn ImDrawList_PrimQuadUV(
2255        list: *mut ImDrawList,
2256        a: ImVec2,
2257        b: ImVec2,
2258        c: ImVec2,
2259        d: ImVec2,
2260        uv_a: ImVec2,
2261        uv_b: ImVec2,
2262        uv_c: ImVec2,
2263        uv_d: ImVec2,
2264        col: ImU32,
2265    );
2266    pub fn ImDrawList_PrimWriteVtx(list: *mut ImDrawList, pos: ImVec2, uv: ImVec2, col: ImU32);
2267    pub fn ImDrawList_PrimWriteIdx(list: *mut ImDrawList, idx: ImDrawIdx);
2268    pub fn ImDrawList_PrimVtx(list: *mut ImDrawList, pos: ImVec2, uv: ImVec2, col: ImU32);
2269    pub fn ImDrawList_UpdateClipRect(list: *mut ImDrawList);
2270    pub fn ImDrawList_UpdateTextureID(list: *mut ImDrawList);
2271}
2272
2273// ImDrawData
2274extern "C" {
2275    pub fn ImDrawData_DeIndexAllBuffers(drawData: *mut ImDrawData);
2276    pub fn ImDrawData_ScaleClipRects(drawData: *mut ImDrawData, sc: ImVec2);
2277}
2278
2279extern "C" {
2280    pub fn ImFontAtlas_GetTexDataAsRGBA32(
2281        atlas: *mut ImFontAtlas,
2282        out_pixels: *mut *mut c_uchar,
2283        out_width: *mut c_int,
2284        out_height: *mut c_int,
2285        out_bytes_per_pixel: *mut c_int,
2286    );
2287    pub fn ImFontAtlas_GetTexDataAsAlpha8(
2288        atlas: *mut ImFontAtlas,
2289        out_pixels: *mut *mut c_uchar,
2290        out_width: *mut c_int,
2291        out_height: *mut c_int,
2292        out_bytes_per_pixel: *mut c_int,
2293    );
2294    pub fn ImFontAtlas_SetTexID(atlas: *mut ImFontAtlas, tex: ImTextureID);
2295    pub fn ImFontAtlas_AddFont(
2296        atlas: *mut ImFontAtlas,
2297        font_cfg: *const ImFontConfig,
2298    ) -> *mut ImFont;
2299    pub fn ImFontAtlas_AddFontDefault(
2300        atlas: *mut ImFontAtlas,
2301        font_cfg: *const ImFontConfig,
2302    ) -> *mut ImFont;
2303    pub fn ImFontAtlas_AddFontFromFileTTF(
2304        atlas: *mut ImFontAtlas,
2305        filename: *const c_char,
2306        size_pixels: c_float,
2307        font_cfg: *const ImFontConfig,
2308        glyph_ranges: *const ImWchar,
2309    ) -> *mut ImFont;
2310    pub fn ImFontAtlas_AddFontFromMemoryTTF(
2311        atlas: *mut ImFontAtlas,
2312        font_data: *mut c_void,
2313        font_size: c_int,
2314        size_pixels: c_float,
2315        font_cfg: *const ImFontConfig,
2316        glyph_ranges: *const ImWchar,
2317    ) -> *mut ImFont;
2318    pub fn ImFontAtlas_AddFontFromMemoryCompressedTTF(
2319        atlas: *mut ImFontAtlas,
2320        compressed_font_data: *const c_void,
2321        compressed_font_size: c_int,
2322        size_pixels: c_float,
2323        font_cfg: *const ImFontConfig,
2324        glyph_ranges: *const ImWchar,
2325    ) -> *mut ImFont;
2326    pub fn ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(
2327        atlas: *mut ImFontAtlas,
2328        compressed_font_data_base85: *const c_char,
2329        size_pixels: c_float,
2330        font_cfg: *const ImFontConfig,
2331        glyph_ranges: *const ImWchar,
2332    ) -> *mut ImFont;
2333    pub fn ImFontAtlas_ClearTexData(atlas: *mut ImFontAtlas);
2334    pub fn ImFontAtlas_Clear(atlas: *mut ImFontAtlas);
2335    pub fn ImFontAtlas_GetGlyphRangesDefault(atlas: *mut ImFontAtlas) -> *const ImWchar;
2336    pub fn ImFontAtlas_GetGlyphRangesKorean(atlas: *mut ImFontAtlas) -> *const ImWchar;
2337    pub fn ImFontAtlas_GetGlyphRangesJapanese(atlas: *mut ImFontAtlas) -> *const ImWchar;
2338    pub fn ImFontAtlas_GetGlyphRangesChinese(atlas: *mut ImFontAtlas) -> *const ImWchar;
2339    pub fn ImFontAtlas_GetGlyphRangesCyrillic(atlas: *mut ImFontAtlas) -> *const ImWchar;
2340    pub fn ImFontAtlas_GetGlyphRangesThai(atlas: *mut ImFontAtlas) -> *const ImWchar;
2341    pub fn ImFontAtlas_GetTexID(atlas: *mut ImFontAtlas) -> ImTextureID;
2342    pub fn ImFontAtlas_GetTexPixelsAlpha8(atlas: *mut ImFontAtlas) -> *mut c_uchar;
2343    pub fn ImFontAtlas_GetTexPixelsRGBA32(altas: *mut ImFontAtlas) -> *mut c_uint;
2344    pub fn ImFontAtlas_GetTexWidth(atlas: *mut ImFontAtlas) -> c_int;
2345    pub fn ImFontAtlas_GetTexHeight(atlas: *mut ImFontAtlas) -> c_int;
2346    pub fn ImFontAtlas_GetTexDesiredWidth(atlas: *mut ImFontAtlas) -> c_int;
2347    pub fn ImFontAtlas_SetTexDesiredWidth(atlas: *mut ImFontAtlas, TexDesiredWidth_: c_int);
2348    pub fn ImFontAtlas_GetTexGlyphPadding(atlas: *mut ImFontAtlas) -> c_int;
2349    pub fn ImFontAtlas_SetTexGlyphPadding(atlas: *mut ImFontAtlas, TexGlyphPadding_: c_int);
2350    pub fn ImFontAtlas_GetTexUvWhitePixel(atlas: *mut ImFontAtlas, out: *mut ImVec2);
2351}
2352
2353// ImFontAtlas::Fonts
2354extern "C" {
2355    pub fn ImFontAtlas_Fonts_size(atlas: *mut ImFontAtlas) -> c_int;
2356    pub fn ImFontAtlas_Fonts_index(atlas: *mut ImFontAtlas, index: c_int) -> *mut ImFont;
2357}
2358
2359// ImFont
2360extern "C" {
2361    pub fn ImFont_GetFontSize(font: *const ImFont) -> c_float;
2362    pub fn ImFont_SetFontSize(font: *mut ImFont, FontSize_: c_float);
2363    pub fn ImFont_GetScale(font: *const ImFont) -> c_float;
2364    pub fn ImFont_SetScale(font: *mut ImFont, Scale_: c_float);
2365    pub fn ImFont_GetDisplayOffset(font: *const ImFont, out: *mut ImVec2);
2366    pub fn ImFont_GetFallbackGlyph(font: *const ImFont) -> *const ImFontGlyph;
2367    pub fn ImFont_SetFallbackGlyph(font: *mut ImFont, FallbackGlyph: *const ImFontGlyph);
2368    pub fn ImFont_GetFallbackAdvanceX(font: *const ImFont) -> c_float;
2369    pub fn ImFont_GetFallbackChar(font: *const ImFont) -> ImWchar;
2370    pub fn ImFont_GetConfigDataCount(font: *const ImFont) -> c_short;
2371    pub fn ImFont_GetConfigData(font: *mut ImFont) -> *mut ImFontConfig;
2372    pub fn ImFont_GetContainerAtlas(font: *mut ImFont) -> *mut ImFontAtlas;
2373    pub fn ImFont_GetAscent(font: *const ImFont) -> c_float;
2374    pub fn ImFont_GetDescent(font: *const ImFont) -> c_float;
2375    pub fn ImFont_GetMetricsTotalSurface(font: *const ImFont) -> c_int;
2376    pub fn ImFont_ClearOutputData(font: *mut ImFont);
2377    pub fn ImFont_BuildLookupTable(font: *mut ImFont);
2378    pub fn ImFont_FindGlyph(font: *const ImFont, c: ImWchar) -> *const ImFontGlyph;
2379    pub fn ImFont_SetFallbackChar(font: *mut ImFont, c: ImWchar);
2380    pub fn ImFont_GetCharAdvance(font: *const ImFont, c: ImWchar) -> c_float;
2381    pub fn ImFont_IsLoaded(font: *const ImFont) -> bool;
2382    pub fn ImFont_GetDebugName(font: *const ImFont) -> *const c_char;
2383    pub fn ImFont_CalcTextSizeA(
2384        font: *const ImFont,
2385        out: *mut ImVec2,
2386        size: c_float,
2387        max_width: c_float,
2388        wrap_width: c_float,
2389        text_begin: *const c_char,
2390        text_end: *const c_char,
2391        remaining: *mut *const c_char,
2392    );
2393    pub fn ImFont_CalcWordWrapPositionA(
2394        font: *const ImFont,
2395        scale: c_float,
2396        text: *const c_char,
2397        text_end: *const c_char,
2398        wrap_width: c_float,
2399    ) -> *const c_char;
2400    pub fn ImFont_RenderChar(
2401        font: *const ImFont,
2402        draw_list: *mut ImDrawList,
2403        size: c_float,
2404        pos: ImVec2,
2405        col: ImU32,
2406        c: c_ushort,
2407    );
2408    pub fn ImFont_RenderText(
2409        font: *const ImFont,
2410        draw_list: *mut ImDrawList,
2411        size: c_float,
2412        pos: ImVec2,
2413        col: ImU32,
2414        clip_rect: *const ImVec4,
2415        text_begin: *const c_char,
2416        text_end: *const c_char,
2417        wrap_width: c_float,
2418        cpu_fine_clip: bool,
2419    );
2420}
2421
2422// ImFont::Glyph
2423extern "C" {
2424    pub fn ImFont_Glyphs_size(font: *const ImFont) -> c_int;
2425    pub fn ImFont_Glyphs_index(font: *mut ImFont, index: c_int) -> *mut ImFontGlyph;
2426}
2427
2428// ImFont::IndexXAdvance
2429extern "C" {
2430    pub fn ImFont_IndexXAdvance_size(font: *const ImFont) -> c_int;
2431    pub fn ImFont_IndexXAdvance_index(font: *const ImFont, index: c_int) -> c_float;
2432}
2433
2434// ImFont::IndexLookup
2435extern "C" {
2436    pub fn ImFont_IndexLookup_size(ofnt: *const ImFont) -> c_int;
2437    pub fn ImFont_IndexLookup_index(font: *const ImFont, index: c_int) -> c_ushort;
2438}
2439
2440// Although this test is sensitive to ImGui updates, it's useful to reveal potential
2441// alignment errors
2442#[test]
2443fn test_default_style() {
2444    let style = unsafe { &*igGetStyle() };
2445    assert_eq!(style.alpha, 1.0);
2446    assert_eq!(style.window_padding, ImVec2::new(8.0, 8.0));
2447    assert_eq!(style.window_rounding, 7.0);
2448    assert_eq!(style.window_border_size, 0.0);
2449    assert_eq!(style.window_min_size, ImVec2::new(32.0, 32.0));
2450    assert_eq!(style.window_title_align, ImVec2::new(0.0, 0.5));
2451    assert_eq!(style.popup_rounding, 0.0);
2452    assert_eq!(style.popup_border_size, 1.0);
2453    assert_eq!(style.frame_padding, ImVec2::new(4.0, 3.0));
2454    assert_eq!(style.frame_rounding, 0.0);
2455    assert_eq!(style.frame_border_size, 0.0);
2456    assert_eq!(style.item_spacing, ImVec2::new(8.0, 4.0));
2457    assert_eq!(style.item_inner_spacing, ImVec2::new(4.0, 4.0));
2458    assert_eq!(style.touch_extra_padding, ImVec2::new(0.0, 0.0));
2459    assert_eq!(style.indent_spacing, 21.0);
2460    assert_eq!(style.columns_min_spacing, 6.0);
2461    assert_eq!(style.scrollbar_size, 16.0);
2462    assert_eq!(style.scrollbar_rounding, 9.0);
2463    assert_eq!(style.grab_min_size, 10.0);
2464    assert_eq!(style.grab_rounding, 0.0);
2465    assert_eq!(style.button_text_align, ImVec2::new(0.5, 0.5));
2466    assert_eq!(style.display_window_padding, ImVec2::new(22.0, 22.0));
2467    assert_eq!(style.display_safe_area_padding, ImVec2::new(4.0, 4.0));
2468    assert_eq!(style.anti_aliased_lines, true);
2469    assert_eq!(style.anti_aliased_fill, true);
2470    assert_eq!(style.curve_tessellation_tol, 1.25);
2471}