1use super::{cstr_ptr, ImGui};
2use nsf_imgui_raw::*;
3use std::ffi::CStr;
4impl ImGui {
5 #[inline]
7 pub fn align_text_to_frame_padding<'a>(&'a self) {
8 unsafe { igAlignTextToFramePadding() };
9 }
10 #[inline]
11 pub fn arrow_button<'a, 'b>(&'a self, str_id: &'b CStr, dir: ImGuiDir) -> bool {
12 unsafe { igArrowButton(str_id.as_ptr(), dir) }
13 }
14 #[inline]
15 pub fn begin<'a, 'b, 'c>(
16 &'a self,
17 name: &'b CStr,
18 p_open: impl Into<Option<&'c mut bool>>,
19 flags: impl Into<Option<ImGuiWindowFlags>>,
20 ) -> bool {
21 unsafe {
22 igBegin(
23 name.as_ptr(),
24 match p_open.into() {
25 Some(v) => v,
26 None => ::std::ptr::null_mut(),
27 },
28 match flags.into() {
29 Some(v) => v,
30 None => ImGuiWindowFlags::empty(),
31 },
32 )
33 }
34 }
35 #[inline]
36 pub fn begin_child<'a, 'b>(
37 &'a self,
38 str_id: &'b CStr,
39 size: impl Into<Option<ImVec2>>,
40 border: impl Into<Option<bool>>,
41 flags: impl Into<Option<ImGuiWindowFlags>>,
42 ) -> bool {
43 unsafe {
44 igBeginChild(
45 str_id.as_ptr(),
46 match size.into() {
47 Some(v) => v,
48 None => ImVec2 { x: 0.0, y: 0.0 },
49 },
50 match border.into() {
51 Some(v) => v,
52 None => false,
53 },
54 match flags.into() {
55 Some(v) => v,
56 None => ImGuiWindowFlags::empty(),
57 },
58 )
59 }
60 }
61 #[inline]
62 pub fn begin_child_id<'a>(
63 &'a self,
64 id: ImGuiID,
65 size: impl Into<Option<ImVec2>>,
66 border: impl Into<Option<bool>>,
67 flags: impl Into<Option<ImGuiWindowFlags>>,
68 ) -> bool {
69 unsafe {
70 igBeginChildID(
71 id,
72 match size.into() {
73 Some(v) => v,
74 None => ImVec2 { x: 0.0, y: 0.0 },
75 },
76 match border.into() {
77 Some(v) => v,
78 None => false,
79 },
80 match flags.into() {
81 Some(v) => v,
82 None => ImGuiWindowFlags::empty(),
83 },
84 )
85 }
86 }
87 #[inline]
88 pub fn begin_child_frame<'a>(
89 &'a self,
90 id: ImGuiID,
91 size: ImVec2,
92 flags: impl Into<Option<ImGuiWindowFlags>>,
93 ) -> bool {
94 unsafe {
95 igBeginChildFrame(
96 id,
97 size,
98 match flags.into() {
99 Some(v) => v,
100 None => ImGuiWindowFlags::empty(),
101 },
102 )
103 }
104 }
105 #[inline]
106 pub fn begin_combo<'a, 'b, 'c>(
107 &'a self,
108 label: &'b CStr,
109 preview_value: &'c CStr,
110 flags: impl Into<Option<ImGuiComboFlags>>,
111 ) -> bool {
112 unsafe {
113 igBeginCombo(
114 label.as_ptr(),
115 preview_value.as_ptr(),
116 match flags.into() {
117 Some(v) => v,
118 None => ImGuiComboFlags::empty(),
119 },
120 )
121 }
122 }
123 #[inline]
124 pub fn begin_drag_drop_source<'a>(&'a self, flags: impl Into<Option<ImGuiDragDropFlags>>) -> bool {
125 unsafe {
126 igBeginDragDropSource(match flags.into() {
127 Some(v) => v,
128 None => ImGuiDragDropFlags::empty(),
129 })
130 }
131 }
132 #[inline]
133 pub fn begin_drag_drop_target<'a>(&'a self) -> bool {
134 unsafe { igBeginDragDropTarget() }
135 }
136 #[inline]
137 pub fn begin_group<'a>(&'a self) {
138 unsafe { igBeginGroup() };
139 }
140 #[inline]
141 pub fn begin_main_menu_bar<'a>(&'a self) -> bool {
142 unsafe { igBeginMainMenuBar() }
143 }
144 #[inline]
145 pub fn begin_menu<'a, 'b>(&'a self, label: &'b CStr, enabled: impl Into<Option<bool>>) -> bool {
146 unsafe {
147 igBeginMenu(
148 label.as_ptr(),
149 match enabled.into() {
150 Some(v) => v,
151 None => true,
152 },
153 )
154 }
155 }
156 #[inline]
157 pub fn begin_menu_bar<'a>(&'a self) -> bool {
158 unsafe { igBeginMenuBar() }
159 }
160 #[inline]
161 pub fn begin_popup<'a, 'b>(&'a self, str_id: &'b CStr, flags: impl Into<Option<ImGuiWindowFlags>>) -> bool {
162 unsafe {
163 igBeginPopup(
164 str_id.as_ptr(),
165 match flags.into() {
166 Some(v) => v,
167 None => ImGuiWindowFlags::empty(),
168 },
169 )
170 }
171 }
172 #[inline]
173 pub fn begin_popup_context_item<'a, 'b>(
174 &'a self,
175 str_id: impl Into<Option<&'b CStr>>,
176 mouse_button: impl Into<Option<i32>>,
177 ) -> bool {
178 unsafe {
179 igBeginPopupContextItem(
180 match str_id.into() {
181 Some(v) => v.as_ptr(),
182 None => ::std::ptr::null(),
183 },
184 match mouse_button.into() {
185 Some(v) => v,
186 None => 1,
187 },
188 )
189 }
190 }
191 #[inline]
192 pub fn begin_popup_context_void<'a, 'b>(
193 &'a self,
194 str_id: impl Into<Option<&'b CStr>>,
195 mouse_button: impl Into<Option<i32>>,
196 ) -> bool {
197 unsafe {
198 igBeginPopupContextVoid(
199 match str_id.into() {
200 Some(v) => v.as_ptr(),
201 None => ::std::ptr::null(),
202 },
203 match mouse_button.into() {
204 Some(v) => v,
205 None => 1,
206 },
207 )
208 }
209 }
210 #[inline]
211 pub fn begin_popup_context_window<'a, 'b>(
212 &'a self,
213 str_id: impl Into<Option<&'b CStr>>,
214 mouse_button: impl Into<Option<i32>>,
215 also_over_items: impl Into<Option<bool>>,
216 ) -> bool {
217 unsafe {
218 igBeginPopupContextWindow(
219 match str_id.into() {
220 Some(v) => v.as_ptr(),
221 None => ::std::ptr::null(),
222 },
223 match mouse_button.into() {
224 Some(v) => v,
225 None => 1,
226 },
227 match also_over_items.into() {
228 Some(v) => v,
229 None => true,
230 },
231 )
232 }
233 }
234 #[inline]
235 pub fn begin_popup_modal<'a, 'b, 'c>(
236 &'a self,
237 name: &'b CStr,
238 p_open: impl Into<Option<&'c mut bool>>,
239 flags: impl Into<Option<ImGuiWindowFlags>>,
240 ) -> bool {
241 unsafe {
242 igBeginPopupModal(
243 name.as_ptr(),
244 match p_open.into() {
245 Some(v) => v,
246 None => ::std::ptr::null_mut(),
247 },
248 match flags.into() {
249 Some(v) => v,
250 None => ImGuiWindowFlags::empty(),
251 },
252 )
253 }
254 }
255 #[inline]
256 pub fn begin_tooltip<'a>(&'a self) {
257 unsafe { igBeginTooltip() };
258 }
259 #[inline]
260 pub fn bullet<'a>(&'a self) {
261 unsafe { igBullet() };
262 }
263 #[inline]
264 pub fn bullet_text<'a, 'b>(&'a self, fmt: &'b CStr) {
265 unsafe { igBulletText(cstr_ptr!("%s"), fmt.as_ptr()) };
266 }
267 #[inline]
268 pub fn button<'a, 'b>(&'a self, label: &'b CStr, size: impl Into<Option<ImVec2>>) -> bool {
269 unsafe {
270 igButton(
271 label.as_ptr(),
272 match size.into() {
273 Some(v) => v,
274 None => ImVec2 { x: 0.0, y: 0.0 },
275 },
276 )
277 }
278 }
279 #[inline]
280 pub fn calc_item_width<'a>(&'a self) -> f32 {
281 unsafe { igCalcItemWidth() }
282 }
283 #[inline]
284 pub fn calc_list_clipping<'a, 'b, 'c>(
285 &'a self,
286 items_count: i32,
287 items_height: f32,
288 out_items_display_start: &'b mut i32,
289 out_items_display_end: &'c mut i32,
290 ) {
291 unsafe {
292 igCalcListClipping(
293 items_count,
294 items_height,
295 out_items_display_start,
296 out_items_display_end,
297 )
298 };
299 }
300 #[inline]
301 pub fn calc_text_size<'a, 'b, 'c>(
302 &'a self,
303 text: &'b CStr,
304 text_end: impl Into<Option<&'c CStr>>,
305 hide_text_after_double_hash: impl Into<Option<bool>>,
306 wrap_width: impl Into<Option<f32>>,
307 ) -> ImVec2 {
308 unsafe {
309 igCalcTextSize(
310 text.as_ptr(),
311 match text_end.into() {
312 Some(v) => v.as_ptr(),
313 None => ::std::ptr::null(),
314 },
315 match hide_text_after_double_hash.into() {
316 Some(v) => v,
317 None => false,
318 },
319 match wrap_width.into() {
320 Some(v) => v,
321 None => -1.0,
322 },
323 )
324 }
325 }
326 #[inline]
327 pub fn capture_keyboard_from_app<'a>(&'a self, capture: impl Into<Option<bool>>) {
328 unsafe {
329 igCaptureKeyboardFromApp(match capture.into() {
330 Some(v) => v,
331 None => true,
332 })
333 };
334 }
335 #[inline]
336 pub fn capture_mouse_from_app<'a>(&'a self, capture: impl Into<Option<bool>>) {
337 unsafe {
338 igCaptureMouseFromApp(match capture.into() {
339 Some(v) => v,
340 None => true,
341 })
342 };
343 }
344 #[inline]
345 pub fn checkbox<'a, 'b, 'c>(&'a self, label: &'b CStr, v: &'c mut bool) -> bool {
346 unsafe { igCheckbox(label.as_ptr(), v) }
347 }
348 #[inline]
349 pub fn checkbox_flags<'a, 'b, 'c>(&'a self, label: &'b CStr, flags: &'c mut u32, flags_value: u32) -> bool {
350 unsafe { igCheckboxFlags(label.as_ptr(), flags, flags_value) }
351 }
352 #[inline]
353 pub fn close_current_popup<'a>(&'a self) {
354 unsafe { igCloseCurrentPopup() };
355 }
356 #[inline]
357 pub fn collapsing_header<'a, 'b>(&'a self, label: &'b CStr, flags: impl Into<Option<ImGuiTreeNodeFlags>>) -> bool {
358 unsafe {
359 igCollapsingHeader(
360 label.as_ptr(),
361 match flags.into() {
362 Some(v) => v,
363 None => ImGuiTreeNodeFlags::empty(),
364 },
365 )
366 }
367 }
368 #[inline]
369 pub fn collapsing_header_bool_ptr<'a, 'b, 'c>(
370 &'a self,
371 label: &'b CStr,
372 p_open: &'c mut bool,
373 flags: impl Into<Option<ImGuiTreeNodeFlags>>,
374 ) -> bool {
375 unsafe {
376 igCollapsingHeaderBoolPtr(
377 label.as_ptr(),
378 p_open,
379 match flags.into() {
380 Some(v) => v,
381 None => ImGuiTreeNodeFlags::empty(),
382 },
383 )
384 }
385 }
386 #[inline]
387 pub fn color_button<'a, 'b>(
388 &'a self,
389 desc_id: &'b CStr,
390 col: ImVec4,
391 flags: impl Into<Option<ImGuiColorEditFlags>>,
392 size: impl Into<Option<ImVec2>>,
393 ) -> bool {
394 unsafe {
395 igColorButton(
396 desc_id.as_ptr(),
397 col,
398 match flags.into() {
399 Some(v) => v,
400 None => ImGuiColorEditFlags::empty(),
401 },
402 match size.into() {
403 Some(v) => v,
404 None => ImVec2 { x: 0.0, y: 0.0 },
405 },
406 )
407 }
408 }
409 #[inline]
410 pub fn color_convert_float4_to_u32<'a>(&'a self, _in: ImVec4) -> u32 {
411 unsafe { igColorConvertFloat4ToU32(_in) }
412 }
413 #[inline]
414 pub fn color_convert_hsv_to_rgb<'a, 'b, 'c, 'd>(
415 &'a self,
416 h: f32,
417 s: f32,
418 v: f32,
419 out_r: &'b mut f32,
420 out_g: &'c mut f32,
421 out_b: &'d mut f32,
422 ) {
423 unsafe { igColorConvertHSVtoRGB(h, s, v, out_r, out_g, out_b) };
424 }
425 #[inline]
426 pub fn color_convert_rgb_to_hsv<'a, 'b, 'c, 'd>(
427 &'a self,
428 r: f32,
429 g: f32,
430 b: f32,
431 out_h: &'b mut f32,
432 out_s: &'c mut f32,
433 out_v: &'d mut f32,
434 ) {
435 unsafe { igColorConvertRGBtoHSV(r, g, b, out_h, out_s, out_v) };
436 }
437 #[inline]
438 pub fn color_convert_u32_to_float4<'a>(&'a self, _in: u32) -> ImVec4 {
439 unsafe { igColorConvertU32ToFloat4(_in) }
440 }
441 #[inline]
442 pub fn color_edit3<'a, 'b, 'c>(
443 &'a self,
444 label: &'b CStr,
445 col: &'c mut [f32; 3],
446 flags: impl Into<Option<ImGuiColorEditFlags>>,
447 ) -> bool {
448 unsafe {
449 igColorEdit3(
450 label.as_ptr(),
451 col,
452 match flags.into() {
453 Some(v) => v,
454 None => ImGuiColorEditFlags::empty(),
455 },
456 )
457 }
458 }
459 #[inline]
460 pub fn color_edit4<'a, 'b, 'c>(
461 &'a self,
462 label: &'b CStr,
463 col: &'c mut [f32; 4],
464 flags: impl Into<Option<ImGuiColorEditFlags>>,
465 ) -> bool {
466 unsafe {
467 igColorEdit4(
468 label.as_ptr(),
469 col,
470 match flags.into() {
471 Some(v) => v,
472 None => ImGuiColorEditFlags::empty(),
473 },
474 )
475 }
476 }
477 #[inline]
478 pub fn color_picker3<'a, 'b, 'c>(
479 &'a self,
480 label: &'b CStr,
481 col: &'c mut [f32; 3],
482 flags: impl Into<Option<ImGuiColorEditFlags>>,
483 ) -> bool {
484 unsafe {
485 igColorPicker3(
486 label.as_ptr(),
487 col,
488 match flags.into() {
489 Some(v) => v,
490 None => ImGuiColorEditFlags::empty(),
491 },
492 )
493 }
494 }
495 #[inline]
496 pub fn color_picker4<'a, 'b, 'c, 'd>(
497 &'a self,
498 label: &'b CStr,
499 col: &'c mut [f32; 4],
500 flags: impl Into<Option<ImGuiColorEditFlags>>,
501 ref_col: impl Into<Option<&'d f32>>,
502 ) -> bool {
503 unsafe {
504 igColorPicker4(
505 label.as_ptr(),
506 col,
507 match flags.into() {
508 Some(v) => v,
509 None => ImGuiColorEditFlags::empty(),
510 },
511 match ref_col.into() {
512 Some(v) => v,
513 None => ::std::ptr::null(),
514 },
515 )
516 }
517 }
518 #[inline]
519 pub fn columns<'a, 'b>(
520 &'a self,
521 count: impl Into<Option<i32>>,
522 id: impl Into<Option<&'b CStr>>,
523 border: impl Into<Option<bool>>,
524 ) {
525 unsafe {
526 igColumns(
527 match count.into() {
528 Some(v) => v,
529 None => 1,
530 },
531 match id.into() {
532 Some(v) => v.as_ptr(),
533 None => ::std::ptr::null(),
534 },
535 match border.into() {
536 Some(v) => v,
537 None => true,
538 },
539 )
540 };
541 }
542 #[inline]
544 pub fn combo_str<'a, 'b, 'c, 'd>(
545 &'a self,
546 label: &'b CStr,
547 current_item: &'c mut i32,
548 items_separated_by_zeros: &'d CStr,
549 popup_max_height_in_items: impl Into<Option<i32>>,
550 ) -> bool {
551 unsafe {
552 igComboStr(
553 label.as_ptr(),
554 current_item,
555 items_separated_by_zeros.as_ptr(),
556 match popup_max_height_in_items.into() {
557 Some(v) => v,
558 None => -1,
559 },
560 )
561 }
562 }
563 #[inline]
565 pub fn debug_check_version_and_data_layout<'a, 'b>(
566 &'a self,
567 version_str: &'b CStr,
568 sz_io: usize,
569 sz_style: usize,
570 sz_vec2: usize,
571 sz_vec4: usize,
572 sz_drawvert: usize,
573 ) -> bool {
574 unsafe {
575 igDebugCheckVersionAndDataLayout(version_str.as_ptr(), sz_io, sz_style, sz_vec2, sz_vec4, sz_drawvert)
576 }
577 }
578 #[inline]
579 pub fn drag_float<'a, 'b, 'c, 'd>(
580 &'a self,
581 label: &'b CStr,
582 v: &'c mut f32,
583 v_speed: impl Into<Option<f32>>,
584 v_min: impl Into<Option<f32>>,
585 v_max: impl Into<Option<f32>>,
586 format: impl Into<Option<&'d CStr>>,
587 power: impl Into<Option<f32>>,
588 ) -> bool {
589 unsafe {
590 igDragFloat(
591 label.as_ptr(),
592 v,
593 match v_speed.into() {
594 Some(v) => v,
595 None => 1.0,
596 },
597 match v_min.into() {
598 Some(v) => v,
599 None => 0.0,
600 },
601 match v_max.into() {
602 Some(v) => v,
603 None => 0.0,
604 },
605 match format.into() {
606 Some(v) => v.as_ptr(),
607 None => cstr_ptr!("%.3f"),
608 },
609 match power.into() {
610 Some(v) => v,
611 None => 1.0,
612 },
613 )
614 }
615 }
616 #[inline]
617 pub fn drag_float2<'a, 'b, 'c, 'd>(
618 &'a self,
619 label: &'b CStr,
620 v: &'c mut [f32; 2],
621 v_speed: impl Into<Option<f32>>,
622 v_min: impl Into<Option<f32>>,
623 v_max: impl Into<Option<f32>>,
624 format: impl Into<Option<&'d CStr>>,
625 power: impl Into<Option<f32>>,
626 ) -> bool {
627 unsafe {
628 igDragFloat2(
629 label.as_ptr(),
630 v,
631 match v_speed.into() {
632 Some(v) => v,
633 None => 1.0,
634 },
635 match v_min.into() {
636 Some(v) => v,
637 None => 0.0,
638 },
639 match v_max.into() {
640 Some(v) => v,
641 None => 0.0,
642 },
643 match format.into() {
644 Some(v) => v.as_ptr(),
645 None => cstr_ptr!("%.3f"),
646 },
647 match power.into() {
648 Some(v) => v,
649 None => 1.0,
650 },
651 )
652 }
653 }
654 #[inline]
655 pub fn drag_float3<'a, 'b, 'c, 'd>(
656 &'a self,
657 label: &'b CStr,
658 v: &'c mut [f32; 3],
659 v_speed: impl Into<Option<f32>>,
660 v_min: impl Into<Option<f32>>,
661 v_max: impl Into<Option<f32>>,
662 format: impl Into<Option<&'d CStr>>,
663 power: impl Into<Option<f32>>,
664 ) -> bool {
665 unsafe {
666 igDragFloat3(
667 label.as_ptr(),
668 v,
669 match v_speed.into() {
670 Some(v) => v,
671 None => 1.0,
672 },
673 match v_min.into() {
674 Some(v) => v,
675 None => 0.0,
676 },
677 match v_max.into() {
678 Some(v) => v,
679 None => 0.0,
680 },
681 match format.into() {
682 Some(v) => v.as_ptr(),
683 None => cstr_ptr!("%.3f"),
684 },
685 match power.into() {
686 Some(v) => v,
687 None => 1.0,
688 },
689 )
690 }
691 }
692 #[inline]
693 pub fn drag_float4<'a, 'b, 'c, 'd>(
694 &'a self,
695 label: &'b CStr,
696 v: &'c mut [f32; 4],
697 v_speed: impl Into<Option<f32>>,
698 v_min: impl Into<Option<f32>>,
699 v_max: impl Into<Option<f32>>,
700 format: impl Into<Option<&'d CStr>>,
701 power: impl Into<Option<f32>>,
702 ) -> bool {
703 unsafe {
704 igDragFloat4(
705 label.as_ptr(),
706 v,
707 match v_speed.into() {
708 Some(v) => v,
709 None => 1.0,
710 },
711 match v_min.into() {
712 Some(v) => v,
713 None => 0.0,
714 },
715 match v_max.into() {
716 Some(v) => v,
717 None => 0.0,
718 },
719 match format.into() {
720 Some(v) => v.as_ptr(),
721 None => cstr_ptr!("%.3f"),
722 },
723 match power.into() {
724 Some(v) => v,
725 None => 1.0,
726 },
727 )
728 }
729 }
730 #[inline]
731 pub fn drag_float_range2<'a, 'b, 'c, 'd, 'e, 'f>(
732 &'a self,
733 label: &'b CStr,
734 v_current_min: &'c mut f32,
735 v_current_max: &'d mut f32,
736 v_speed: impl Into<Option<f32>>,
737 v_min: impl Into<Option<f32>>,
738 v_max: impl Into<Option<f32>>,
739 format: impl Into<Option<&'e CStr>>,
740 format_max: impl Into<Option<&'f CStr>>,
741 power: impl Into<Option<f32>>,
742 ) -> bool {
743 unsafe {
744 igDragFloatRange2(
745 label.as_ptr(),
746 v_current_min,
747 v_current_max,
748 match v_speed.into() {
749 Some(v) => v,
750 None => 1.0,
751 },
752 match v_min.into() {
753 Some(v) => v,
754 None => 0.0,
755 },
756 match v_max.into() {
757 Some(v) => v,
758 None => 0.0,
759 },
760 match format.into() {
761 Some(v) => v.as_ptr(),
762 None => cstr_ptr!("%.3f"),
763 },
764 match format_max.into() {
765 Some(v) => v.as_ptr(),
766 None => ::std::ptr::null(),
767 },
768 match power.into() {
769 Some(v) => v,
770 None => 1.0,
771 },
772 )
773 }
774 }
775 #[inline]
776 pub fn drag_int<'a, 'b, 'c, 'd>(
777 &'a self,
778 label: &'b CStr,
779 v: &'c mut i32,
780 v_speed: impl Into<Option<f32>>,
781 v_min: impl Into<Option<i32>>,
782 v_max: impl Into<Option<i32>>,
783 format: impl Into<Option<&'d CStr>>,
784 ) -> bool {
785 unsafe {
786 igDragInt(
787 label.as_ptr(),
788 v,
789 match v_speed.into() {
790 Some(v) => v,
791 None => 1.0,
792 },
793 match v_min.into() {
794 Some(v) => v,
795 None => 0,
796 },
797 match v_max.into() {
798 Some(v) => v,
799 None => 0,
800 },
801 match format.into() {
802 Some(v) => v.as_ptr(),
803 None => cstr_ptr!("%d"),
804 },
805 )
806 }
807 }
808 #[inline]
809 pub fn drag_int2<'a, 'b, 'c, 'd>(
810 &'a self,
811 label: &'b CStr,
812 v: &'c mut [i32; 2],
813 v_speed: impl Into<Option<f32>>,
814 v_min: impl Into<Option<i32>>,
815 v_max: impl Into<Option<i32>>,
816 format: impl Into<Option<&'d CStr>>,
817 ) -> bool {
818 unsafe {
819 igDragInt2(
820 label.as_ptr(),
821 v,
822 match v_speed.into() {
823 Some(v) => v,
824 None => 1.0,
825 },
826 match v_min.into() {
827 Some(v) => v,
828 None => 0,
829 },
830 match v_max.into() {
831 Some(v) => v,
832 None => 0,
833 },
834 match format.into() {
835 Some(v) => v.as_ptr(),
836 None => cstr_ptr!("%d"),
837 },
838 )
839 }
840 }
841 #[inline]
842 pub fn drag_int3<'a, 'b, 'c, 'd>(
843 &'a self,
844 label: &'b CStr,
845 v: &'c mut [i32; 3],
846 v_speed: impl Into<Option<f32>>,
847 v_min: impl Into<Option<i32>>,
848 v_max: impl Into<Option<i32>>,
849 format: impl Into<Option<&'d CStr>>,
850 ) -> bool {
851 unsafe {
852 igDragInt3(
853 label.as_ptr(),
854 v,
855 match v_speed.into() {
856 Some(v) => v,
857 None => 1.0,
858 },
859 match v_min.into() {
860 Some(v) => v,
861 None => 0,
862 },
863 match v_max.into() {
864 Some(v) => v,
865 None => 0,
866 },
867 match format.into() {
868 Some(v) => v.as_ptr(),
869 None => cstr_ptr!("%d"),
870 },
871 )
872 }
873 }
874 #[inline]
875 pub fn drag_int4<'a, 'b, 'c, 'd>(
876 &'a self,
877 label: &'b CStr,
878 v: &'c mut [i32; 4],
879 v_speed: impl Into<Option<f32>>,
880 v_min: impl Into<Option<i32>>,
881 v_max: impl Into<Option<i32>>,
882 format: impl Into<Option<&'d CStr>>,
883 ) -> bool {
884 unsafe {
885 igDragInt4(
886 label.as_ptr(),
887 v,
888 match v_speed.into() {
889 Some(v) => v,
890 None => 1.0,
891 },
892 match v_min.into() {
893 Some(v) => v,
894 None => 0,
895 },
896 match v_max.into() {
897 Some(v) => v,
898 None => 0,
899 },
900 match format.into() {
901 Some(v) => v.as_ptr(),
902 None => cstr_ptr!("%d"),
903 },
904 )
905 }
906 }
907 #[inline]
908 pub fn drag_int_range2<'a, 'b, 'c, 'd, 'e, 'f>(
909 &'a self,
910 label: &'b CStr,
911 v_current_min: &'c mut i32,
912 v_current_max: &'d mut i32,
913 v_speed: impl Into<Option<f32>>,
914 v_min: impl Into<Option<i32>>,
915 v_max: impl Into<Option<i32>>,
916 format: impl Into<Option<&'e CStr>>,
917 format_max: impl Into<Option<&'f CStr>>,
918 ) -> bool {
919 unsafe {
920 igDragIntRange2(
921 label.as_ptr(),
922 v_current_min,
923 v_current_max,
924 match v_speed.into() {
925 Some(v) => v,
926 None => 1.0,
927 },
928 match v_min.into() {
929 Some(v) => v,
930 None => 0,
931 },
932 match v_max.into() {
933 Some(v) => v,
934 None => 0,
935 },
936 match format.into() {
937 Some(v) => v.as_ptr(),
938 None => cstr_ptr!("%d"),
939 },
940 match format_max.into() {
941 Some(v) => v.as_ptr(),
942 None => ::std::ptr::null(),
943 },
944 )
945 }
946 }
947 #[inline]
950 pub fn dummy<'a>(&'a self, size: ImVec2) {
951 unsafe { igDummy(size) };
952 }
953 #[inline]
954 pub fn end<'a>(&'a self) {
955 unsafe { igEnd() };
956 }
957 #[inline]
958 pub fn end_child<'a>(&'a self) {
959 unsafe { igEndChild() };
960 }
961 #[inline]
962 pub fn end_child_frame<'a>(&'a self) {
963 unsafe { igEndChildFrame() };
964 }
965 #[inline]
966 pub fn end_combo<'a>(&'a self) {
967 unsafe { igEndCombo() };
968 }
969 #[inline]
970 pub fn end_drag_drop_source<'a>(&'a self) {
971 unsafe { igEndDragDropSource() };
972 }
973 #[inline]
974 pub fn end_drag_drop_target<'a>(&'a self) {
975 unsafe { igEndDragDropTarget() };
976 }
977 #[inline]
978 pub fn end_frame<'a>(&'a self) {
979 unsafe { igEndFrame() };
980 }
981 #[inline]
982 pub fn end_group<'a>(&'a self) {
983 unsafe { igEndGroup() };
984 }
985 #[inline]
986 pub fn end_main_menu_bar<'a>(&'a self) {
987 unsafe { igEndMainMenuBar() };
988 }
989 #[inline]
990 pub fn end_menu<'a>(&'a self) {
991 unsafe { igEndMenu() };
992 }
993 #[inline]
994 pub fn end_menu_bar<'a>(&'a self) {
995 unsafe { igEndMenuBar() };
996 }
997 #[inline]
998 pub fn end_popup<'a>(&'a self) {
999 unsafe { igEndPopup() };
1000 }
1001 #[inline]
1002 pub fn end_tooltip<'a>(&'a self) {
1003 unsafe { igEndTooltip() };
1004 }
1005 #[inline]
1006 pub fn get_clipboard_text<'a>(&'a self) -> String {
1007 unsafe { CStr::from_ptr(igGetClipboardText()).to_string_lossy().into_owned() }
1008 }
1009 #[inline]
1010 pub fn get_color_u32<'a>(&'a self, idx: ImGuiCol, alpha_mul: impl Into<Option<f32>>) -> u32 {
1011 unsafe {
1012 igGetColorU32(
1013 idx,
1014 match alpha_mul.into() {
1015 Some(v) => v,
1016 None => 1.0,
1017 },
1018 )
1019 }
1020 }
1021 #[inline]
1022 pub fn get_color_u32_vec4<'a>(&'a self, col: ImVec4) -> u32 {
1023 unsafe { igGetColorU32Vec4(col) }
1024 }
1025 #[inline]
1026 pub fn get_color_u32_u32<'a>(&'a self, col: u32) -> u32 {
1027 unsafe { igGetColorU32U32(col) }
1028 }
1029 #[inline]
1030 pub fn get_column_index<'a>(&'a self) -> i32 {
1031 unsafe { igGetColumnIndex() }
1032 }
1033 #[inline]
1034 pub fn get_column_offset<'a>(&'a self, column_index: impl Into<Option<i32>>) -> f32 {
1035 unsafe {
1036 igGetColumnOffset(match column_index.into() {
1037 Some(v) => v,
1038 None => -1,
1039 })
1040 }
1041 }
1042 #[inline]
1043 pub fn get_column_width<'a>(&'a self, column_index: impl Into<Option<i32>>) -> f32 {
1044 unsafe {
1045 igGetColumnWidth(match column_index.into() {
1046 Some(v) => v,
1047 None => -1,
1048 })
1049 }
1050 }
1051 #[inline]
1052 pub fn get_columns_count<'a>(&'a self) -> i32 {
1053 unsafe { igGetColumnsCount() }
1054 }
1055 #[inline]
1056 pub fn get_content_region_avail<'a>(&'a self) -> ImVec2 {
1057 unsafe { igGetContentRegionAvail() }
1058 }
1059 #[inline]
1060 pub fn get_content_region_avail_width<'a>(&'a self) -> f32 {
1061 unsafe { igGetContentRegionAvailWidth() }
1062 }
1063 #[inline]
1064 pub fn get_content_region_max<'a>(&'a self) -> ImVec2 {
1065 unsafe { igGetContentRegionMax() }
1066 }
1067 #[inline]
1069 pub fn get_cursor_pos<'a>(&'a self) -> ImVec2 {
1070 unsafe { igGetCursorPos() }
1071 }
1072 #[inline]
1073 pub fn get_cursor_pos_x<'a>(&'a self) -> f32 {
1074 unsafe { igGetCursorPosX() }
1075 }
1076 #[inline]
1077 pub fn get_cursor_pos_y<'a>(&'a self) -> f32 {
1078 unsafe { igGetCursorPosY() }
1079 }
1080 #[inline]
1081 pub fn get_cursor_screen_pos<'a>(&'a self) -> ImVec2 {
1082 unsafe { igGetCursorScreenPos() }
1083 }
1084 #[inline]
1085 pub fn get_cursor_start_pos<'a>(&'a self) -> ImVec2 {
1086 unsafe { igGetCursorStartPos() }
1087 }
1088 #[inline]
1093 pub fn get_font_size<'a>(&'a self) -> f32 {
1094 unsafe { igGetFontSize() }
1095 }
1096 #[inline]
1097 pub fn get_font_tex_uv_white_pixel<'a>(&'a self) -> ImVec2 {
1098 unsafe { igGetFontTexUvWhitePixel() }
1099 }
1100 #[inline]
1101 pub fn get_frame_count<'a>(&'a self) -> i32 {
1102 unsafe { igGetFrameCount() }
1103 }
1104 #[inline]
1105 pub fn get_frame_height<'a>(&'a self) -> f32 {
1106 unsafe { igGetFrameHeight() }
1107 }
1108 #[inline]
1109 pub fn get_frame_height_with_spacing<'a>(&'a self) -> f32 {
1110 unsafe { igGetFrameHeightWithSpacing() }
1111 }
1112 #[inline]
1113 pub fn get_id_str<'a, 'b>(&'a self, str_id: &'b CStr) -> ImGuiID {
1114 unsafe { igGetIDStr(str_id.as_ptr()) }
1115 }
1116 #[inline]
1117 pub fn get_id_range<'a, 'b, 'c>(&'a self, str_id_begin: &'b CStr, str_id_end: &'c CStr) -> ImGuiID {
1118 unsafe { igGetIDRange(str_id_begin.as_ptr(), str_id_end.as_ptr()) }
1119 }
1120 #[inline]
1123 pub fn get_item_rect_max<'a>(&'a self) -> ImVec2 {
1124 unsafe { igGetItemRectMax() }
1125 }
1126 #[inline]
1127 pub fn get_item_rect_min<'a>(&'a self) -> ImVec2 {
1128 unsafe { igGetItemRectMin() }
1129 }
1130 #[inline]
1131 pub fn get_item_rect_size<'a>(&'a self) -> ImVec2 {
1132 unsafe { igGetItemRectSize() }
1133 }
1134 #[inline]
1135 pub fn get_key_index<'a>(&'a self, imgui_key: ImGuiKey) -> i32 {
1136 unsafe { igGetKeyIndex(imgui_key) }
1137 }
1138 #[inline]
1139 pub fn get_key_pressed_amount<'a>(&'a self, key_index: i32, repeat_delay: f32, rate: f32) -> i32 {
1140 unsafe { igGetKeyPressedAmount(key_index, repeat_delay, rate) }
1141 }
1142 #[inline]
1143 pub fn get_mouse_cursor<'a>(&'a self) -> ImGuiMouseCursor {
1144 unsafe { igGetMouseCursor() }
1145 }
1146 #[inline]
1147 pub fn get_mouse_drag_delta<'a>(
1148 &'a self,
1149 button: impl Into<Option<i32>>,
1150 lock_threshold: impl Into<Option<f32>>,
1151 ) -> ImVec2 {
1152 unsafe {
1153 igGetMouseDragDelta(
1154 match button.into() {
1155 Some(v) => v,
1156 None => 0,
1157 },
1158 match lock_threshold.into() {
1159 Some(v) => v,
1160 None => -1.0,
1161 },
1162 )
1163 }
1164 }
1165 #[inline]
1166 pub fn get_mouse_pos<'a>(&'a self) -> ImVec2 {
1167 unsafe { igGetMousePos() }
1168 }
1169 #[inline]
1170 pub fn get_mouse_pos_on_opening_current_popup<'a>(&'a self) -> ImVec2 {
1171 unsafe { igGetMousePosOnOpeningCurrentPopup() }
1172 }
1173 #[inline]
1175 pub fn get_scroll_max_x<'a>(&'a self) -> f32 {
1176 unsafe { igGetScrollMaxX() }
1177 }
1178 #[inline]
1179 pub fn get_scroll_max_y<'a>(&'a self) -> f32 {
1180 unsafe { igGetScrollMaxY() }
1181 }
1182 #[inline]
1183 pub fn get_scroll_x<'a>(&'a self) -> f32 {
1184 unsafe { igGetScrollX() }
1185 }
1186 #[inline]
1187 pub fn get_scroll_y<'a>(&'a self) -> f32 {
1188 unsafe { igGetScrollY() }
1189 }
1190 #[inline]
1193 pub fn get_style_color_name<'a>(&'a self, idx: ImGuiCol) -> String {
1194 unsafe { CStr::from_ptr(igGetStyleColorName(idx)).to_string_lossy().into_owned() }
1195 }
1196 #[inline]
1198 pub fn get_text_line_height<'a>(&'a self) -> f32 {
1199 unsafe { igGetTextLineHeight() }
1200 }
1201 #[inline]
1202 pub fn get_text_line_height_with_spacing<'a>(&'a self) -> f32 {
1203 unsafe { igGetTextLineHeightWithSpacing() }
1204 }
1205 #[inline]
1206 pub fn get_time<'a>(&'a self) -> f64 {
1207 unsafe { igGetTime() }
1208 }
1209 #[inline]
1210 pub fn get_tree_node_to_label_spacing<'a>(&'a self) -> f32 {
1211 unsafe { igGetTreeNodeToLabelSpacing() }
1212 }
1213 #[inline]
1214 pub fn get_version<'a>(&'a self) -> String {
1215 unsafe { CStr::from_ptr(igGetVersion()).to_string_lossy().into_owned() }
1216 }
1217 #[inline]
1218 pub fn get_window_content_region_max<'a>(&'a self) -> ImVec2 {
1219 unsafe { igGetWindowContentRegionMax() }
1220 }
1221 #[inline]
1222 pub fn get_window_content_region_min<'a>(&'a self) -> ImVec2 {
1223 unsafe { igGetWindowContentRegionMin() }
1224 }
1225 #[inline]
1226 pub fn get_window_content_region_width<'a>(&'a self) -> f32 {
1227 unsafe { igGetWindowContentRegionWidth() }
1228 }
1229 #[inline]
1231 pub fn get_window_height<'a>(&'a self) -> f32 {
1232 unsafe { igGetWindowHeight() }
1233 }
1234 #[inline]
1235 pub fn get_window_pos<'a>(&'a self) -> ImVec2 {
1236 unsafe { igGetWindowPos() }
1237 }
1238 #[inline]
1239 pub fn get_window_size<'a>(&'a self) -> ImVec2 {
1240 unsafe { igGetWindowSize() }
1241 }
1242 #[inline]
1243 pub fn get_window_width<'a>(&'a self) -> f32 {
1244 unsafe { igGetWindowWidth() }
1245 }
1246 #[inline]
1247 pub fn image<'a>(
1248 &'a self,
1249 user_texture_id: ImTextureID,
1250 size: ImVec2,
1251 uv0: impl Into<Option<ImVec2>>,
1252 uv1: impl Into<Option<ImVec2>>,
1253 tint_col: impl Into<Option<ImVec4>>,
1254 border_col: impl Into<Option<ImVec4>>,
1255 ) {
1256 unsafe {
1257 igImage(
1258 user_texture_id,
1259 size,
1260 match uv0.into() {
1261 Some(v) => v,
1262 None => ImVec2 { x: 0.0, y: 0.0 },
1263 },
1264 match uv1.into() {
1265 Some(v) => v,
1266 None => ImVec2 { x: 1.0, y: 1.0 },
1267 },
1268 match tint_col.into() {
1269 Some(v) => v,
1270 None => ImVec4 {
1271 x: 1.0,
1272 y: 1.0,
1273 z: 1.0,
1274 w: 1.0,
1275 },
1276 },
1277 match border_col.into() {
1278 Some(v) => v,
1279 None => ImVec4 {
1280 x: 0.0,
1281 y: 0.0,
1282 z: 0.0,
1283 w: 0.0,
1284 },
1285 },
1286 )
1287 };
1288 }
1289 #[inline]
1290 pub fn image_button<'a>(
1291 &'a self,
1292 user_texture_id: ImTextureID,
1293 size: ImVec2,
1294 uv0: impl Into<Option<ImVec2>>,
1295 uv1: impl Into<Option<ImVec2>>,
1296 frame_padding: impl Into<Option<i32>>,
1297 bg_col: impl Into<Option<ImVec4>>,
1298 tint_col: impl Into<Option<ImVec4>>,
1299 ) -> bool {
1300 unsafe {
1301 igImageButton(
1302 user_texture_id,
1303 size,
1304 match uv0.into() {
1305 Some(v) => v,
1306 None => ImVec2 { x: 0.0, y: 0.0 },
1307 },
1308 match uv1.into() {
1309 Some(v) => v,
1310 None => ImVec2 { x: 1.0, y: 1.0 },
1311 },
1312 match frame_padding.into() {
1313 Some(v) => v,
1314 None => -1,
1315 },
1316 match bg_col.into() {
1317 Some(v) => v,
1318 None => ImVec4 {
1319 x: 0.0,
1320 y: 0.0,
1321 z: 0.0,
1322 w: 0.0,
1323 },
1324 },
1325 match tint_col.into() {
1326 Some(v) => v,
1327 None => ImVec4 {
1328 x: 1.0,
1329 y: 1.0,
1330 z: 1.0,
1331 w: 1.0,
1332 },
1333 },
1334 )
1335 }
1336 }
1337 #[inline]
1338 pub fn indent<'a>(&'a self, indent_w: impl Into<Option<f32>>) {
1339 unsafe {
1340 igIndent(match indent_w.into() {
1341 Some(v) => v,
1342 None => 0.0,
1343 })
1344 };
1345 }
1346 #[inline]
1347 pub fn input_double<'a, 'b, 'c, 'd>(
1348 &'a self,
1349 label: &'b CStr,
1350 v: &'c mut f64,
1351 step: impl Into<Option<f64>>,
1352 step_fast: impl Into<Option<f64>>,
1353 format: impl Into<Option<&'d CStr>>,
1354 extra_flags: impl Into<Option<ImGuiInputTextFlags>>,
1355 ) -> bool {
1356 unsafe {
1357 igInputDouble(
1358 label.as_ptr(),
1359 v,
1360 match step.into() {
1361 Some(v) => v,
1362 None => 0.0,
1363 },
1364 match step_fast.into() {
1365 Some(v) => v,
1366 None => 0.0,
1367 },
1368 match format.into() {
1369 Some(v) => v.as_ptr(),
1370 None => cstr_ptr!("%.6f"),
1371 },
1372 match extra_flags.into() {
1373 Some(v) => v,
1374 None => ImGuiInputTextFlags::empty(),
1375 },
1376 )
1377 }
1378 }
1379 #[inline]
1380 pub fn input_float<'a, 'b, 'c, 'd>(
1381 &'a self,
1382 label: &'b CStr,
1383 v: &'c mut f32,
1384 step: impl Into<Option<f32>>,
1385 step_fast: impl Into<Option<f32>>,
1386 format: impl Into<Option<&'d CStr>>,
1387 extra_flags: impl Into<Option<ImGuiInputTextFlags>>,
1388 ) -> bool {
1389 unsafe {
1390 igInputFloat(
1391 label.as_ptr(),
1392 v,
1393 match step.into() {
1394 Some(v) => v,
1395 None => 0.0,
1396 },
1397 match step_fast.into() {
1398 Some(v) => v,
1399 None => 0.0,
1400 },
1401 match format.into() {
1402 Some(v) => v.as_ptr(),
1403 None => cstr_ptr!("%.3f"),
1404 },
1405 match extra_flags.into() {
1406 Some(v) => v,
1407 None => ImGuiInputTextFlags::empty(),
1408 },
1409 )
1410 }
1411 }
1412 #[inline]
1413 pub fn input_float2<'a, 'b, 'c, 'd>(
1414 &'a self,
1415 label: &'b CStr,
1416 v: &'c mut [f32; 2],
1417 format: impl Into<Option<&'d CStr>>,
1418 extra_flags: impl Into<Option<ImGuiInputTextFlags>>,
1419 ) -> bool {
1420 unsafe {
1421 igInputFloat2(
1422 label.as_ptr(),
1423 v,
1424 match format.into() {
1425 Some(v) => v.as_ptr(),
1426 None => cstr_ptr!("%.3f"),
1427 },
1428 match extra_flags.into() {
1429 Some(v) => v,
1430 None => ImGuiInputTextFlags::empty(),
1431 },
1432 )
1433 }
1434 }
1435 #[inline]
1436 pub fn input_float3<'a, 'b, 'c, 'd>(
1437 &'a self,
1438 label: &'b CStr,
1439 v: &'c mut [f32; 3],
1440 format: impl Into<Option<&'d CStr>>,
1441 extra_flags: impl Into<Option<ImGuiInputTextFlags>>,
1442 ) -> bool {
1443 unsafe {
1444 igInputFloat3(
1445 label.as_ptr(),
1446 v,
1447 match format.into() {
1448 Some(v) => v.as_ptr(),
1449 None => cstr_ptr!("%.3f"),
1450 },
1451 match extra_flags.into() {
1452 Some(v) => v,
1453 None => ImGuiInputTextFlags::empty(),
1454 },
1455 )
1456 }
1457 }
1458 #[inline]
1459 pub fn input_float4<'a, 'b, 'c, 'd>(
1460 &'a self,
1461 label: &'b CStr,
1462 v: &'c mut [f32; 4],
1463 format: impl Into<Option<&'d CStr>>,
1464 extra_flags: impl Into<Option<ImGuiInputTextFlags>>,
1465 ) -> bool {
1466 unsafe {
1467 igInputFloat4(
1468 label.as_ptr(),
1469 v,
1470 match format.into() {
1471 Some(v) => v.as_ptr(),
1472 None => cstr_ptr!("%.3f"),
1473 },
1474 match extra_flags.into() {
1475 Some(v) => v,
1476 None => ImGuiInputTextFlags::empty(),
1477 },
1478 )
1479 }
1480 }
1481 #[inline]
1482 pub fn input_int<'a, 'b, 'c>(
1483 &'a self,
1484 label: &'b CStr,
1485 v: &'c mut i32,
1486 step: impl Into<Option<i32>>,
1487 step_fast: impl Into<Option<i32>>,
1488 extra_flags: impl Into<Option<ImGuiInputTextFlags>>,
1489 ) -> bool {
1490 unsafe {
1491 igInputInt(
1492 label.as_ptr(),
1493 v,
1494 match step.into() {
1495 Some(v) => v,
1496 None => 1,
1497 },
1498 match step_fast.into() {
1499 Some(v) => v,
1500 None => 100,
1501 },
1502 match extra_flags.into() {
1503 Some(v) => v,
1504 None => ImGuiInputTextFlags::empty(),
1505 },
1506 )
1507 }
1508 }
1509 #[inline]
1510 pub fn input_int2<'a, 'b, 'c>(
1511 &'a self,
1512 label: &'b CStr,
1513 v: &'c mut [i32; 2],
1514 extra_flags: impl Into<Option<ImGuiInputTextFlags>>,
1515 ) -> bool {
1516 unsafe {
1517 igInputInt2(
1518 label.as_ptr(),
1519 v,
1520 match extra_flags.into() {
1521 Some(v) => v,
1522 None => ImGuiInputTextFlags::empty(),
1523 },
1524 )
1525 }
1526 }
1527 #[inline]
1528 pub fn input_int3<'a, 'b, 'c>(
1529 &'a self,
1530 label: &'b CStr,
1531 v: &'c mut [i32; 3],
1532 extra_flags: impl Into<Option<ImGuiInputTextFlags>>,
1533 ) -> bool {
1534 unsafe {
1535 igInputInt3(
1536 label.as_ptr(),
1537 v,
1538 match extra_flags.into() {
1539 Some(v) => v,
1540 None => ImGuiInputTextFlags::empty(),
1541 },
1542 )
1543 }
1544 }
1545 #[inline]
1546 pub fn input_int4<'a, 'b, 'c>(
1547 &'a self,
1548 label: &'b CStr,
1549 v: &'c mut [i32; 4],
1550 extra_flags: impl Into<Option<ImGuiInputTextFlags>>,
1551 ) -> bool {
1552 unsafe {
1553 igInputInt4(
1554 label.as_ptr(),
1555 v,
1556 match extra_flags.into() {
1557 Some(v) => v,
1558 None => ImGuiInputTextFlags::empty(),
1559 },
1560 )
1561 }
1562 }
1563 #[inline]
1568 pub fn invisible_button<'a, 'b>(&'a self, str_id: &'b CStr, size: ImVec2) -> bool {
1569 unsafe { igInvisibleButton(str_id.as_ptr(), size) }
1570 }
1571 #[inline]
1572 pub fn is_any_item_active<'a>(&'a self) -> bool {
1573 unsafe { igIsAnyItemActive() }
1574 }
1575 #[inline]
1576 pub fn is_any_item_focused<'a>(&'a self) -> bool {
1577 unsafe { igIsAnyItemFocused() }
1578 }
1579 #[inline]
1580 pub fn is_any_item_hovered<'a>(&'a self) -> bool {
1581 unsafe { igIsAnyItemHovered() }
1582 }
1583 #[inline]
1584 pub fn is_any_mouse_down<'a>(&'a self) -> bool {
1585 unsafe { igIsAnyMouseDown() }
1586 }
1587 #[inline]
1588 pub fn is_item_active<'a>(&'a self) -> bool {
1589 unsafe { igIsItemActive() }
1590 }
1591 #[inline]
1592 pub fn is_item_clicked<'a>(&'a self, mouse_button: impl Into<Option<i32>>) -> bool {
1593 unsafe {
1594 igIsItemClicked(match mouse_button.into() {
1595 Some(v) => v,
1596 None => 0,
1597 })
1598 }
1599 }
1600 #[inline]
1601 pub fn is_item_deactivated<'a>(&'a self) -> bool {
1602 unsafe { igIsItemDeactivated() }
1603 }
1604 #[inline]
1605 pub fn is_item_deactivated_after_edit<'a>(&'a self) -> bool {
1606 unsafe { igIsItemDeactivatedAfterEdit() }
1607 }
1608 #[inline]
1609 pub fn is_item_edited<'a>(&'a self) -> bool {
1610 unsafe { igIsItemEdited() }
1611 }
1612 #[inline]
1613 pub fn is_item_focused<'a>(&'a self) -> bool {
1614 unsafe { igIsItemFocused() }
1615 }
1616 #[inline]
1617 pub fn is_item_hovered<'a>(&'a self, flags: impl Into<Option<ImGuiHoveredFlags>>) -> bool {
1618 unsafe {
1619 igIsItemHovered(match flags.into() {
1620 Some(v) => v,
1621 None => ImGuiHoveredFlags::empty(),
1622 })
1623 }
1624 }
1625 #[inline]
1626 pub fn is_item_visible<'a>(&'a self) -> bool {
1627 unsafe { igIsItemVisible() }
1628 }
1629 #[inline]
1630 pub fn is_key_down<'a>(&'a self, user_key_index: i32) -> bool {
1631 unsafe { igIsKeyDown(user_key_index) }
1632 }
1633 #[inline]
1634 pub fn is_key_pressed<'a>(&'a self, user_key_index: i32, repeat: impl Into<Option<bool>>) -> bool {
1635 unsafe {
1636 igIsKeyPressed(
1637 user_key_index,
1638 match repeat.into() {
1639 Some(v) => v,
1640 None => true,
1641 },
1642 )
1643 }
1644 }
1645 #[inline]
1646 pub fn is_key_released<'a>(&'a self, user_key_index: i32) -> bool {
1647 unsafe { igIsKeyReleased(user_key_index) }
1648 }
1649 #[inline]
1650 pub fn is_mouse_clicked<'a>(&'a self, button: i32, repeat: impl Into<Option<bool>>) -> bool {
1651 unsafe {
1652 igIsMouseClicked(
1653 button,
1654 match repeat.into() {
1655 Some(v) => v,
1656 None => false,
1657 },
1658 )
1659 }
1660 }
1661 #[inline]
1662 pub fn is_mouse_double_clicked<'a>(&'a self, button: i32) -> bool {
1663 unsafe { igIsMouseDoubleClicked(button) }
1664 }
1665 #[inline]
1666 pub fn is_mouse_down<'a>(&'a self, button: i32) -> bool {
1667 unsafe { igIsMouseDown(button) }
1668 }
1669 #[inline]
1670 pub fn is_mouse_dragging<'a>(
1671 &'a self,
1672 button: impl Into<Option<i32>>,
1673 lock_threshold: impl Into<Option<f32>>,
1674 ) -> bool {
1675 unsafe {
1676 igIsMouseDragging(
1677 match button.into() {
1678 Some(v) => v,
1679 None => 0,
1680 },
1681 match lock_threshold.into() {
1682 Some(v) => v,
1683 None => -1.0,
1684 },
1685 )
1686 }
1687 }
1688 #[inline]
1689 pub fn is_mouse_hovering_rect<'a>(&'a self, r_min: ImVec2, r_max: ImVec2, clip: impl Into<Option<bool>>) -> bool {
1690 unsafe {
1691 igIsMouseHoveringRect(
1692 r_min,
1693 r_max,
1694 match clip.into() {
1695 Some(v) => v,
1696 None => true,
1697 },
1698 )
1699 }
1700 }
1701 #[inline]
1702 pub fn is_mouse_pos_valid<'a, 'b>(&'a self, mouse_pos: impl Into<Option<&'b ImVec2>>) -> bool {
1703 unsafe {
1704 igIsMousePosValid(match mouse_pos.into() {
1705 Some(v) => v,
1706 None => ::std::ptr::null(),
1707 })
1708 }
1709 }
1710 #[inline]
1711 pub fn is_mouse_released<'a>(&'a self, button: i32) -> bool {
1712 unsafe { igIsMouseReleased(button) }
1713 }
1714 #[inline]
1715 pub fn is_popup_open<'a, 'b>(&'a self, str_id: &'b CStr) -> bool {
1716 unsafe { igIsPopupOpen(str_id.as_ptr()) }
1717 }
1718 #[inline]
1719 pub fn is_rect_visible<'a>(&'a self, size: ImVec2) -> bool {
1720 unsafe { igIsRectVisible(size) }
1721 }
1722 #[inline]
1723 pub fn is_rect_visible_vec2<'a>(&'a self, rect_min: ImVec2, rect_max: ImVec2) -> bool {
1724 unsafe { igIsRectVisibleVec2(rect_min, rect_max) }
1725 }
1726 #[inline]
1727 pub fn is_window_appearing<'a>(&'a self) -> bool {
1728 unsafe { igIsWindowAppearing() }
1729 }
1730 #[inline]
1731 pub fn is_window_collapsed<'a>(&'a self) -> bool {
1732 unsafe { igIsWindowCollapsed() }
1733 }
1734 #[inline]
1735 pub fn is_window_focused<'a>(&'a self, flags: impl Into<Option<ImGuiFocusedFlags>>) -> bool {
1736 unsafe {
1737 igIsWindowFocused(match flags.into() {
1738 Some(v) => v,
1739 None => ImGuiFocusedFlags::empty(),
1740 })
1741 }
1742 }
1743 #[inline]
1744 pub fn is_window_hovered<'a>(&'a self, flags: impl Into<Option<ImGuiHoveredFlags>>) -> bool {
1745 unsafe {
1746 igIsWindowHovered(match flags.into() {
1747 Some(v) => v,
1748 None => ImGuiHoveredFlags::empty(),
1749 })
1750 }
1751 }
1752 #[inline]
1753 pub fn label_text<'a, 'b, 'c>(&'a self, label: &'b CStr, fmt: &'c CStr) {
1754 unsafe { igLabelText(label.as_ptr(), cstr_ptr!("%s"), fmt.as_ptr()) };
1755 }
1756 #[inline]
1759 pub fn list_box_footer<'a>(&'a self) {
1760 unsafe { igListBoxFooter() };
1761 }
1762 #[inline]
1763 pub fn list_box_header_vec2<'a, 'b>(&'a self, label: &'b CStr, size: impl Into<Option<ImVec2>>) -> bool {
1764 unsafe {
1765 igListBoxHeaderVec2(
1766 label.as_ptr(),
1767 match size.into() {
1768 Some(v) => v,
1769 None => ImVec2 { x: 0.0, y: 0.0 },
1770 },
1771 )
1772 }
1773 }
1774 #[inline]
1775 pub fn list_box_header_int<'a, 'b>(
1776 &'a self,
1777 label: &'b CStr,
1778 items_count: i32,
1779 height_in_items: impl Into<Option<i32>>,
1780 ) -> bool {
1781 unsafe {
1782 igListBoxHeaderInt(
1783 label.as_ptr(),
1784 items_count,
1785 match height_in_items.into() {
1786 Some(v) => v,
1787 None => -1,
1788 },
1789 )
1790 }
1791 }
1792 #[inline]
1793 pub fn load_ini_settings_from_disk<'a, 'b>(&'a self, ini_filename: &'b CStr) {
1794 unsafe { igLoadIniSettingsFromDisk(ini_filename.as_ptr()) };
1795 }
1796 #[inline]
1797 pub fn load_ini_settings_from_memory<'a, 'b>(&'a self, ini_data: &'b CStr, ini_size: impl Into<Option<usize>>) {
1798 unsafe {
1799 igLoadIniSettingsFromMemory(
1800 ini_data.as_ptr(),
1801 match ini_size.into() {
1802 Some(v) => v,
1803 None => 0,
1804 },
1805 )
1806 };
1807 }
1808 #[inline]
1809 pub fn log_buttons<'a>(&'a self) {
1810 unsafe { igLogButtons() };
1811 }
1812 #[inline]
1813 pub fn log_finish<'a>(&'a self) {
1814 unsafe { igLogFinish() };
1815 }
1816 #[inline]
1817 pub fn log_text<'a, 'b>(&'a self, fmt: &'b CStr) {
1818 unsafe { igLogText(cstr_ptr!("%s"), fmt.as_ptr()) };
1819 }
1820 #[inline]
1821 pub fn log_to_clipboard<'a>(&'a self, max_depth: impl Into<Option<i32>>) {
1822 unsafe {
1823 igLogToClipboard(match max_depth.into() {
1824 Some(v) => v,
1825 None => -1,
1826 })
1827 };
1828 }
1829 #[inline]
1830 pub fn log_to_file<'a, 'b>(&'a self, max_depth: impl Into<Option<i32>>, filename: impl Into<Option<&'b CStr>>) {
1831 unsafe {
1832 igLogToFile(
1833 match max_depth.into() {
1834 Some(v) => v,
1835 None => -1,
1836 },
1837 match filename.into() {
1838 Some(v) => v.as_ptr(),
1839 None => ::std::ptr::null(),
1840 },
1841 )
1842 };
1843 }
1844 #[inline]
1845 pub fn log_to_tty<'a>(&'a self, max_depth: impl Into<Option<i32>>) {
1846 unsafe {
1847 igLogToTTY(match max_depth.into() {
1848 Some(v) => v,
1849 None => -1,
1850 })
1851 };
1852 }
1853 #[inline]
1854 pub fn menu_item_bool<'a, 'b, 'c>(
1855 &'a self,
1856 label: &'b CStr,
1857 shortcut: impl Into<Option<&'c CStr>>,
1858 selected: impl Into<Option<bool>>,
1859 enabled: impl Into<Option<bool>>,
1860 ) -> bool {
1861 unsafe {
1862 igMenuItemBool(
1863 label.as_ptr(),
1864 match shortcut.into() {
1865 Some(v) => v.as_ptr(),
1866 None => ::std::ptr::null(),
1867 },
1868 match selected.into() {
1869 Some(v) => v,
1870 None => false,
1871 },
1872 match enabled.into() {
1873 Some(v) => v,
1874 None => true,
1875 },
1876 )
1877 }
1878 }
1879 #[inline]
1880 pub fn menu_item_bool_ptr<'a, 'b, 'c, 'd>(
1881 &'a self,
1882 label: &'b CStr,
1883 shortcut: &'c CStr,
1884 p_selected: &'d mut bool,
1885 enabled: impl Into<Option<bool>>,
1886 ) -> bool {
1887 unsafe {
1888 igMenuItemBoolPtr(
1889 label.as_ptr(),
1890 shortcut.as_ptr(),
1891 p_selected,
1892 match enabled.into() {
1893 Some(v) => v,
1894 None => true,
1895 },
1896 )
1897 }
1898 }
1899 #[inline]
1900 pub fn new_frame<'a>(&'a self) {
1901 unsafe { igNewFrame() };
1902 }
1903 #[inline]
1904 pub fn new_line<'a>(&'a self) {
1905 unsafe { igNewLine() };
1906 }
1907 #[inline]
1908 pub fn next_column<'a>(&'a self) {
1909 unsafe { igNextColumn() };
1910 }
1911 #[inline]
1912 pub fn open_popup<'a, 'b>(&'a self, str_id: &'b CStr) {
1913 unsafe { igOpenPopup(str_id.as_ptr()) };
1914 }
1915 #[inline]
1916 pub fn open_popup_on_item_click<'a, 'b>(
1917 &'a self,
1918 str_id: impl Into<Option<&'b CStr>>,
1919 mouse_button: impl Into<Option<i32>>,
1920 ) -> bool {
1921 unsafe {
1922 igOpenPopupOnItemClick(
1923 match str_id.into() {
1924 Some(v) => v.as_ptr(),
1925 None => ::std::ptr::null(),
1926 },
1927 match mouse_button.into() {
1928 Some(v) => v,
1929 None => 1,
1930 },
1931 )
1932 }
1933 }
1934 #[inline]
1935 pub fn plot_histogram_float_ptr<'a, 'b, 'c, 'd>(
1936 &'a self,
1937 label: &'b CStr,
1938 values: &'c f32,
1939 values_count: i32,
1940 values_offset: impl Into<Option<i32>>,
1941 overlay_text: impl Into<Option<&'d CStr>>,
1942 scale_min: impl Into<Option<f32>>,
1943 scale_max: impl Into<Option<f32>>,
1944 graph_size: impl Into<Option<ImVec2>>,
1945 stride: impl Into<Option<i32>>,
1946 ) {
1947 unsafe {
1948 igPlotHistogramFloatPtr(
1949 label.as_ptr(),
1950 values,
1951 values_count,
1952 match values_offset.into() {
1953 Some(v) => v,
1954 None => 0,
1955 },
1956 match overlay_text.into() {
1957 Some(v) => v.as_ptr(),
1958 None => ::std::ptr::null(),
1959 },
1960 match scale_min.into() {
1961 Some(v) => v,
1962 None => ::std::f32::MAX,
1963 },
1964 match scale_max.into() {
1965 Some(v) => v,
1966 None => ::std::f32::MAX,
1967 },
1968 match graph_size.into() {
1969 Some(v) => v,
1970 None => ImVec2 { x: 0.0, y: 0.0 },
1971 },
1972 match stride.into() {
1973 Some(v) => v,
1974 None => ::std::mem::size_of::<f32>() as i32,
1975 },
1976 )
1977 };
1978 }
1979 #[inline]
1981 pub fn plot_lines<'a, 'b, 'c, 'd>(
1982 &'a self,
1983 label: &'b CStr,
1984 values: &'c f32,
1985 values_count: i32,
1986 values_offset: impl Into<Option<i32>>,
1987 overlay_text: impl Into<Option<&'d CStr>>,
1988 scale_min: impl Into<Option<f32>>,
1989 scale_max: impl Into<Option<f32>>,
1990 graph_size: impl Into<Option<ImVec2>>,
1991 stride: impl Into<Option<i32>>,
1992 ) {
1993 unsafe {
1994 igPlotLines(
1995 label.as_ptr(),
1996 values,
1997 values_count,
1998 match values_offset.into() {
1999 Some(v) => v,
2000 None => 0,
2001 },
2002 match overlay_text.into() {
2003 Some(v) => v.as_ptr(),
2004 None => ::std::ptr::null(),
2005 },
2006 match scale_min.into() {
2007 Some(v) => v,
2008 None => ::std::f32::MAX,
2009 },
2010 match scale_max.into() {
2011 Some(v) => v,
2012 None => ::std::f32::MAX,
2013 },
2014 match graph_size.into() {
2015 Some(v) => v,
2016 None => ImVec2 { x: 0.0, y: 0.0 },
2017 },
2018 match stride.into() {
2019 Some(v) => v,
2020 None => ::std::mem::size_of::<f32>() as i32,
2021 },
2022 )
2023 };
2024 }
2025 #[inline]
2027 pub fn pop_allow_keyboard_focus<'a>(&'a self) {
2028 unsafe { igPopAllowKeyboardFocus() };
2029 }
2030 #[inline]
2031 pub fn pop_button_repeat<'a>(&'a self) {
2032 unsafe { igPopButtonRepeat() };
2033 }
2034 #[inline]
2035 pub fn pop_clip_rect<'a>(&'a self) {
2036 unsafe { igPopClipRect() };
2037 }
2038 #[inline]
2039 pub fn pop_font<'a>(&'a self) {
2040 unsafe { igPopFont() };
2041 }
2042 #[inline]
2043 pub fn pop_id<'a>(&'a self) {
2044 unsafe { igPopID() };
2045 }
2046 #[inline]
2047 pub fn pop_item_width<'a>(&'a self) {
2048 unsafe { igPopItemWidth() };
2049 }
2050 #[inline]
2051 pub fn pop_style_color<'a>(&'a self, count: impl Into<Option<i32>>) {
2052 unsafe {
2053 igPopStyleColor(match count.into() {
2054 Some(v) => v,
2055 None => 1,
2056 })
2057 };
2058 }
2059 #[inline]
2060 pub fn pop_style_var<'a>(&'a self, count: impl Into<Option<i32>>) {
2061 unsafe {
2062 igPopStyleVar(match count.into() {
2063 Some(v) => v,
2064 None => 1,
2065 })
2066 };
2067 }
2068 #[inline]
2069 pub fn pop_text_wrap_pos<'a>(&'a self) {
2070 unsafe { igPopTextWrapPos() };
2071 }
2072 #[inline]
2073 pub fn progress_bar<'a, 'b>(
2074 &'a self,
2075 fraction: f32,
2076 size_arg: impl Into<Option<ImVec2>>,
2077 overlay: impl Into<Option<&'b CStr>>,
2078 ) {
2079 unsafe {
2080 igProgressBar(
2081 fraction,
2082 match size_arg.into() {
2083 Some(v) => v,
2084 None => ImVec2 { x: -1.0, y: 0.0 },
2085 },
2086 match overlay.into() {
2087 Some(v) => v.as_ptr(),
2088 None => ::std::ptr::null(),
2089 },
2090 )
2091 };
2092 }
2093 #[inline]
2094 pub fn push_allow_keyboard_focus<'a>(&'a self, allow_keyboard_focus: bool) {
2095 unsafe { igPushAllowKeyboardFocus(allow_keyboard_focus) };
2096 }
2097 #[inline]
2098 pub fn push_button_repeat<'a>(&'a self, repeat: bool) {
2099 unsafe { igPushButtonRepeat(repeat) };
2100 }
2101 #[inline]
2102 pub fn push_clip_rect<'a>(
2103 &'a self,
2104 clip_rect_min: ImVec2,
2105 clip_rect_max: ImVec2,
2106 intersect_with_current_clip_rect: bool,
2107 ) {
2108 unsafe { igPushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect) };
2109 }
2110 #[inline]
2112 pub fn push_id_str<'a, 'b>(&'a self, str_id: &'b CStr) {
2113 unsafe { igPushIDStr(str_id.as_ptr()) };
2114 }
2115 #[inline]
2116 pub fn push_id_range<'a, 'b, 'c>(&'a self, str_id_begin: &'b CStr, str_id_end: &'c CStr) {
2117 unsafe { igPushIDRange(str_id_begin.as_ptr(), str_id_end.as_ptr()) };
2118 }
2119 #[inline]
2121 pub fn push_id_int<'a>(&'a self, int_id: i32) {
2122 unsafe { igPushIDInt(int_id) };
2123 }
2124 #[inline]
2125 pub fn push_item_width<'a>(&'a self, item_width: f32) {
2126 unsafe { igPushItemWidth(item_width) };
2127 }
2128 #[inline]
2129 pub fn push_style_color_u32<'a>(&'a self, idx: ImGuiCol, col: u32) {
2130 unsafe { igPushStyleColorU32(idx, col) };
2131 }
2132 #[inline]
2133 pub fn push_style_color<'a>(&'a self, idx: ImGuiCol, col: ImVec4) {
2134 unsafe { igPushStyleColor(idx, col) };
2135 }
2136 #[inline]
2137 pub fn push_style_var_float<'a>(&'a self, idx: ImGuiStyleVar, val: f32) {
2138 unsafe { igPushStyleVarFloat(idx, val) };
2139 }
2140 #[inline]
2141 pub fn push_style_var_vec2<'a>(&'a self, idx: ImGuiStyleVar, val: ImVec2) {
2142 unsafe { igPushStyleVarVec2(idx, val) };
2143 }
2144 #[inline]
2145 pub fn push_text_wrap_pos<'a>(&'a self, wrap_pos_x: impl Into<Option<f32>>) {
2146 unsafe {
2147 igPushTextWrapPos(match wrap_pos_x.into() {
2148 Some(v) => v,
2149 None => 0.0,
2150 })
2151 };
2152 }
2153 #[inline]
2154 pub fn radio_button_bool<'a, 'b>(&'a self, label: &'b CStr, active: bool) -> bool {
2155 unsafe { igRadioButtonBool(label.as_ptr(), active) }
2156 }
2157 #[inline]
2158 pub fn radio_button_int_ptr<'a, 'b, 'c>(&'a self, label: &'b CStr, v: &'c mut i32, v_button: i32) -> bool {
2159 unsafe { igRadioButtonIntPtr(label.as_ptr(), v, v_button) }
2160 }
2161 #[inline]
2162 pub fn render<'a>(&'a self) {
2163 unsafe { igRender() };
2164 }
2165 #[inline]
2166 pub fn reset_mouse_drag_delta<'a>(&'a self, button: impl Into<Option<i32>>) {
2167 unsafe {
2168 igResetMouseDragDelta(match button.into() {
2169 Some(v) => v,
2170 None => 0,
2171 })
2172 };
2173 }
2174 #[inline]
2175 pub fn same_line<'a>(&'a self, pos_x: impl Into<Option<f32>>, spacing_w: impl Into<Option<f32>>) {
2176 unsafe {
2177 igSameLine(
2178 match pos_x.into() {
2179 Some(v) => v,
2180 None => 0.0,
2181 },
2182 match spacing_w.into() {
2183 Some(v) => v,
2184 None => -1.0,
2185 },
2186 )
2187 };
2188 }
2189 #[inline]
2190 pub fn save_ini_settings_to_disk<'a, 'b>(&'a self, ini_filename: &'b CStr) {
2191 unsafe { igSaveIniSettingsToDisk(ini_filename.as_ptr()) };
2192 }
2193 #[inline]
2194 pub fn save_ini_settings_to_memory<'a, 'b>(&'a self, out_ini_size: impl Into<Option<&'b mut usize>>) -> String {
2195 unsafe {
2196 CStr::from_ptr(igSaveIniSettingsToMemory(match out_ini_size.into() {
2197 Some(v) => v,
2198 None => ::std::ptr::null_mut(),
2199 }))
2200 .to_string_lossy()
2201 .into_owned()
2202 }
2203 }
2204 #[inline]
2205 pub fn selectable<'a, 'b>(
2206 &'a self,
2207 label: &'b CStr,
2208 selected: impl Into<Option<bool>>,
2209 flags: impl Into<Option<ImGuiSelectableFlags>>,
2210 size: impl Into<Option<ImVec2>>,
2211 ) -> bool {
2212 unsafe {
2213 igSelectable(
2214 label.as_ptr(),
2215 match selected.into() {
2216 Some(v) => v,
2217 None => false,
2218 },
2219 match flags.into() {
2220 Some(v) => v,
2221 None => ImGuiSelectableFlags::empty(),
2222 },
2223 match size.into() {
2224 Some(v) => v,
2225 None => ImVec2 { x: 0.0, y: 0.0 },
2226 },
2227 )
2228 }
2229 }
2230 #[inline]
2231 pub fn selectable_bool_ptr<'a, 'b, 'c>(
2232 &'a self,
2233 label: &'b CStr,
2234 p_selected: &'c mut bool,
2235 flags: impl Into<Option<ImGuiSelectableFlags>>,
2236 size: impl Into<Option<ImVec2>>,
2237 ) -> bool {
2238 unsafe {
2239 igSelectableBoolPtr(
2240 label.as_ptr(),
2241 p_selected,
2242 match flags.into() {
2243 Some(v) => v,
2244 None => ImGuiSelectableFlags::empty(),
2245 },
2246 match size.into() {
2247 Some(v) => v,
2248 None => ImVec2 { x: 0.0, y: 0.0 },
2249 },
2250 )
2251 }
2252 }
2253 #[inline]
2254 pub fn separator<'a>(&'a self) {
2255 unsafe { igSeparator() };
2256 }
2257 #[inline]
2258 pub fn set_clipboard_text<'a, 'b>(&'a self, text: &'b CStr) {
2259 unsafe { igSetClipboardText(text.as_ptr()) };
2260 }
2261 #[inline]
2262 pub fn set_color_edit_options<'a>(&'a self, flags: ImGuiColorEditFlags) {
2263 unsafe { igSetColorEditOptions(flags) };
2264 }
2265 #[inline]
2266 pub fn set_column_offset<'a>(&'a self, column_index: i32, offset_x: f32) {
2267 unsafe { igSetColumnOffset(column_index, offset_x) };
2268 }
2269 #[inline]
2270 pub fn set_column_width<'a>(&'a self, column_index: i32, width: f32) {
2271 unsafe { igSetColumnWidth(column_index, width) };
2272 }
2273 #[inline]
2274 pub fn set_cursor_pos<'a>(&'a self, local_pos: ImVec2) {
2275 unsafe { igSetCursorPos(local_pos) };
2276 }
2277 #[inline]
2278 pub fn set_cursor_pos_x<'a>(&'a self, x: f32) {
2279 unsafe { igSetCursorPosX(x) };
2280 }
2281 #[inline]
2282 pub fn set_cursor_pos_y<'a>(&'a self, y: f32) {
2283 unsafe { igSetCursorPosY(y) };
2284 }
2285 #[inline]
2286 pub fn set_cursor_screen_pos<'a>(&'a self, screen_pos: ImVec2) {
2287 unsafe { igSetCursorScreenPos(screen_pos) };
2288 }
2289 #[inline]
2291 pub fn set_item_allow_overlap<'a>(&'a self) {
2292 unsafe { igSetItemAllowOverlap() };
2293 }
2294 #[inline]
2295 pub fn set_item_default_focus<'a>(&'a self) {
2296 unsafe { igSetItemDefaultFocus() };
2297 }
2298 #[inline]
2299 pub fn set_keyboard_focus_here<'a>(&'a self, offset: impl Into<Option<i32>>) {
2300 unsafe {
2301 igSetKeyboardFocusHere(match offset.into() {
2302 Some(v) => v,
2303 None => 0,
2304 })
2305 };
2306 }
2307 #[inline]
2308 pub fn set_mouse_cursor<'a>(&'a self, _type: ImGuiMouseCursor) {
2309 unsafe { igSetMouseCursor(_type) };
2310 }
2311 #[inline]
2312 pub fn set_next_tree_node_open<'a>(&'a self, is_open: bool, cond: impl Into<Option<ImGuiCond>>) {
2313 unsafe {
2314 igSetNextTreeNodeOpen(
2315 is_open,
2316 match cond.into() {
2317 Some(v) => v,
2318 None => ImGuiCond::empty(),
2319 },
2320 )
2321 };
2322 }
2323 #[inline]
2324 pub fn set_next_window_bg_alpha<'a>(&'a self, alpha: f32) {
2325 unsafe { igSetNextWindowBgAlpha(alpha) };
2326 }
2327 #[inline]
2328 pub fn set_next_window_collapsed<'a>(&'a self, collapsed: bool, cond: impl Into<Option<ImGuiCond>>) {
2329 unsafe {
2330 igSetNextWindowCollapsed(
2331 collapsed,
2332 match cond.into() {
2333 Some(v) => v,
2334 None => ImGuiCond::empty(),
2335 },
2336 )
2337 };
2338 }
2339 #[inline]
2340 pub fn set_next_window_content_size<'a>(&'a self, size: ImVec2) {
2341 unsafe { igSetNextWindowContentSize(size) };
2342 }
2343 #[inline]
2344 pub fn set_next_window_focus<'a>(&'a self) {
2345 unsafe { igSetNextWindowFocus() };
2346 }
2347 #[inline]
2348 pub fn set_next_window_pos<'a>(
2349 &'a self,
2350 pos: ImVec2,
2351 cond: impl Into<Option<ImGuiCond>>,
2352 pivot: impl Into<Option<ImVec2>>,
2353 ) {
2354 unsafe {
2355 igSetNextWindowPos(
2356 pos,
2357 match cond.into() {
2358 Some(v) => v,
2359 None => ImGuiCond::empty(),
2360 },
2361 match pivot.into() {
2362 Some(v) => v,
2363 None => ImVec2 { x: 0.0, y: 0.0 },
2364 },
2365 )
2366 };
2367 }
2368 #[inline]
2369 pub fn set_next_window_size<'a>(&'a self, size: ImVec2, cond: impl Into<Option<ImGuiCond>>) {
2370 unsafe {
2371 igSetNextWindowSize(
2372 size,
2373 match cond.into() {
2374 Some(v) => v,
2375 None => ImGuiCond::empty(),
2376 },
2377 )
2378 };
2379 }
2380 #[inline]
2382 pub fn set_scroll_from_pos_y<'a>(&'a self, pos_y: f32, center_y_ratio: impl Into<Option<f32>>) {
2383 unsafe {
2384 igSetScrollFromPosY(
2385 pos_y,
2386 match center_y_ratio.into() {
2387 Some(v) => v,
2388 None => 0.5,
2389 },
2390 )
2391 };
2392 }
2393 #[inline]
2394 pub fn set_scroll_here_y<'a>(&'a self, center_y_ratio: impl Into<Option<f32>>) {
2395 unsafe {
2396 igSetScrollHereY(match center_y_ratio.into() {
2397 Some(v) => v,
2398 None => 0.5,
2399 })
2400 };
2401 }
2402 #[inline]
2403 pub fn set_scroll_x<'a>(&'a self, scroll_x: f32) {
2404 unsafe { igSetScrollX(scroll_x) };
2405 }
2406 #[inline]
2407 pub fn set_scroll_y<'a>(&'a self, scroll_y: f32) {
2408 unsafe { igSetScrollY(scroll_y) };
2409 }
2410 #[inline]
2412 pub fn set_tooltip<'a, 'b>(&'a self, fmt: &'b CStr) {
2413 unsafe { igSetTooltip(cstr_ptr!("%s"), fmt.as_ptr()) };
2414 }
2415 #[inline]
2416 pub fn set_window_collapsed_bool<'a>(&'a self, collapsed: bool, cond: impl Into<Option<ImGuiCond>>) {
2417 unsafe {
2418 igSetWindowCollapsedBool(
2419 collapsed,
2420 match cond.into() {
2421 Some(v) => v,
2422 None => ImGuiCond::empty(),
2423 },
2424 )
2425 };
2426 }
2427 #[inline]
2428 pub fn set_window_collapsed_str<'a, 'b>(
2429 &'a self,
2430 name: &'b CStr,
2431 collapsed: bool,
2432 cond: impl Into<Option<ImGuiCond>>,
2433 ) {
2434 unsafe {
2435 igSetWindowCollapsedStr(
2436 name.as_ptr(),
2437 collapsed,
2438 match cond.into() {
2439 Some(v) => v,
2440 None => ImGuiCond::empty(),
2441 },
2442 )
2443 };
2444 }
2445 #[inline]
2446 pub fn set_window_focus<'a>(&'a self) {
2447 unsafe { igSetWindowFocus() };
2448 }
2449 #[inline]
2450 pub fn set_window_focus_str<'a, 'b>(&'a self, name: &'b CStr) {
2451 unsafe { igSetWindowFocusStr(name.as_ptr()) };
2452 }
2453 #[inline]
2454 pub fn set_window_font_scale<'a>(&'a self, scale: f32) {
2455 unsafe { igSetWindowFontScale(scale) };
2456 }
2457 #[inline]
2458 pub fn set_window_pos_vec2<'a>(&'a self, pos: ImVec2, cond: impl Into<Option<ImGuiCond>>) {
2459 unsafe {
2460 igSetWindowPosVec2(
2461 pos,
2462 match cond.into() {
2463 Some(v) => v,
2464 None => ImGuiCond::empty(),
2465 },
2466 )
2467 };
2468 }
2469 #[inline]
2470 pub fn set_window_pos_str<'a, 'b>(&'a self, name: &'b CStr, pos: ImVec2, cond: impl Into<Option<ImGuiCond>>) {
2471 unsafe {
2472 igSetWindowPosStr(
2473 name.as_ptr(),
2474 pos,
2475 match cond.into() {
2476 Some(v) => v,
2477 None => ImGuiCond::empty(),
2478 },
2479 )
2480 };
2481 }
2482 #[inline]
2483 pub fn set_window_size_vec2<'a>(&'a self, size: ImVec2, cond: impl Into<Option<ImGuiCond>>) {
2484 unsafe {
2485 igSetWindowSizeVec2(
2486 size,
2487 match cond.into() {
2488 Some(v) => v,
2489 None => ImGuiCond::empty(),
2490 },
2491 )
2492 };
2493 }
2494 #[inline]
2495 pub fn set_window_size_str<'a, 'b>(&'a self, name: &'b CStr, size: ImVec2, cond: impl Into<Option<ImGuiCond>>) {
2496 unsafe {
2497 igSetWindowSizeStr(
2498 name.as_ptr(),
2499 size,
2500 match cond.into() {
2501 Some(v) => v,
2502 None => ImGuiCond::empty(),
2503 },
2504 )
2505 };
2506 }
2507 #[inline]
2508 pub fn show_about_window<'a, 'b>(&'a self, p_open: impl Into<Option<&'b mut bool>>) {
2509 unsafe {
2510 igShowAboutWindow(match p_open.into() {
2511 Some(v) => v,
2512 None => ::std::ptr::null_mut(),
2513 })
2514 };
2515 }
2516 #[inline]
2517 pub fn show_demo_window<'a, 'b>(&'a self, p_open: impl Into<Option<&'b mut bool>>) {
2518 unsafe {
2519 igShowDemoWindow(match p_open.into() {
2520 Some(v) => v,
2521 None => ::std::ptr::null_mut(),
2522 })
2523 };
2524 }
2525 #[inline]
2526 pub fn show_font_selector<'a, 'b>(&'a self, label: &'b CStr) {
2527 unsafe { igShowFontSelector(label.as_ptr()) };
2528 }
2529 #[inline]
2530 pub fn show_metrics_window<'a, 'b>(&'a self, p_open: impl Into<Option<&'b mut bool>>) {
2531 unsafe {
2532 igShowMetricsWindow(match p_open.into() {
2533 Some(v) => v,
2534 None => ::std::ptr::null_mut(),
2535 })
2536 };
2537 }
2538 #[inline]
2540 pub fn show_style_selector<'a, 'b>(&'a self, label: &'b CStr) -> bool {
2541 unsafe { igShowStyleSelector(label.as_ptr()) }
2542 }
2543 #[inline]
2544 pub fn show_user_guide<'a>(&'a self) {
2545 unsafe { igShowUserGuide() };
2546 }
2547 #[inline]
2548 pub fn slider_angle<'a, 'b, 'c, 'd>(
2549 &'a self,
2550 label: &'b CStr,
2551 v_rad: &'c mut f32,
2552 v_degrees_min: impl Into<Option<f32>>,
2553 v_degrees_max: impl Into<Option<f32>>,
2554 format: impl Into<Option<&'d CStr>>,
2555 ) -> bool {
2556 unsafe {
2557 igSliderAngle(
2558 label.as_ptr(),
2559 v_rad,
2560 match v_degrees_min.into() {
2561 Some(v) => v,
2562 None => -360.0,
2563 },
2564 match v_degrees_max.into() {
2565 Some(v) => v,
2566 None => 360.0,
2567 },
2568 match format.into() {
2569 Some(v) => v.as_ptr(),
2570 None => cstr_ptr!("%.0f deg"),
2571 },
2572 )
2573 }
2574 }
2575 #[inline]
2576 pub fn slider_float<'a, 'b, 'c, 'd>(
2577 &'a self,
2578 label: &'b CStr,
2579 v: &'c mut f32,
2580 v_min: f32,
2581 v_max: f32,
2582 format: impl Into<Option<&'d CStr>>,
2583 power: impl Into<Option<f32>>,
2584 ) -> bool {
2585 unsafe {
2586 igSliderFloat(
2587 label.as_ptr(),
2588 v,
2589 v_min,
2590 v_max,
2591 match format.into() {
2592 Some(v) => v.as_ptr(),
2593 None => cstr_ptr!("%.3f"),
2594 },
2595 match power.into() {
2596 Some(v) => v,
2597 None => 1.0,
2598 },
2599 )
2600 }
2601 }
2602 #[inline]
2603 pub fn slider_float2<'a, 'b, 'c, 'd>(
2604 &'a self,
2605 label: &'b CStr,
2606 v: &'c mut [f32; 2],
2607 v_min: f32,
2608 v_max: f32,
2609 format: impl Into<Option<&'d CStr>>,
2610 power: impl Into<Option<f32>>,
2611 ) -> bool {
2612 unsafe {
2613 igSliderFloat2(
2614 label.as_ptr(),
2615 v,
2616 v_min,
2617 v_max,
2618 match format.into() {
2619 Some(v) => v.as_ptr(),
2620 None => cstr_ptr!("%.3f"),
2621 },
2622 match power.into() {
2623 Some(v) => v,
2624 None => 1.0,
2625 },
2626 )
2627 }
2628 }
2629 #[inline]
2630 pub fn slider_float3<'a, 'b, 'c, 'd>(
2631 &'a self,
2632 label: &'b CStr,
2633 v: &'c mut [f32; 3],
2634 v_min: f32,
2635 v_max: f32,
2636 format: impl Into<Option<&'d CStr>>,
2637 power: impl Into<Option<f32>>,
2638 ) -> bool {
2639 unsafe {
2640 igSliderFloat3(
2641 label.as_ptr(),
2642 v,
2643 v_min,
2644 v_max,
2645 match format.into() {
2646 Some(v) => v.as_ptr(),
2647 None => cstr_ptr!("%.3f"),
2648 },
2649 match power.into() {
2650 Some(v) => v,
2651 None => 1.0,
2652 },
2653 )
2654 }
2655 }
2656 #[inline]
2657 pub fn slider_float4<'a, 'b, 'c, 'd>(
2658 &'a self,
2659 label: &'b CStr,
2660 v: &'c mut [f32; 4],
2661 v_min: f32,
2662 v_max: f32,
2663 format: impl Into<Option<&'d CStr>>,
2664 power: impl Into<Option<f32>>,
2665 ) -> bool {
2666 unsafe {
2667 igSliderFloat4(
2668 label.as_ptr(),
2669 v,
2670 v_min,
2671 v_max,
2672 match format.into() {
2673 Some(v) => v.as_ptr(),
2674 None => cstr_ptr!("%.3f"),
2675 },
2676 match power.into() {
2677 Some(v) => v,
2678 None => 1.0,
2679 },
2680 )
2681 }
2682 }
2683 #[inline]
2684 pub fn slider_int<'a, 'b, 'c, 'd>(
2685 &'a self,
2686 label: &'b CStr,
2687 v: &'c mut i32,
2688 v_min: i32,
2689 v_max: i32,
2690 format: impl Into<Option<&'d CStr>>,
2691 ) -> bool {
2692 unsafe {
2693 igSliderInt(
2694 label.as_ptr(),
2695 v,
2696 v_min,
2697 v_max,
2698 match format.into() {
2699 Some(v) => v.as_ptr(),
2700 None => cstr_ptr!("%d"),
2701 },
2702 )
2703 }
2704 }
2705 #[inline]
2706 pub fn slider_int2<'a, 'b, 'c, 'd>(
2707 &'a self,
2708 label: &'b CStr,
2709 v: &'c mut [i32; 2],
2710 v_min: i32,
2711 v_max: i32,
2712 format: impl Into<Option<&'d CStr>>,
2713 ) -> bool {
2714 unsafe {
2715 igSliderInt2(
2716 label.as_ptr(),
2717 v,
2718 v_min,
2719 v_max,
2720 match format.into() {
2721 Some(v) => v.as_ptr(),
2722 None => cstr_ptr!("%d"),
2723 },
2724 )
2725 }
2726 }
2727 #[inline]
2728 pub fn slider_int3<'a, 'b, 'c, 'd>(
2729 &'a self,
2730 label: &'b CStr,
2731 v: &'c mut [i32; 3],
2732 v_min: i32,
2733 v_max: i32,
2734 format: impl Into<Option<&'d CStr>>,
2735 ) -> bool {
2736 unsafe {
2737 igSliderInt3(
2738 label.as_ptr(),
2739 v,
2740 v_min,
2741 v_max,
2742 match format.into() {
2743 Some(v) => v.as_ptr(),
2744 None => cstr_ptr!("%d"),
2745 },
2746 )
2747 }
2748 }
2749 #[inline]
2750 pub fn slider_int4<'a, 'b, 'c, 'd>(
2751 &'a self,
2752 label: &'b CStr,
2753 v: &'c mut [i32; 4],
2754 v_min: i32,
2755 v_max: i32,
2756 format: impl Into<Option<&'d CStr>>,
2757 ) -> bool {
2758 unsafe {
2759 igSliderInt4(
2760 label.as_ptr(),
2761 v,
2762 v_min,
2763 v_max,
2764 match format.into() {
2765 Some(v) => v.as_ptr(),
2766 None => cstr_ptr!("%d"),
2767 },
2768 )
2769 }
2770 }
2771 #[inline]
2774 pub fn small_button<'a, 'b>(&'a self, label: &'b CStr) -> bool {
2775 unsafe { igSmallButton(label.as_ptr()) }
2776 }
2777 #[inline]
2778 pub fn spacing<'a>(&'a self) {
2779 unsafe { igSpacing() };
2780 }
2781 #[inline]
2785 pub fn text<'a, 'b>(&'a self, fmt: &'b CStr) {
2786 unsafe { igText(cstr_ptr!("%s"), fmt.as_ptr()) };
2787 }
2788 #[inline]
2789 pub fn text_colored<'a, 'b>(&'a self, col: ImVec4, fmt: &'b CStr) {
2790 unsafe { igTextColored(col, cstr_ptr!("%s"), fmt.as_ptr()) };
2791 }
2792 #[inline]
2793 pub fn text_disabled<'a, 'b>(&'a self, fmt: &'b CStr) {
2794 unsafe { igTextDisabled(cstr_ptr!("%s"), fmt.as_ptr()) };
2795 }
2796 #[inline]
2797 pub fn text_wrapped<'a, 'b>(&'a self, fmt: &'b CStr) {
2798 unsafe { igTextWrapped(cstr_ptr!("%s"), fmt.as_ptr()) };
2799 }
2800 #[inline]
2801 pub fn tree_advance_to_label_pos<'a>(&'a self) {
2802 unsafe { igTreeAdvanceToLabelPos() };
2803 }
2804 #[inline]
2805 pub fn tree_node_str<'a, 'b>(&'a self, label: &'b CStr) -> bool {
2806 unsafe { igTreeNodeStr(label.as_ptr()) }
2807 }
2808 #[inline]
2809 pub fn tree_node_str_str<'a, 'b, 'c>(&'a self, str_id: &'b CStr, fmt: &'c CStr) -> bool {
2810 unsafe { igTreeNodeStrStr(str_id.as_ptr(), cstr_ptr!("%s"), fmt.as_ptr()) }
2811 }
2812 #[inline]
2814 pub fn tree_node_ex_str<'a, 'b>(&'a self, label: &'b CStr, flags: impl Into<Option<ImGuiTreeNodeFlags>>) -> bool {
2815 unsafe {
2816 igTreeNodeExStr(
2817 label.as_ptr(),
2818 match flags.into() {
2819 Some(v) => v,
2820 None => ImGuiTreeNodeFlags::empty(),
2821 },
2822 )
2823 }
2824 }
2825 #[inline]
2826 pub fn tree_node_ex_str_str<'a, 'b, 'c>(
2827 &'a self,
2828 str_id: &'b CStr,
2829 flags: ImGuiTreeNodeFlags,
2830 fmt: &'c CStr,
2831 ) -> bool {
2832 unsafe { igTreeNodeExStrStr(str_id.as_ptr(), flags, cstr_ptr!("%s"), fmt.as_ptr()) }
2833 }
2834 #[inline]
2836 pub fn tree_pop<'a>(&'a self) {
2837 unsafe { igTreePop() };
2838 }
2839 #[inline]
2840 pub fn tree_push_str<'a, 'b>(&'a self, str_id: &'b CStr) {
2841 unsafe { igTreePushStr(str_id.as_ptr()) };
2842 }
2843 #[inline]
2845 pub fn unindent<'a>(&'a self, indent_w: impl Into<Option<f32>>) {
2846 unsafe {
2847 igUnindent(match indent_w.into() {
2848 Some(v) => v,
2849 None => 0.0,
2850 })
2851 };
2852 }
2853 #[inline]
2854 pub fn v_slider_float<'a, 'b, 'c, 'd>(
2855 &'a self,
2856 label: &'b CStr,
2857 size: ImVec2,
2858 v: &'c mut f32,
2859 v_min: f32,
2860 v_max: f32,
2861 format: impl Into<Option<&'d CStr>>,
2862 power: impl Into<Option<f32>>,
2863 ) -> bool {
2864 unsafe {
2865 igVSliderFloat(
2866 label.as_ptr(),
2867 size,
2868 v,
2869 v_min,
2870 v_max,
2871 match format.into() {
2872 Some(v) => v.as_ptr(),
2873 None => cstr_ptr!("%.3f"),
2874 },
2875 match power.into() {
2876 Some(v) => v,
2877 None => 1.0,
2878 },
2879 )
2880 }
2881 }
2882 #[inline]
2883 pub fn v_slider_int<'a, 'b, 'c, 'd>(
2884 &'a self,
2885 label: &'b CStr,
2886 size: ImVec2,
2887 v: &'c mut i32,
2888 v_min: i32,
2889 v_max: i32,
2890 format: impl Into<Option<&'d CStr>>,
2891 ) -> bool {
2892 unsafe {
2893 igVSliderInt(
2894 label.as_ptr(),
2895 size,
2896 v,
2897 v_min,
2898 v_max,
2899 match format.into() {
2900 Some(v) => v.as_ptr(),
2901 None => cstr_ptr!("%d"),
2902 },
2903 )
2904 }
2905 }
2906 #[inline]
2908 pub fn value_bool<'a, 'b>(&'a self, prefix: &'b CStr, b: bool) {
2909 unsafe { igValueBool(prefix.as_ptr(), b) };
2910 }
2911 #[inline]
2912 pub fn value_int<'a, 'b>(&'a self, prefix: &'b CStr, v: i32) {
2913 unsafe { igValueInt(prefix.as_ptr(), v) };
2914 }
2915 #[inline]
2916 pub fn value_uint<'a, 'b>(&'a self, prefix: &'b CStr, v: u32) {
2917 unsafe { igValueUint(prefix.as_ptr(), v) };
2918 }
2919 #[inline]
2920 pub fn value_float<'a, 'b, 'c>(&'a self, prefix: &'b CStr, v: f32, float_format: impl Into<Option<&'c CStr>>) {
2921 unsafe {
2922 igValueFloat(
2923 prefix.as_ptr(),
2924 v,
2925 match float_format.into() {
2926 Some(v) => v.as_ptr(),
2927 None => ::std::ptr::null(),
2928 },
2929 )
2930 };
2931 }
2932} pub mod types_used {
2934 pub use nsf_imgui_raw::ImGuiCol;
2935 pub use nsf_imgui_raw::ImGuiColorEditFlags;
2936 pub use nsf_imgui_raw::ImGuiComboFlags;
2937 pub use nsf_imgui_raw::ImGuiCond;
2938 pub use nsf_imgui_raw::ImGuiDir;
2939 pub use nsf_imgui_raw::ImGuiDragDropFlags;
2940 pub use nsf_imgui_raw::ImGuiFocusedFlags;
2941 pub use nsf_imgui_raw::ImGuiHoveredFlags;
2942 pub use nsf_imgui_raw::ImGuiID;
2943 pub use nsf_imgui_raw::ImGuiInputTextFlags;
2944 pub use nsf_imgui_raw::ImGuiKey;
2945 pub use nsf_imgui_raw::ImGuiMouseCursor;
2946 pub use nsf_imgui_raw::ImGuiSelectableFlags;
2947 pub use nsf_imgui_raw::ImGuiStyleVar;
2948 pub use nsf_imgui_raw::ImGuiTreeNodeFlags;
2949 pub use nsf_imgui_raw::ImGuiWindowFlags;
2950 pub use nsf_imgui_raw::ImTextureID;
2951 pub use nsf_imgui_raw::ImVec2;
2952 pub use nsf_imgui_raw::ImVec4;
2953}