appcui_proc_macro 0.2.5

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

use procmacro_builder::{AppCUITrait, TraitImplementation, TraitsConfig, BaseControlType};

extern crate proc_macro;

/// Used to create a custom control
/// The general format is: `#[CustomControl(overwrite = ..., events= ...)]`
/// Where the **overwrite** parameter is a list of traits that can be overwritten that include:
/// * OnPaint
/// * OnKeyPressed
/// * OnMouseEvents
/// * OnDefaultAction
/// * OnResize
/// * OnFocus
/// 
/// and the **events** parameter is a list of events that could be received by the new control:
/// * CommandBarEvents
/// * MenuEvents
///
/// If none of the **overwrite** or **events** parameters is present, a default implementation
/// will be provided.
///
/// # Example
/// ```rust,compile_fail
/// use appcui::prelude::*;
///
/// #[CustomControl(overwrite = OnPaint+OnKeyPressed)]
/// struct MyCustomControl {
///     // custom data
/// }
/// impl MyCustomControl { /* specific methods */}
/// impl OnPaint for MyCustomControl {
///     fn on_paint(&self, surface: &mut Surface, theme: &Theme) {
///         // add your code that draws that control here
///         // clipping is already set
///     }
/// }
/// impl OnKeyPressed for MyCustomControl {
///     fn on_key_pressed(&mut self, key: Key, character: char) -> EventProcessStatus {
///         // do some actions based on the provided key
///         // this method should return `EventProcessStatus::Processed` if
///         // the provided key was used, or `EventProcessStatus::Ignored` if
///         // the key should be send to the parent control.
///     }
/// }
/// ```
#[allow(non_snake_case)]
#[proc_macro_attribute]
pub fn CustomControl(args: TokenStream, input: TokenStream) -> TokenStream {
    let mut config = TraitsConfig::new("CustomControl");
    // Deref is mandatory
    config.set(AppCUITrait::Deref, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::Control, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::NotDesktop, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::NotWindow, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::OnWindowRegistered, TraitImplementation::DefaultNonOverwritable);
    // Raw events (implemente by default)
    config.set(AppCUITrait::OnPaint, TraitImplementation::Default);
    config.set(AppCUITrait::OnResize, TraitImplementation::Default);
    config.set(AppCUITrait::OnFocus, TraitImplementation::Default);
    config.set(AppCUITrait::OnExpand, TraitImplementation::Default);
    config.set(AppCUITrait::OnDefaultAction, TraitImplementation::Default);
    config.set(AppCUITrait::OnKeyPressed, TraitImplementation::Default);
    config.set(AppCUITrait::OnMouseEvent, TraitImplementation::Default);
    config.set(AppCUITrait::OnSiblingSelected, TraitImplementation::Default);
    config.set(AppCUITrait::OnThemeChanged, TraitImplementation::Default);

    // control events
    config.set(AppCUITrait::ButtonEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::CheckBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::RadioBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ToggleButtonEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::WindowEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::MenuEvents, TraitImplementation::Default);
    config.set(AppCUITrait::AppBarEvents, TraitImplementation::Default);
    config.set(AppCUITrait::CommandBarEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ToolBarEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ColorPickerEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ThreeStateBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::PasswordEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::KeySelectorEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::TextFieldEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::RichTextFieldEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericSelectorEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ComboBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericDropDownListEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericNumericSelectorEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::DatePickerEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ListBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericListViewEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::PathFinderEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericTreeViewEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::MarkdownEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericBackgroundTaskEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::AccordionEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::TabEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::CharPickerEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericGraphViewEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::TimePickerEvents, TraitImplementation::DefaultNonOverwritable);

    // custom events
    config.set(AppCUITrait::CustomEvents, TraitImplementation::DefaultNonOverwritable);

    // timer events
    config.set(AppCUITrait::TimerEvents, TraitImplementation::Default);


    // desktop
    config.set(AppCUITrait::DesktopEvents, TraitImplementation::DefaultNonOverwritable);

    procmacro_builder::build(args, input, BaseControlType::CustomControl, &mut config)
}


#[allow(non_snake_case)]
#[proc_macro_attribute]
pub fn CustomContainer(args: TokenStream, input: TokenStream) -> TokenStream {
    let mut config = TraitsConfig::new("CustomContainer");
    // Deref is mandatory
    config.set(AppCUITrait::Deref, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::Control, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::NotDesktop, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::NotWindow, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::OnWindowRegistered, TraitImplementation::DefaultNonOverwritable);
    // Raw events (implemente by default)
    config.set(AppCUITrait::OnPaint, TraitImplementation::Default);
    config.set(AppCUITrait::OnResize, TraitImplementation::Default);
    config.set(AppCUITrait::OnFocus, TraitImplementation::Default);
    config.set(AppCUITrait::OnExpand, TraitImplementation::Default);
    config.set(AppCUITrait::OnDefaultAction, TraitImplementation::Default);
    config.set(AppCUITrait::OnKeyPressed, TraitImplementation::Default);
    config.set(AppCUITrait::OnMouseEvent, TraitImplementation::Default);
    config.set(AppCUITrait::OnSiblingSelected, TraitImplementation::Default);
    config.set(AppCUITrait::OnThemeChanged, TraitImplementation::Default);

    // control events
    config.set(AppCUITrait::ButtonEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::CheckBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::RadioBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ToggleButtonEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::WindowEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::MenuEvents, TraitImplementation::Default);
    config.set(AppCUITrait::AppBarEvents, TraitImplementation::Default);
    config.set(AppCUITrait::CommandBarEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ToolBarEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ColorPickerEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ThreeStateBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::PasswordEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::KeySelectorEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::TextFieldEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::RichTextFieldEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericSelectorEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ComboBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericDropDownListEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericNumericSelectorEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::DatePickerEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ListBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericListViewEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::PathFinderEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericTreeViewEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::MarkdownEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericBackgroundTaskEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::AccordionEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::TabEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::CharPickerEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericGraphViewEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::TimePickerEvents, TraitImplementation::DefaultNonOverwritable);
    // custom events
    config.set(AppCUITrait::CustomEvents, TraitImplementation::DefaultNonOverwritable);

    // timer events
    config.set(AppCUITrait::TimerEvents, TraitImplementation::Default);


    // desktop
    config.set(AppCUITrait::DesktopEvents, TraitImplementation::DefaultNonOverwritable);

    procmacro_builder::build(args, input, BaseControlType::CustomContainer, &mut config)
}



/// Used to create a custom window that can process events from its controls
/// The general format is: `#[Window(events = ...)]`
/// Where the **events** parameter is a list of traits that can be overwritten:
/// * WindowEvents
/// * ButtonEvents
/// * CheckBoxEvents
/// * CommandBarEvents
/// * MenuEvents
/// * ToolBarEvents
///
/// If not overwritten, a default implementation will be automatically added
///
/// # Example
/// ```rust,compile_fail
/// use appcui::prelude::*;
///
/// #[Window(events = ButtonEvens+WindowEvents)]
/// struct MyWindow {
///     // custom data
/// }
/// impl MyWindow { /* specific methods */}
/// impl ButtonEvents for MyWindow { /* ... */ }
/// impl WindowEvents for MyWindow { /* ... */ }
/// ```
#[allow(non_snake_case)]
#[proc_macro_attribute]
pub fn Window(args: TokenStream, input: TokenStream) -> TokenStream {
    let mut config = TraitsConfig::new("Window");
    // Deref is mandatory
    config.set(AppCUITrait::Deref, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::Control, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::WindowControl, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::NotModalWindow, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::OnWindowRegistered, TraitImplementation::BaseFallbackNonOverwritable);
    // Raw events (implemente by default)
    config.set(AppCUITrait::OnPaint, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::OnResize, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::OnFocus, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::OnExpand, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::OnDefaultAction, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::OnKeyPressed, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::OnMouseEvent, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::OnSiblingSelected, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::OnThemeChanged, TraitImplementation::Default);


    // control events
    config.set(AppCUITrait::ButtonEvents, TraitImplementation::Default);
    config.set(AppCUITrait::CheckBoxEvents, TraitImplementation::Default);
    config.set(AppCUITrait::RadioBoxEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ToggleButtonEvents, TraitImplementation::Default);
    config.set(AppCUITrait::WindowEvents, TraitImplementation::Default);
    config.set(AppCUITrait::MenuEvents, TraitImplementation::Default);
    config.set(AppCUITrait::AppBarEvents, TraitImplementation::Default);
    config.set(AppCUITrait::CommandBarEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ToolBarEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ColorPickerEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ThreeStateBoxEvents, TraitImplementation::Default);
    config.set(AppCUITrait::PasswordEvents, TraitImplementation::Default);
    config.set(AppCUITrait::KeySelectorEvents, TraitImplementation::Default);
    config.set(AppCUITrait::TextFieldEvents, TraitImplementation::Default);
    config.set(AppCUITrait::RichTextFieldEvents, TraitImplementation::Default);
    config.set(AppCUITrait::GenericSelectorEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ComboBoxEvents, TraitImplementation::Default);
    config.set(AppCUITrait::GenericDropDownListEvents, TraitImplementation::Default);
    config.set(AppCUITrait::GenericNumericSelectorEvents, TraitImplementation::Default);
    config.set(AppCUITrait::DatePickerEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ListBoxEvents, TraitImplementation::Default);
    config.set(AppCUITrait::GenericListViewEvents, TraitImplementation::Default);
    config.set(AppCUITrait::PathFinderEvents, TraitImplementation::Default);
    config.set(AppCUITrait::GenericTreeViewEvents, TraitImplementation::Default);
    config.set(AppCUITrait::MarkdownEvents, TraitImplementation::Default);
    config.set(AppCUITrait::GenericBackgroundTaskEvents, TraitImplementation::Default);
    config.set(AppCUITrait::AccordionEvents, TraitImplementation::Default);
    config.set(AppCUITrait::TabEvents, TraitImplementation::Default);
    config.set(AppCUITrait::CharPickerEvents, TraitImplementation::Default);
    config.set(AppCUITrait::GenericGraphViewEvents, TraitImplementation::Default);
    config.set(AppCUITrait::TimePickerEvents, TraitImplementation::Default);

    // custom events
    config.set(AppCUITrait::CustomEvents, TraitImplementation::Default);

    // timer events
    config.set(AppCUITrait::TimerEvents, TraitImplementation::Default);

    // desktop
    config.set(AppCUITrait::DesktopEvents, TraitImplementation::DefaultNonOverwritable);

    procmacro_builder::build(args, input, BaseControlType::Window, &mut config)
}

#[allow(non_snake_case)]
#[proc_macro_attribute]
pub fn ModalWindow(args: TokenStream, input: TokenStream) -> TokenStream {
    let mut config = TraitsConfig::new("ModalWindow");
    // Deref is mandatory
    config.set(AppCUITrait::Deref, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::Control, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::WindowControl, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::OnWindowRegistered, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::ModalWindowMethods, TraitImplementation::BaseFallbackNonOverwritable);
    // Raw events (implemente by default)
    config.set(AppCUITrait::OnPaint, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::OnResize, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::OnFocus, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::OnExpand, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::OnDefaultAction, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::OnKeyPressed, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::OnMouseEvent, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::OnSiblingSelected, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::OnThemeChanged, TraitImplementation::Default);

    // control events
    config.set(AppCUITrait::ButtonEvents, TraitImplementation::Default);
    config.set(AppCUITrait::CheckBoxEvents, TraitImplementation::Default);
    config.set(AppCUITrait::RadioBoxEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ToggleButtonEvents, TraitImplementation::Default);
    config.set(AppCUITrait::WindowEvents, TraitImplementation::Default);
    config.set(AppCUITrait::MenuEvents, TraitImplementation::Default);
    config.set(AppCUITrait::AppBarEvents, TraitImplementation::Default);
    config.set(AppCUITrait::CommandBarEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ToolBarEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ColorPickerEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ThreeStateBoxEvents, TraitImplementation::Default);
    config.set(AppCUITrait::PasswordEvents, TraitImplementation::Default);
    config.set(AppCUITrait::KeySelectorEvents, TraitImplementation::Default);
    config.set(AppCUITrait::TextFieldEvents, TraitImplementation::Default);
    config.set(AppCUITrait::RichTextFieldEvents, TraitImplementation::Default);
    config.set(AppCUITrait::GenericSelectorEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ComboBoxEvents, TraitImplementation::Default);
    config.set(AppCUITrait::GenericDropDownListEvents, TraitImplementation::Default);
    config.set(AppCUITrait::GenericNumericSelectorEvents, TraitImplementation::Default);
    config.set(AppCUITrait::DatePickerEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ListBoxEvents, TraitImplementation::Default);
    config.set(AppCUITrait::GenericListViewEvents, TraitImplementation::Default);
    config.set(AppCUITrait::PathFinderEvents, TraitImplementation::Default);
    config.set(AppCUITrait::GenericTreeViewEvents, TraitImplementation::Default);
    config.set(AppCUITrait::MarkdownEvents, TraitImplementation::Default);
    config.set(AppCUITrait::GenericBackgroundTaskEvents, TraitImplementation::Default);
    config.set(AppCUITrait::AccordionEvents, TraitImplementation::Default);
    config.set(AppCUITrait::TabEvents, TraitImplementation::Default);
    config.set(AppCUITrait::CharPickerEvents, TraitImplementation::Default);
    config.set(AppCUITrait::GenericGraphViewEvents, TraitImplementation::Default);
    config.set(AppCUITrait::TimePickerEvents, TraitImplementation::Default);


    // custom events
    config.set(AppCUITrait::CustomEvents, TraitImplementation::DefaultNonOverwritable);

    // timer events
    config.set(AppCUITrait::TimerEvents, TraitImplementation::Default);

    // desktop
    config.set(AppCUITrait::DesktopEvents, TraitImplementation::Default);

    procmacro_builder::build(args, input, BaseControlType::ModalWindow, &mut config)
}


