-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathimgui.h
7944 lines (7601 loc) · 389 KB
/
imgui.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// dear imgui, v1.91.7 WIP
// (headers)
// Help:
// - See links below.
// - Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp. All applications
// in examples/ are doing that.
// - Read top of imgui.cpp for more details, links and comments.
// - Add '#define IMGUI_DEFINE_MATH_OPERATORS' before including this file (or in
// imconfig.h) to access courtesy maths operators for ImVec2 and ImVec4.
// Resources:
// - FAQ ........................ https://dearimgui.com/faq (in repository as
// docs/FAQ.md)
// - Homepage ................... https://github.com/ocornut/imgui
// - Releases & changelog ....... https://github.com/ocornut/imgui/releases
// - Gallery ....................
// https://github.com/ocornut/imgui/issues?q=label%3Agallery (please post your
// screenshots/video there!)
// - Wiki ....................... https://github.com/ocornut/imgui/wiki (lots of
// good stuff there)
// - Getting Started https://github.com/ocornut/imgui/wiki/Getting-Started
// (how to integrate in an existing app by adding ~25 lines of code)
// - Third-party Extensions
// https://github.com/ocornut/imgui/wiki/Useful-Extensions (ImPlot & many
// more)
// - Bindings/Backends https://github.com/ocornut/imgui/wiki/Bindings
// (language bindings, backends for various tech/engines)
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
// - Debug Tools https://github.com/ocornut/imgui/wiki/Debug-Tools
// - Software using Dear ImGui
// https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui
// - Issues & support ........... https://github.com/ocornut/imgui/issues
// - Test Engine & Automation ... https://github.com/ocornut/imgui_test_engine
// (test suite, test engine to automate your apps)
// For first-time users having issues compiling/linking/running/loading fonts:
// please post in https://github.com/ocornut/imgui/discussions if you cannot
// find a solution in resources above. Everything else should be asked in
// 'Issues'! We are building a database of cross-linked knowledge there.
// Library Version
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if
// IMGUI_VERSION_NUM >= 12345')
#define IMGUI_VERSION "1.91.7 WIP"
#define IMGUI_VERSION_NUM 19164
#define IMGUI_HAS_TABLE
/*
Index of this file:
// [SECTION] Header mess
// [SECTION] Forward declarations and basic types
// [SECTION] Dear ImGui end-user API functions
// [SECTION] Flags & Enumerations
// [SECTION] Tables API flags and structures (ImGuiTableFlags,
ImGuiTableColumnFlags, ImGuiTableRowFlags, ImGuiTableBgTarget,
ImGuiTableSortSpecs, ImGuiTableColumnSortSpecs)
// [SECTION] Helpers: Debug log, Memory allocations macros, ImVector<>
// [SECTION] ImGuiStyle
// [SECTION] ImGuiIO
// [SECTION] Misc data structures (ImGuiInputTextCallbackData,
ImGuiSizeCallbackData, ImGuiPayload)
// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer,
ImGuiStorage, ImGuiListClipper, Math Operators, ImColor)
// [SECTION] Multi-Select API flags and structures (ImGuiMultiSelectFlags,
ImGuiMultiSelectIO, ImGuiSelectionRequest, ImGuiSelectionBasicStorage,
ImGuiSelectionExternalStorage)
// [SECTION] Drawing API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert,
ImDrawChannel, ImDrawListSplitter, ImDrawFlags, ImDrawListFlags, ImDrawList,
ImDrawData)
// [SECTION] Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder,
ImFontAtlasFlags, ImFontAtlas, ImFont)
// [SECTION] Viewports (ImGuiViewportFlags, ImGuiViewport)
// [SECTION] ImGuiPlatformIO + other Platform Dependent Interfaces
(ImGuiPlatformImeData)
// [SECTION] Obsolete functions and types
*/
#pragma once
// Configuration file with compile-time options
// (edit imconfig.h or '#define IMGUI_USER_CONFIG "myfilename.h" from your build
// system)
#ifdef IMGUI_USER_CONFIG
#include IMGUI_USER_CONFIG
#endif
#include "imconfig.h"
#ifndef IMGUI_DISABLE
//-----------------------------------------------------------------------------
// [SECTION] Header mess
//-----------------------------------------------------------------------------
// Includes
#include <float.h> // FLT_MIN, FLT_MAX
#include <stdarg.h> // va_list, va_start, va_end
#include <stddef.h> // ptrdiff_t, NULL
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
// Define attributes of all API symbols declarations (e.g. for DLL under
// Windows) IMGUI_API is used for core imgui functions, IMGUI_IMPL_API is used
// for the default backends files (imgui_impl_xxx.h) Using dear imgui via a
// shared library is not recommended: we don't guarantee backward nor forward
// ABI compatibility + this is a call-heavy library and function call overhead
// adds up.
#ifndef IMGUI_API
#define IMGUI_API
#endif
#ifndef IMGUI_IMPL_API
#define IMGUI_IMPL_API IMGUI_API
#endif
// Helper Macros
#ifndef IM_ASSERT
#include <assert.h>
#define IM_ASSERT(_EXPR) \
assert(_EXPR) // You can override the default assert handler by editing
// imconfig.h
#endif
#define IM_ARRAYSIZE(_ARR) \
((int) (sizeof(_ARR) / sizeof(*(_ARR)))) // Size of a static C-style array.
// Don't use on pointers!
#define IM_UNUSED(_VAR) \
((void) (_VAR)) // Used to silence "unused variable warnings". Often useful as
// asserts may be stripped out from final builds.
// Check that version and structures layouts are matching between compiled imgui
// code and caller. Read comments above DebugCheckVersionAndDataLayout() for
// details.
#define IMGUI_CHECKVERSION() \
ImGui::DebugCheckVersionAndDataLayout( \
IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), \
sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our
// formatting functions. (MSVC provides an equivalent mechanism via SAL
// Annotations but it would require the macros in a different
// location. e.g. #include <sal.h> + void myprintf(_Printf_format_string_ const
// char* format, ...))
#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && \
!defined(__clang__)
#define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT + 1)))
#define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0)))
#elif !defined(IMGUI_USE_STB_SPRINTF) && \
(defined(__clang__) || defined(__GNUC__))
#define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT + 1)))
#define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0)))
#else
#define IM_FMTARGS(FMT)
#define IM_FMTLIST(FMT)
#endif
// Disable some of MSVC most aggressive Debug runtime checks in function
// header/footer (used in some simple/low-level functions)
#if defined(_MSC_VER) && !defined(__clang__) && !defined(__INTEL_COMPILER) && \
!defined(IMGUI_DEBUG_PARANOID)
#define IM_MSVC_RUNTIME_CHECKS_OFF \
__pragma(runtime_checks("", off)) __pragma(check_stack(off)) \
__pragma(strict_gs_check(push, off))
#define IM_MSVC_RUNTIME_CHECKS_RESTORE \
__pragma(runtime_checks("", restore)) __pragma(check_stack()) \
__pragma(strict_gs_check(pop))
#else
#define IM_MSVC_RUNTIME_CHECKS_OFF
#define IM_MSVC_RUNTIME_CHECKS_RESTORE
#endif
// Warnings
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning( \
disable : 26495) // [Static Analyzer] Variable 'XXX' is uninitialized.
// Always initialize a member variable (type.6).
#endif
#if defined(__clang__)
#pragma clang diagnostic push
#if __has_warning("-Wunknown-warning-option")
#pragma clang diagnostic ignored \
"-Wunknown-warning-option" // warning: unknown warning group 'xxx'
#endif
#pragma clang diagnostic ignored \
"-Wunknown-pragmas" // warning: unknown warning group 'xxx'
#pragma clang diagnostic ignored \
"-Wold-style-cast" // warning: use of old-style cast
#pragma clang diagnostic ignored "-Wfloat-equal" // warning: comparing floating
// point with == or != is
// unsafe
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // warning:
// zero as
// null
// pointer
// constant
#pragma clang diagnostic ignored \
"-Wreserved-identifier" // warning: identifier '_Xxx' is reserved because it
// starts with '_' followed by a capital letter
#pragma clang diagnostic ignored \
"-Wunsafe-buffer-usage" // warning: 'xxx' is an unsafe pointer used for
// buffer access
#pragma clang diagnostic ignored \
"-Wnontrivial-memaccess" // warning: first argument in call to 'memset' is a
// pointer to non-trivially copyable type
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored \
"-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
#pragma GCC diagnostic ignored \
"-Wfloat-equal" // warning: comparing floating-point with '==' or '!=' is
// unsafe
#pragma GCC diagnostic ignored \
"-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy'
// clearing/writing an object of type 'xxxx' with no
// trivial copy-assignment; use assignment or
// value-initialization instead
#endif
//-----------------------------------------------------------------------------
// [SECTION] Forward declarations and basic types
//-----------------------------------------------------------------------------
// Scalar data types
typedef unsigned int ImGuiID; // A unique ID used by widgets (typically the
// result of hashing a stack of string)
typedef signed char ImS8; // 8-bit signed integer
typedef unsigned char ImU8; // 8-bit unsigned integer
typedef signed short ImS16; // 16-bit signed integer
typedef unsigned short ImU16; // 16-bit unsigned integer
typedef signed int ImS32; // 32-bit signed integer == int
typedef unsigned int
ImU32; // 32-bit unsigned integer (often used to store packed colors)
typedef signed long long ImS64; // 64-bit signed integer
typedef unsigned long long ImU64; // 64-bit unsigned integer
// Forward declarations
struct ImDrawChannel; // Temporary storage to output draw commands out of order,
// used by ImDrawListSplitter and
// ImDrawList::ChannelsSplit()
struct ImDrawCmd; // A single draw command within a parent ImDrawList (generally
// maps to 1 GPU draw call, unless it is a callback)
struct ImDrawData; // All draw command lists required to render the frame +
// pos/size coordinates to use for the projection matrix.
struct ImDrawList; // A single draw command list (generally one per window,
// conceptually you may see this as a dynamic "mesh" builder)
struct ImDrawListSharedData; // Data shared among multiple draw lists (typically
// owned by parent ImGui context, but you may
// create one yourself)
struct ImDrawListSplitter; // Helper to split a draw list into different layers
// which can be drawn into out of order, then
// flattened back.
struct ImDrawVert; // A single vertex (pos + uv + col = 20 bytes by default.
// Override layout with
// IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT)
struct ImFont; // Runtime data for a single font within a parent ImFontAtlas
struct ImFontAtlas; // Runtime data for multiple fonts, bake multiple fonts into
// a single texture, TTF/OTF font loader
struct ImFontBuilderIO; // Opaque interface to a font builder (stb_truetype or
// FreeType).
struct ImFontConfig; // Configuration data when adding a font or merging fonts
struct ImFontGlyph; // A single font glyph (code point + coordinates within in
// ImFontAtlas + offset)
struct ImFontGlyphRangesBuilder; // Helper to build glyph ranges from
// text/string data
struct ImColor; // Helper functions to create a color that can be converted to
// either u32 or float4 (*OBSOLETE* please avoid using)
struct ImGuiContext; // Dear ImGui context (opaque structure, unless including
// imgui_internal.h)
struct ImGuiIO; // Main configuration and I/O between your application and ImGui
// (also see: ImGuiPlatformIO)
struct ImGuiInputTextCallbackData; // Shared state of InputText() when using
// custom ImGuiInputTextCallback
// (rare/advanced use)
struct ImGuiKeyData; // Storage for ImGuiIO and IsKeyDown(), IsKeyPressed() etc
// functions.
struct ImGuiListClipper; // Helper to manually clip large list of items
struct ImGuiMultiSelectIO; // Structure to interact with a
// BeginMultiSelect()/EndMultiSelect() block
struct ImGuiOnceUponAFrame; // Helper for running a block of code not more than
// once a frame
struct ImGuiPayload; // User data payload for drag and drop operations
struct ImGuiPlatformIO; // Interface between platform/renderer backends and
// ImGui (e.g. Clipboard, IME hooks). Extends ImGuiIO.
// In docking branch, this gets extended to support
// multi-viewports.
struct ImGuiPlatformImeData; // Platform IME data for io.PlatformSetImeDataFn()
// function.
struct ImGuiSelectionBasicStorage; // Optional helper to store multi-selection
// state + apply multi-selection requests.
struct ImGuiSelectionExternalStorage; // Optional helper to apply
// multi-selection requests to existing
// randomly accessible storage.
struct ImGuiSelectionRequest; // A selection request (stored in
// ImGuiMultiSelectIO)
struct ImGuiSizeCallbackData; // Callback data when using
// SetNextWindowSizeConstraints() (rare/advanced
// use)
struct ImGuiStorage; // Helper for key->value storage (container sorted by key)
struct ImGuiStoragePair; // Helper for key->value storage (pair)
struct ImGuiStyle; // Runtime data for styling/colors
struct ImGuiTableSortSpecs; // Sorting specifications for a table (often
// handling sort specs for a single column,
// occasionally more)
struct ImGuiTableColumnSortSpecs; // Sorting specification for one column of a
// table
struct ImGuiTextBuffer; // Helper to hold and append into a text buffer (~string
// builder)
struct ImGuiTextFilter; // Helper to parse and apply text filters (e.g.
// "aaaaa[,bbbbb][,ccccc]")
struct ImGuiViewport; // A Platform Window (always only one in 'master' branch),
// in the future may represent Platform Monitor
// Enumerations
// - We don't use strongly typed enums much because they add constraints (can't
// extend in private code, can't store typed in bit fields, extra casting on
// iteration)
// - Tip: Use your programming IDE navigation facilities on the names in the
// _central column_ below to find the actual flags/enum lists!
// - In Visual Studio: CTRL+comma ("Edit.GoToAll") can follow symbols inside
// comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
// - In Visual Studio w/ Visual Assist installed: ALT+G
// ("VAssistX.GoToImplementation") can also follow symbols inside comments.
// - In VS Code, CLion, etc.: CTRL+click can follow symbols inside comments.
enum ImGuiDir : int; // -> enum ImGuiDir // Enum: A cardinal
// direction (Left, Right, Up, Down)
enum ImGuiKey : int; // -> enum ImGuiKey // Enum: A key identifier
// (ImGuiKey_XXX or ImGuiMod_XXX value)
enum ImGuiMouseSource : int; // -> enum ImGuiMouseSource // Enum; A mouse
// input source identifier (Mouse, TouchScreen,
// Pen)
enum ImGuiSortDirection : ImU8; // -> enum ImGuiSortDirection // Enum: A
// sorting direction (ascending or descending)
typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color
// identifier for styling
typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A condition for
// many Set*() functions
typedef int
ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type
typedef int ImGuiMouseButton; // -> enum ImGuiMouseButton_ // Enum: A mouse
// button identifier (0=left, 1=right, 2=middle)
typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse
// cursor shape
typedef int ImGuiStyleVar; // -> enum ImGuiStyleVar_ // Enum: A variable
// identifier for styling
typedef int ImGuiTableBgTarget; // -> enum ImGuiTableBgTarget_ // Enum: A
// color target for TableSetBgColor()
// Flags (declared as int to allow using as flags without overhead, and to not
// pollute the top of this file)
// - Tip: Use your programming IDE navigation facilities on the names in the
// _central column_ below to find the actual flags/enum lists!
// - In Visual Studio: CTRL+comma ("Edit.GoToAll") can follow symbols inside
// comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
// - In Visual Studio w/ Visual Assist installed: ALT+G
// ("VAssistX.GoToImplementation") can also follow symbols inside comments.
// - In VS Code, CLion, etc.: CTRL+click can follow symbols inside comments.
typedef int ImDrawFlags; // -> enum ImDrawFlags_ // Flags: for
// ImDrawList functions
typedef int ImDrawListFlags; // -> enum ImDrawListFlags_ // Flags: for
// ImDrawList instance
typedef int ImFontAtlasFlags; // -> enum ImFontAtlasFlags_ // Flags: for
// ImFontAtlas build
typedef int ImGuiBackendFlags; // -> enum ImGuiBackendFlags_ // Flags: for
// io.BackendFlags
typedef int ImGuiButtonFlags; // -> enum ImGuiButtonFlags_ // Flags: for
// InvisibleButton()
typedef int
ImGuiChildFlags; // -> enum ImGuiChildFlags_ // Flags: for BeginChild()
typedef int ImGuiColorEditFlags; // -> enum ImGuiColorEditFlags_ // Flags: for
// ColorEdit4(), ColorPicker4() etc.
typedef int ImGuiConfigFlags; // -> enum ImGuiConfigFlags_ // Flags: for
// io.ConfigFlags
typedef int
ImGuiComboFlags; // -> enum ImGuiComboFlags_ // Flags: for BeginCombo()
typedef int
ImGuiDragDropFlags; // -> enum ImGuiDragDropFlags_ // Flags: for
// BeginDragDropSource(), AcceptDragDropPayload()
typedef int ImGuiFocusedFlags; // -> enum ImGuiFocusedFlags_ // Flags: for
// IsWindowFocused()
typedef int ImGuiHoveredFlags; // -> enum ImGuiHoveredFlags_ // Flags: for
// IsItemHovered(), IsWindowHovered() etc.
typedef int ImGuiInputFlags; // -> enum ImGuiInputFlags_ // Flags: for
// Shortcut(), SetNextItemShortcut()
typedef int ImGuiInputTextFlags; // -> enum ImGuiInputTextFlags_ // Flags: for
// InputText(), InputTextMultiline()
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for
// PushItemFlag(), shared by all items
typedef int
ImGuiKeyChord; // -> ImGuiKey | ImGuiMod_XXX // Flags: for
// IsKeyChordPressed(), Shortcut() etc. an ImGuiKey
// optionally OR-ed with one or more ImGuiMod_XXX values.
typedef int
ImGuiPopupFlags; // -> enum ImGuiPopupFlags_ // Flags: for
// OpenPopup*(), BeginPopupContext*(), IsPopupOpen()
typedef int ImGuiMultiSelectFlags; // -> enum ImGuiMultiSelectFlags_// Flags:
// for BeginMultiSelect()
typedef int ImGuiSelectableFlags; // -> enum ImGuiSelectableFlags_ // Flags: for
// Selectable()
typedef int
ImGuiSliderFlags; // -> enum ImGuiSliderFlags_ // Flags: for
// DragFloat(), DragInt(), SliderFloat(), SliderInt() etc.
typedef int ImGuiTabBarFlags; // -> enum ImGuiTabBarFlags_ // Flags: for
// BeginTabBar()
typedef int ImGuiTabItemFlags; // -> enum ImGuiTabItemFlags_ // Flags: for
// BeginTabItem()
typedef int
ImGuiTableFlags; // -> enum ImGuiTableFlags_ // Flags: For BeginTable()
typedef int ImGuiTableColumnFlags; // -> enum ImGuiTableColumnFlags_// Flags:
// For TableSetupColumn()
typedef int ImGuiTableRowFlags; // -> enum ImGuiTableRowFlags_ // Flags: For
// TableNextRow()
typedef int ImGuiTreeNodeFlags; // -> enum ImGuiTreeNodeFlags_ // Flags: for
// TreeNode(), TreeNodeEx(), CollapsingHeader()
typedef int ImGuiViewportFlags; // -> enum ImGuiViewportFlags_ // Flags: for
// ImGuiViewport
typedef int ImGuiWindowFlags; // -> enum ImGuiWindowFlags_ // Flags: for
// Begin(), BeginChild()
// ImTexture: user data for renderer backend to identify a texture [Compile-time
// configurable type]
// - To use something else than an opaque void* pointer: override with e.g.
// '#define ImTextureID MyTextureType*' in your imconfig.h file.
// - This can be whatever to you want it to be! read the FAQ about ImTextureID
// for details.
// - You can make this a structure with various constructors if you need. You
// will have to implement ==/!= operators.
// - (note: before v1.91.4 (2024/10/08) the default type for ImTextureID was
// void*. Use intermediary intptr_t cast and read FAQ if you have casting
// warnings)
#ifndef ImTextureID
typedef ImU64
ImTextureID; // Default: store a pointer or an integer fitting in a pointer
// (most renderer backends are ok with that)
#endif
// ImDrawIdx: vertex index. [Compile-time configurable type]
// - To use 16-bit indices + allow large meshes: backend need to set
// 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset' and handle
// ImDrawCmd::VtxOffset (recommended).
// - To use 32-bit indices: override with '#define ImDrawIdx unsigned int' in
// your imconfig.h file.
#ifndef ImDrawIdx
typedef unsigned short ImDrawIdx; // Default: 16-bit (for maximum compatibility
// with renderer backends)
#endif
// Character types
// (we generally use UTF-8 encoded string in the API. This is storage
// specifically for a decoded character used for keyboard input and display)
typedef unsigned int
ImWchar32; // A single decoded U32 character/code point. We encode them as
// multi bytes UTF-8 when used in strings.
typedef unsigned short
ImWchar16; // A single decoded U16 character/code point. We encode them as
// multi bytes UTF-8 when used in strings.
#ifdef IMGUI_USE_WCHAR32 // ImWchar [configurable type: override in imconfig.h
// with '#define IMGUI_USE_WCHAR32' to support Unicode
// planes 1-16]
typedef ImWchar32 ImWchar;
#else
typedef ImWchar16 ImWchar;
#endif
// Multi-Selection item index or identifier when using BeginMultiSelect()
// - Used by SetNextItemSelectionUserData() + and inside ImGuiMultiSelectIO
// structure.
// - Most users are likely to use this store an item INDEX but this may be used
// to store a POINTER/ID as well. Read comments near ImGuiMultiSelectIO for
// details.
typedef ImS64 ImGuiSelectionUserData;
// Callback and functions types
typedef int (*ImGuiInputTextCallback)(
ImGuiInputTextCallbackData
*data); // Callback function for ImGui::InputText()
typedef void (*ImGuiSizeCallback)(
ImGuiSizeCallbackData
*data); // Callback function for ImGui::SetNextWindowSizeConstraints()
typedef void *(*ImGuiMemAllocFunc)(
size_t sz,
void *user_data); // Function signature for ImGui::SetAllocatorFunctions()
typedef void (*ImGuiMemFreeFunc)(
void *ptr,
void *user_data); // Function signature for ImGui::SetAllocatorFunctions()
// ImVec2: 2D vector used to store positions, sizes etc. [Compile-time
// configurable type]
// - This is a frequently used type in the API. Consider using
// IM_VEC2_CLASS_EXTRA to create implicit cast from/to our preferred type.
// - Add '#define IMGUI_DEFINE_MATH_OPERATORS' before including this file (or in
// imconfig.h) to access courtesy maths operators for ImVec2 and ImVec4.
IM_MSVC_RUNTIME_CHECKS_OFF
struct ImVec2
{
float x, y;
constexpr ImVec2() : x(0.0f), y(0.0f) {}
constexpr ImVec2(float _x, float _y) : x(_x), y(_y) {}
float &
operator[](size_t idx)
{
IM_ASSERT(idx == 0 || idx == 1);
return ((float *) (void *) (char *) this)[idx];
} // We very rarely use this [] operator, so the assert overhead is fine.
float
operator[](size_t idx) const
{
IM_ASSERT(idx == 0 || idx == 1);
return ((const float *) (const void *) (const char *) this)[idx];
}
#ifdef IM_VEC2_CLASS_EXTRA
IM_VEC2_CLASS_EXTRA // Define additional constructors and implicit cast
// operators in imconfig.h to convert back and forth
// between your math types and ImVec2.
#endif
};
// ImVec4: 4D vector used to store clipping rectangles, colors etc.
// [Compile-time configurable type]
struct ImVec4
{
float x, y, z, w;
constexpr ImVec4() : x(0.0f), y(0.0f), z(0.0f), w(0.0f) {}
constexpr ImVec4(float _x, float _y, float _z, float _w)
: x(_x), y(_y), z(_z), w(_w)
{}
#ifdef IM_VEC4_CLASS_EXTRA
IM_VEC4_CLASS_EXTRA // Define additional constructors and implicit cast
// operators in imconfig.h to convert back and forth
// between your math types and ImVec4.
#endif
};
IM_MSVC_RUNTIME_CHECKS_RESTORE
//-----------------------------------------------------------------------------
// [SECTION] Dear ImGui end-user API functions
// (Note that ImGui:: being a namespace, you can add extra ImGui:: functions in
// your own separate file. Please don't modify imgui source files!)
//-----------------------------------------------------------------------------
namespace ImGui {
// Context creation and access
// - Each context create its own ImFontAtlas by default. You may instance one
// yourself and pass it to CreateContext() to share a font atlas between
// contexts.
// - DLL users: heaps and globals are not shared across DLL boundaries! You will
// need to call SetCurrentContext() + SetAllocatorFunctions()
// for each static/DLL boundary you are calling from. Read "Context and Memory
// Allocators" section of imgui.cpp for details.
IMGUI_API ImGuiContext *CreateContext(ImFontAtlas *shared_font_atlas = NULL);
IMGUI_API void
DestroyContext(ImGuiContext *ctx = NULL); // NULL = destroy current context
IMGUI_API ImGuiContext *GetCurrentContext();
IMGUI_API void SetCurrentContext(ImGuiContext *ctx);
// Main
IMGUI_API ImGuiIO &
GetIO(); // access the ImGuiIO structure (mouse/keyboard/gamepad inputs, time,
// various configuration options/flags)
IMGUI_API ImGuiPlatformIO &
GetPlatformIO(); // access the ImGuiPlatformIO structure (mostly hooks/functions
// to connect to platform/renderer and OS Clipboard, IME etc.)
IMGUI_API ImGuiStyle &
GetStyle(); // access the Style structure (colors, sizes). Always use
// PushStyleColor(), PushStyleVar() to modify style mid-frame!
IMGUI_API void NewFrame(); // start a new Dear ImGui frame, you can submit any
// command from this point until Render()/EndFrame().
IMGUI_API void
EndFrame(); // ends the Dear ImGui frame. automatically called by Render(). If
// you don't need to render data (skipping rendering) you may call
// EndFrame() without Render()... but you'll have wasted CPU
// already! If you don't need to render, better to not create any
// windows and not call NewFrame() at all!
IMGUI_API void Render(); // ends the Dear ImGui frame, finalize the draw data.
// You can then get call GetDrawData().
IMGUI_API ImDrawData *
GetDrawData(); // valid after Render() and until the next call to NewFrame().
// this is what you have to render.
// Demo, Debug, Information
IMGUI_API void ShowDemoWindow(
bool *p_open = NULL); // create Demo window. demonstrate most ImGui
// features. call this to learn about the library! try
// to make it always available in your application!
IMGUI_API void ShowMetricsWindow(
bool *p_open =
NULL); // create Metrics/Debugger window. display Dear ImGui internals:
// windows, draw commands, various internal state, etc.
IMGUI_API void ShowDebugLogWindow(
bool *p_open = NULL); // create Debug Log window. display a simplified log
// of important dear imgui events.
IMGUI_API void ShowIDStackToolWindow(
bool *p_open =
NULL); // create Stack Tool window. hover items with mouse to query
// information about the source of their unique ID.
IMGUI_API void ShowAboutWindow(
bool *p_open = NULL); // create About window. display Dear ImGui version,
// credits and build/system information.
IMGUI_API void ShowStyleEditor(
ImGuiStyle *ref =
NULL); // add style editor block (not a window). you can pass in a
// reference ImGuiStyle structure to compare to, revert to and
// save to (else it uses the default style)
IMGUI_API bool ShowStyleSelector(
const char *label); // add style selector block (not a window), essentially
// a combo listing the default styles.
IMGUI_API void ShowFontSelector(
const char *label); // add font selector block (not a window), essentially a
// combo listing the loaded fonts.
IMGUI_API void
ShowUserGuide(); // add basic help/info block (not a window): how to manipulate
// ImGui as an end-user (mouse/keyboard controls).
IMGUI_API const char *
GetVersion(); // get the compiled version string e.g. "1.80 WIP" (essentially
// the value for IMGUI_VERSION from the compiled version of
// imgui.cpp)
// Styles
IMGUI_API void
StyleColorsDark(ImGuiStyle *dst = NULL); // new, recommended style (default)
IMGUI_API void
StyleColorsLight(ImGuiStyle *dst =
NULL); // best used with borders and a custom, thicker font
IMGUI_API void
StyleColorsClassic(ImGuiStyle *dst = NULL); // classic imgui style
// Windows
// - Begin() = push window to the stack and start appending to it. End() = pop
// window from the stack.
// - Passing 'bool* p_open != NULL' shows a window-closing widget in the
// upper-right corner of the window,
// which clicking will set the boolean to false when clicked.
// - You may append multiple times to the same window during the same frame by
// calling Begin()/End() pairs multiple times.
// Some information such as 'flags' or 'p_open' will only be considered by the
// first call to Begin().
// - Begin() return false to indicate the window is collapsed or fully clipped,
// so you may early out and omit submitting
// anything to the window. Always call a matching End() for each Begin() call,
// regardless of its return value! [Important: due to legacy reason, Begin/End
// and BeginChild/EndChild are inconsistent with all other functions
// such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call
// should only be called if the corresponding BeginXXX function returned
// true. Begin and BeginChild are the only odd ones out. Will be fixed in a
// future update.]
// - Note that the bottom of window stack always contains a window called
// "Debug".
IMGUI_API bool Begin(const char *name, bool *p_open = NULL,
ImGuiWindowFlags flags = 0);
IMGUI_API void End();
// Child Windows
// - Use child windows to begin into a self-contained independent
// scrolling/clipping regions within a host window. Child windows can embed
// their own child.
// - Before 1.90 (November 2023), the "ImGuiChildFlags child_flags = 0"
// parameter was "bool border = false".
// This API is backward compatible with old code, as we guarantee that
// ImGuiChildFlags_Borders == true. Consider updating your old code:
// BeginChild("Name", size, false) -> Begin("Name", size, 0); or
// Begin("Name", size, ImGuiChildFlags_None); BeginChild("Name", size,
// true) -> Begin("Name", size, ImGuiChildFlags_Borders);
// - Manual sizing (each axis can use a different setting e.g. ImVec2(0.0f,
// 400.0f)):
// == 0.0f: use remaining parent window size for this axis.
// > 0.0f: use specified size for this axis.
// < 0.0f: right/bottom-align to specified distance from available content
// boundaries.
// - Specifying ImGuiChildFlags_AutoResizeX or ImGuiChildFlags_AutoResizeY makes
// the sizing automatic based on child contents.
// Combining both ImGuiChildFlags_AutoResizeX _and_
// ImGuiChildFlags_AutoResizeY defeats purpose of a scrolling region and is
// NOT recommended.
// - BeginChild() returns false to indicate the window is collapsed or fully
// clipped, so you may early out and omit submitting
// anything to the window. Always call a matching EndChild() for each
// BeginChild() call, regardless of its return value. [Important: due to
// legacy reason, Begin/End and BeginChild/EndChild are inconsistent with all
// other functions
// such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call
// should only be called if the corresponding BeginXXX function returned
// true. Begin and BeginChild are the only odd ones out. Will be fixed in a
// future update.]
IMGUI_API bool BeginChild(const char *str_id, const ImVec2 &size = ImVec2(0, 0),
ImGuiChildFlags child_flags = 0,
ImGuiWindowFlags window_flags = 0);
IMGUI_API bool BeginChild(ImGuiID id, const ImVec2 &size = ImVec2(0, 0),
ImGuiChildFlags child_flags = 0,
ImGuiWindowFlags window_flags = 0);
IMGUI_API bool BeginChildCustom(const char *str_id,
const ImVec2 &size = ImVec2(0, 0),
ImGuiChildFlags child_flags = 0,
ImGuiWindowFlags window_flags = 0);
IMGUI_API bool BeginChildCustom(ImGuiID id, const ImVec2 &size = ImVec2(0, 0),
ImGuiChildFlags child_flags = 0,
ImGuiWindowFlags window_flags = 0);
IMGUI_API void EndChild();
// Windows Utilities
// - 'current window' = the window we are appending into while inside a
// Begin()/End() block. 'next window' = next window we will Begin() into.
IMGUI_API bool IsWindowAppearing();
IMGUI_API bool IsWindowCollapsed();
IMGUI_API bool
IsWindowFocused(ImGuiFocusedFlags flags =
0); // is current window focused? or its root/child,
// depending on flags. see flags for options.
IMGUI_API bool IsWindowHovered(
ImGuiHoveredFlags flags =
0); // is current window hovered and hoverable (e.g. not blocked by a
// popup/modal)? See ImGuiHoveredFlags_ for options. IMPORTANT: If
// you are trying to check whether your mouse should be dispatched
// to Dear ImGui or to your underlying app, you should not use this
// function! Use the 'io.WantCaptureMouse' boolean for that! Refer
// to FAQ entry "How can I tell whether to dispatch mouse/keyboard
// to Dear ImGui or my application?" for details.
IMGUI_API ImDrawList *
GetWindowDrawList(); // get draw list associated to the current window, to
// append your own drawing primitives
IMGUI_API ImVec2
GetWindowPos(); // get current window position in screen space (IT IS UNLIKELY
// YOU EVER NEED TO USE THIS. Consider always using
// GetCursorScreenPos() and GetContentRegionAvail() instead)
IMGUI_API ImVec2
GetWindowSize(); // get current window size (IT IS UNLIKELY YOU EVER NEED TO USE
// THIS. Consider always using GetCursorScreenPos() and
// GetContentRegionAvail() instead)
IMGUI_API float
GetWindowWidth(); // get current window width (IT IS UNLIKELY YOU EVER NEED TO
// USE THIS). Shortcut for GetWindowSize().x.
IMGUI_API float
GetWindowHeight(); // get current window height (IT IS UNLIKELY YOU EVER NEED TO
// USE THIS). Shortcut for GetWindowSize().y.
// Window manipulation
// - Prefer using SetNextXXX functions (before Begin) rather that SetXXX
// functions (after Begin).
IMGUI_API void SetNextWindowPos(
const ImVec2 &pos, ImGuiCond cond = 0,
const ImVec2 &pivot =
ImVec2(0, 0)); // set next window position. call before Begin(). use
// pivot=(0.5f,0.5f) to center on given point, etc.
IMGUI_API void SetNextWindowSize(
const ImVec2 &size,
ImGuiCond cond = 0); // set next window size. set axis to 0.0f to force an
// auto-fit on this axis. call before Begin()
IMGUI_API void SetNextWindowSizeConstraints(
const ImVec2 &size_min, const ImVec2 &size_max,
ImGuiSizeCallback custom_callback = NULL,
void *custom_callback_data =
NULL); // set next window size limits. use 0.0f or FLT_MAX if you don't
// want limits. Use -1 for both min and max of same axis to
// preserve current size (which itself is a constraint). Use
// callback to apply non-trivial programmatic constraints.
IMGUI_API void SetNextWindowContentSize(
const ImVec2 &
size); // set next window content size (~ scrollable client area, which
// enforce the range of scrollbars). Not including window
// decorations (title bar, menu bar, etc.) nor WindowPadding. set
// an axis to 0.0f to leave it automatic. call before Begin()
IMGUI_API void SetNextWindowCollapsed(
bool collapsed,
ImGuiCond cond = 0); // set next window collapsed state. call before Begin()
IMGUI_API void SetNextWindowFocus(); // set next window to be focused /
// top-most. call before Begin()
IMGUI_API void SetNextWindowScroll(
const ImVec2 &scroll); // set next window scrolling value (use < 0.0f to not
// affect a given axis).
IMGUI_API void SetNextWindowBgAlpha(
float alpha); // set next window background color alpha. helper to easily
// override the Alpha component of
// ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use
// ImGuiWindowFlags_NoBackground.
IMGUI_API void
SetWindowPos(const ImVec2 &pos,
ImGuiCond cond =
0); // (not recommended) set current window position - call
// within Begin()/End(). prefer using SetNextWindowPos(),
// as this may incur tearing and side-effects.
IMGUI_API void SetWindowSize(
const ImVec2 &size,
ImGuiCond cond = 0); // (not recommended) set current window size - call
// within Begin()/End(). set to ImVec2(0, 0) to force
// an auto-fit. prefer using SetNextWindowSize(), as
// this may incur tearing and minor side-effects.
IMGUI_API void SetWindowCollapsed(
bool collapsed,
ImGuiCond cond = 0); // (not recommended) set current window collapsed
// state. prefer using SetNextWindowCollapsed().
IMGUI_API void
SetWindowFocus(); // (not recommended) set current window to be focused /
// top-most. prefer using SetNextWindowFocus().
IMGUI_API void SetWindowFontScale(
float scale); // [OBSOLETE] set font scale. Adjust IO.FontGlobalScale if you
// want to scale all windows. This is an old API! For correct
// scaling, prefer to reload font + rebuild ImFontAtlas + call
// style.ScaleAllSizes().
IMGUI_API void SetWindowPos(const char *name, const ImVec2 &pos,
ImGuiCond cond = 0); // set named window position.
IMGUI_API void
SetWindowSize(const char *name, const ImVec2 &size,
ImGuiCond cond = 0); // set named window size. set axis to 0.0f to
// force an auto-fit on this axis.
IMGUI_API void
SetWindowCollapsed(const char *name, bool collapsed,
ImGuiCond cond = 0); // set named window collapsed state
IMGUI_API void
SetWindowFocus(const char *name); // set named window to be focused / top-most.
// use NULL to remove focus.
// Windows Scrolling
// - Any change of Scroll will be applied at the beginning of next frame in the
// first call to Begin().
// - You may instead use SetNextWindowScroll() prior to calling Begin() to avoid
// this delay, as an alternative to using SetScrollX()/SetScrollY().
IMGUI_API float GetScrollX(); // get scrolling amount [0 .. GetScrollMaxX()]
IMGUI_API float GetScrollY(); // get scrolling amount [0 .. GetScrollMaxY()]
IMGUI_API void
SetScrollX(float scroll_x); // set scrolling amount [0 .. GetScrollMaxX()]
IMGUI_API void
SetScrollY(float scroll_y); // set scrolling amount [0 .. GetScrollMaxY()]
IMGUI_API float
GetScrollMaxX(); // get maximum scrolling amount ~~ ContentSize.x - WindowSize.x
// - DecorationsSize.x
IMGUI_API float
GetScrollMaxY(); // get maximum scrolling amount ~~ ContentSize.y - WindowSize.y
// - DecorationsSize.y
IMGUI_API void SetScrollHereX(
float center_x_ratio =
0.5f); // adjust scrolling amount to make current cursor position
// visible. center_x_ratio=0.0: left, 0.5: center, 1.0: right.
// When using to make a "default/current item" visible, consider
// using SetItemDefaultFocus() instead.
IMGUI_API void SetScrollHereY(
float center_y_ratio =
0.5f); // adjust scrolling amount to make current cursor position
// visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom.
// When using to make a "default/current item" visible, consider
// using SetItemDefaultFocus() instead.
IMGUI_API void
SetScrollFromPosX(float local_x,
float center_x_ratio =
0.5f); // adjust scrolling amount to make given position
// visible. Generally GetCursorStartPos() + offset
// to compute a valid position.
IMGUI_API void
SetScrollFromPosY(float local_y,
float center_y_ratio =
0.5f); // adjust scrolling amount to make given position
// visible. Generally GetCursorStartPos() + offset
// to compute a valid position.
// Parameters stacks (shared)
IMGUI_API void
PushFont(ImFont *font); // use NULL as a shortcut to push default font
IMGUI_API void PopFont();
IMGUI_API void
PushStyleColor(ImGuiCol idx,
ImU32 col); // modify a style color. always use this if you
// modify the style after NewFrame().
IMGUI_API void PushStyleColor(ImGuiCol idx, const ImVec4 &col);
IMGUI_API void PopStyleColor(int count = 1);
IMGUI_API void
PushStyleVar(ImGuiStyleVar idx,
float val); // modify a style float variable. always use this if
// you modify the style after NewFrame()!
IMGUI_API void
PushStyleVar(ImGuiStyleVar idx,
const ImVec2 &val); // modify a style ImVec2 variable. "
IMGUI_API void
PushStyleVarX(ImGuiStyleVar idx,
float val_x); // modify X component of a style ImVec2 variable. "
IMGUI_API void
PushStyleVarY(ImGuiStyleVar idx,
float val_y); // modify Y component of a style ImVec2 variable. "
IMGUI_API void PopStyleVar(int count = 1);
IMGUI_API void
PushItemFlag(ImGuiItemFlags option,
bool enabled); // modify specified shared item flag, e.g.
// PushItemFlag(ImGuiItemFlags_NoTabStop, true)
IMGUI_API void PopItemFlag();
// Parameters stacks (current window)
IMGUI_API void PushItemWidth(
float item_width); // push width of items for common large "item+label"
// widgets. >0.0f: width in pixels, <0.0f align xx pixels
// to the right of window (so -FLT_MIN always align width
// to the right side).
IMGUI_API void PopItemWidth();
IMGUI_API void SetNextItemWidth(
float item_width); // set width of the _next_ common large "item+label"
// widget. >0.0f: width in pixels, <0.0f align xx pixels
// to the right of window (so -FLT_MIN always align width
// to the right side)
IMGUI_API float
CalcItemWidth(); // width of item given pushed settings and current cursor
// position. NOT necessarily the width of last item unlike most
// 'Item' functions.
IMGUI_API void PushTextWrapPos(
float wrap_local_pos_x =
0.0f); // push word-wrapping position for Text*() commands. < 0.0f: no
// wrapping; 0.0f: wrap to end of window (or column); > 0.0f:
// wrap at 'wrap_pos_x' position in window local space
IMGUI_API void PopTextWrapPos();
// Style read access
// - Use the ShowStyleEditor() function to interactively see/edit the colors.
IMGUI_API ImFont *GetFont(); // get current font
IMGUI_API float GetFontSize(); // get current font size (= height in pixels) of
// current font with current scale applied
IMGUI_API ImVec2
GetFontTexUvWhitePixel(); // get UV coordinate for a white pixel, useful to draw
// custom shapes via the ImDrawList API
IMGUI_API ImU32 GetColorU32(
ImGuiCol idx,
float alpha_mul = 1.0f); // retrieve given style color with style alpha
// applied and optional extra alpha multiplier,
// packed as a 32-bit value suitable for ImDrawList
IMGUI_API ImU32 GetColorU32(
const ImVec4 &col); // retrieve given color with style alpha applied, packed
// as a 32-bit value suitable for ImDrawList
IMGUI_API ImU32 GetColorU32(
ImU32 col,
float alpha_mul = 1.0f); // retrieve given color with style alpha applied,
// packed as a 32-bit value suitable for ImDrawList
IMGUI_API const ImVec4 &GetStyleColorVec4(
ImGuiCol
idx); // retrieve style color as stored in ImGuiStyle structure. use to
// feed back into PushStyleColor(), otherwise use GetColorU32() to
// get style color with style alpha baked in.
// Layout cursor positioning
// - By "cursor" we mean the current output position.
// - The typical widget behavior is to output themselves at the current cursor
// position, then move the cursor one line down.
// - You can call SameLine() between widgets to undo the last carriage return
// and output at the right of the preceding widget.
// - YOU CAN DO 99% OF WHAT YOU NEED WITH ONLY GetCursorScreenPos() and
// GetContentRegionAvail().
// - Attention! We currently have inconsistencies between window-local and
// absolute positions we will aim to fix with future API:
// - Absolute coordinate: GetCursorScreenPos(), SetCursorScreenPos(),
// all ImDrawList:: functions. -> this is the preferred way forward.
// - Window-local coordinates: SameLine(offset), GetCursorPos(),
// SetCursorPos(), GetCursorStartPos(), PushTextWrapPos()
// - Window-local coordinates: GetContentRegionMax(),
// GetWindowContentRegionMin(), GetWindowContentRegionMax() --> all
// obsoleted. YOU DON'T NEED THEM.
// - GetCursorScreenPos() = GetCursorPos() + GetWindowPos(). GetWindowPos() is
// almost only ever useful to convert from window-local to absolute coordinates.
// Try not to use it.
IMGUI_API ImVec2
GetCursorScreenPos(); // cursor position, absolute coordinates. THIS IS YOUR
// BEST FRIEND (prefer using this rather than
// GetCursorPos(), also more useful to work with
// ImDrawList API).
IMGUI_API void
SetCursorScreenPos(const ImVec2 &pos); // cursor position, absolute coordinates.
// THIS IS YOUR BEST FRIEND.
IMGUI_API ImVec2 GetContentRegionAvail(); // available space from current
// position. THIS IS YOUR BEST FRIEND.
IMGUI_API ImVec2
GetCursorPos(); // [window-local] cursor position in window-local coordinates.
// This is not your best friend.
IMGUI_API float GetCursorPosX(); // [window-local] "
IMGUI_API float GetCursorPosY(); // [window-local] "
IMGUI_API void SetCursorPos(const ImVec2 &local_pos); // [window-local] "
IMGUI_API void SetCursorPosX(float local_x); // [window-local] "
IMGUI_API void SetCursorPosY(float local_y); // [window-local] "
IMGUI_API ImVec2
GetCursorStartPos(); // [window-local] initial cursor position, in window-local
// coordinates. Call GetCursorScreenPos() after Begin() to
// get the absolute coordinates version.
// Other layout functions
IMGUI_API void
Separator(); // separator, generally horizontal. inside a menu bar or in
// horizontal layout mode, this becomes a vertical separator.
IMGUI_API void
SameLine(float offset_from_start_x = 0.0f,
float spacing =
-1.0f); // call between widgets or groups to layout them
// horizontally. X position given in window coordinates.
IMGUI_API void NewLine(); // undo a SameLine() or force a new line when in a
// horizontal-layout context.
IMGUI_API void Spacing(); // add vertical spacing.
IMGUI_API void
Dummy(const ImVec2
&size); // add a dummy item of given size. unlike InvisibleButton(),
// Dummy() won't take the mouse click or be navigable into.
IMGUI_API void Indent(
float indent_w = 0.0f); // move content position toward the right, by
// indent_w, or style.IndentSpacing if indent_w <= 0
IMGUI_API void Unindent(
float indent_w = 0.0f); // move content position back to the left, by
// indent_w, or style.IndentSpacing if indent_w <= 0
IMGUI_API void BeginGroup(); // lock horizontal starting position
IMGUI_API void
EndGroup(); // unlock horizontal starting position + capture the whole group
// bounding box into one "item" (so you can use IsItemHovered() or
// layout primitives such as SameLine() on whole group, etc.)