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