/// Used to create window and intercepts/process events from children controls.
/// The general format is: `#[Desktop(overwrite = ..., events= ...)]`
/// Where the **overwrite** parameter is a list of traits that can be overwritten that include:
/// * OnPaint
/// * OnResize
///
///and the **events** parameter is a list of events that could be received by the new control:
/// * CommandBarEvents
/// * MenuEvents
/// * DesktopEvents
///
/// If not overwritten, a default implementation will be automatically added
///
/// # Example
/// ```rust,compile_fail
/// use appcui::prelude::*;
///
/// #[Desktop(overwrite = OnPaint, events = DesktopEvents)]
/// struct MyDesktop {
///     // custom data
/// }
/// impl MyDesktop { /* specific methods */}
/// impl OnPaint for MyDesktop { /* ... */ }
/// impl DesktopEvents for MyDesktop { /* ... */ }
/// ```
#[allow(non_snake_case)]
#[proc_macro_attribute]
pub fn Desktop(args: TokenStream, input: TokenStream) -> TokenStream {
    let mut config = TraitsConfig::new("Desktop");
    // Deref is mandatory
    config.set(AppCUITrait::Deref, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::Control, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::DesktopControl, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::OnWindowRegistered, TraitImplementation::DefaultNonOverwritable);
    // Raw events (implemente by default)
    config.set(AppCUITrait::OnPaint, TraitImplementation::BaseFallback);
    config.set(AppCUITrait::OnResize, TraitImplementation::Default);
    config.set(AppCUITrait::OnFocus, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::OnExpand, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::OnDefaultAction, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::OnKeyPressed, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::OnMouseEvent, TraitImplementation::BaseFallbackNonOverwritable);
    config.set(AppCUITrait::OnSiblingSelected, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::OnThemeChanged, TraitImplementation::Default);

    // control events
    config.set(AppCUITrait::ButtonEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::CheckBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::RadioBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ToggleButtonEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::WindowEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::MenuEvents, TraitImplementation::Default);
    config.set(AppCUITrait::AppBarEvents, TraitImplementation::Default);
    config.set(AppCUITrait::CommandBarEvents, TraitImplementation::Default);
    config.set(AppCUITrait::ToolBarEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ColorPickerEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ThreeStateBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::PasswordEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::KeySelectorEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::TextFieldEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::RichTextFieldEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericSelectorEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ComboBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericDropDownListEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericNumericSelectorEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::DatePickerEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::ListBoxEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericListViewEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::PathFinderEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericTreeViewEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::MarkdownEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericBackgroundTaskEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::AccordionEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::TabEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::CharPickerEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::GenericGraphViewEvents, TraitImplementation::DefaultNonOverwritable);
    config.set(AppCUITrait::TimePickerEvents, TraitImplementation::DefaultNonOverwritable);

    // custom events
    config.set(AppCUITrait::CustomEvents, TraitImplementation::DefaultNonOverwritable);

    // timer events
    config.set(AppCUITrait::TimerEvents, TraitImplementation::Default);

    // desktop
    config.set(AppCUITrait::DesktopEvents, TraitImplementation::Default);

    procmacro_builder::build(args, input, BaseControlType::Desktop, &mut config)
}


/// Automatically implements the `ListItem` trait for a structure, enabling it to be displayed in controls like ListView or TreeView.
/// 
/// This derive macro should be used in combination with `#[Column(...)]` attributes on struct fields to define how each field
/// should be displayed in the list.
/// 
/// # Column Attribute Parameters
/// 
/// The `#[Column(...)]` attribute supports the following parameters:
/// 
/// | Parameter        | Type   | Required | Default      | Description                                                                                  |
/// | ---------------- | ------ | -------- | ------------ | -------------------------------------------------------------------------------------------- |
/// | `name` or `text` | String | **Yes**  | N/A          | The name of the column displayed in the header                                               |
/// | `width` or `w`   | u16    | No       | 10           | The width of the column in characters                                                        |
/// | `align` or `a`   | Align  | No       | Left         | Alignment: `Left`/`l`, `Right`/`r`, or `Center`/`c`                                          |
/// | `render` or `r`  | Render | No       | Auto-detect  | The render method for the column                                                             |
/// | `format` or `f`  | Format | No       | Varies       | Format for the render method                                                                 |
/// | `index` or `idx` | u16    | No       | Auto-assign  | Column order index (starting from 0 or 1)                                                    |
/// 
/// # Automatic Render Methods
/// 
/// If the `render` parameter is not provided, the render method will be determined based on the field type:
/// 
/// | Field type                | Render method | Default format   |
/// | ------------------------- | ------------- | ---------------- |
/// | `&str`, `String`          | Text          |                  |
/// | `i8`, `i16`, `i32`, `i64` | Int64         | Normal           |
/// | `u8`, `u16`, `u32`, `u64` | UInt64        | Normal           |
/// | `f32`, `f64`              | Float         | Normal           |
/// | `bool`                    | Bool          | CheckmarkMinus   |
/// | `NaiveDateTime`           | DateTime      | Normal           |
/// | `NaiveTime`               | Time          | Normal           |
/// | `NaiveDate`               | Date          | Full             |
/// | `Duration`                | Duration      | Auto             |
/// | `Status`                  | Status        | Graphical        |
/// 
/// # Available Render Methods
/// 
/// When specifying a render method explicitly, the following options are available:
/// 
/// | Render Method | Description                                  | Format Options                                                                                                                                                                                                                        |
/// | ------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
/// | Text          | Plain text                                   | N/A                                                                                                                                                                                                                                   |
/// | Ascii         | ASCII-only text                              | N/A                                                                                                                                                                                                                                   |
/// | DateTime      | Date and time                                | `Full`, `Normal`, `Short`                                                                                                                                                                                                             |
/// | Time          | Time only                                    | `Short`, `AMPM`, `Normal`                                                                                                                                                                                                             |
/// | Date          | Date only                                    | `Full`, `YearMonthDay`, `DayMonthYear`                                                                                                                                                                                                |
/// | Duration      | Time duration                                | `Auto`, `Seconds`, `Details`                                                                                                                                                                                                          |
/// | Int64         | Signed integer                               | `Normal`, `Separator`, `Hex`, `Hex16`, `Hex32`, `Hex64`                                                                                                                                                                               |
/// | UInt64        | Unsigned integer                             | `Normal`, `Separator`, `Hex`, `Hex16`, `Hex32`, `Hex64`                                                                                                                                                                               |
/// | Bool          | Boolean value                                | `YesNo`, `TrueFalse`, `XMinus`, `CheckmarkMinus`                                                                                                                                                                                      |
/// | Size          | File size or memory usage                    | `Auto`, `AutoWithDecimals`, `Bytes`, `KiloBytes`, `MegaBytes`, `GigaBytes`, `TeraBytes`, `KiloBytesWithDecimals`, `MegaBytesWithDecimals`, `GigaBytesWithDecimals`, `TeraBytesWithDecimals`                                           |
/// | Percentage    | Percentage value                             | `Normal`, `Decimals`                                                                                                                                                                                                                  |
/// | Float         | Floating point number                        | `Normal`, `TwoDigits`, `ThreeDigits`, `FourDigits`                                                                                                                                                                                    |
/// | Status        | Status indicator                             | `Hashtag`, `Graphical`, `Arrow`                                                                                                                                                                                                       |
/// | Temperature   | Temperature value                            | `Celsius`, `Fahrenheit`, `Kelvin`                                                                                                                                                                                                     |
/// | Area          | Area measurement                             | `SquaredMillimeters`, `SquaredCentimeters`, `SquaredMeters`, `SquaredKilometers`, `Hectares`, `Ares`, `SquareFeet`, `SquareInches`, `SquareYards`, `SquareMiles`                                                                      |
/// | Rating        | Rating display                               | `Numerical`, `Stars`, `Circles`, `Asterix`                                                                                                                                                                                            |
/// | Currency      | Currency value                               | `USD`, `USDSymbol`, `EUR`, `EURSymbol`, `GBP`, `GBPSymbol`, `YEN`, `YENSymbol`, `Bitcoin`, `BitcoinSymbol`, `RON`                                                                                                                     |
/// | Distance      | Distance measurement                         | `Kilometers`, `Meters`, `Centimeters`, `Millimeters`, `Inches`, `Feet`, `Yards`, `Miles`                                                                                                                                              |
/// | Volume        | Volume measurement                           | `CubicMillimeters`, `CubicCentimeters`, `CubicMeters`, `CubicKilometers`, `Liters`, `Milliliters`, `Gallons`, `CubicFeet`, `CubicInches`, `CubicYards`, `CubicMiles`                                                                  |
/// | Weight        | Weight measurement                           | `Grams`, `Milligrams`, `Kilograms`, `Pounds`, `Tons`                                                                                                                                                                                  |
/// | Speed         | Speed measurement                            | `KilometersPerHour`, `MetersPerHour`, `KilometersPerSecond`, `MetersPerSecond`, `MilesPerHour`, `MilesPerSecond`, `Knots`, `FeetPerSecond`, `Mach`                                                                                    |
/// | Custom        | Custom rendering (requires `paint()` method) | N/A                                                                                                                                                                                                                                   |
/// 
/// # Example
/// 
/// ```no_compile
/// use appcui::prelude::*;
/// 
/// #[derive(ListItem)]
/// struct Student {
///     #[Column(name: "&Name", width: 20, align: Left)]
///     name: String,
///     
///     #[Column(name: "&Grade", width: 5, align: Center)]
///     grade: u8,
///     
///     #[Column(name: "&Stars", width: 5, align: Center, render: Rating, format: Stars)]
///     stars: u8,
/// }
/// ```
/// 
/// This automatically implements all required ListItem methods, including `columns_count()`, `column()`, 
/// `render_method()`, and `compare()`. Custom implementations of `matches()` or `paint()` can still be 
/// added for custom filtering or rendering.
#[proc_macro_derive(ListItem, attributes(Column))]
pub fn listitem_derive(input: TokenStream) -> TokenStream {
    crate::derives::listitem::derive(input)
}

/// Automatically implements the `EnumSelector` trait for an enum, enabling it to be used with controls like Selector.
/// 
/// This derive macro should be used in combination with `#[VariantInfo(...)]` attributes on enum variants to 
/// define how each variant should be represented.
/// 
/// # VariantInfo Attribute Parameters
/// 
/// The `#[VariantInfo(...)]` attribute supports the following parameters:
/// 
/// | Parameter     | Type   | Required | Default                | Description                         |
/// | ------------- | ------ | -------- | ---------------------- | ----------------------------------- |
/// | `name`        | String | No       | Variant name as string | Display name for the variant        |
/// | `description` | String | No       | Empty string           | Description text for the variant    |
/// 
/// # Generated Implementation
/// 
/// The macro automatically implements:
/// 
/// * `COUNT` constant - Set to the number of enum variants
/// * `from_index(index: u32) -> Option<Self>` - Maps numeric index to enum variant
/// * `name(&self) -> &'static str` - Returns the name of the variant
/// * `description(&self) -> &'static str` - Returns the description of the variant
/// 
/// # Required Trait Derives
/// 
/// The enum must also derive `Eq`, `PartialEq`, `Copy`, and `Clone` for the `EnumSelector` derive macro 
/// to work properly.
/// 
/// # Example
/// 
/// ```no_compile
/// use appcui::prelude::*;
/// 
/// #[derive(EnumSelector, Eq, PartialEq, Copy, Clone)]
/// enum Shape {
///     #[VariantInfo(name = "Square", description = "a red square")]
///     Square,
///     
///     #[VariantInfo(name = "Rectangle", description = "a green rectangle")]
///     Rectangle,
///     
///     #[VariantInfo(name = "Triangle", description = "a blue triangle")]
///     Triangle,
///     
///     #[VariantInfo(name = "Circle", description = "a white circle")]
///     Circle,
/// }
/// ```
/// 
/// When a variant doesn't have a `#[VariantInfo]` attribute, the variant's name is used as the display name,
/// and the description defaults to an empty string.
#[proc_macro_derive(EnumSelector, attributes(VariantInfo))]
pub fn enumselector_derive(input: TokenStream) -> TokenStream {
    crate::derives::enumselector::derive(input)
}

/// Automatically implements the `DropDownListType` trait for an enum, enabling it to be used with dropdown selection mechanisms.
/// 
/// This derive macro should be used in combination with `#[VariantInfo(...)]` attributes on enum variants to 
/// define how each variant should be represented in a dropdown list.
/// 
/// # VariantInfo Attribute Parameters
/// 
/// The `#[VariantInfo(...)]` attribute supports the following parameters:
/// 
/// | Parameter     | Type   | Required | Default                | Description                            |
/// | ------------- | ------ | -------- | ---------------------- | -------------------------------------- |
/// | `name`        | String | No       | Variant name as string | Display name for the variant           |
/// | `description` | String | No       | Empty string           | Description text for the variant       |
/// | `symbol`      | String | No       | Empty string           | Symbolic representation of the variant |
/// 
/// # Generated Implementation
/// 
/// The macro automatically implements:
/// 
/// * `name(&self) -> &str` - Returns the display name of the variant
/// * `description(&self) -> &str` - Returns the description of the variant
/// * `symbol(&self) -> &str` - Returns a symbolic representation of the variant
/// 
/// # Example
/// 
/// ```no_compile
/// use appcui::prelude::*;
/// 
/// #[derive(DropDownListType)]
/// enum MathOp {
///     #[VariantInfo(name = "Sum", description = "Add multiple numbers", symbol = "∑")]
///     Sum,
///     
///     #[VariantInfo(name = "Product", description = "Multiply multiple numbers", symbol = "∏")]
///     Product,
///     
///     #[VariantInfo(name = "Integral", description = "Calculate the integral of a function", symbol = "∫")]
///     Integral,
///     
///     #[VariantInfo(name = "Radical", description = "Calculate the radical of a number", symbol = "√")]
///     Radical,
///     
///     #[VariantInfo(name = "Different", description = "Check if all elements from a set are different", symbol = "≠")]
///     Different,
/// }
/// ```
/// 
/// When a variant doesn't have a `#[VariantInfo]` attribute, the variant's name is used as the display name,
/// and the description and symbol default to empty strings.
#[proc_macro_derive(DropDownListType, attributes(VariantInfo))]
pub fn dropdownlisttype_derive(input: TokenStream) -> TokenStream {
    crate::derives::dropdownlisttype::derive(input)
}

/// Use to quickly identify a key or a combination via a string
/// Usage examples:
/// * key!("F2")
/// * key!("Enter")
/// * key!("Alt+F4")
/// * key!("Ctrl+Alt+F")
/// * key!("Ctrl+Shift+Alt+Tab")
///
/// The list of all keys supported by this macro is:
/// * F-commands (`F1` to `F12`)
/// * Letters (`A` to `Z`) - with apper case
/// * Numbers (`0` to `9`)
/// * Arrows (`Up`, `Down`, `Left`, `Right`)
/// * Navigation keys (`PageUp`, `PageDown`, `Home`, `End`)
/// * Deletion and Insertions (`Delete` , `Backspace`, `Insert`)
/// * White-spaces (`Space`, `Tab`)
/// * Other (`Enter`, `Escape`)
///
/// The supported modifiers are:
/// * Shift
/// * Ctrl
/// * Alt
///
/// Modifiers can be used in combination with the simple `+` between them.
#[proc_macro]
pub fn key(input: TokenStream) -> TokenStream {
    crate::key::create(input)
}

/// Creates a Character object with customizable appearance. The `char!` macro provides a convenient way to create 
/// characters with specific colors and attributes.
/// 
/// # Syntax
/// 
/// The macro supports both positional and named parameters:
/// 
/// ```no_compile
/// char!(character, foreground_color, background_color)
/// ```
/// 
/// or
/// 
/// ```no_compile
/// char!(named_parameters)
/// ```
/// 
/// # Positional Parameters
/// 
/// 1. **character** - A character or special character representation
/// 2. **foreground_color** - The foreground color (supports color names and short forms)
/// 3. **background_color** - The background color (supports color names and short forms)
/// 
/// # Named Parameters
/// 
/// * `value`, `char`, `ch` - Character or special character representation
/// * `code`, `unicode` - Unicode value of character
/// * `fore`, `foreground`, `forecolor`, `color` - Foreground color (default: Transparent)
/// * `back`, `background`, `backcolor` - Background color (default: Transparent)
/// * `attr`, `attributes` - Character attributes (Bold, Italic, Underline)
/// 
/// # Color Values
/// 
/// Colors can be specified using their full name (e.g., `Red`, `DarkBlue`) or short forms (e.g., `r` for Red, 
/// `db` for DarkBlue). `Transparent` can be specified as `transparent`, `invisible` or `?`.
/// 
/// # Special Characters
/// 
/// Special characters can be specified by name or special notation:
/// * Arrow symbols: `up`, `/|\`, `down`, `\|/`, `left`, `<-`, `right`, `->`
/// * Triangle symbols: `/\`, `\/`, `<|`, `|>`
/// * Other symbols: `...` for three dots
/// 
/// # Examples
/// 
/// ```no_compile
/// use appcui::prelude::*;
/// 
/// // Red 'A' on yellow background
/// let c = char!("A,red,yellow");
/// let c = char!("A,r,y");
/// 
/// // Bolded white 'A' on dark blue background
/// let c = char!("A,fore=White,back=DarkBlue,attr=[Bold,Underline]");
/// let c = char!("A,w,db,attr=Bold+Underline");
/// 
/// // Red left arrow with transparent background
/// let c = char!("<-,red");
/// let c = char!("<-,r");
/// ```
#[proc_macro]
pub fn char(input: TokenStream) -> TokenStream {
    crate::chars::create(input)
}

/// Creates a CharAttribute object that defines colors and attributes for characters.
/// 
/// # Syntax
/// 
/// The macro supports both positional and named parameters:
/// 
/// ```no_compile
/// charattr!(foreground_color, background_color)
/// ```
/// 
/// or
/// 
/// ```no_compile
/// charattr!(named_parameters)
/// ```
/// 
/// # Positional Parameters
/// 
/// 1. **foreground_color** - The foreground color (supports color names and short forms)
/// 2. **background_color** - The background color (supports color names and short forms)
/// 
/// # Named Parameters
/// 
/// * `fore`, `foreground`, `forecolor`, `color` - Foreground color (default: Transparent)
/// * `back`, `background`, `backcolor` - Background color (default: Transparent)
/// * `attr`, `attributes` - Character attributes (Bold, Italic, Underline)
/// 
/// # Color Values
/// 
/// Colors can be specified using their full name (e.g., `Red`, `DarkBlue`) or short forms (e.g., `r` for Red, 
/// `db` for DarkBlue). `Transparent` can be specified as `transparent`, `invisible` or `?`.
/// 
/// # Examples
/// 
/// ```no_compile
/// use appcui::prelude::*;
/// // Dark green foreground with transparent background, bold and underlined
/// let attr = charattr!("DarkGreen,Transparent,attr:Bold+Underline");
/// let attr = charattr!("dg,?,attr:Bold+Underline");
/// 
/// // Creating and using a character attribute
/// let attr = charattr!("red,blue");
/// let c = Character::with_attr('A', attr);
/// ```
#[proc_macro]
pub fn charattr(input: TokenStream) -> TokenStream {
    crate::chars::create_attr(input)
}

/// Creates a Column object for use in controls like ListView or similar. This macro provides a convenient way to 
/// define columns with caption, width, and text alignment.
/// 
/// # Syntax
/// 
/// The macro supports both positional and named parameters:
/// 
/// ```no_compile
/// headercolumn!(caption, width, alignment)
/// ```
/// 
/// or
/// 
/// ```no_compile
/// headercolumn!(named_parameters)
/// ```
/// 
/// # Positional Parameters
/// 
/// 1. **caption** - The text displayed in the column header
/// 2. **width** - The width of the column in characters
/// 3. **align** - The text alignment within the column
/// 
/// # Named Parameters
/// 
/// * `caption`, `name`, `text` - The text displayed in the column header
/// * `width`, `w` - The width of the column in characters (if not specified, uses caption length + 2)
/// * `align`, `a`, `alignment` - Text alignment in the column (Left, Right, or Center)
/// 
/// # Text Alignment Values
/// 
/// Alignment can be one of:
/// * `Left` or `L` - Align text to the left
/// * `Right` or `R` - Align text to the right
/// * `Center` or `C` - Center the text
/// 
/// If not specified, alignment defaults to `Left`.
/// 
/// # Examples
/// 
/// ```no_compile
/// // Basic column with default alignment (Left)
/// let col = headercolumn!("'Name', 20");
/// 
/// // Column with right alignment
/// let col = headercolumn!("'Price', 10, Right");
/// 
/// // Using named parameters
/// let col = headercolumn!("caption='Date', width=12, align=Center");
/// ```
#[proc_macro]
pub fn headercolumn(input: TokenStream) -> TokenStream {
    crate::column::create(input)
}


/// Creates a new button control. The format is `button!("attributes")` where the attributes are pairs of key-value , separated by comma, in the format `key=value` or `key:value`. 
/// If the `value` is a string, use single quotes to delimit the value. 
/// The following attributes are supported:
/// * `name` or `caption` or `text` - the text displayed on the button
/// * `type` - the type of the button. The following values are supported:
///   - **Normal** - a normal button
///   - **Flat** - a flat button
/// * position attributes: `x` and  `y`,
/// * size attributes: `width` or `w` (alias)
/// * margin attributes: `left` or `l`(alias), `right` or `r`(alias), `top` or `t`(alias), `bottom` or `b`(alias)
/// * Alignment attributes: 
///   - `align` or `a`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
///   - `dock` or `d`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
/// * State attributes: `enabled`, `visible`
/// 
/// # Example
/// 
/// ```button!("caption='Click me!', type=Flat, x=10, y=10, width=20")```
/// 
/// Alternatively, the first parameter (if the key is not specified) is consider the caption:
/// 
/// ```button!("'Click me!', x:0, y=10, w:20")```
#[proc_macro]
pub fn button(input: TokenStream) -> TokenStream {
    crate::controls::button::create(input)
}

/// Creates a new checkbox control. The format is `checkbox!("attributes")` where the attributes are pairs of key-value , separated by comma, in the format `key=value` or `key:value`.
/// If the `value` is a string, use single quotes to delimit the value.
/// The following attributes are supported:
/// * `caption` or `text` - the text displayed near the checkbox
/// * `checked` or `check` - if the checkbox is checked or not
/// * `type` - the type of the checkbox. The following values are supported:
///   - **Standard** - a standard checkbox (`[✓]` or `[ ]`)
///   - **Ascii** - an ascii checkbox (`[X]` or `[ ]`)
///   - **CheckBox** - a checkbox with a check symbol (`☑` or `☐`)
///   - **CheckMark** - a checkbox with a check mark (`✔` or `x`)
///   - **FilledBox** - a checkbox with a filled box (`▣` or `▢`)
///   - **YesNo** - a checkbox with a yes or no symbol (`[Y]` or `[N]`)
///   - **PlusMinus** - a checkbox with a plus or minus symbol (`➕` or `➖`)
/// * position attributes: `x` and  `y`,
/// * size attributes: `width` or `w` (alias), `height` or `h` (alias), 
/// * margin attributes: `left` or `l`(alias), `right` or `r`(alias), `top` or `t`(alias), `bottom` or `b`(alias)   
/// * Alignment attributes:
///   - `align` or `a`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
///   - `dock` or `d`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
/// * State attributes: `enabled`, `visible`
/// 
/// # Example
/// 
/// ```checkbox!("caption='Check me!', x=10, y=10, width=20, height=2")```
/// 
/// Alternatively, the first parameter (if the key is not specified) is consider the caption:
/// 
/// ```checkbox!("'Check me!', x:0, y=10, w:20")```
#[proc_macro]
pub fn checkbox(input: TokenStream) -> TokenStream {
    crate::controls::checkbox::create(input)
}

/// Creates a new radiobox control. The format is `radiobox!("attributes")` where the attributes are pairs of key-value , separated by comma, in the format `key=value` or `key:value`.
/// If the `value` is a string, use single quotes to delimit the value.
/// The following attributes are supported:
/// * `caption` or `text` - the text displayed near the radiobox
/// * `selected` or `selec` - if the radiobox is selected or not
/// * position attributes: `x` and  `y`,
/// * size attributes: `width` or `w` (alias), `height` or `h` (alias), 
/// * margin attributes: `left` or `l`(alias), `right` or `r`(alias), `top` or `t`(alias), `bottom` or `b`(alias)   
/// * Alignment attributes:
///   - `align` or `a`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
///   - `dock` or `d`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
/// * State attributes: `enabled`, `visible`
/// 
/// # Example
/// 
/// ```radiobox!("caption='Select me!', x=10, y=10, width=20, height=2")```
/// 
/// Alternatively, the first parameter (if the key is not specified) is consider the caption:
/// 
/// ```radiobox!("'Select me!', x:0, y=10, w:20")```
#[proc_macro]
pub fn radiobox(input: TokenStream) -> TokenStream {
    crate::controls::radiobox::create(input)
}

/// Creates a new label control. The format is `label!("attributes")` where the attributes are pairs of key-value , separated by comma, in the format `key=value` or `key:value`.
/// If the `value` is a string, use single quotes to delimit the value.
/// The following attributes are supported:
/// * `caption` or `text` - the text displayed on the label
/// * position attributes: `x` and  `y`,
/// * size attributes: `width` or `w` (alias), `height` or `h` (alias),
/// * margin attributes: `left` or `l`(alias), `right` or `r`(alias), `top` or `t`(alias), `bottom` or `b`(alias)
/// * Alignment attributes:
///   - `align` or `a`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
///   - `dock` or `d`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
/// * State attributes: `enabled`, `visible`
/// 
/// # Example
/// 
/// ```label!("caption='Hello!', x=10, y=10, width=20, height=2")```
/// 
/// Alternatively, the first parameter (if the key is not specified) is consider the caption:
/// 
/// ```label!("'Hello!', x:0, y=10, w:20")```
#[proc_macro]
pub fn label(input: TokenStream) -> TokenStream {
    crate::controls::label::create(input)
}

/// Creates a new panel control. The format is `panel!("attributes")` where the attributes are pairs of key-value , separated by comma, in the format `key=value` or `key:value`.
/// If the `value` is a string, use single quotes to delimit the value.
/// The following attributes are supported:
/// * `caption` or `tile` or `text` - the text displayed on the panel
/// * `type` - the type of the panel. The following values are supported:
///  - **Border** - a normal panel with a border
///  - **Window** - a panel that looks like a window
///  - **Page** - a panel that looks like a page
///  - **TopBar** - a panel that looks like a top bar
/// * position attributes: `x` and  `y`,
/// * size attributes: `width` or `w` (alias), `height` or `h` (alias),
/// * margin attributes: `left` or `l`(alias), `right` or `r`(alias), `top` or `t`(alias), `bottom` or `b`(alias)
/// * Alignment attributes:
///   - `align` or `a`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
///   - `dock` or `d`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
/// * State attributes: `enabled`, `visible`
/// 
/// # Example
/// 
/// ```panel!("caption='Hello!', x=10, y=10, width=20, height=10")```
/// 
/// Alternatively, the first parameter (if the key is not specified) is consider the caption:
/// 
/// ```panel!("'Hello!', x:0, y=10, w:20, h:10, type=Window")```
#[proc_macro]
pub fn panel(input: TokenStream) -> TokenStream {
    crate::controls::panel::create(input)
}

/// Creates a new password control. The format is `password!("attributes")` where the attributes are pairs of key-value , separated by comma, in the format `key=value` or `key:value`.
/// If the `value` is a string, use single quotes to delimit the value.
/// The following attributes are supported:
/// * `password` or `pass`- the password displayed in the control
/// * position attributes: `x` and  `y`,
/// * size attributes: `width` or `w` (alias), `height` or `h` (alias),
/// * margin attributes: `left` or `l`(alias), `right` or `r`(alias), `top` or `t`(alias), `bottom` or `b`(alias)
/// * Alignment attributes:
///   - `align` or `a`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
///   - `dock` or `d`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
/// * State attributes: `enabled`, `visible`
/// 
/// # Example
///
/// ```password!("password='1234', x=10, y=10, width=20")```
#[proc_macro]
pub fn password(input: TokenStream) -> TokenStream {
    crate::controls::password::create(input)
}

#[proc_macro]
pub fn window(input: TokenStream) -> TokenStream {
    crate::controls::window::create(input)
}

#[proc_macro]
pub fn toolbaritem(input: TokenStream) -> TokenStream {
    crate::controls::toolbaritem::create(input)
}

/// Creates a new colorpicker control. The format is `colorpicker!("attributes")` where the attributes are pairs of key-value , separated by comma, in the format `key=value` or `key:value`.
/// If the `value` is a string, use single quotes to delimit the value.
/// The following attributes are supported:
/// * `color` - the color selected by the colorpicker. Could be one of the following: **Black**, **DakrBlue**, **DarkGreen**, **Teal**, **DarkRed**, **Magenta**, **Olive**, **Gray**, **Silver**, **Blue**, **Green**, **Aqua**, **Red**, **Pink**, **Yellow**, **White** or **Transparent**
/// * position attributes: `x` and  `y`,
/// * size attributes: `width` or `w` (alias),
/// * margin attributes: `left` or `l`(alias), `right` or `r`(alias), `top` or `t`(alias), `bottom` or `b`(alias)
/// * Alignment attributes:
///   - `align` or `a`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
///   - `dock` or `d`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
/// * State attributes: `enabled`, `visible`
/// 
/// # Example
///
/// ```colorpicker!("color=Red, x=10, y=10, width=20")```
/// 
/// Alternatively, the first parameter (if the key is not specified) is consider the color:
/// 
/// ```colorpicker!("Red, x:0, y=10, w:20")```
#[proc_macro]
pub fn colorpicker(input: TokenStream) -> TokenStream {
    crate::controls::colorpicker::create(input)
}

/// Creates a new three-state box control. The format is `threestatebox!("attributes")` where the attributes are pairs of key-value , separated by comma, in the format `key=value` or `key:value`.
/// If the `value` is a string, use single quotes to delimit the value.
/// The following attributes are supported:
/// * `caption` or `text` - the text displayed near the threestatebox
/// * `state` - the state of the threestatebox. The following values are supported:
///   - **Checked** - the threestatebox is checked
///   - **Unchecked** - the threestatebox is unchecked
///   - **Unknown** - the threestatebox is in indeterminate state
/// * position attributes: `x` and  `y`,
/// * size attributes: `width` or `w` (alias), `height` or `h` (alias),
/// * margin attributes: `left` or `l`(alias), `right` or `r`(alias), `top` or `t`(alias), `bottom` or `b`(alias)
/// * Alignment attributes:
///   - `align` or `a`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
///   - `dock` or `d`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
/// * State attributes: `enabled`, `visible`
/// 
/// # Example
/// 
/// ```threestatebox!("caption='Check me!', x=10, y=10, width=20, height=2")```
/// 
/// Alternatively, the first parameter (if the key is not specified) is consider the caption:
/// 
/// ```threestatebox!("'Check me!', x:0, y=10, w:20")```
#[proc_macro]
pub fn threestatebox(input: TokenStream) -> TokenStream {
    crate::controls::threestatebox::create(input)
}

/// Creates a new canvas control for custom drawing operations.
/// The format is `canvas!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `size` or `sz` or `surface` (required, first positional parameter) - Size of the canvas. Can be specified in two formats:
///   - `width,height` - Using comma as separator (e.g. `40,20`)
///   - `width x height` - Using 'x' as separator (e.g. `40x20`)
///     Values must be positive integers between 1 and 32000
/// * `flags` - Control flags (optional). Can be:
///   - **ScrollBars** - Shows scroll bars when content exceeds the canvas size
/// * `background` or `back` - Background character and attributes (optional). Format: `{char,color,background_color}`
/// * `left-scroll-margin` or `lsm` - Left scroll margin in characters (optional)
/// * `top-scroll-margin` or `tsm` - Top scroll margin in characters (optional)
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic canvas with size using comma
/// let canvas = canvas!("'40,20', x=1, y=1");
/// 
/// // Basic canvas with size using 'x' format
/// let canvas = canvas!("40x20, x=1, y=1");
/// 
/// // Canvas with scrollbars and background
/// let canvas = canvas!(
///     "size: 50x25,
///     flags: ScrollBars,
///     back: {' ', White, Blue},
///     lsm: 2,
///     tsm: 1,
///     x=2, y=2"
/// );
/// 
/// // Canvas with custom background
/// let canvas = canvas!(
///     "'30,15',
///     back: {'#', Yellow, DarkBlue},
///     x=3, y=3"
/// );
/// ```
#[proc_macro]
pub fn canvas(input: TokenStream) -> TokenStream {
    crate::controls::canvas::create(input)
}

/// Creates a new image viewer control for displaying images with various rendering options.
/// The format is `imageviewer!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `image` (required) - The image to display. Can be:
///   - A string representation using pipe characters `|` to delimit rows
///   - Color codes: '0'/' ' (black), 'B'/'1' (dark blue), 'G'/'2' (dark green), etc.
/// * `charset` or `char_set` - Character set for rendering (optional). Can be:
///   - **SmallBlocks** (default) - Uses small block characters
///   - **LargeBlocks** - Uses large block characters
///   - **DitheredShades** - Uses dithered shading
///   - **Braille** - Uses braille characters
///   - **AsciiArt** - Uses ASCII art characters
/// * `scale` - Scaling percentage (optional). Can be:
///   - **100** (default) - No scaling
///   - **50** - 50% scaling
///   - **33** - 33% scaling
///   - **25** - 25% scaling
///   - **20** - 20% scaling
///   - **10** - 10% scaling
///   - **5** - 5% scaling
/// * `color_schema` or `colorschema` or `cs` - Color schema (optional). Can be:
///   - **Auto** (default) - Automatic color detection
///   - **Color16** - 16-color mode
///   - **TrueColors** - True color mode (if feature enabled)
///   - **GrayScale4** - 4-level grayscale
///   - **GrayScaleTrueColors** - True color grayscale (if feature enabled)
///   - **BlackAndWhite** - Black and white mode
/// * `luminance_threshold` or `lt` - Luminance threshold percentage (optional, 0-100)
///   - Controls the threshold for black/white conversion
///   - Default: 50%
/// * `flags` - Control flags (optional). Can be:
///   - **ScrollBars** - Shows horizontal and vertical scrollbars
/// * `background` or `back` - Background character (optional)
/// * `left-scroll-margin` or `lsm` - Left scroll margin (optional)
/// * `top-scroll-margin` or `tsm` - Top scroll margin (optional)
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic image viewer
/// let iv = imageviewer!("image:'|RRRR|,|R..R|,|R..R|,|RRRR|', x=1, y=1, width=20, height=10");
/// 
/// // Image viewer with custom rendering options
/// let iv = imageviewer!(
///     "image: '|BB..........BB|,|B..rr....rr..B|,|..rrrr..rrrr..|',
///      charset: Braille,
///      scale: 50%,
///      color_schema: BlackAndWhite,
///      luminance_threshold: 30%,
///      flags: ScrollBars,
///      x=2, y=2, width=40, height=20"
/// );
/// 
/// // Image viewer with ASCII art
/// let iv = imageviewer!(
///     "image: '|RGB|,|YWr|',
///      charset: AsciiArt,
///      scale: 25,
///      color_schema: Color16,
///      x=3, y=3, width=60, height=30"
/// );
/// ```
/// 
/// # Image Format
/// Images are defined using a string format where:
/// - Pipe characters `|` delimit rows
/// - Single characters represent colored pixels
/// - Color codes: '0'/' ' (black), 'B'/'1' (dark blue), 'G'/'2' (dark green), 'T'/'3' (teal),
///   'R'/'4' (dark red), 'M'/'m'/'5' (magenta), '6'/'o'/'O' (olive), 'S'/'7' (silver),
///   's'/'8' (gray), 'b'/'9' (blue), 'g' (green), 'A'/'a'/'t' (aqua), 'r' (red),
///   'P'/'p' (pink), 'Y'/'y' (yellow), 'W'/'w' (white)
#[proc_macro]
pub fn imageviewer(input: TokenStream) -> TokenStream {
    crate::controls::imageviewer::create(input)
}

/// Creates a new tab control for organizing content into multiple pages.
/// The format is `tab!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `tabs` - List of tab captions. Format: `[Tab1, Tab2, ...]`
/// * `type` - Tab type (optional). Can be:
///   - **OnTop** (default) - Tabs are displayed at the top
///   - **OnBottom** - Tabs are displayed at the bottom
///   - **OnLeft** - Tabs are displayed on the left side
///   - **HiddenTabs** - Tabs are hidden
/// * `flags` - Control flags (optional). Can be:
///   - **TransparentBackground** - Uses transparent background
///   - **TabsBar** - Shows a bar for tabs
/// * `tabwidth` or `tab-width` or `tw` - Width of each tab (optional)
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic tab with top tabs
/// let tab = tab!("tabs=['Tab 1', 'Tab 2'], x=1, y=1, width=40, height=20");
/// 
/// // Tab with bottom tabs and transparent background
/// let tab = tab!(
///     "tabs: ['First', 'Second', 'Third'],
///     type: OnBottom,
///     flags: TransparentBackground,
///     x=2, y=2, width=50, height=25"
/// );
/// 
/// // Tab with left tabs and custom width
/// let tab = tab!(
///     "tabs=['Settings', 'Help'],
///     type: OnLeft,
///     tabwidth: 15,
///     x=3, y=3, width=60, height=30"
/// );
/// ```
/// 
/// The caption of each tab may contain the special character `&` that indicates that the next character is a hot-key.
/// For example, constructing a tab with the caption `&Start` will set up the text of the tab to `Start` and will set up character `S` as the hot key to activate that tab.
#[proc_macro]
pub fn tab(input: TokenStream) -> TokenStream {
    crate::controls::tab::create(input)
}

/// Creates a new accordion control for displaying collapsible content sections.
/// The format is `accordion!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `panels` (required) - List of panel captions. Format: `[Panel1, Panel2, ...]`
/// * `flags` - Control flags (optional). Can be:
///   - **TransparentBackground** - Uses transparent background
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment value (optional). Can be:
///     - **topleft**/**lefttop**/**tl**/**lt** - Aligns from top-left corner
///     - **top**/**t** - Aligns from top center
///     - **topright**/**righttop**/**tr**/**rt** - Aligns from top-right corner
///     - **right**/**r** - Aligns from right center
///     - **bottomright**/**rightbottom**/**br**/**rb** - Aligns from bottom-right corner
///     - **bottom**/**b** - Aligns from bottom center
///     - **bottomleft**/**leftbottom**/**lb**/**bl** - Aligns from bottom-left corner
///     - **left**/**l** - Aligns from left center
///     - **center**/**c** - Aligns from center
///   - `dock`/`d` - Docking value (optional). Can be:
///     - **topleft**/**lefttop**/**tl**/**lt** - Docks to top-left corner
///     - **top**/**t** - Docks to top
///     - **topright**/**righttop**/**tr**/**rt** - Docks to top-right corner
///     - **right**/**r** - Docks to right
///     - **bottomright**/**rightbottom**/**br**/**rb** - Docks to bottom-right corner
///     - **bottom**/**b** - Docks to bottom
///     - **bottomleft**/**leftbottom**/**lb**/**bl** - Docks to bottom-left corner
///     - **left**/**l** - Docks to left
///     - **center**/**c** - Docks to center
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic accordion with panels
/// let acc = accordion!("panels=['Section 1', 'Section 2'], x=1, y=1, width=40, height=20");
/// 
/// // Accordion with transparent background
/// let acc = accordion!(
///     "panels: ['First', 'Second', 'Third'],
///     flags: TransparentBackground,
///     x=2, y=2, width=50, height=25"
/// );
/// 
/// // Accordion with custom layout
/// let acc = accordion!(
///     "panels=['Settings', 'Help'],
///     dock: left,
///     width: 20,
///     height: 30"
/// );
/// ```
/// 
/// The caption of each panel may contain the special character `&` that indicates that the next character is a hot-key.
/// For example, constructing a panel with the caption `&Start` will set up the text of the panel to `Start` and will set up character `S` as the hot key to activate that panel.
#[proc_macro]
pub fn accordion(input: TokenStream) -> TokenStream {
    crate::controls::accordion::create(input)
}

/// Creates a new keyselector control. The format is `keyselector!("attributes")` where the attributes are pairs of key-value , separated by comma, in the format `key=value` or `key:value`.
/// If the `value` is a string, use single quotes to delimit the value.
/// The following attributes are supported:
/// * `key` - the key selected by the keyselector. The key should be a valid key (see the `key!` macro)
/// * `flags` - the flags of the keyselector. The following values are supported:
///   - **AcceptEnter** - the keyselector will process the Enter key
///   - **AcceptEscape** - the keyselector will process the Escape key
///   - **AcceptTab** - the keyselector will process the Tab key
///   - **ReadOnly** - the keyselector is read-only
/// * position attributes: `x` and  `y`,
/// * size attributes: `width` or `w` (alias), 
/// * margin attributes: `left` or `l`(alias), `right` or `r`(alias), `top` or `t`(alias), `bottom` or `b`(alias)
/// * Alignment attributes:
///   - `align` or `a`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
///   - `dock` or `d`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
/// * State attributes: `enabled`, `visible`
/// 
/// # Example
/// 
/// ```keyselector!("key='F2', x=10, y=10, width=20")```
/// 
/// Alternatively, the first parameter (if the key is not specified) is consider the key:
/// 
/// ```keyselector!("'Ctrl+Alt+F2', x:0, y=10, w:20")```
#[proc_macro]
pub fn keyselector(input: TokenStream) -> TokenStream {
    crate::controls::keyselector::create(input)
}

/// Creates a new textfield control. The format is `textfield!("attributes")` where the attributes are pairs of key-value , separated by comma, in the format `key=value` or `key:value`.
/// If the `value` is a string, use single quotes to delimit the value.
/// The following attributes are supported:
/// * `text` - the text displayed in the textfield
/// * `flags` - the flags of the textfield. The following values are supported:
///   - **ProcessEnter** - the textfield will process the Enter key
///   - **ReadOnly** - the textfield is read-only
///   - **DisableAutoSelectOnFocus** - the text will not be selected when the textfield receives the focus
/// * position attributes: `x` and  `y`,
/// * size attributes: `width` or `w` (alias), `height` or `h` (alias),
/// * margin attributes: `left` or `l`(alias), `right` or `r`(alias), `top` or `t`(alias), `bottom` or `b`(alias)
/// * Alignment attributes:
///   - `align` or `a`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
///   - `dock` or `d`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
/// * State attributes: `enabled`, `visible`
/// 
/// # Example
/// 
/// ```textfield!("text='Hello!', x=10, y=10, width=20, height=2")```
/// 
/// Alternatively, the first parameter (if the key is not specified) is consider the text:
/// 
/// ```textfield!("'Hello!', x:0, y=10, w:20")```
#[proc_macro]
pub fn textfield(input: TokenStream) -> TokenStream {
    crate::controls::textfield::create(input)
}

/// Creates a new richtextfield control. The format is `richtextfield!("attributes")` where the attributes are pairs of key-value, separated by comma, in the format `key=value` or `key:value`.
/// If the `value` is a string, use single quotes to delimit the value.
/// The following attributes are supported:
/// * `text` (or `caption`) - the text displayed in the richtextfield
/// * `flags` - the flags of the richtextfield. The following values are supported:
///   - **ProcessEnter** - the richtextfield will process the Enter key
///   - **ReadOnly** - the richtextfield is read-only
///   - **DisableAutoSelectOnFocus** - the text will not be selected when the richtextfield receives focus
/// * position attributes: `x` and `y`
/// * size attributes: `width` or `w` (alias), `height` or `h` (alias)
/// * margin attributes: `left` or `l` (alias), `right` or `r` (alias), `top` or `t` (alias), `bottom` or `b` (alias)
/// * Alignment attributes:
///   - `align` or `a` (alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
///   - `dock` or `d` (alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
/// * State attributes: `enabled`, `visible`
///
/// # Example
///
/// ```richtextfield!("text='Hello!', x=10, y=10, width=20, height=2")```
///
/// Alternatively, the first parameter (if the key is not specified) is considered the text:
///
/// ```richtextfield!("'Hello!', x:0, y=10, w:20")```
#[proc_macro]
pub fn richtextfield(input: TokenStream) -> TokenStream {
    crate::controls::richtextfield::create(input)
}


/// Creates a new selector control for choosing enum values.
/// The format is `selector!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `enum` or `class` (required, first positional parameter) - The enum type to use for selection
/// * `value` - Initial selected enum variant (optional)
/// * `flags` - Control flags (optional). Can be:
///   - **AllowNoneVariant** - Allows selecting no value (None)
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic selector
/// let sel = selector!("MyEnum, x=1, y=1, width=20");
/// 
/// // Selector with initial value
/// let sel = selector!(
///     "enum: MyEnum,
///     value: Variant1,
///     x=2, y=2, width=25"
/// );
/// 
/// // Selector that allows no selection
/// let sel = selector!(
///     "MyEnum,
///     flags: AllowNoneVariant,
///     x=3, y=3, width=30"
/// );
/// ```
#[proc_macro]
pub fn selector(input: TokenStream) -> TokenStream {
    crate::controls::selector::create(input)
}

/// Creates a new combobox control for selecting from a list of items.
/// The format is `combobox!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `items` - List of strings to populate the combobox (required). Format: `['item1', 'item2', ...]`
/// * `index` or `selected_index` - Index of the initially selected item (optional, 0-based)
/// * `flags` - Control flags (optional). Can be:
///   - **ShowDescription** - Shows a description for each item
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic combobox with items
/// let cb = combobox!("items=['Option 1', 'Option 2', 'Option 3'], x=1, y=1, width=20");
/// 
/// // Combobox with initial selection
/// let cb = combobox!(
///     "items: ['Red', 'Green', 'Blue'],
///     index: 1,
///     x=2, y=2, width=25"
/// );
/// 
/// // Combobox with descriptions
/// let cb = combobox!(
///     "items: ['Item 1', 'Item 2'],
///     flags: ShowDescription,
///     x=3, y=3, width=30"
/// );
/// ```
#[proc_macro]
pub fn combobox(input: TokenStream) -> TokenStream {
    crate::controls::combobox::create(input)
}

/// Creates a new dropdown list control for selecting from a list of items.
/// The format is `dropdownlist!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `class` or `type` (required, first positional parameter) - The type of items to display in the dropdown
/// * `flags` - Control flags (optional). Can be:
///   - **AllowNoneSelection** - Allows selecting no value (None)
///   - **ShowDescription** - Shows a description for each item
/// * `symbolsize` - Size of the symbol displayed for each item (optional). Can be:
///   - **0** - No symbol
///   - **1** - Small symbol
///   - **2** - Medium symbol
///   - **3** - Large symbol
/// * `none` - Text to display when no item is selected (optional)
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic dropdown list
/// let dd = dropdownlist!("MyEnum, x=1, y=1, width=20");
/// 
/// // Dropdown with flags and symbol size
/// let dd = dropdownlist!(
///     "type: MyEnum,
///     flags: AllowNoneSelection+ShowDescription,
///     symbolsize: 2,
///     none: 'Select an option',
///     x=2, y=2, width=25"
/// );
/// 
/// // Dropdown with custom none text
/// let dd = dropdownlist!(
///     "MyEnum,
///     none: 'No selection',
///     x=3, y=3, width=30"
/// );
/// ```
#[proc_macro]
pub fn dropdownlist(input: TokenStream) -> TokenStream {
    crate::controls::dropdownlist::create(input)
}

/// Creates a new listbox control. The format is `listbox!("attributes")` where the attributes are pairs of key-value, separated by comma, in the format `key=value` or `key:value`.
/// If the `value` is a string, use single quotes to delimit the value.
/// The following attributes are supported:
/// * `flags` - The flags of the listbox. The following values are supported:
///   - **ScrollBars** - Adds scrollbars to the listbox
///   - **SearchBar** - Adds a search bar for filtering items
///   - **CheckBoxes** - Adds checkboxes for multiple selection
///   - **AutoScroll** - Automatically scrolls to newly added items
///   - **HighlightSelectedItemWhenInactive** - Highlights selected item even when inactive
/// * `items` - A list of strings to populate the listbox with. Format: `['item1', 'item2', ...]`
/// * `index` or `selected_index` - The index of the initially selected item (0-based)
/// * `lsm` or `left-scroll-margin` - Left scroll margin in characters
/// * `tsm` or `top-scroll-margin` - Top scroll margin in characters
/// * `em` or `empty-message` - Message to display when the listbox is empty
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, TopLeft, TopRight, BottomLeft, BottomRight
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, TopLeft, TopRight, BottomLeft, BottomRight
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic listbox with items
/// let lb = listbox!("items=['Red', 'Green', 'Blue'], x=1, y=1, width=20, height=10");
/// 
/// // Listbox with scrollbars and search
/// let lb = listbox!("flags: ScrollBars+SearchBar, x=0, y=0, width=30, height=15");
/// 
/// // Listbox with checkboxes and initial selection
/// let lb = listbox!("flags: CheckBoxes, items=['Option 1', 'Option 2'], index: 1, x=2, y=2, width=25, height=8");
/// ```
#[proc_macro]
pub fn listbox(input: TokenStream) -> TokenStream {
    crate::controls::listbox::create(input)
}

/// Creates a new numeric selector control for selecting numeric values.
/// The format is `numericselector!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `type` or `class` (required, first positional parameter) - The numeric type to use. Supported types:
///   - Integer types: `i8`, `i16`, `i32`, `i64`, `i128`, `u8`, `u16`, `u32`, `u64`, `u128`, `isize`, `usize`
///   - Floating point types: `f32`, `f64`
/// * `value` (optional, second positional parameter) - Initial value
/// * `min` (optional, third positional parameter) - Minimum allowed value
/// * `max` (optional, fourth positional parameter) - Maximum allowed value
/// * `step` (optional, fifth positional parameter) - Step size for increment/decrement
/// * `flags` - Control flags (optional). Can be:
///   - **HideButtons** - Hides the increment/decrement buttons
///   - **ReadOnly** - Makes the control read-only
/// * `format` or `numericformat` or `nf` - Number format (optional). Can be:
///   - **Decimal** (default) - Standard decimal format
///   - **Percentage** - Displays value as percentage
///   - **DigitGrouping** - Uses digit grouping (e.g. 1,000)
///   - **Hex** - Displays value in hexadecimal
///   - **Size** - Displays value as a size (e.g. KB, MB)
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic integer selector
/// let ns = numericselector!("i32, value: 42, x=1, y=1, width=10");
/// 
/// // Float selector with custom range and step
/// let ns = numericselector!(
///     "f64, 
///     value: 3.14, 
///     min: 0.0, 
///     max: 10.0, 
///     step: 0.1, 
///     format: Percentage,
///     x=2, y=2, width=15"
/// );
/// 
/// // Read-only selector with digit grouping
/// let ns = numericselector!("u64, flags: ReadOnly, format: DigitGrouping, x=3, y=3, width=20");
/// ```
#[proc_macro]
pub fn numericselector(input: TokenStream) -> TokenStream {
    crate::controls::numericselector::create(input)
}

/// Creates a new menu item for use in menus.
/// The format is `menuitem!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `caption` or `text` (required, first positional parameter) - The text displayed in the menu
/// * `shortcut` or `shortcutkey` or `key` (optional, second positional parameter) - Keyboard shortcut for the menu item
/// * `cmd` or `command` or `cmd-id` or `command-id` (required, third positional parameter) - Command identifier
/// * `type` - Menu item type (optional, auto-detected based on other parameters). Can be:
///   - **Command** (default) - Regular menu command
///   - **CheckBox** - Checkable menu item
///   - **SingleChoice** - Radio button style menu item
///   - **SubMenu** - Menu item that opens a submenu
///   - **Line** or **Separator** - Menu separator line
/// * `enable` or `enabled` - Whether the menu item is enabled (optional, defaults to true)
/// * `check` or `checked` - Whether a checkbox menu item is checked (optional, defaults to false)
/// * `select` or `selected` - Whether a single choice menu item is selected (optional, defaults to false)
/// * `items` or `subitems` - List of submenu items (required for SubMenu type)
/// * `class` - Class name for command resolution (optional)
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic command menu item
/// let item = menuitem!("'Open File', shortcut: 'Ctrl+O', cmd: 'OpenFile'");
/// 
/// // Checkbox menu item
/// let item = menuitem!(
///     "caption: 'Show Toolbar',
///     shortcut: 'Ctrl+T',
///     cmd: 'ToggleToolbar',
///     checked: true"
/// );
/// 
/// // Single choice menu item
/// let item = menuitem!(
///     "'View Mode',
///     shortcut: 'Ctrl+M',
///     cmd: 'ChangeViewMode',
///     selected: true"
/// );
/// 
/// // Submenu with items
/// let item = menuitem!(
///     "'Recent Files',
///     items: [
///         {'Open File 1', cmd: 'OpenFile1'},
///         {'Open File 2', cmd: 'OpenFile2'}
///     ]"
/// );
/// 
/// // Separator line
/// let item = menuitem!("'---'");
/// ```
#[proc_macro]
pub fn menuitem(input: TokenStream) -> TokenStream {
    crate::menu::menuitem::create(input, None)
}

/// Creates a new menu that can contain menu items.
/// The format is `menu!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `items` or `subitems` - List of menu items to include in the menu (optional)
/// * `class` - Class name for command resolution (optional)
/// 
/// Menu items can be created using the `menuitem!` macro and can be of various types:
/// * Regular commands
/// * Checkboxes
/// * Single choice items
/// * Submenus
/// * Separator lines
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic menu with items
/// let menu = menu!(
///     "items: [
///         {'Open File', shortcut: 'Ctrl+O', cmd: 'OpenFile'},
///         {'Save', shortcut: 'Ctrl+S', cmd: 'SaveFile'},
///         {'---'},
///         {'Exit', shortcut: 'Alt+F4', cmd: 'Exit'}
///     ]"
/// );
/// 
/// // Menu with submenus
/// let menu = menu!(
///     "items: [
///         {'Show Toolbar', shortcut: 'Ctrl+T', cmd: 'ToggleToolbar', checked: true},
///         {'---'},
///         {'Zoom',
///             items: [
///                 {'Zoom In', shortcut: 'Ctrl++', cmd: 'ZoomIn'},
///                 {'Zoom Out', shortcut: 'Ctrl+-', cmd: 'ZoomOut'},
///                 {'Reset Zoom', shortcut: 'Ctrl+0', cmd: 'ResetZoom'}
///             ]
///         }
///     ]"
/// );
/// 
/// // Menu with class specification
/// let menu = menu!(
///     "class: 'MyWindow',
///     items: [
///         {'Cut', shortcut: 'Ctrl+X', cmd: 'Cut'},
///         {'Copy', shortcut: 'Ctrl+C', cmd: 'Copy'},
///         {'Paste', shortcut: 'Ctrl+V', cmd: 'Paste'}
///     ]"
/// );
/// ```
#[proc_macro]
pub fn menu(input: TokenStream) -> TokenStream {
    crate::menu::menu::create(input, None)
}

/// Creates a new horizontal line control.
/// The format is `hline!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `text` or `caption` (optional, first positional parameter) - Text to display if HasTitle flag is set
/// * `flags` - Line initialization flags (optional). Can be:
///   - **DoubleLine** - Uses double line characters instead of single
///   - **HasTitle** - Shows the text/caption in the middle of the line
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w` - Width of the line (required)
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Simple line
/// let line = hline!("x=0, y=0, width=40");
/// 
/// // Double line with title
/// let line = hline!("'Section Title', flags: [DoubleLine,HasTitle], width=40");
/// ```
#[proc_macro]
pub fn hline(input: TokenStream) -> TokenStream {
    crate::controls::hline::create(input)
}

/// Creates a new vertical line control.
/// The format is `vline!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `flags` - Line initialization flags (optional). Can be:
///   - **DoubleLine** - Uses double line characters instead of single
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `height`/`h` - Height of the line (required)
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Simple line
/// let line = vline!("x=0, y=0, height=20");
/// 
/// // Double line
/// let line = vline!("flags: DoubleLine, height=20, dock: left");
/// ```
#[proc_macro]
pub fn vline(input: TokenStream) -> TokenStream {
    crate::controls::vline::create(input)
}

/// Creates a new vertical splitter control for resizing two vertical panes.
/// The format is `vsplitter!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `pos` (optional, first positional parameter) - Initial position of the splitter
/// * `resize`, `resize-behavior`, `on-resize`, `rb` - Resize behavior (optional). Can be:
///   - **PreserveAspectRatio** (default) - Maintains relative sizes when parent resizes
///   - **PreserveLeftPanelSize** - Keeps left panel size fixed
///   - **PreserveRightPanelSize** - Keeps right panel size fixed
/// * `min-left-width`, `mintopwidth`, `mlw` - Minimum width for the left panel
/// * `min-right-width`, `minbottomwidth`, `mrw` - Minimum width for the right panel
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `height`/`h` - Height of the splitter (required)
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Simple splitter
/// let split = vsplitter!("width=40, height=20");
/// 
/// // Advanced configuration
/// let split = vsplitter!(
///     "x=0, y=0, height=20, width=40,
///     resize: PreserveLeftPanelSize, 
///     minleftwidth: 30, 
///     minrightwidth: 40"
/// );
/// ```
#[proc_macro]
pub fn vsplitter(input: TokenStream) -> TokenStream {
    crate::controls::vsplitter::create(input)
}

/// Creates a new horizontal splitter control for resizing two horizontal panes.
/// The format is `hsplitter!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `pos` (optional, first positional parameter) - Initial position of the splitter
/// * `resize`, `resize-behavior`, `on-resize`, `rb` - Resize behavior (optional). Can be:
///   - **PreserveAspectRatio** (default) - Maintains relative sizes when parent resizes
///   - **PreserveTopPanelSize** - Keeps top panel size fixed
///   - **PreserveBottomPanelSize** - Keeps bottom panel size fixed
/// * `min-top-height`, `mintopheight`, `mth` - Minimum height for the top panel
/// * `min-bottom-height`, `minbottomheight`, `mbh` - Minimum height for the bottom panel
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w` - Width of the splitter (required)
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Simple splitter
/// let split = hsplitter!("x:0, y:0, width=40, height=20");
/// 
/// // Advanced configuration
/// let split = hsplitter!(
///     "x=0, y=0, width=40, height=20,
///     resize: PreserveTopPanelSize, 
///     mintopheight: 10, 
///     minbottomheight: 15"
/// );
/// ```
#[proc_macro]
pub fn hsplitter(input: TokenStream) -> TokenStream {
    crate::controls::hsplitter::create(input)
}

/// Creates a new DatePicker control for selecting dates.
/// The format is `datepicker!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `date` (optional, first positional parameter) - Initial date in YYYY-MM-DD format or any format supported by NaiveDate
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // With explicit date
/// let dp = datepicker!("2024-06-13, x=1, y=1, width=19, height=1");
/// 
/// // With named parameter and layout
/// let dp = datepicker!("date: 2024-06-13, dock: center, width: 19, margin: 1");
/// ```
#[proc_macro]
pub fn datepicker(input: TokenStream) -> TokenStream {
    crate::controls::datepicker::create(input)
}

/// Creates a new ListView control for displaying a list of items of type T.
/// The format is `listview!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `type` or `class` (required, first positional parameter) - The type T of items to display
/// * `flags` - ListView initialization flags (optional). Can be:
///   - **ScrollBars** - Shows scroll bars
///   - **SearchBar** - Enables search functionality
///   - **CheckBoxes** - Adds checkboxes to items
///   - **ShowGroups** - Enables item grouping
///   - **SmallIcons** - Uses small icons
///   - **LargeIcons** - Uses large icons
///   - **CustomFilter** - Enables custom filtering
///   - **NoSelection** - Disables item selection
/// * `view` or `viewmode` or `vm` - View mode (optional). Can be:
///   - **Details** - Shows items in details view with columns
///   - **Columns(N)** - Shows items in N columns (N from 1 to 10)
/// * `columns` - Column definitions for details view (optional). Format: [{Name,Width,Align},...] 
/// * `lsm` or `left-scroll-margin` - Left scroll margin in characters (optional)
/// * `tsm` or `top-scroll-margin` - Top scroll margin in characters (optional)
/// * Layout parameters: x, y, width/w, height/h, align/a, dock/d, etc.
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic usage
/// let lv = listview!("type: MyType, flags: ScrollBars, x=0, y=0, width=40, height=20");
/// 
/// // With columns in details view
/// let lv = listview!(
///     "MyType, 
///     view: Details, 
///     columns: [{Name,10,left}, {Age,5,right}], 
///     x=1, y=1, width=50, height=25"
/// );
/// 
/// // Multi-column view
/// let lv = listview!("class: MyType, view: Columns(3), x=2, y=2, width=60, height=30");
/// ```
/// 
/// The type T must implement the `ListItem` trait. For columns, use the `#[Column]` attribute 
/// on struct fields to define how they should be displayed.
#[proc_macro]
pub fn listview(input: TokenStream) -> TokenStream {
    crate::controls::listview::create(input)
}

/// Creates a new toggle button control that can be toggled on/off.
/// The format is `togglebutton!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `caption` or `name` or `text` (required, first positional parameter) - The text displayed on the button
/// * `tooltip` or `description` or `desc` (optional, second positional parameter) - Tooltip text shown on hover
/// * `type` - Button type (optional). Can be:
///   - **Normal** (default) - Standard toggle button
///   - **Underlined** - Button with underlined text
/// * `select` or `selected` or `state` - Initial selected state (optional, defaults to false)
/// * `group` or `single_selection` - Whether the button is part of a single-selection group (optional, defaults to false)
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic toggle button
/// let btn = togglebutton!("'Enable Feature', x=1, y=1, width=20");
/// 
/// // Toggle button with tooltip and initial state
/// let btn = togglebutton!(
///     "caption: 'Auto-save',
///     tooltip: 'Enable automatic saving of changes',
///     selected: true,
///     x=2, y=2, width=25"
/// );
/// 
/// // Underlined toggle button in a single-selection group
/// let btn = togglebutton!(
///     "'Option A',
///     type: Underlined,
///     group: true,
///     x=3, y=3, width=15"
/// );
/// ```
#[proc_macro]
pub fn togglebutton(input: TokenStream) -> TokenStream {
    crate::controls::togglebutton::create(input)
}

/// Creates a new pathfinder control. The format is `pathfinder!("attributes")` where the attributes are pairs of key-value , separated by comma, in the format `key=value` or `key:value`.
/// If the `value` is a string, use single quotes to delimit the value.
/// The following attributes are supported:
/// * `path` - the path displayed in the pathfinder
/// * `flags` - the flags of the pathfinder. The following values are supported:
///   - **ReadOnly** - the pathfinder is read-only
///   - **CaseSensitive** - the pathfinder is case-sensitive
/// * position attributes: `x` and  `y`,
/// * size attributes: `width` or `w` (alias),
/// * margin attributes: `left` or `l`(alias), `right` or `r`(alias), `top` or `t`(alias), `bottom` or `b`(alias)   
/// * Alignment attributes:
///   - `align` or `a`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
///   - `dock` or `d`(alias) - one of **Left**, **Right**, **Top**, **Bottom**, **Center**, **TopLeft**, **TopRight**, **BottomLeft**, **BottomRight**
/// * State attributes: `enabled`, `visible`
/// 
/// # Example
/// 
/// ```pathfinder!("path='C:\\', x=10, y=10, width=20")```
/// 
/// Alternatively, the first parameter (if the key is not specified) is consider the path:
/// 
/// ```pathfinder!("'C:\\Windows\\', x:0, y=10, w:20")```
#[proc_macro]
pub fn pathfinder(input: TokenStream) -> TokenStream {
    crate::controls::pathfinder::create(input)
}

/// Creates a new tree view control for displaying hierarchical data.
/// The format is `treeview!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `type` or `class` (required, first positional parameter) - The type of items to display in the tree
/// * `columns` - Column definitions for the tree view (optional). Format: `[{Name,Width,Align},...]`
/// * `flags` - Control flags (optional). Can be:
///   - **ScrollBars** - Shows scroll bars
///   - **SearchBar** - Enables search functionality
///   - **ShowGroups** - Enables item grouping
///   - **SmallIcons** - Uses small icons
///   - **LargeIcons** - Uses large icons
///   - **CustomFilter** - Enables custom filtering
///   - **NoSelection** - Disables item selection
///   - **HideHeader** - Hides the column header
/// * `left-scroll-margin` or `lsm` - Left scroll margin in characters (optional)
/// * `top-scroll-margin` or `tsm` - Top scroll margin in characters (optional)
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic tree view
/// let tv = treeview!("MyItemType, x=1, y=1, width=40, height=20");
/// 
/// // Tree view with columns and search
/// let tv = treeview!(
///     "type: MyItemType,
///     columns: [{Name,20,Left}, {Size,10,Right}, {Date,15,Left}],
///     flags: ScrollBars+SearchBar,
///     x=2, y=2, width=50, height=25"
/// );
/// 
/// // Tree view with icons and custom margins
/// let tv = treeview!(
///     "MyItemType,
///     flags: SmallIcons+ShowGroups,
///     lsm: 2,
///     tsm: 1,
///     x=3, y=3, width=60, height=30"
/// );
/// ```
#[proc_macro]
pub fn treeview(input: TokenStream) -> TokenStream {
    crate::controls::treeview::create(input)
}

/// Creates a new markdown viewer control for displaying formatted text content.
/// The format is `markdown!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `content` or `text` (required, first positional parameter) - The markdown content to display
/// * `flags` - Control flags (optional). Can be:
///   - **ScrollBars** - Shows scroll bars when content exceeds the control size
/// * `left-scroll-margin` or `lsm` - Left scroll margin in characters (optional)
/// * `top-scroll-margin` or `tsm` - Top scroll margin in characters (optional)
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic markdown viewer
/// let md = markdown!("'# Hello World\nThis is a **markdown** example', x=1, y=1, width=40, height=10");
/// 
/// // Markdown with scrollbars and margins
/// let md = markdown!(
///     "content: '# Documentation\n\n## Features\n* Feature 1\n* Feature 2',
///     flags: ScrollBars,
///     lsm: 2,
///     tsm: 1,
///     x=2, y=2, width=50, height=15"
/// );
/// 
/// // Docked markdown viewer
/// let md = markdown!("'# Help\n\nPress F1 for more information', dock: right, width=30");
/// ```
#[proc_macro]
pub fn markdown(input: TokenStream) -> TokenStream {
    crate::controls::markdown::create(input)
}

/// Creates a new progress bar control for displaying progress of an operation.
/// The format is `progressbar!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `count` or `c` or `total` - Total number of steps/items to process (optional)
/// * `value` or `progress` or `v` - Current progress value (optional)
/// * `text` or `caption` - Text to display on the progress bar (optional)
/// * `paused` or `pause` - Whether the progress bar is paused (optional)
/// * `flags` - Control flags (optional). Can be:
///   - **HidePercentage** - Hides the percentage display
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic progress bar
/// let pb = progressbar!("x=1, y=1, width=40");
/// 
/// // Progress bar with total count and current value
/// let pb = progressbar!(
///     "count: 100,
///     value: 42,
///     text: 'Processing...',
///     x=2, y=2, width=50"
/// );
/// 
/// // Paused progress bar without percentage
/// let pb = progressbar!(
///     "count: 50,
///     value: 25,
///     paused: true,
///     flags: HidePercentage,
///     x=3, y=3, width=30"
/// );
/// ```
#[proc_macro]
pub fn progressbar(input: TokenStream) -> TokenStream {
    crate::controls::progressbar::create(input)
}

/// Creates a new text area control for multi-line text input and display.
/// The format is `textarea!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `text` (optional, first positional parameter) - Initial text content to display
/// * `flags` - Control flags (optional). Can be:
///   - **ShowLineNumber** - Displays line numbers on the left side
///   - **ReadOnly** - Makes the text area read-only
///   - **ScrollBars** - Shows scroll bars when content exceeds the control size
///   - **HighlightCursor** - Highlights the current cursor position
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic text area
/// let ta = textarea!("x=1, y=1, width=40, height=10");
/// 
/// // Text area with initial content and line numbers
/// let ta = textarea!(
///     "text: 'Hello\nWorld!',
///     flags: ShowLineNumber+ScrollBars,
///     x=2, y=2, width=50, height=15"
/// );
/// 
/// // Read-only text area with highlighted cursor
/// let ta = textarea!(
///     "'This is read-only text',
///     flags: ReadOnly+HighlightCursor,
///     dock: right,
///     width=30"
/// );
/// ```
#[proc_macro]
pub fn textarea(input: TokenStream) -> TokenStream {
    crate::controls::textarea::create(input)
}


/// Creates a layout from a string description using the LayoutBuilder pattern.
/// The format is `layout!("parameter:value, parameter:value, ...")` where parameters define how a control should be positioned and sized.
/// 
/// # Syntax
/// 
/// The macro accepts a string with comma-separated parameter-value pairs:
/// ```no_compile
/// layout!("parameter:value, parameter:value, ...")
/// ```
/// 
/// or
/// 
/// ```no_compile
/// layout!("parameter=value, parameter=value, ...")
/// ```
/// 
/// # Parameters
/// 
/// | Parameter | Alias | LayoutBuilder Method | Value Type              | Description                                                                              |
/// | --------- | ----- | -------------------- | ----------------------- | ---------------------------------------------------------------------------------------- |
/// | `x`       |       | `.x(...)`            | numerical or percentage | X coordinate                                                                             |
/// | `y`       |       | `.y(...)`            | numerical or percentage | Y coordinate                                                                             |
/// | `left`    | `l`   | `.left_anchor(...)`  | numerical or percentage | Left anchor (space between parent left margin and control)                              |
/// | `right`   | `r`   | `.right_anchor(...)` | numerical or percentage | Right anchor (space between parent right margin and control)                            |
/// | `top`     | `t`   | `.top_anchor(...)`   | numerical or percentage | Top anchor (space between parent top margin and control)                                |
/// | `bottom`  | `b`   | `.bottom_anchor(...)` | numerical or percentage | Bottom anchor (space between parent bottom margin and control)                          |
/// | `width`   | `w`   | `.width(...)`        | numerical or percentage | Width of the control                                                                     |
/// | `height`  | `h`   | `.height(...)`       | numerical or percentage | Height of the control                                                                    |
/// | `dock`    | `d`   | `.dock(...)`         | docking value           | How the control is docked to its parent                                                 |
/// | `align`   | `a`   | `.alignment(...)`    | alignment value         | How the control is aligned against the margins of its parent                            |
/// | `pivot`   | `p`   | `.pivot(...)`        | pivoting direction      | How the control is aligned against the point represented by (x,y) - the pivot          |
/// 
/// # Value Types
/// 
/// * **Numerical values**: Integer numbers between -30000 and 30000 (e.g., `x:100`)
/// * **Percentage values**: Floating point numbers followed by `%` between -300% and 300% (e.g., `width:50%`)
/// * All parameters are case-insensitive
/// 
/// # Dock Values
/// 
/// | Value    | Alias | Description                                                     | Required Parameter |
/// | -------- | ----- | --------------------------------------------------------------- | ------------------ |
/// | `left`   | `l`   | Docks control to the left edge of its parent                   | `width`            |
/// | `right`  | `r`   | Docks control to the right edge of its parent                  | `width`            |
/// | `top`    | `t`   | Docks control to the top edge of its parent                    | `height`           |
/// | `bottom` | `b`   | Docks control to the bottom edge of its parent                 | `height`           |
/// | `fill`   | `f`   | Control fills the entire space of its parent                   | none               |
/// 
/// # Align Values
/// 
/// | Value         | Aliases                               | Description                    |
/// | ------------- | ------------------------------------- | ------------------------------ |
/// | `topleft`     | `lefttop`, `tl`, `lt`, `top-left`     | Align to top-left corner       |
/// | `topcenter`   | `t`, `tc`, `ct`, `top-center`         | Align to top center            |
/// | `topright`    | `righttop`, `tr`, `rt`, `top-right`   | Align to top-right corner      |
/// | `centerright` | `r`, `cr`, `rc`, `center-right`       | Align to center-right          |
/// | `bottomright` | `rightbottom`, `br`, `rb`, `bottom-right` | Align to bottom-right corner   |
/// | `bottomcenter`| `b`, `bc`, `cb`, `bottom-center`      | Align to bottom center         |
/// | `bottomleft`  | `leftbottom`, `lb`, `bl`, `bottom-left` | Align to bottom-left corner    |
/// | `centerleft`  | `l`, `cl`, `lc`, `center-left`        | Align to center-left           |
/// | `center`      | `c`                                   | Align to center                |
/// 
/// # Pivot Values
/// 
/// Pivot values use the same names as align values but define how width and height extend from the (x,y) point:
/// 
/// | Value         | Aliases             | Top-Left Corner        | Bottom-Right Corner    |
/// | ------------- | ------------------- | ---------------------- | ---------------------- |
/// | `top-left`    | `lefttop`, `tl`, `lt` | (x,y)                  | (x+width,y+height)     |
/// | `top-center`  | `top`, `t`          | (x-width/2,y)          | (x+width/2,y+height)   |
/// | `top-right`   | `righttop`, `tr`, `rt` | (x-width,y)            | (x,y+height)           |
/// | `center-right`| `right`, `r`        | (x-width,y-height/2)   | (x,y+height/2)         |
/// | `bottom-right`| `rightbottom`, `br`, `rb` | (x-width,y-height)     | (x,y)                  |
/// | `bottom-center`| `bottom`, `b`       | (x-width/2,y-height)   | (x+width/2,y)          |
/// | `bottom-left` | `leftbottom`, `lb`, `bl` | (x,y-height)           | (x+width,y)            |
/// | `center-left` | `left`, `l`         | (x,y-height/2)         | (x+width,y+height/2)   |
/// | `center`      | `center`, `c`       | (x-width/2,y-height/2) | (x+width/2,y+height/2) |
/// 
/// # Examples
/// 
/// ```no_compile
/// use appcui::prelude::*;
/// 
/// // Dock to left with width of 10
/// let layout = layout!("dock:left, width:10");
/// let layout = layout!("d:l, w:10"); // Using aliases
/// 
/// // Position at coordinates with size
/// let layout = layout!("x:50, y:20, width:100, height:50");
/// 
/// // Center alignment with percentage width
/// let layout = layout!("align:center, width:50%, height:25%");
/// 
/// // Using anchors for responsive layout
/// let layout = layout!("left:10, right:10, top:5, bottom:5");
/// 
/// // Pivot-based positioning
/// let layout = layout!("x:100, y:50, width:80, height:40, pivot:center");
/// 
/// // Fill parent completely
/// let layout = layout!("dock:fill");
/// ```
/// 
/// The layout macro provides a more concise alternative to manually building layouts with LayoutBuilder methods.
#[proc_macro]
pub fn layout(input: TokenStream) -> TokenStream {
    crate::controls::layout::create(input)
}



/// Creates a new character picker control for selecting Unicode characters from various character sets.
/// The format is `charpicker!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `char` or `ch` (optional, first positional parameter) - Initial character to select
/// * `code` - Unicode code point to select as initial character (optional, must be positive)
/// * `sets` - List of character sets to display (optional). Available sets:
///   - **Animals** - Animal symbols and emojis
///   - **Arabic** - Arabic script characters
///   - **Arrows** - Arrow symbols and directional indicators
///   - **Ascii** - Basic ASCII characters
///   - **Blocks** - Block drawing characters
///   - **BoxDrawing** - Box drawing and line characters
///   - **Braille** - Braille pattern characters
///   - **Chinese** - Chinese characters and symbols
///   - **Currency** - Currency symbols ($, €, ¥, etc.)
///   - **Cyrillic** - Cyrillic script characters
///   - **Emoticons** - Emoticon and emoji characters
///   - **Games** - Gaming-related symbols
///   - **Greek** - Greek alphabet characters
///   - **Latin** - Latin alphabet and extended characters
///   - **Math** - Mathematical symbols and operators
///   - **Numbers** - Numeric characters and related symbols
///   - **Pictographs** - Pictographic symbols
///   - **Punctuation** - Punctuation marks and symbols
///   - **Shapes** - Geometric shapes and symbols
///   - **Subscripts** - Subscript characters
///   - **Superscripts** - Superscript characters
///   - **Transport** - Transportation symbols
///   - **Unicode** - General Unicode symbols
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic character picker with all sets
/// let cp = charpicker!("sets: [*], x=1, y=1, width=40, height=20");
/// 
/// // Character picker with specific sets
/// let cp = charpicker!(
///     "sets: [Arrows, Math, Shapes],
///     x=2, y=2, width=50, height=25"
/// );
/// 
/// // Character picker with initial character selection
/// let cp = charpicker!(
///     "'→',
///     sets: [Arrows, Punctuation],
///     x=3, y=3, width=30, height=15"
/// );
/// 
/// // Character picker with Unicode code point
/// let cp = charpicker!(
///     "code: 8594,
///     sets: [Arrows, Math],
///     dock: center,
///     width: 35,
///     height: 20"
/// );
/// 
/// // Specialized picker for mathematical symbols
/// let cp = charpicker!(
///     "sets: [Math, Greek, Superscripts, Subscripts],
///     char: '∑',
///     x=0, y=0, width=45, height=30"
/// );
/// 
/// // Emoji and symbol picker
/// let cp = charpicker!(
///     "sets: [Emoticons, Animals, Pictographs],
///     x=5, y=5, width=40, height=25"
/// );
/// ```
#[proc_macro]
pub fn charpicker(input: TokenStream) -> TokenStream {
    crate::controls::charpicker::create(input)
}

/// Creates a new graph view control for displaying and interacting with node-edge graphs.
/// The format is `graphview!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `flags` - Control flags (optional). Can be:
///   - **ScrollBars** - Shows scroll bars when content exceeds the control size
///   - **SearchBar** - Enables search functionality for finding nodes and edges
/// * `background` or `back` - Background character and attributes (optional). Format: `{char,color,background_color}`
/// * `left-scroll-margin` or `lsm` - Left scroll margin in characters (optional)
/// * `top-scroll-margin` or `tsm` - Top scroll margin in characters (optional)
/// * `line-type`, `edge-line-type`, or `elt` - Edge line rendering style (optional). Can be:
///   - **Single** - Single line characters (default)
///   - **Double** - Double line characters
///   - **SingleThick** - Single thick line characters
///   - **Border** - Border-style line characters
///   - **Ascii** - ASCII line characters (-, |, +)
///   - **AsciiRound** - ASCII rounded line characters
///   - **SingleRound** - Single rounded line characters
///   - **Braille** - Braille dot characters for smooth lines
/// * `routing` or `edge-routing` - Edge routing algorithm (optional). Can be:
///   - **Direct** - Direct straight lines between nodes (default)
///   - **Orthogonal** - Orthogonal (right-angle) routing
/// * `arrange` or `arrange-nodes` - Node arrangement algorithm (optional). Can be:
///   - **None** - No automatic arrangement (default)
///   - **Grid** - Simple grid layout
///   - **GridPacked** - Packed grid layout with minimal spacing
///   - **Circular** - Circular arrangement
///   - **Hierarchical** - Hierarchical tree-like arrangement
///   - **HierarchicalPacked** - Packed hierarchical arrangement
///   - **ForceDirected** - Force-directed physics-based layout
/// * `arrow-heads` or `arrows` - Whether to display arrow heads on directed edges (optional, defaults to false)
/// * `highlight-incoming-edges` or `hie` - Whether to highlight incoming edges when a node is selected (optional, defaults to false)
/// * `highlight-outgoing-edges` or `hoe` - Whether to highlight outgoing edges when a node is selected (optional, defaults to false)
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rust,compile_fail
/// use appcui::prelude::*;
/// 
/// // Basic graph view
/// let gv = graphview!("x=1, y=1, width=40, height=20");
/// 
/// // Graph view with scrollbars and search
/// let gv = graphview!(
///     "flags: ScrollBars+SearchBar,
///     x=2, y=2, width=50, height=25"
/// );
/// 
/// // Graph with custom styling and layout
/// let gv = graphview!(
///     "flags: ScrollBars,
///     line-type: Double,
///     routing: Orthogonal,
///     arrange: ForceDirected,
///     arrows: true,
///     highlight-incoming-edges: true,
///     highlight-outgoing-edges: true,
///     back: {' ', White, DarkBlue},
///     x=3, y=3, width=60, height=30"
/// );
/// 
/// // Minimalist graph with ASCII rendering
/// let gv = graphview!(
///     "elt: Ascii,
///     routing: Direct,
///     arrange: Grid,
///     lsm: 2,
///     tsm: 1,
///     dock: fill"
/// );
/// 
/// // Hierarchical graph with braille lines
/// let gv = graphview!(
///     "line-type: Braille,
///     arrange: Hierarchical,
///     arrows: true,
///     flags: ScrollBars,
///     x=0, y=0, width=80, height=40"
/// );
/// ```
#[proc_macro]
pub fn graphview(input: TokenStream) -> TokenStream {
    crate::controls::graphview::create(input)
}


/// Creates a new TimePicker control for selecting and editing time values.
/// The format is `timepicker!("attributes")` where the attributes are pairs of key-value, separated by comma.
/// 
/// # Parameters
/// * `time` (optional, first positional parameter) - Initial time in HH:MM:SS format or any format supported by NaiveTime
/// * `flags` - Control flags (optional). Can be:
///   - **Seconds** - Shows seconds in the time picker (format becomes HH:MM:SS)
///   - **AMPM** - Shows AM/PM indicator and uses 12-hour format
///   - Flags can be combined using `|` (e.g., `Seconds|AMPM`)
/// * Position and size:
///   - `x`, `y` - Position coordinates
///   - `width`/`w`, `height`/`h` - Control dimensions
/// * Layout:
///   - `align`/`a` - Alignment: Left, Right, Top, Bottom, Center, etc.
///   - `dock`/`d` - Docking: Left, Right, Top, Bottom, Center, etc.
/// * Margins: `left`/`l`, `right`/`r`, `top`/`t`, `bottom`/`b`
/// * State: `enabled`, `visible`
/// 
/// # Examples
/// ```rustfs
/// use appcui::prelude::*;
/// 
/// // Basic time picker
/// let tp = timepicker!("'12:34:56', x=1, y=1, width=10");
/// 
/// // With named parameter and seconds display
/// let tp = timepicker!("time: '14:30:45', flags: Seconds, dock: center, width: 10");
/// 
/// // With AM/PM format
/// let tp = timepicker!("'09:15', flags: AMPM, x=0, y=0, width=10");
/// 
/// // With both seconds and AM/PM
/// let tp = timepicker!("time: '21:45:30', flags: [Seconds,AMPM], align: center, width: 13");
/// ```
#[proc_macro]
pub fn timepicker(input: TokenStream) -> TokenStream {
    crate::controls::timepicker::create(input)
}