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
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use glib::translate::*;
use glib::value::FromValue;
use glib::value::ToValue;
use glib::StaticType;
use glib::Type;
use std::fmt;

/// Specifies how xy coordinates are to be interpreted. Used by functions such
/// as [`ComponentExt::position()`][crate::prelude::ComponentExt::position()] and [`TextExt::character_extents()`][crate::prelude::TextExt::character_extents()]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AtkCoordType")]
pub enum CoordType {
    /// specifies xy coordinates relative to the screen
    #[doc(alias = "ATK_XY_SCREEN")]
    Screen,
    /// specifies xy coordinates relative to the widget's
    /// top-level window
    #[doc(alias = "ATK_XY_WINDOW")]
    Window,
    /// specifies xy coordinates relative to the widget's
    /// immediate parent. Since: 2.30
    #[doc(alias = "ATK_XY_PARENT")]
    Parent,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for CoordType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "CoordType::{}",
            match *self {
                Self::Screen => "Screen",
                Self::Window => "Window",
                Self::Parent => "Parent",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl IntoGlib for CoordType {
    type GlibType = ffi::AtkCoordType;

    fn into_glib(self) -> ffi::AtkCoordType {
        match self {
            Self::Screen => ffi::ATK_XY_SCREEN,
            Self::Window => ffi::ATK_XY_WINDOW,
            Self::Parent => ffi::ATK_XY_PARENT,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AtkCoordType> for CoordType {
    unsafe fn from_glib(value: ffi::AtkCoordType) -> Self {
        skip_assert_initialized!();
        match value {
            ffi::ATK_XY_SCREEN => Self::Screen,
            ffi::ATK_XY_WINDOW => Self::Window,
            ffi::ATK_XY_PARENT => Self::Parent,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for CoordType {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::atk_coord_type_get_type()) }
    }
}

impl glib::value::ValueType for CoordType {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for CoordType {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for CoordType {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

/// Describes the layer of a component
///
/// These enumerated "layer values" are used when determining which UI
/// rendering layer a component is drawn into, which can help in making
/// determinations of when components occlude one another.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AtkLayer")]
pub enum Layer {
    /// The object does not have a layer
    #[doc(alias = "ATK_LAYER_INVALID")]
    Invalid,
    /// This layer is reserved for the desktop background
    #[doc(alias = "ATK_LAYER_BACKGROUND")]
    Background,
    /// This layer is used for Canvas components
    #[doc(alias = "ATK_LAYER_CANVAS")]
    Canvas,
    /// This layer is normally used for components
    #[doc(alias = "ATK_LAYER_WIDGET")]
    Widget,
    /// This layer is used for layered components
    #[doc(alias = "ATK_LAYER_MDI")]
    Mdi,
    /// This layer is used for popup components, such as menus
    #[doc(alias = "ATK_LAYER_POPUP")]
    Popup,
    /// This layer is reserved for future use.
    #[doc(alias = "ATK_LAYER_OVERLAY")]
    Overlay,
    /// This layer is used for toplevel windows.
    #[doc(alias = "ATK_LAYER_WINDOW")]
    Window,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for Layer {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "Layer::{}",
            match *self {
                Self::Invalid => "Invalid",
                Self::Background => "Background",
                Self::Canvas => "Canvas",
                Self::Widget => "Widget",
                Self::Mdi => "Mdi",
                Self::Popup => "Popup",
                Self::Overlay => "Overlay",
                Self::Window => "Window",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl IntoGlib for Layer {
    type GlibType = ffi::AtkLayer;

    fn into_glib(self) -> ffi::AtkLayer {
        match self {
            Self::Invalid => ffi::ATK_LAYER_INVALID,
            Self::Background => ffi::ATK_LAYER_BACKGROUND,
            Self::Canvas => ffi::ATK_LAYER_CANVAS,
            Self::Widget => ffi::ATK_LAYER_WIDGET,
            Self::Mdi => ffi::ATK_LAYER_MDI,
            Self::Popup => ffi::ATK_LAYER_POPUP,
            Self::Overlay => ffi::ATK_LAYER_OVERLAY,
            Self::Window => ffi::ATK_LAYER_WINDOW,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AtkLayer> for Layer {
    unsafe fn from_glib(value: ffi::AtkLayer) -> Self {
        skip_assert_initialized!();
        match value {
            ffi::ATK_LAYER_INVALID => Self::Invalid,
            ffi::ATK_LAYER_BACKGROUND => Self::Background,
            ffi::ATK_LAYER_CANVAS => Self::Canvas,
            ffi::ATK_LAYER_WIDGET => Self::Widget,
            ffi::ATK_LAYER_MDI => Self::Mdi,
            ffi::ATK_LAYER_POPUP => Self::Popup,
            ffi::ATK_LAYER_OVERLAY => Self::Overlay,
            ffi::ATK_LAYER_WINDOW => Self::Window,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for Layer {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::atk_layer_get_type()) }
    }
}

impl glib::value::ValueType for Layer {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for Layer {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for Layer {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

/// Describes the type of the relation
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AtkRelationType")]
pub enum RelationType {
    /// Not used, represens "no relationship" or an error condition.
    #[doc(alias = "ATK_RELATION_NULL")]
    Null,
    /// Indicates an object controlled by one or more target objects.
    #[doc(alias = "ATK_RELATION_CONTROLLED_BY")]
    ControlledBy,
    /// Indicates an object is an controller for one or more target objects.
    #[doc(alias = "ATK_RELATION_CONTROLLER_FOR")]
    ControllerFor,
    /// Indicates an object is a label for one or more target objects.
    #[doc(alias = "ATK_RELATION_LABEL_FOR")]
    LabelFor,
    /// Indicates an object is labelled by one or more target objects.
    #[doc(alias = "ATK_RELATION_LABELLED_BY")]
    LabelledBy,
    /// Indicates an object is a member of a group of one or more target objects.
    #[doc(alias = "ATK_RELATION_MEMBER_OF")]
    MemberOf,
    /// Indicates an object is a cell in a treetable which is displayed because a cell in the same column is expanded and identifies that cell.
    #[doc(alias = "ATK_RELATION_NODE_CHILD_OF")]
    NodeChildOf,
    /// Indicates that the object has content that flows logically to another
    ///  AtkObject in a sequential way, (for instance text-flow).
    #[doc(alias = "ATK_RELATION_FLOWS_TO")]
    FlowsTo,
    /// Indicates that the object has content that flows logically from
    ///  another AtkObject in a sequential way, (for instance text-flow).
    #[doc(alias = "ATK_RELATION_FLOWS_FROM")]
    FlowsFrom,
    /// Indicates a subwindow attached to a component but otherwise has no connection in the UI heirarchy to that component.
    #[doc(alias = "ATK_RELATION_SUBWINDOW_OF")]
    SubwindowOf,
    /// Indicates that the object visually embeds
    ///  another object's content, i.e. this object's content flows around
    ///  another's content.
    #[doc(alias = "ATK_RELATION_EMBEDS")]
    Embeds,
    /// Reciprocal of [`Embeds`][Self::Embeds], indicates that
    ///  this object's content is visualy embedded in another object.
    #[doc(alias = "ATK_RELATION_EMBEDDED_BY")]
    EmbeddedBy,
    /// Indicates that an object is a popup for another object.
    #[doc(alias = "ATK_RELATION_POPUP_FOR")]
    PopupFor,
    /// Indicates that an object is a parent window of another object.
    #[doc(alias = "ATK_RELATION_PARENT_WINDOW_OF")]
    ParentWindowOf,
    /// Reciprocal of [`DescriptionFor`][Self::DescriptionFor]. Indicates that one
    /// or more target objects provide descriptive information about this object. This relation
    /// type is most appropriate for information that is not essential as its presentation may
    /// be user-configurable and/or limited to an on-demand mechanism such as an assistive
    /// technology command. For brief, essential information such as can be found in a widget's
    /// on-screen label, use [`LabelledBy`][Self::LabelledBy]. For an on-screen error message, use
    /// [`ErrorMessage`][Self::ErrorMessage]. For lengthy extended descriptive information contained in
    /// an on-screen object, consider using [`Details`][Self::Details] as assistive technologies may
    /// provide a means for the user to navigate to objects containing detailed descriptions so
    /// that their content can be more closely reviewed.
    #[doc(alias = "ATK_RELATION_DESCRIBED_BY")]
    DescribedBy,
    /// Reciprocal of [`DescribedBy`][Self::DescribedBy]. Indicates that this
    /// object provides descriptive information about the target object(s). See also
    /// [`DetailsFor`][Self::DetailsFor] and [`ErrorFor`][Self::ErrorFor].
    #[doc(alias = "ATK_RELATION_DESCRIPTION_FOR")]
    DescriptionFor,
    /// Indicates an object is a cell in a treetable and is expanded to display other cells in the same column.
    #[doc(alias = "ATK_RELATION_NODE_PARENT_OF")]
    NodeParentOf,
    /// Reciprocal of [`DetailsFor`][Self::DetailsFor]. Indicates that this object
    /// has a detailed or extended description, the contents of which can be found in the target
    /// object(s). This relation type is most appropriate for information that is sufficiently
    /// lengthy as to make navigation to the container of that information desirable. For less
    /// verbose information suitable for announcement only, see [`DescribedBy`][Self::DescribedBy]. If
    /// the detailed information describes an error condition, [`ErrorFor`][Self::ErrorFor] should be
    /// used instead. `Since`: ATK-2.26.
    #[doc(alias = "ATK_RELATION_DETAILS")]
    Details,
    /// Reciprocal of [`Details`][Self::Details]. Indicates that this object
    /// provides a detailed or extended description about the target object(s). See also
    /// [`DescriptionFor`][Self::DescriptionFor] and [`ErrorFor`][Self::ErrorFor]. `Since`: ATK-2.26.
    #[doc(alias = "ATK_RELATION_DETAILS_FOR")]
    DetailsFor,
    /// Reciprocal of [`ErrorFor`][Self::ErrorFor]. Indicates that this object
    /// has one or more errors, the nature of which is described in the contents of the target
    /// object(s). Objects that have this relation type should also contain [`StateType::InvalidEntry`][crate::StateType::InvalidEntry]
    /// in their [`StateSet`][crate::StateSet]. `Since`: ATK-2.26.
    #[doc(alias = "ATK_RELATION_ERROR_MESSAGE")]
    ErrorMessage,
    /// Reciprocal of [`ErrorMessage`][Self::ErrorMessage]. Indicates that this object
    /// contains an error message describing an invalid condition in the target object(s). `Since`:
    /// ATK_2.26.
    #[doc(alias = "ATK_RELATION_ERROR_FOR")]
    ErrorFor,
    /// Not used, this value indicates the end of the enumeration.
    #[doc(alias = "ATK_RELATION_LAST_DEFINED")]
    LastDefined,
    #[doc(hidden)]
    __Unknown(i32),
}

impl RelationType {
    #[doc(alias = "atk_relation_type_for_name")]
    pub fn for_name(name: &str) -> RelationType {
        assert_initialized_main_thread!();
        unsafe { from_glib(ffi::atk_relation_type_for_name(name.to_glib_none().0)) }
    }

    #[doc(alias = "atk_relation_type_get_name")]
    #[doc(alias = "get_name")]
    pub fn name(self) -> Option<glib::GString> {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::atk_relation_type_get_name(self.into_glib())) }
    }
}

impl fmt::Display for RelationType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "RelationType::{}",
            match *self {
                Self::Null => "Null",
                Self::ControlledBy => "ControlledBy",
                Self::ControllerFor => "ControllerFor",
                Self::LabelFor => "LabelFor",
                Self::LabelledBy => "LabelledBy",
                Self::MemberOf => "MemberOf",
                Self::NodeChildOf => "NodeChildOf",
                Self::FlowsTo => "FlowsTo",
                Self::FlowsFrom => "FlowsFrom",
                Self::SubwindowOf => "SubwindowOf",
                Self::Embeds => "Embeds",
                Self::EmbeddedBy => "EmbeddedBy",
                Self::PopupFor => "PopupFor",
                Self::ParentWindowOf => "ParentWindowOf",
                Self::DescribedBy => "DescribedBy",
                Self::DescriptionFor => "DescriptionFor",
                Self::NodeParentOf => "NodeParentOf",
                Self::Details => "Details",
                Self::DetailsFor => "DetailsFor",
                Self::ErrorMessage => "ErrorMessage",
                Self::ErrorFor => "ErrorFor",
                Self::LastDefined => "LastDefined",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl IntoGlib for RelationType {
    type GlibType = ffi::AtkRelationType;

    fn into_glib(self) -> ffi::AtkRelationType {
        match self {
            Self::Null => ffi::ATK_RELATION_NULL,
            Self::ControlledBy => ffi::ATK_RELATION_CONTROLLED_BY,
            Self::ControllerFor => ffi::ATK_RELATION_CONTROLLER_FOR,
            Self::LabelFor => ffi::ATK_RELATION_LABEL_FOR,
            Self::LabelledBy => ffi::ATK_RELATION_LABELLED_BY,
            Self::MemberOf => ffi::ATK_RELATION_MEMBER_OF,
            Self::NodeChildOf => ffi::ATK_RELATION_NODE_CHILD_OF,
            Self::FlowsTo => ffi::ATK_RELATION_FLOWS_TO,
            Self::FlowsFrom => ffi::ATK_RELATION_FLOWS_FROM,
            Self::SubwindowOf => ffi::ATK_RELATION_SUBWINDOW_OF,
            Self::Embeds => ffi::ATK_RELATION_EMBEDS,
            Self::EmbeddedBy => ffi::ATK_RELATION_EMBEDDED_BY,
            Self::PopupFor => ffi::ATK_RELATION_POPUP_FOR,
            Self::ParentWindowOf => ffi::ATK_RELATION_PARENT_WINDOW_OF,
            Self::DescribedBy => ffi::ATK_RELATION_DESCRIBED_BY,
            Self::DescriptionFor => ffi::ATK_RELATION_DESCRIPTION_FOR,
            Self::NodeParentOf => ffi::ATK_RELATION_NODE_PARENT_OF,
            Self::Details => ffi::ATK_RELATION_DETAILS,
            Self::DetailsFor => ffi::ATK_RELATION_DETAILS_FOR,
            Self::ErrorMessage => ffi::ATK_RELATION_ERROR_MESSAGE,
            Self::ErrorFor => ffi::ATK_RELATION_ERROR_FOR,
            Self::LastDefined => ffi::ATK_RELATION_LAST_DEFINED,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AtkRelationType> for RelationType {
    unsafe fn from_glib(value: ffi::AtkRelationType) -> Self {
        skip_assert_initialized!();
        match value {
            ffi::ATK_RELATION_NULL => Self::Null,
            ffi::ATK_RELATION_CONTROLLED_BY => Self::ControlledBy,
            ffi::ATK_RELATION_CONTROLLER_FOR => Self::ControllerFor,
            ffi::ATK_RELATION_LABEL_FOR => Self::LabelFor,
            ffi::ATK_RELATION_LABELLED_BY => Self::LabelledBy,
            ffi::ATK_RELATION_MEMBER_OF => Self::MemberOf,
            ffi::ATK_RELATION_NODE_CHILD_OF => Self::NodeChildOf,
            ffi::ATK_RELATION_FLOWS_TO => Self::FlowsTo,
            ffi::ATK_RELATION_FLOWS_FROM => Self::FlowsFrom,
            ffi::ATK_RELATION_SUBWINDOW_OF => Self::SubwindowOf,
            ffi::ATK_RELATION_EMBEDS => Self::Embeds,
            ffi::ATK_RELATION_EMBEDDED_BY => Self::EmbeddedBy,
            ffi::ATK_RELATION_POPUP_FOR => Self::PopupFor,
            ffi::ATK_RELATION_PARENT_WINDOW_OF => Self::ParentWindowOf,
            ffi::ATK_RELATION_DESCRIBED_BY => Self::DescribedBy,
            ffi::ATK_RELATION_DESCRIPTION_FOR => Self::DescriptionFor,
            ffi::ATK_RELATION_NODE_PARENT_OF => Self::NodeParentOf,
            ffi::ATK_RELATION_DETAILS => Self::Details,
            ffi::ATK_RELATION_DETAILS_FOR => Self::DetailsFor,
            ffi::ATK_RELATION_ERROR_MESSAGE => Self::ErrorMessage,
            ffi::ATK_RELATION_ERROR_FOR => Self::ErrorFor,
            ffi::ATK_RELATION_LAST_DEFINED => Self::LastDefined,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for RelationType {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::atk_relation_type_get_type()) }
    }
}

impl glib::value::ValueType for RelationType {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for RelationType {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for RelationType {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

/// Describes the role of an object
///
/// These are the built-in enumerated roles that UI components can have
/// in ATK. Other roles may be added at runtime, so an AtkRole >=
/// [`LastDefined`][Self::LastDefined] is not necessarily an error.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AtkRole")]
pub enum Role {
    /// Invalid role
    #[doc(alias = "ATK_ROLE_INVALID")]
    Invalid,
    /// A label which represents an accelerator
    #[doc(alias = "ATK_ROLE_ACCEL_LABEL")]
    AcceleratorLabel,
    /// An object which is an alert to the user. Assistive Technologies typically respond to ATK_ROLE_ALERT by reading the entire onscreen contents of containers advertising this role. Should be used for warning dialogs, etc.
    #[doc(alias = "ATK_ROLE_ALERT")]
    Alert,
    /// An object which is an animated image
    #[doc(alias = "ATK_ROLE_ANIMATION")]
    Animation,
    /// An arrow in one of the four cardinal directions
    #[doc(alias = "ATK_ROLE_ARROW")]
    Arrow,
    /// An object that displays a calendar and allows the user to select a date
    #[doc(alias = "ATK_ROLE_CALENDAR")]
    Calendar,
    /// An object that can be drawn into and is used to trap events
    #[doc(alias = "ATK_ROLE_CANVAS")]
    Canvas,
    /// A choice that can be checked or unchecked and provides a separate indicator for the current state
    #[doc(alias = "ATK_ROLE_CHECK_BOX")]
    CheckBox,
    /// A menu item with a check box
    #[doc(alias = "ATK_ROLE_CHECK_MENU_ITEM")]
    CheckMenuItem,
    /// A specialized dialog that lets the user choose a color
    #[doc(alias = "ATK_ROLE_COLOR_CHOOSER")]
    ColorChooser,
    /// The header for a column of data
    #[doc(alias = "ATK_ROLE_COLUMN_HEADER")]
    ColumnHeader,
    /// A collapsible list of choices the user can select from
    #[doc(alias = "ATK_ROLE_COMBO_BOX")]
    ComboBox,
    /// An object whose purpose is to allow a user to edit a date
    #[doc(alias = "ATK_ROLE_DATE_EDITOR")]
    DateEditor,
    /// An inconifed internal frame within a DESKTOP_PANE
    #[doc(alias = "ATK_ROLE_DESKTOP_ICON")]
    DesktopIcon,
    /// A pane that supports internal frames and iconified versions of those internal frames
    #[doc(alias = "ATK_ROLE_DESKTOP_FRAME")]
    DesktopFrame,
    /// An object whose purpose is to allow a user to set a value
    #[doc(alias = "ATK_ROLE_DIAL")]
    Dial,
    /// A top level window with title bar and a border
    #[doc(alias = "ATK_ROLE_DIALOG")]
    Dialog,
    /// A pane that allows the user to navigate through and select the contents of a directory
    #[doc(alias = "ATK_ROLE_DIRECTORY_PANE")]
    DirectoryPane,
    /// An object used for drawing custom user interface elements
    #[doc(alias = "ATK_ROLE_DRAWING_AREA")]
    DrawingArea,
    /// A specialized dialog that lets the user choose a file
    #[doc(alias = "ATK_ROLE_FILE_CHOOSER")]
    FileChooser,
    /// A object that fills up space in a user interface
    #[doc(alias = "ATK_ROLE_FILLER")]
    Filler,
    /// A specialized dialog that lets the user choose a font
    #[doc(alias = "ATK_ROLE_FONT_CHOOSER")]
    FontChooser,
    /// A top level window with a title bar, border, menubar, etc.
    #[doc(alias = "ATK_ROLE_FRAME")]
    Frame,
    /// A pane that is guaranteed to be painted on top of all panes beneath it
    #[doc(alias = "ATK_ROLE_GLASS_PANE")]
    GlassPane,
    /// A document container for HTML, whose children represent the document content
    #[doc(alias = "ATK_ROLE_HTML_CONTAINER")]
    HtmlContainer,
    /// A small fixed size picture, typically used to decorate components
    #[doc(alias = "ATK_ROLE_ICON")]
    Icon,
    /// An object whose primary purpose is to display an image
    #[doc(alias = "ATK_ROLE_IMAGE")]
    Image,
    /// A frame-like object that is clipped by a desktop pane
    #[doc(alias = "ATK_ROLE_INTERNAL_FRAME")]
    InternalFrame,
    /// An object used to present an icon or short string in an interface
    #[doc(alias = "ATK_ROLE_LABEL")]
    Label,
    /// A specialized pane that allows its children to be drawn in layers, providing a form of stacking order
    #[doc(alias = "ATK_ROLE_LAYERED_PANE")]
    LayeredPane,
    /// An object that presents a list of objects to the user and allows the user to select one or more of them
    #[doc(alias = "ATK_ROLE_LIST")]
    List,
    /// An object that represents an element of a list
    #[doc(alias = "ATK_ROLE_LIST_ITEM")]
    ListItem,
    /// An object usually found inside a menu bar that contains a list of actions the user can choose from
    #[doc(alias = "ATK_ROLE_MENU")]
    Menu,
    /// An object usually drawn at the top of the primary dialog box of an application that contains a list of menus the user can choose from
    #[doc(alias = "ATK_ROLE_MENU_BAR")]
    MenuBar,
    /// An object usually contained in a menu that presents an action the user can choose
    #[doc(alias = "ATK_ROLE_MENU_ITEM")]
    MenuItem,
    /// A specialized pane whose primary use is inside a DIALOG
    #[doc(alias = "ATK_ROLE_OPTION_PANE")]
    OptionPane,
    /// An object that is a child of a page tab list
    #[doc(alias = "ATK_ROLE_PAGE_TAB")]
    PageTab,
    /// An object that presents a series of panels (or page tabs), one at a time, through some mechanism provided by the object
    #[doc(alias = "ATK_ROLE_PAGE_TAB_LIST")]
    PageTabList,
    /// A generic container that is often used to group objects
    #[doc(alias = "ATK_ROLE_PANEL")]
    Panel,
    /// A text object uses for passwords, or other places where the text content is not shown visibly to the user
    #[doc(alias = "ATK_ROLE_PASSWORD_TEXT")]
    PasswordText,
    /// A temporary window that is usually used to offer the user a list of choices, and then hides when the user selects one of those choices
    #[doc(alias = "ATK_ROLE_POPUP_MENU")]
    PopupMenu,
    /// An object used to indicate how much of a task has been completed
    #[doc(alias = "ATK_ROLE_PROGRESS_BAR")]
    ProgressBar,
    /// An object the user can manipulate to tell the application to do something
    #[doc(alias = "ATK_ROLE_PUSH_BUTTON")]
    PushButton,
    /// A specialized check box that will cause other radio buttons in the same group to become unchecked when this one is checked
    #[doc(alias = "ATK_ROLE_RADIO_BUTTON")]
    RadioButton,
    /// A check menu item which belongs to a group. At each instant exactly one of the radio menu items from a group is selected
    #[doc(alias = "ATK_ROLE_RADIO_MENU_ITEM")]
    RadioMenuItem,
    /// A specialized pane that has a glass pane and a layered pane as its children
    #[doc(alias = "ATK_ROLE_ROOT_PANE")]
    RootPane,
    /// The header for a row of data
    #[doc(alias = "ATK_ROLE_ROW_HEADER")]
    RowHeader,
    /// An object usually used to allow a user to incrementally view a large amount of data.
    #[doc(alias = "ATK_ROLE_SCROLL_BAR")]
    ScrollBar,
    /// An object that allows a user to incrementally view a large amount of information
    #[doc(alias = "ATK_ROLE_SCROLL_PANE")]
    ScrollPane,
    /// An object usually contained in a menu to provide a visible and logical separation of the contents in a menu
    #[doc(alias = "ATK_ROLE_SEPARATOR")]
    Separator,
    /// An object that allows the user to select from a bounded range
    #[doc(alias = "ATK_ROLE_SLIDER")]
    Slider,
    /// A specialized panel that presents two other panels at the same time
    #[doc(alias = "ATK_ROLE_SPLIT_PANE")]
    SplitPane,
    /// An object used to get an integer or floating point number from the user
    #[doc(alias = "ATK_ROLE_SPIN_BUTTON")]
    SpinButton,
    /// An object which reports messages of minor importance to the user
    #[doc(alias = "ATK_ROLE_STATUSBAR")]
    Statusbar,
    /// An object used to represent information in terms of rows and columns
    #[doc(alias = "ATK_ROLE_TABLE")]
    Table,
    /// A cell in a table
    #[doc(alias = "ATK_ROLE_TABLE_CELL")]
    TableCell,
    /// The header for a column of a table
    #[doc(alias = "ATK_ROLE_TABLE_COLUMN_HEADER")]
    TableColumnHeader,
    /// The header for a row of a table
    #[doc(alias = "ATK_ROLE_TABLE_ROW_HEADER")]
    TableRowHeader,
    /// A menu item used to tear off and reattach its menu
    #[doc(alias = "ATK_ROLE_TEAR_OFF_MENU_ITEM")]
    TearOffMenuItem,
    /// An object that represents an accessible terminal. (Since: 0.6)
    #[doc(alias = "ATK_ROLE_TERMINAL")]
    Terminal,
    /// An interactive widget that supports multiple lines of text and
    /// optionally accepts user input, but whose purpose is not to solicit user input.
    /// Thus ATK_ROLE_TEXT is appropriate for the text view in a plain text editor
    /// but inappropriate for an input field in a dialog box or web form. For widgets
    /// whose purpose is to solicit input from the user, see ATK_ROLE_ENTRY and
    /// ATK_ROLE_PASSWORD_TEXT. For generic objects which display a brief amount of
    /// textual information, see ATK_ROLE_STATIC.
    #[doc(alias = "ATK_ROLE_TEXT")]
    Text,
    /// A specialized push button that can be checked or unchecked, but does not provide a separate indicator for the current state
    #[doc(alias = "ATK_ROLE_TOGGLE_BUTTON")]
    ToggleButton,
    /// A bar or palette usually composed of push buttons or toggle buttons
    #[doc(alias = "ATK_ROLE_TOOL_BAR")]
    ToolBar,
    /// An object that provides information about another object
    #[doc(alias = "ATK_ROLE_TOOL_TIP")]
    ToolTip,
    /// An object used to represent hierarchical information to the user
    #[doc(alias = "ATK_ROLE_TREE")]
    Tree,
    /// An object capable of expanding and collapsing rows as well as showing multiple columns of data. (Since: 0.7)
    #[doc(alias = "ATK_ROLE_TREE_TABLE")]
    TreeTable,
    /// The object contains some Accessible information, but its role is not known
    #[doc(alias = "ATK_ROLE_UNKNOWN")]
    Unknown,
    /// An object usually used in a scroll pane
    #[doc(alias = "ATK_ROLE_VIEWPORT")]
    Viewport,
    /// A top level window with no title or border.
    #[doc(alias = "ATK_ROLE_WINDOW")]
    Window,
    /// An object that serves as a document header. (Since: 1.1.1)
    #[doc(alias = "ATK_ROLE_HEADER")]
    Header,
    /// An object that serves as a document footer. (Since: 1.1.1)
    #[doc(alias = "ATK_ROLE_FOOTER")]
    Footer,
    /// An object which is contains a paragraph of text content. (Since: 1.1.1)
    #[doc(alias = "ATK_ROLE_PARAGRAPH")]
    Paragraph,
    /// An object which describes margins and tab stops, etc. for text objects which it controls (should have CONTROLLER_FOR relation to such). (Since: 1.1.1)
    #[doc(alias = "ATK_ROLE_RULER")]
    Ruler,
    /// The object is an application object, which may contain [`Frame`][Self::Frame] objects or other types of accessibles. The root accessible of any application's ATK hierarchy should have ATK_ROLE_APPLICATION. (Since: 1.1.4)
    #[doc(alias = "ATK_ROLE_APPLICATION")]
    Application,
    /// The object is a dialog or list containing items for insertion into an entry widget, for instance a list of words for completion of a text entry. (Since: 1.3)
    #[doc(alias = "ATK_ROLE_AUTOCOMPLETE")]
    Autocomplete,
    /// The object is an editable text object in a toolbar. (Since: 1.5)
    #[doc(alias = "ATK_ROLE_EDITBAR")]
    EditBar,
    /// The object is an embedded container within a document or panel. This role is a grouping "hint" indicating that the contained objects share a context. (Since: 1.7.2)
    #[doc(alias = "ATK_ROLE_EMBEDDED")]
    Embedded,
    /// The object is a component whose textual content may be entered or modified by the user, provided [`StateType::Editable`][crate::StateType::Editable] is present. (Since: 1.11)
    #[doc(alias = "ATK_ROLE_ENTRY")]
    Entry,
    /// The object is a graphical depiction of quantitative data. It may contain multiple subelements whose attributes and/or description may be queried to obtain both the quantitative data and information about how the data is being presented. The LABELLED_BY relation is particularly important in interpreting objects of this type, as is the accessible-description property. (Since: 1.11)
    #[doc(alias = "ATK_ROLE_CHART")]
    Chart,
    /// The object contains descriptive information, usually textual, about another user interface element such as a table, chart, or image. (Since: 1.11)
    #[doc(alias = "ATK_ROLE_CAPTION")]
    Caption,
    /// The object is a visual frame or container which contains a view of document content. Document frames may occur within another Document instance, in which case the second document may be said to be embedded in the containing instance. HTML frames are often ROLE_DOCUMENT_FRAME. Either this object, or a singleton descendant, should implement the Document interface. (Since: 1.11)
    #[doc(alias = "ATK_ROLE_DOCUMENT_FRAME")]
    DocumentFrame,
    /// The object serves as a heading for content which follows it in a document. The 'heading level' of the heading, if availabe, may be obtained by querying the object's attributes.
    #[doc(alias = "ATK_ROLE_HEADING")]
    Heading,
    /// The object is a containing instance which encapsulates a page of information. [`Page`][Self::Page] is used in documents and content which support a paginated navigation model. (Since: 1.11)
    #[doc(alias = "ATK_ROLE_PAGE")]
    Page,
    /// The object is a containing instance of document content which constitutes a particular 'logical' section of the document. The type of content within a section, and the nature of the section division itself, may be obtained by querying the object's attributes. Sections may be nested. (Since: 1.11)
    #[doc(alias = "ATK_ROLE_SECTION")]
    Section,
    /// The object is redundant with another object in the hierarchy, and is exposed for purely technical reasons. Objects of this role should normally be ignored by clients. (Since: 1.11)
    #[doc(alias = "ATK_ROLE_REDUNDANT_OBJECT")]
    RedundantObject,
    /// The object is a container for form controls, for instance as part of a
    /// web form or user-input form within a document. This role is primarily a tag/convenience for
    /// clients when navigating complex documents, it is not expected that ordinary GUI containers will
    /// always have ATK_ROLE_FORM. (Since: 1.12.0)
    #[doc(alias = "ATK_ROLE_FORM")]
    Form,
    /// The object is a hypertext anchor, i.e. a "link" in a
    /// hypertext document. Such objects are distinct from 'inline'
    /// content which may also use the Hypertext/Hyperlink interfaces
    /// to indicate the range/location within a text object where
    /// an inline or embedded object lies. (Since: 1.12.1)
    #[doc(alias = "ATK_ROLE_LINK")]
    Link,
    /// The object is a window or similar viewport
    /// which is used to allow composition or input of a 'complex character',
    /// in other words it is an "input method window." (Since: 1.12.1)
    #[doc(alias = "ATK_ROLE_INPUT_METHOD_WINDOW")]
    InputMethodWindow,
    /// A row in a table. (Since: 2.1.0)
    #[doc(alias = "ATK_ROLE_TABLE_ROW")]
    TableRow,
    /// An object that represents an element of a tree. (Since: 2.1.0)
    #[doc(alias = "ATK_ROLE_TREE_ITEM")]
    TreeItem,
    /// A document frame which contains a spreadsheet. (Since: 2.1.0)
    #[doc(alias = "ATK_ROLE_DOCUMENT_SPREADSHEET")]
    DocumentSpreadsheet,
    /// A document frame which contains a presentation or slide content. (Since: 2.1.0)
    #[doc(alias = "ATK_ROLE_DOCUMENT_PRESENTATION")]
    DocumentPresentation,
    /// A document frame which contains textual content, such as found in a word processing application. (Since: 2.1.0)
    #[doc(alias = "ATK_ROLE_DOCUMENT_TEXT")]
    DocumentText,
    /// A document frame which contains HTML or other markup suitable for display in a web browser. (Since: 2.1.0)
    #[doc(alias = "ATK_ROLE_DOCUMENT_WEB")]
    DocumentWeb,
    /// A document frame which contains email content to be displayed or composed either in plain text or HTML. (Since: 2.1.0)
    #[doc(alias = "ATK_ROLE_DOCUMENT_EMAIL")]
    DocumentEmail,
    /// An object found within a document and designed to present a comment, note, or other annotation. In some cases, this object might not be visible until activated. (Since: 2.1.0)
    #[doc(alias = "ATK_ROLE_COMMENT")]
    Comment,
    /// A non-collapsible list of choices the user can select from. (Since: 2.1.0)
    #[doc(alias = "ATK_ROLE_LIST_BOX")]
    ListBox,
    /// A group of related widgets. This group typically has a label. (Since: 2.1.0)
    #[doc(alias = "ATK_ROLE_GROUPING")]
    Grouping,
    /// An image map object. Usually a graphic with multiple hotspots, where each hotspot can be activated resulting in the loading of another document or section of a document. (Since: 2.1.0)
    #[doc(alias = "ATK_ROLE_IMAGE_MAP")]
    ImageMap,
    /// A transitory object designed to present a message to the user, typically at the desktop level rather than inside a particular application. (Since: 2.1.0)
    #[doc(alias = "ATK_ROLE_NOTIFICATION")]
    Notification,
    /// An object designed to present a message to the user within an existing window. (Since: 2.1.0)
    #[doc(alias = "ATK_ROLE_INFO_BAR")]
    InfoBar,
    /// A bar that serves as a level indicator to, for instance, show the strength of a password or the state of a battery. (Since: 2.7.3)
    #[doc(alias = "ATK_ROLE_LEVEL_BAR")]
    LevelBar,
    /// A bar that serves as the title of a window or a
    /// dialog. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_TITLE_BAR")]
    TitleBar,
    /// An object which contains a text section
    /// that is quoted from another source. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_BLOCK_QUOTE")]
    BlockQuote,
    /// An object which represents an audio element. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_AUDIO")]
    Audio,
    /// An object which represents a video element. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_VIDEO")]
    Video,
    /// A definition of a term or concept. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_DEFINITION")]
    Definition,
    /// A section of a page that consists of a
    /// composition that forms an independent part of a document, page, or
    /// site. Examples: A blog entry, a news story, a forum post. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_ARTICLE")]
    Article,
    /// A region of a web page intended as a
    /// navigational landmark. This is designed to allow Assistive
    /// Technologies to provide quick navigation among key regions within a
    /// document. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_LANDMARK")]
    Landmark,
    /// A text widget or container holding log content, such
    /// as chat history and error logs. In this role there is a
    /// relationship between the arrival of new items in the log and the
    /// reading order. The log contains a meaningful sequence and new
    /// information is added only to the end of the log, not at arbitrary
    /// points. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_LOG")]
    Log,
    /// A container where non-essential information
    /// changes frequently. Common usages of marquee include stock tickers
    /// and ad banners. The primary difference between a marquee and a log
    /// is that logs usually have a meaningful order or sequence of
    /// important content changes. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_MARQUEE")]
    Marquee,
    /// A text widget or container that holds a mathematical
    /// expression. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_MATH")]
    Math,
    /// A widget whose purpose is to display a rating,
    /// such as the number of stars associated with a song in a media
    /// player. Objects of this role should also implement
    /// AtkValue. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_RATING")]
    Rating,
    /// An object containing a numerical counter which
    /// indicates an amount of elapsed time from a start point, or the time
    /// remaining until an end point. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_TIMER")]
    Timer,
    /// An object that represents a list of
    /// term-value groups. A term-value group represents a individual
    /// description and consist of one or more names
    /// (ATK_ROLE_DESCRIPTION_TERM) followed by one or more values
    /// (ATK_ROLE_DESCRIPTION_VALUE). For each list, there should not be
    /// more than one group with the same term name. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_DESCRIPTION_LIST")]
    DescriptionList,
    /// An object that represents a term or phrase
    /// with a corresponding definition. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_DESCRIPTION_TERM")]
    DescriptionTerm,
    /// An object that represents the
    /// description, definition or value of a term. (Since: 2.12)
    #[doc(alias = "ATK_ROLE_DESCRIPTION_VALUE")]
    DescriptionValue,
    /// A generic non-container object whose purpose is to display a
    /// brief amount of information to the user and whose role is known by the
    /// implementor but lacks semantic value for the user. Examples in which
    /// [`Static`][Self::Static] is appropriate include the message displayed in a message box
    /// and an image used as an alternative means to display text. [`Static`][Self::Static]
    /// should not be applied to widgets which are traditionally interactive, objects
    /// which display a significant amount of content, or any object which has an
    /// accessible relation pointing to another object. Implementors should expose the
    /// displayed information through the accessible name of the object. If doing so seems
    /// inappropriate, it may indicate that a different role should be used. For
    /// labels which describe another widget, see [`Label`][Self::Label]. For text views, see
    /// [`Text`][Self::Text]. For generic containers, see [`Panel`][Self::Panel]. For objects whose
    /// role is not known by the implementor, see [`Unknown`][Self::Unknown]. (Since: 2.16)
    #[doc(alias = "ATK_ROLE_STATIC")]
    Static,
    /// An object that represents a mathematical fraction.
    /// (Since: 2.16)
    #[doc(alias = "ATK_ROLE_MATH_FRACTION")]
    MathFraction,
    /// An object that represents a mathematical expression
    /// displayed with a radical. (Since: 2.16)
    #[doc(alias = "ATK_ROLE_MATH_ROOT")]
    MathRoot,
    /// An object that contains text that is displayed as a
    /// subscript. (Since: 2.16)
    #[doc(alias = "ATK_ROLE_SUBSCRIPT")]
    Subscript,
    /// An object that contains text that is displayed as a
    /// superscript. (Since: 2.16)
    #[doc(alias = "ATK_ROLE_SUPERSCRIPT")]
    Superscript,
    /// An object that contains the text of a footnote. (Since: 2.26)
    #[doc(alias = "ATK_ROLE_FOOTNOTE")]
    Footnote,
    /// Content previously deleted or proposed to be
    /// deleted, e.g. in revision history or a content view providing suggestions
    /// from reviewers. (Since: 2.34)
    #[doc(alias = "ATK_ROLE_CONTENT_DELETION")]
    ContentDeletion,
    /// Content previously inserted or proposed to be
    /// inserted, e.g. in revision history or a content view providing suggestions
    /// from reviewers. (Since: 2.34)
    #[doc(alias = "ATK_ROLE_CONTENT_INSERTION")]
    ContentInsertion,
    /// A run of content that is marked or highlighted, such as for
    /// reference purposes, or to call it out as having a special purpose. If the
    /// marked content has an associated section in the document elaborating on the
    /// reason for the mark, then [`RelationType::Details`][crate::RelationType::Details] should be used on the mark
    /// to point to that associated section. In addition, the reciprocal relation
    /// [`RelationType::DetailsFor`][crate::RelationType::DetailsFor] should be used on the associated content section
    /// to point back to the mark. (Since: 2.36)
    #[doc(alias = "ATK_ROLE_MARK")]
    Mark,
    /// A container for content that is called out as a proposed
    /// change from the current version of the document, such as by a reviewer of the
    /// content. This role should include either [`ContentDeletion`][Self::ContentDeletion] and/or
    /// [`ContentInsertion`][Self::ContentInsertion] children, in any order, to indicate what the
    /// actual change is. (Since: 2.36)
    #[doc(alias = "ATK_ROLE_SUGGESTION")]
    Suggestion,
    /// not a valid role, used for finding end of the enumeration
    #[doc(alias = "ATK_ROLE_LAST_DEFINED")]
    LastDefined,
    #[doc(hidden)]
    __Unknown(i32),
}

impl Role {
    #[doc(alias = "atk_role_for_name")]
    pub fn for_name(name: &str) -> Role {
        assert_initialized_main_thread!();
        unsafe { from_glib(ffi::atk_role_for_name(name.to_glib_none().0)) }
    }

    #[doc(alias = "atk_role_get_localized_name")]
    #[doc(alias = "get_localized_name")]
    pub fn localized_name(self) -> Option<glib::GString> {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::atk_role_get_localized_name(self.into_glib())) }
    }

    #[doc(alias = "atk_role_get_name")]
    #[doc(alias = "get_name")]
    pub fn name(self) -> Option<glib::GString> {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::atk_role_get_name(self.into_glib())) }
    }
}

impl fmt::Display for Role {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "Role::{}",
            match *self {
                Self::Invalid => "Invalid",
                Self::AcceleratorLabel => "AcceleratorLabel",
                Self::Alert => "Alert",
                Self::Animation => "Animation",
                Self::Arrow => "Arrow",
                Self::Calendar => "Calendar",
                Self::Canvas => "Canvas",
                Self::CheckBox => "CheckBox",
                Self::CheckMenuItem => "CheckMenuItem",
                Self::ColorChooser => "ColorChooser",
                Self::ColumnHeader => "ColumnHeader",
                Self::ComboBox => "ComboBox",
                Self::DateEditor => "DateEditor",
                Self::DesktopIcon => "DesktopIcon",
                Self::DesktopFrame => "DesktopFrame",
                Self::Dial => "Dial",
                Self::Dialog => "Dialog",
                Self::DirectoryPane => "DirectoryPane",
                Self::DrawingArea => "DrawingArea",
                Self::FileChooser => "FileChooser",
                Self::Filler => "Filler",
                Self::FontChooser => "FontChooser",
                Self::Frame => "Frame",
                Self::GlassPane => "GlassPane",
                Self::HtmlContainer => "HtmlContainer",
                Self::Icon => "Icon",
                Self::Image => "Image",
                Self::InternalFrame => "InternalFrame",
                Self::Label => "Label",
                Self::LayeredPane => "LayeredPane",
                Self::List => "List",
                Self::ListItem => "ListItem",
                Self::Menu => "Menu",
                Self::MenuBar => "MenuBar",
                Self::MenuItem => "MenuItem",
                Self::OptionPane => "OptionPane",
                Self::PageTab => "PageTab",
                Self::PageTabList => "PageTabList",
                Self::Panel => "Panel",
                Self::PasswordText => "PasswordText",
                Self::PopupMenu => "PopupMenu",
                Self::ProgressBar => "ProgressBar",
                Self::PushButton => "PushButton",
                Self::RadioButton => "RadioButton",
                Self::RadioMenuItem => "RadioMenuItem",
                Self::RootPane => "RootPane",
                Self::RowHeader => "RowHeader",
                Self::ScrollBar => "ScrollBar",
                Self::ScrollPane => "ScrollPane",
                Self::Separator => "Separator",
                Self::Slider => "Slider",
                Self::SplitPane => "SplitPane",
                Self::SpinButton => "SpinButton",
                Self::Statusbar => "Statusbar",
                Self::Table => "Table",
                Self::TableCell => "TableCell",
                Self::TableColumnHeader => "TableColumnHeader",
                Self::TableRowHeader => "TableRowHeader",
                Self::TearOffMenuItem => "TearOffMenuItem",
                Self::Terminal => "Terminal",
                Self::Text => "Text",
                Self::ToggleButton => "ToggleButton",
                Self::ToolBar => "ToolBar",
                Self::ToolTip => "ToolTip",
                Self::Tree => "Tree",
                Self::TreeTable => "TreeTable",
                Self::Unknown => "Unknown",
                Self::Viewport => "Viewport",
                Self::Window => "Window",
                Self::Header => "Header",
                Self::Footer => "Footer",
                Self::Paragraph => "Paragraph",
                Self::Ruler => "Ruler",
                Self::Application => "Application",
                Self::Autocomplete => "Autocomplete",
                Self::EditBar => "EditBar",
                Self::Embedded => "Embedded",
                Self::Entry => "Entry",
                Self::Chart => "Chart",
                Self::Caption => "Caption",
                Self::DocumentFrame => "DocumentFrame",
                Self::Heading => "Heading",
                Self::Page => "Page",
                Self::Section => "Section",
                Self::RedundantObject => "RedundantObject",
                Self::Form => "Form",
                Self::Link => "Link",
                Self::InputMethodWindow => "InputMethodWindow",
                Self::TableRow => "TableRow",
                Self::TreeItem => "TreeItem",
                Self::DocumentSpreadsheet => "DocumentSpreadsheet",
                Self::DocumentPresentation => "DocumentPresentation",
                Self::DocumentText => "DocumentText",
                Self::DocumentWeb => "DocumentWeb",
                Self::DocumentEmail => "DocumentEmail",
                Self::Comment => "Comment",
                Self::ListBox => "ListBox",
                Self::Grouping => "Grouping",
                Self::ImageMap => "ImageMap",
                Self::Notification => "Notification",
                Self::InfoBar => "InfoBar",
                Self::LevelBar => "LevelBar",
                Self::TitleBar => "TitleBar",
                Self::BlockQuote => "BlockQuote",
                Self::Audio => "Audio",
                Self::Video => "Video",
                Self::Definition => "Definition",
                Self::Article => "Article",
                Self::Landmark => "Landmark",
                Self::Log => "Log",
                Self::Marquee => "Marquee",
                Self::Math => "Math",
                Self::Rating => "Rating",
                Self::Timer => "Timer",
                Self::DescriptionList => "DescriptionList",
                Self::DescriptionTerm => "DescriptionTerm",
                Self::DescriptionValue => "DescriptionValue",
                Self::Static => "Static",
                Self::MathFraction => "MathFraction",
                Self::MathRoot => "MathRoot",
                Self::Subscript => "Subscript",
                Self::Superscript => "Superscript",
                Self::Footnote => "Footnote",
                Self::ContentDeletion => "ContentDeletion",
                Self::ContentInsertion => "ContentInsertion",
                Self::Mark => "Mark",
                Self::Suggestion => "Suggestion",
                Self::LastDefined => "LastDefined",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl IntoGlib for Role {
    type GlibType = ffi::AtkRole;

    fn into_glib(self) -> ffi::AtkRole {
        match self {
            Self::Invalid => ffi::ATK_ROLE_INVALID,
            Self::AcceleratorLabel => ffi::ATK_ROLE_ACCEL_LABEL,
            Self::Alert => ffi::ATK_ROLE_ALERT,
            Self::Animation => ffi::ATK_ROLE_ANIMATION,
            Self::Arrow => ffi::ATK_ROLE_ARROW,
            Self::Calendar => ffi::ATK_ROLE_CALENDAR,
            Self::Canvas => ffi::ATK_ROLE_CANVAS,
            Self::CheckBox => ffi::ATK_ROLE_CHECK_BOX,
            Self::CheckMenuItem => ffi::ATK_ROLE_CHECK_MENU_ITEM,
            Self::ColorChooser => ffi::ATK_ROLE_COLOR_CHOOSER,
            Self::ColumnHeader => ffi::ATK_ROLE_COLUMN_HEADER,
            Self::ComboBox => ffi::ATK_ROLE_COMBO_BOX,
            Self::DateEditor => ffi::ATK_ROLE_DATE_EDITOR,
            Self::DesktopIcon => ffi::ATK_ROLE_DESKTOP_ICON,
            Self::DesktopFrame => ffi::ATK_ROLE_DESKTOP_FRAME,
            Self::Dial => ffi::ATK_ROLE_DIAL,
            Self::Dialog => ffi::ATK_ROLE_DIALOG,
            Self::DirectoryPane => ffi::ATK_ROLE_DIRECTORY_PANE,
            Self::DrawingArea => ffi::ATK_ROLE_DRAWING_AREA,
            Self::FileChooser => ffi::ATK_ROLE_FILE_CHOOSER,
            Self::Filler => ffi::ATK_ROLE_FILLER,
            Self::FontChooser => ffi::ATK_ROLE_FONT_CHOOSER,
            Self::Frame => ffi::ATK_ROLE_FRAME,
            Self::GlassPane => ffi::ATK_ROLE_GLASS_PANE,
            Self::HtmlContainer => ffi::ATK_ROLE_HTML_CONTAINER,
            Self::Icon => ffi::ATK_ROLE_ICON,
            Self::Image => ffi::ATK_ROLE_IMAGE,
            Self::InternalFrame => ffi::ATK_ROLE_INTERNAL_FRAME,
            Self::Label => ffi::ATK_ROLE_LABEL,
            Self::LayeredPane => ffi::ATK_ROLE_LAYERED_PANE,
            Self::List => ffi::ATK_ROLE_LIST,
            Self::ListItem => ffi::ATK_ROLE_LIST_ITEM,
            Self::Menu => ffi::ATK_ROLE_MENU,
            Self::MenuBar => ffi::ATK_ROLE_MENU_BAR,
            Self::MenuItem => ffi::ATK_ROLE_MENU_ITEM,
            Self::OptionPane => ffi::ATK_ROLE_OPTION_PANE,
            Self::PageTab => ffi::ATK_ROLE_PAGE_TAB,
            Self::PageTabList => ffi::ATK_ROLE_PAGE_TAB_LIST,
            Self::Panel => ffi::ATK_ROLE_PANEL,
            Self::PasswordText => ffi::ATK_ROLE_PASSWORD_TEXT,
            Self::PopupMenu => ffi::ATK_ROLE_POPUP_MENU,
            Self::ProgressBar => ffi::ATK_ROLE_PROGRESS_BAR,
            Self::PushButton => ffi::ATK_ROLE_PUSH_BUTTON,
            Self::RadioButton => ffi::ATK_ROLE_RADIO_BUTTON,
            Self::RadioMenuItem => ffi::ATK_ROLE_RADIO_MENU_ITEM,
            Self::RootPane => ffi::ATK_ROLE_ROOT_PANE,
            Self::RowHeader => ffi::ATK_ROLE_ROW_HEADER,
            Self::ScrollBar => ffi::ATK_ROLE_SCROLL_BAR,
            Self::ScrollPane => ffi::ATK_ROLE_SCROLL_PANE,
            Self::Separator => ffi::ATK_ROLE_SEPARATOR,
            Self::Slider => ffi::ATK_ROLE_SLIDER,
            Self::SplitPane => ffi::ATK_ROLE_SPLIT_PANE,
            Self::SpinButton => ffi::ATK_ROLE_SPIN_BUTTON,
            Self::Statusbar => ffi::ATK_ROLE_STATUSBAR,
            Self::Table => ffi::ATK_ROLE_TABLE,
            Self::TableCell => ffi::ATK_ROLE_TABLE_CELL,
            Self::TableColumnHeader => ffi::ATK_ROLE_TABLE_COLUMN_HEADER,
            Self::TableRowHeader => ffi::ATK_ROLE_TABLE_ROW_HEADER,
            Self::TearOffMenuItem => ffi::ATK_ROLE_TEAR_OFF_MENU_ITEM,
            Self::Terminal => ffi::ATK_ROLE_TERMINAL,
            Self::Text => ffi::ATK_ROLE_TEXT,
            Self::ToggleButton => ffi::ATK_ROLE_TOGGLE_BUTTON,
            Self::ToolBar => ffi::ATK_ROLE_TOOL_BAR,
            Self::ToolTip => ffi::ATK_ROLE_TOOL_TIP,
            Self::Tree => ffi::ATK_ROLE_TREE,
            Self::TreeTable => ffi::ATK_ROLE_TREE_TABLE,
            Self::Unknown => ffi::ATK_ROLE_UNKNOWN,
            Self::Viewport => ffi::ATK_ROLE_VIEWPORT,
            Self::Window => ffi::ATK_ROLE_WINDOW,
            Self::Header => ffi::ATK_ROLE_HEADER,
            Self::Footer => ffi::ATK_ROLE_FOOTER,
            Self::Paragraph => ffi::ATK_ROLE_PARAGRAPH,
            Self::Ruler => ffi::ATK_ROLE_RULER,
            Self::Application => ffi::ATK_ROLE_APPLICATION,
            Self::Autocomplete => ffi::ATK_ROLE_AUTOCOMPLETE,
            Self::EditBar => ffi::ATK_ROLE_EDITBAR,
            Self::Embedded => ffi::ATK_ROLE_EMBEDDED,
            Self::Entry => ffi::ATK_ROLE_ENTRY,
            Self::Chart => ffi::ATK_ROLE_CHART,
            Self::Caption => ffi::ATK_ROLE_CAPTION,
            Self::DocumentFrame => ffi::ATK_ROLE_DOCUMENT_FRAME,
            Self::Heading => ffi::ATK_ROLE_HEADING,
            Self::Page => ffi::ATK_ROLE_PAGE,
            Self::Section => ffi::ATK_ROLE_SECTION,
            Self::RedundantObject => ffi::ATK_ROLE_REDUNDANT_OBJECT,
            Self::Form => ffi::ATK_ROLE_FORM,
            Self::Link => ffi::ATK_ROLE_LINK,
            Self::InputMethodWindow => ffi::ATK_ROLE_INPUT_METHOD_WINDOW,
            Self::TableRow => ffi::ATK_ROLE_TABLE_ROW,
            Self::TreeItem => ffi::ATK_ROLE_TREE_ITEM,
            Self::DocumentSpreadsheet => ffi::ATK_ROLE_DOCUMENT_SPREADSHEET,
            Self::DocumentPresentation => ffi::ATK_ROLE_DOCUMENT_PRESENTATION,
            Self::DocumentText => ffi::ATK_ROLE_DOCUMENT_TEXT,
            Self::DocumentWeb => ffi::ATK_ROLE_DOCUMENT_WEB,
            Self::DocumentEmail => ffi::ATK_ROLE_DOCUMENT_EMAIL,
            Self::Comment => ffi::ATK_ROLE_COMMENT,
            Self::ListBox => ffi::ATK_ROLE_LIST_BOX,
            Self::Grouping => ffi::ATK_ROLE_GROUPING,
            Self::ImageMap => ffi::ATK_ROLE_IMAGE_MAP,
            Self::Notification => ffi::ATK_ROLE_NOTIFICATION,
            Self::InfoBar => ffi::ATK_ROLE_INFO_BAR,
            Self::LevelBar => ffi::ATK_ROLE_LEVEL_BAR,
            Self::TitleBar => ffi::ATK_ROLE_TITLE_BAR,
            Self::BlockQuote => ffi::ATK_ROLE_BLOCK_QUOTE,
            Self::Audio => ffi::ATK_ROLE_AUDIO,
            Self::Video => ffi::ATK_ROLE_VIDEO,
            Self::Definition => ffi::ATK_ROLE_DEFINITION,
            Self::Article => ffi::ATK_ROLE_ARTICLE,
            Self::Landmark => ffi::ATK_ROLE_LANDMARK,
            Self::Log => ffi::ATK_ROLE_LOG,
            Self::Marquee => ffi::ATK_ROLE_MARQUEE,
            Self::Math => ffi::ATK_ROLE_MATH,
            Self::Rating => ffi::ATK_ROLE_RATING,
            Self::Timer => ffi::ATK_ROLE_TIMER,
            Self::DescriptionList => ffi::ATK_ROLE_DESCRIPTION_LIST,
            Self::DescriptionTerm => ffi::ATK_ROLE_DESCRIPTION_TERM,
            Self::DescriptionValue => ffi::ATK_ROLE_DESCRIPTION_VALUE,
            Self::Static => ffi::ATK_ROLE_STATIC,
            Self::MathFraction => ffi::ATK_ROLE_MATH_FRACTION,
            Self::MathRoot => ffi::ATK_ROLE_MATH_ROOT,
            Self::Subscript => ffi::ATK_ROLE_SUBSCRIPT,
            Self::Superscript => ffi::ATK_ROLE_SUPERSCRIPT,
            Self::Footnote => ffi::ATK_ROLE_FOOTNOTE,
            Self::ContentDeletion => ffi::ATK_ROLE_CONTENT_DELETION,
            Self::ContentInsertion => ffi::ATK_ROLE_CONTENT_INSERTION,
            Self::Mark => ffi::ATK_ROLE_MARK,
            Self::Suggestion => ffi::ATK_ROLE_SUGGESTION,
            Self::LastDefined => ffi::ATK_ROLE_LAST_DEFINED,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AtkRole> for Role {
    unsafe fn from_glib(value: ffi::AtkRole) -> Self {
        skip_assert_initialized!();
        match value {
            ffi::ATK_ROLE_INVALID => Self::Invalid,
            ffi::ATK_ROLE_ACCEL_LABEL => Self::AcceleratorLabel,
            ffi::ATK_ROLE_ALERT => Self::Alert,
            ffi::ATK_ROLE_ANIMATION => Self::Animation,
            ffi::ATK_ROLE_ARROW => Self::Arrow,
            ffi::ATK_ROLE_CALENDAR => Self::Calendar,
            ffi::ATK_ROLE_CANVAS => Self::Canvas,
            ffi::ATK_ROLE_CHECK_BOX => Self::CheckBox,
            ffi::ATK_ROLE_CHECK_MENU_ITEM => Self::CheckMenuItem,
            ffi::ATK_ROLE_COLOR_CHOOSER => Self::ColorChooser,
            ffi::ATK_ROLE_COLUMN_HEADER => Self::ColumnHeader,
            ffi::ATK_ROLE_COMBO_BOX => Self::ComboBox,
            ffi::ATK_ROLE_DATE_EDITOR => Self::DateEditor,
            ffi::ATK_ROLE_DESKTOP_ICON => Self::DesktopIcon,
            ffi::ATK_ROLE_DESKTOP_FRAME => Self::DesktopFrame,
            ffi::ATK_ROLE_DIAL => Self::Dial,
            ffi::ATK_ROLE_DIALOG => Self::Dialog,
            ffi::ATK_ROLE_DIRECTORY_PANE => Self::DirectoryPane,
            ffi::ATK_ROLE_DRAWING_AREA => Self::DrawingArea,
            ffi::ATK_ROLE_FILE_CHOOSER => Self::FileChooser,
            ffi::ATK_ROLE_FILLER => Self::Filler,
            ffi::ATK_ROLE_FONT_CHOOSER => Self::FontChooser,
            ffi::ATK_ROLE_FRAME => Self::Frame,
            ffi::ATK_ROLE_GLASS_PANE => Self::GlassPane,
            ffi::ATK_ROLE_HTML_CONTAINER => Self::HtmlContainer,
            ffi::ATK_ROLE_ICON => Self::Icon,
            ffi::ATK_ROLE_IMAGE => Self::Image,
            ffi::ATK_ROLE_INTERNAL_FRAME => Self::InternalFrame,
            ffi::ATK_ROLE_LABEL => Self::Label,
            ffi::ATK_ROLE_LAYERED_PANE => Self::LayeredPane,
            ffi::ATK_ROLE_LIST => Self::List,
            ffi::ATK_ROLE_LIST_ITEM => Self::ListItem,
            ffi::ATK_ROLE_MENU => Self::Menu,
            ffi::ATK_ROLE_MENU_BAR => Self::MenuBar,
            ffi::ATK_ROLE_MENU_ITEM => Self::MenuItem,
            ffi::ATK_ROLE_OPTION_PANE => Self::OptionPane,
            ffi::ATK_ROLE_PAGE_TAB => Self::PageTab,
            ffi::ATK_ROLE_PAGE_TAB_LIST => Self::PageTabList,
            ffi::ATK_ROLE_PANEL => Self::Panel,
            ffi::ATK_ROLE_PASSWORD_TEXT => Self::PasswordText,
            ffi::ATK_ROLE_POPUP_MENU => Self::PopupMenu,
            ffi::ATK_ROLE_PROGRESS_BAR => Self::ProgressBar,
            ffi::ATK_ROLE_PUSH_BUTTON => Self::PushButton,
            ffi::ATK_ROLE_RADIO_BUTTON => Self::RadioButton,
            ffi::ATK_ROLE_RADIO_MENU_ITEM => Self::RadioMenuItem,
            ffi::ATK_ROLE_ROOT_PANE => Self::RootPane,
            ffi::ATK_ROLE_ROW_HEADER => Self::RowHeader,
            ffi::ATK_ROLE_SCROLL_BAR => Self::ScrollBar,
            ffi::ATK_ROLE_SCROLL_PANE => Self::ScrollPane,
            ffi::ATK_ROLE_SEPARATOR => Self::Separator,
            ffi::ATK_ROLE_SLIDER => Self::Slider,
            ffi::ATK_ROLE_SPLIT_PANE => Self::SplitPane,
            ffi::ATK_ROLE_SPIN_BUTTON => Self::SpinButton,
            ffi::ATK_ROLE_STATUSBAR => Self::Statusbar,
            ffi::ATK_ROLE_TABLE => Self::Table,
            ffi::ATK_ROLE_TABLE_CELL => Self::TableCell,
            ffi::ATK_ROLE_TABLE_COLUMN_HEADER => Self::TableColumnHeader,
            ffi::ATK_ROLE_TABLE_ROW_HEADER => Self::TableRowHeader,
            ffi::ATK_ROLE_TEAR_OFF_MENU_ITEM => Self::TearOffMenuItem,
            ffi::ATK_ROLE_TERMINAL => Self::Terminal,
            ffi::ATK_ROLE_TEXT => Self::Text,
            ffi::ATK_ROLE_TOGGLE_BUTTON => Self::ToggleButton,
            ffi::ATK_ROLE_TOOL_BAR => Self::ToolBar,
            ffi::ATK_ROLE_TOOL_TIP => Self::ToolTip,
            ffi::ATK_ROLE_TREE => Self::Tree,
            ffi::ATK_ROLE_TREE_TABLE => Self::TreeTable,
            ffi::ATK_ROLE_UNKNOWN => Self::Unknown,
            ffi::ATK_ROLE_VIEWPORT => Self::Viewport,
            ffi::ATK_ROLE_WINDOW => Self::Window,
            ffi::ATK_ROLE_HEADER => Self::Header,
            ffi::ATK_ROLE_FOOTER => Self::Footer,
            ffi::ATK_ROLE_PARAGRAPH => Self::Paragraph,
            ffi::ATK_ROLE_RULER => Self::Ruler,
            ffi::ATK_ROLE_APPLICATION => Self::Application,
            ffi::ATK_ROLE_AUTOCOMPLETE => Self::Autocomplete,
            ffi::ATK_ROLE_EDITBAR => Self::EditBar,
            ffi::ATK_ROLE_EMBEDDED => Self::Embedded,
            ffi::ATK_ROLE_ENTRY => Self::Entry,
            ffi::ATK_ROLE_CHART => Self::Chart,
            ffi::ATK_ROLE_CAPTION => Self::Caption,
            ffi::ATK_ROLE_DOCUMENT_FRAME => Self::DocumentFrame,
            ffi::ATK_ROLE_HEADING => Self::Heading,
            ffi::ATK_ROLE_PAGE => Self::Page,
            ffi::ATK_ROLE_SECTION => Self::Section,
            ffi::ATK_ROLE_REDUNDANT_OBJECT => Self::RedundantObject,
            ffi::ATK_ROLE_FORM => Self::Form,
            ffi::ATK_ROLE_LINK => Self::Link,
            ffi::ATK_ROLE_INPUT_METHOD_WINDOW => Self::InputMethodWindow,
            ffi::ATK_ROLE_TABLE_ROW => Self::TableRow,
            ffi::ATK_ROLE_TREE_ITEM => Self::TreeItem,
            ffi::ATK_ROLE_DOCUMENT_SPREADSHEET => Self::DocumentSpreadsheet,
            ffi::ATK_ROLE_DOCUMENT_PRESENTATION => Self::DocumentPresentation,
            ffi::ATK_ROLE_DOCUMENT_TEXT => Self::DocumentText,
            ffi::ATK_ROLE_DOCUMENT_WEB => Self::DocumentWeb,
            ffi::ATK_ROLE_DOCUMENT_EMAIL => Self::DocumentEmail,
            ffi::ATK_ROLE_COMMENT => Self::Comment,
            ffi::ATK_ROLE_LIST_BOX => Self::ListBox,
            ffi::ATK_ROLE_GROUPING => Self::Grouping,
            ffi::ATK_ROLE_IMAGE_MAP => Self::ImageMap,
            ffi::ATK_ROLE_NOTIFICATION => Self::Notification,
            ffi::ATK_ROLE_INFO_BAR => Self::InfoBar,
            ffi::ATK_ROLE_LEVEL_BAR => Self::LevelBar,
            ffi::ATK_ROLE_TITLE_BAR => Self::TitleBar,
            ffi::ATK_ROLE_BLOCK_QUOTE => Self::BlockQuote,
            ffi::ATK_ROLE_AUDIO => Self::Audio,
            ffi::ATK_ROLE_VIDEO => Self::Video,
            ffi::ATK_ROLE_DEFINITION => Self::Definition,
            ffi::ATK_ROLE_ARTICLE => Self::Article,
            ffi::ATK_ROLE_LANDMARK => Self::Landmark,
            ffi::ATK_ROLE_LOG => Self::Log,
            ffi::ATK_ROLE_MARQUEE => Self::Marquee,
            ffi::ATK_ROLE_MATH => Self::Math,
            ffi::ATK_ROLE_RATING => Self::Rating,
            ffi::ATK_ROLE_TIMER => Self::Timer,
            ffi::ATK_ROLE_DESCRIPTION_LIST => Self::DescriptionList,
            ffi::ATK_ROLE_DESCRIPTION_TERM => Self::DescriptionTerm,
            ffi::ATK_ROLE_DESCRIPTION_VALUE => Self::DescriptionValue,
            ffi::ATK_ROLE_STATIC => Self::Static,
            ffi::ATK_ROLE_MATH_FRACTION => Self::MathFraction,
            ffi::ATK_ROLE_MATH_ROOT => Self::MathRoot,
            ffi::ATK_ROLE_SUBSCRIPT => Self::Subscript,
            ffi::ATK_ROLE_SUPERSCRIPT => Self::Superscript,
            ffi::ATK_ROLE_FOOTNOTE => Self::Footnote,
            ffi::ATK_ROLE_CONTENT_DELETION => Self::ContentDeletion,
            ffi::ATK_ROLE_CONTENT_INSERTION => Self::ContentInsertion,
            ffi::ATK_ROLE_MARK => Self::Mark,
            ffi::ATK_ROLE_SUGGESTION => Self::Suggestion,
            ffi::ATK_ROLE_LAST_DEFINED => Self::LastDefined,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for Role {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::atk_role_get_type()) }
    }
}

impl glib::value::ValueType for Role {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for Role {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for Role {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

/// Specifies where an object should be placed on the screen when using scroll_to.
#[cfg(any(feature = "v2_30", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_30")))]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AtkScrollType")]
pub enum ScrollType {
    /// Scroll the object vertically and horizontally to bring
    ///  its top left corner to the top left corner of the window.
    #[doc(alias = "ATK_SCROLL_TOP_LEFT")]
    TopLeft,
    /// Scroll the object vertically and horizontally to
    ///  bring its bottom right corner to the bottom right corner of the window.
    #[doc(alias = "ATK_SCROLL_BOTTOM_RIGHT")]
    BottomRight,
    /// Scroll the object vertically to bring its top edge to
    ///  the top edge of the window.
    #[doc(alias = "ATK_SCROLL_TOP_EDGE")]
    TopEdge,
    /// Scroll the object vertically to bring its bottom
    ///  edge to the bottom edge of the window.
    #[doc(alias = "ATK_SCROLL_BOTTOM_EDGE")]
    BottomEdge,
    /// Scroll the object vertically and horizontally to bring
    ///  its left edge to the left edge of the window.
    #[doc(alias = "ATK_SCROLL_LEFT_EDGE")]
    LeftEdge,
    /// Scroll the object vertically and horizontally to
    ///  bring its right edge to the right edge of the window.
    #[doc(alias = "ATK_SCROLL_RIGHT_EDGE")]
    RightEdge,
    /// Scroll the object vertically and horizontally so that
    ///  as much as possible of the object becomes visible. The exact placement is
    ///  determined by the application.
    #[doc(alias = "ATK_SCROLL_ANYWHERE")]
    Anywhere,
    #[doc(hidden)]
    __Unknown(i32),
}

#[cfg(any(feature = "v2_30", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_30")))]
impl fmt::Display for ScrollType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "ScrollType::{}",
            match *self {
                Self::TopLeft => "TopLeft",
                Self::BottomRight => "BottomRight",
                Self::TopEdge => "TopEdge",
                Self::BottomEdge => "BottomEdge",
                Self::LeftEdge => "LeftEdge",
                Self::RightEdge => "RightEdge",
                Self::Anywhere => "Anywhere",
                _ => "Unknown",
            }
        )
    }
}

#[cfg(any(feature = "v2_30", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_30")))]
#[doc(hidden)]
impl IntoGlib for ScrollType {
    type GlibType = ffi::AtkScrollType;

    fn into_glib(self) -> ffi::AtkScrollType {
        match self {
            Self::TopLeft => ffi::ATK_SCROLL_TOP_LEFT,
            Self::BottomRight => ffi::ATK_SCROLL_BOTTOM_RIGHT,
            Self::TopEdge => ffi::ATK_SCROLL_TOP_EDGE,
            Self::BottomEdge => ffi::ATK_SCROLL_BOTTOM_EDGE,
            Self::LeftEdge => ffi::ATK_SCROLL_LEFT_EDGE,
            Self::RightEdge => ffi::ATK_SCROLL_RIGHT_EDGE,
            Self::Anywhere => ffi::ATK_SCROLL_ANYWHERE,
            Self::__Unknown(value) => value,
        }
    }
}

#[cfg(any(feature = "v2_30", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_30")))]
#[doc(hidden)]
impl FromGlib<ffi::AtkScrollType> for ScrollType {
    unsafe fn from_glib(value: ffi::AtkScrollType) -> Self {
        skip_assert_initialized!();
        match value {
            ffi::ATK_SCROLL_TOP_LEFT => Self::TopLeft,
            ffi::ATK_SCROLL_BOTTOM_RIGHT => Self::BottomRight,
            ffi::ATK_SCROLL_TOP_EDGE => Self::TopEdge,
            ffi::ATK_SCROLL_BOTTOM_EDGE => Self::BottomEdge,
            ffi::ATK_SCROLL_LEFT_EDGE => Self::LeftEdge,
            ffi::ATK_SCROLL_RIGHT_EDGE => Self::RightEdge,
            ffi::ATK_SCROLL_ANYWHERE => Self::Anywhere,
            value => Self::__Unknown(value),
        }
    }
}

#[cfg(any(feature = "v2_30", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_30")))]
impl StaticType for ScrollType {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::atk_scroll_type_get_type()) }
    }
}

#[cfg(any(feature = "v2_30", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_30")))]
impl glib::value::ValueType for ScrollType {
    type Type = Self;
}

#[cfg(any(feature = "v2_30", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_30")))]
unsafe impl<'a> FromValue<'a> for ScrollType {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v2_30", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_30")))]
impl ToValue for ScrollType {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

/// The possible types of states of an object
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AtkStateType")]
pub enum StateType {
    /// Indicates an invalid state - probably an error condition.
    #[doc(alias = "ATK_STATE_INVALID")]
    Invalid,
    /// Indicates a window is currently the active window, or an object is the active subelement within a container or table. ATK_STATE_ACTIVE should not be used for objects which have ATK_STATE_FOCUSABLE or ATK_STATE_SELECTABLE: Those objects should use ATK_STATE_FOCUSED and ATK_STATE_SELECTED respectively. ATK_STATE_ACTIVE is a means to indicate that an object which is not focusable and not selectable is the currently-active item within its parent container.
    #[doc(alias = "ATK_STATE_ACTIVE")]
    Active,
    /// Indicates that the object is 'armed', i.e. will be activated by if a pointer button-release event occurs within its bounds. Buttons often enter this state when a pointer click occurs within their bounds, as a precursor to activation. ATK_STATE_ARMED has been deprecated since ATK-2.16 and should not be used in newly-written code.
    #[doc(alias = "ATK_STATE_ARMED")]
    Armed,
    /// Indicates the current object is busy, i.e. onscreen representation is in the process of changing, or the object is temporarily unavailable for interaction due to activity already in progress. This state may be used by implementors of Document to indicate that content loading is underway. It also may indicate other 'pending' conditions; clients may wish to interrogate this object when the ATK_STATE_BUSY flag is removed.
    #[doc(alias = "ATK_STATE_BUSY")]
    Busy,
    /// Indicates this object is currently checked, for instance a checkbox is 'non-empty'.
    #[doc(alias = "ATK_STATE_CHECKED")]
    Checked,
    /// Indicates that this object no longer has a valid backing widget (for instance, if its peer object has been destroyed)
    #[doc(alias = "ATK_STATE_DEFUNCT")]
    Defunct,
    /// Indicates that this object can contain text, and that the
    /// user can change the textual contents of this object by editing those contents
    /// directly. For an object which is expected to be editable due to its type, but
    /// which cannot be edited due to the application or platform preventing the user
    /// from doing so, that object's [`StateSet`][crate::StateSet] should lack ATK_STATE_EDITABLE and
    /// should contain ATK_STATE_READ_ONLY.
    #[doc(alias = "ATK_STATE_EDITABLE")]
    Editable,
    /// Indicates that this object is enabled, i.e. that it currently reflects some application state. Objects that are "greyed out" may lack this state, and may lack the STATE_SENSITIVE if direct user interaction cannot cause them to acquire STATE_ENABLED. See also: ATK_STATE_SENSITIVE
    #[doc(alias = "ATK_STATE_ENABLED")]
    Enabled,
    /// Indicates this object allows progressive disclosure of its children
    #[doc(alias = "ATK_STATE_EXPANDABLE")]
    Expandable,
    /// Indicates this object its expanded - see ATK_STATE_EXPANDABLE above
    #[doc(alias = "ATK_STATE_EXPANDED")]
    Expanded,
    /// Indicates this object can accept keyboard focus, which means all events resulting from typing on the keyboard will normally be passed to it when it has focus
    #[doc(alias = "ATK_STATE_FOCUSABLE")]
    Focusable,
    /// Indicates this object currently has the keyboard focus
    #[doc(alias = "ATK_STATE_FOCUSED")]
    Focused,
    /// Indicates the orientation of this object is horizontal; used, for instance, by objects of ATK_ROLE_SCROLL_BAR. For objects where vertical/horizontal orientation is especially meaningful.
    #[doc(alias = "ATK_STATE_HORIZONTAL")]
    Horizontal,
    /// Indicates this object is minimized and is represented only by an icon
    #[doc(alias = "ATK_STATE_ICONIFIED")]
    Iconified,
    /// Indicates something must be done with this object before the user can interact with an object in a different window
    #[doc(alias = "ATK_STATE_MODAL")]
    Modal,
    /// Indicates this (text) object can contain multiple lines of text
    #[doc(alias = "ATK_STATE_MULTI_LINE")]
    MultiLine,
    /// Indicates this object allows more than one of its children to be selected at the same time, or in the case of text objects, that the object supports non-contiguous text selections.
    #[doc(alias = "ATK_STATE_MULTISELECTABLE")]
    Multiselectable,
    /// Indicates this object paints every pixel within its rectangular region.
    #[doc(alias = "ATK_STATE_OPAQUE")]
    Opaque,
    /// Indicates this object is currently pressed.
    #[doc(alias = "ATK_STATE_PRESSED")]
    Pressed,
    /// Indicates the size of this object is not fixed
    #[doc(alias = "ATK_STATE_RESIZABLE")]
    Resizable,
    /// Indicates this object is the child of an object that allows its children to be selected and that this child is one of those children that can be selected
    #[doc(alias = "ATK_STATE_SELECTABLE")]
    Selectable,
    /// Indicates this object is the child of an object that allows its children to be selected and that this child is one of those children that has been selected
    #[doc(alias = "ATK_STATE_SELECTED")]
    Selected,
    /// Indicates this object is sensitive, e.g. to user interaction.
    /// STATE_SENSITIVE usually accompanies STATE_ENABLED for user-actionable controls,
    /// but may be found in the absence of STATE_ENABLED if the current visible state of the
    /// control is "disconnected" from the application state. In such cases, direct user interaction
    /// can often result in the object gaining STATE_SENSITIVE, for instance if a user makes
    /// an explicit selection using an object whose current state is ambiguous or undefined.
    /// `see` STATE_ENABLED, STATE_INDETERMINATE.
    #[doc(alias = "ATK_STATE_SENSITIVE")]
    Sensitive,
    /// Indicates this object, the object's parent, the object's parent's parent, and so on,
    /// are all 'shown' to the end-user, i.e. subject to "exposure" if blocking or obscuring objects do not interpose
    /// between this object and the top of the window stack.
    #[doc(alias = "ATK_STATE_SHOWING")]
    Showing,
    /// Indicates this (text) object can contain only a single line of text
    #[doc(alias = "ATK_STATE_SINGLE_LINE")]
    SingleLine,
    /// Indicates that the information returned for this object may no longer be
    /// synchronized with the application state. This is implied if the object has STATE_TRANSIENT,
    /// and can also occur towards the end of the object peer's lifecycle. It can also be used to indicate that
    /// the index associated with this object has changed since the user accessed the object (in lieu of
    /// "index-in-parent-changed" events).
    #[doc(alias = "ATK_STATE_STALE")]
    Stale,
    /// Indicates this object is transient, i.e. a snapshot which may not emit events when its
    /// state changes. Data from objects with ATK_STATE_TRANSIENT should not be cached, since there may be no
    /// notification given when the cached data becomes obsolete.
    #[doc(alias = "ATK_STATE_TRANSIENT")]
    Transient,
    /// Indicates the orientation of this object is vertical
    #[doc(alias = "ATK_STATE_VERTICAL")]
    Vertical,
    /// Indicates this object is visible, e.g. has been explicitly marked for exposure to the user.
    /// **note**: [`Visible`][Self::Visible] is no guarantee that the object is actually unobscured on the screen, only
    /// that it is 'potentially' visible, barring obstruction, being scrolled or clipped out of the
    /// field of view, or having an ancestor container that has not yet made visible.
    /// A widget is potentially onscreen if it has both [`Visible`][Self::Visible] and [`Showing`][Self::Showing].
    /// The absence of [`Visible`][Self::Visible] and [`Showing`][Self::Showing] is semantically equivalent to saying
    /// that an object is 'hidden'. See also [`Truncated`][Self::Truncated], which applies if an object with
    /// [`Visible`][Self::Visible] and [`Showing`][Self::Showing] set lies within a viewport which means that its
    /// contents are clipped, e.g. a truncated spreadsheet cell or
    /// an image within a scrolling viewport. Mostly useful for screen-review and magnification
    /// algorithms.
    #[doc(alias = "ATK_STATE_VISIBLE")]
    Visible,
    /// Indicates that "active-descendant-changed" event
    /// is sent when children become 'active' (i.e. are selected or navigated to onscreen).
    /// Used to prevent need to enumerate all children in very large containers, like tables.
    /// The presence of STATE_MANAGES_DESCENDANTS is an indication to the client.
    /// that the children should not, and need not, be enumerated by the client.
    /// Objects implementing this state are expected to provide relevant state
    /// notifications to listening clients, for instance notifications of visibility
    /// changes and activation of their contained child objects, without the client
    /// having previously requested references to those children.
    #[doc(alias = "ATK_STATE_MANAGES_DESCENDANTS")]
    ManagesDescendants,
    /// Indicates that the value, or some other quantifiable
    /// property, of this AtkObject cannot be fully determined. In the case of a large
    /// data set in which the total number of items in that set is unknown (e.g. 1 of
    /// 999+), implementors should expose the currently-known set size (999) along
    /// with this state. In the case of a check box, this state should be used to
    /// indicate that the check box is a tri-state check box which is currently
    /// neither checked nor unchecked.
    #[doc(alias = "ATK_STATE_INDETERMINATE")]
    Indeterminate,
    /// Indicates that an object is truncated, e.g. a text value in a speradsheet cell.
    #[doc(alias = "ATK_STATE_TRUNCATED")]
    Truncated,
    /// Indicates that explicit user interaction with an object is required by the user interface, e.g. a required field in a "web-form" interface.
    #[doc(alias = "ATK_STATE_REQUIRED")]
    Required,
    /// Indicates that the object has encountered an error condition due to failure of input validation. For instance, a form control may acquire this state in response to invalid or malformed user input.
    #[doc(alias = "ATK_STATE_INVALID_ENTRY")]
    InvalidEntry,
    /// Indicates that the object in question implements some form of ¨typeahead¨ or
    /// pre-selection behavior whereby entering the first character of one or more sub-elements
    /// causes those elements to scroll into view or become selected. Subsequent character input
    /// may narrow the selection further as long as one or more sub-elements match the string.
    /// This state is normally only useful and encountered on objects that implement Selection.
    /// In some cases the typeahead behavior may result in full or partial ¨completion¨ of
    /// the data in the input field, in which case these input events may trigger text-changed
    /// events from the AtkText interface. This state supplants [`Role::Autocomplete`][crate::Role::Autocomplete].
    #[doc(alias = "ATK_STATE_SUPPORTS_AUTOCOMPLETION")]
    SupportsAutocompletion,
    /// Indicates that the object in question supports text selection. It should only be exposed on objects which implement the Text interface, in order to distinguish this state from [`Selectable`][Self::Selectable], which infers that the object in question is a selectable child of an object which implements Selection. While similar, text selection and subelement selection are distinct operations.
    #[doc(alias = "ATK_STATE_SELECTABLE_TEXT")]
    SelectableText,
    /// Indicates that the object is the "default" active component, i.e. the object which is activated by an end-user press of the "Enter" or "Return" key. Typically a "close" or "submit" button.
    #[doc(alias = "ATK_STATE_DEFAULT")]
    Default,
    /// Indicates that the object changes its appearance dynamically as an inherent part of its presentation. This state may come and go if an object is only temporarily animated on the way to a 'final' onscreen presentation.
    /// **note**: some applications, notably content viewers, may not be able to detect
    /// all kinds of animated content. Therefore the absence of this state should not
    /// be taken as definitive evidence that the object's visual representation is
    /// static; this state is advisory.
    #[doc(alias = "ATK_STATE_ANIMATED")]
    Animated,
    /// Indicates that the object (typically a hyperlink) has already been 'activated', and/or its backing data has already been downloaded, rendered, or otherwise "visited".
    #[doc(alias = "ATK_STATE_VISITED")]
    Visited,
    /// Indicates this object has the potential to be
    ///  checked, such as a checkbox or toggle-able table cell. `Since`:
    ///  ATK-2.12
    #[doc(alias = "ATK_STATE_CHECKABLE")]
    Checkable,
    /// Indicates that the object has a popup context
    /// menu or sub-level menu which may or may not be showing. This means
    /// that activation renders conditional content. Note that ordinary
    /// tooltips are not considered popups in this context. `Since`: ATK-2.12
    #[doc(alias = "ATK_STATE_HAS_POPUP")]
    HasPopup,
    /// Indicates this object has a tooltip. `Since`: ATK-2.16
    #[doc(alias = "ATK_STATE_HAS_TOOLTIP")]
    HasTooltip,
    /// Indicates that a widget which is ENABLED and SENSITIVE
    /// has a value which can be read, but not modified, by the user. Note that this
    /// state should only be applied to widget types whose value is normally directly
    /// user modifiable, such as check boxes, radio buttons, spin buttons, text input
    /// fields, and combo boxes, as a means to convey that the expected interaction
    /// with that widget is not possible. When the expected interaction with a
    /// widget does not include modification by the user, as is the case with
    /// labels and containers, ATK_STATE_READ_ONLY should not be applied. See also
    /// ATK_STATE_EDITABLE. `Since`: ATK-2-16
    #[doc(alias = "ATK_STATE_READ_ONLY")]
    ReadOnly,
    /// Not a valid state, used for finding end of enumeration
    #[doc(alias = "ATK_STATE_LAST_DEFINED")]
    LastDefined,
    #[doc(hidden)]
    __Unknown(i32),
}

impl StateType {
    #[doc(alias = "atk_state_type_for_name")]
    pub fn for_name(name: &str) -> StateType {
        assert_initialized_main_thread!();
        unsafe { from_glib(ffi::atk_state_type_for_name(name.to_glib_none().0)) }
    }

    #[doc(alias = "atk_state_type_get_name")]
    #[doc(alias = "get_name")]
    pub fn name(self) -> Option<glib::GString> {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::atk_state_type_get_name(self.into_glib())) }
    }
}

impl fmt::Display for StateType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "StateType::{}",
            match *self {
                Self::Invalid => "Invalid",
                Self::Active => "Active",
                Self::Armed => "Armed",
                Self::Busy => "Busy",
                Self::Checked => "Checked",
                Self::Defunct => "Defunct",
                Self::Editable => "Editable",
                Self::Enabled => "Enabled",
                Self::Expandable => "Expandable",
                Self::Expanded => "Expanded",
                Self::Focusable => "Focusable",
                Self::Focused => "Focused",
                Self::Horizontal => "Horizontal",
                Self::Iconified => "Iconified",
                Self::Modal => "Modal",
                Self::MultiLine => "MultiLine",
                Self::Multiselectable => "Multiselectable",
                Self::Opaque => "Opaque",
                Self::Pressed => "Pressed",
                Self::Resizable => "Resizable",
                Self::Selectable => "Selectable",
                Self::Selected => "Selected",
                Self::Sensitive => "Sensitive",
                Self::Showing => "Showing",
                Self::SingleLine => "SingleLine",
                Self::Stale => "Stale",
                Self::Transient => "Transient",
                Self::Vertical => "Vertical",
                Self::Visible => "Visible",
                Self::ManagesDescendants => "ManagesDescendants",
                Self::Indeterminate => "Indeterminate",
                Self::Truncated => "Truncated",
                Self::Required => "Required",
                Self::InvalidEntry => "InvalidEntry",
                Self::SupportsAutocompletion => "SupportsAutocompletion",
                Self::SelectableText => "SelectableText",
                Self::Default => "Default",
                Self::Animated => "Animated",
                Self::Visited => "Visited",
                Self::Checkable => "Checkable",
                Self::HasPopup => "HasPopup",
                Self::HasTooltip => "HasTooltip",
                Self::ReadOnly => "ReadOnly",
                Self::LastDefined => "LastDefined",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl IntoGlib for StateType {
    type GlibType = ffi::AtkStateType;

    fn into_glib(self) -> ffi::AtkStateType {
        match self {
            Self::Invalid => ffi::ATK_STATE_INVALID,
            Self::Active => ffi::ATK_STATE_ACTIVE,
            Self::Armed => ffi::ATK_STATE_ARMED,
            Self::Busy => ffi::ATK_STATE_BUSY,
            Self::Checked => ffi::ATK_STATE_CHECKED,
            Self::Defunct => ffi::ATK_STATE_DEFUNCT,
            Self::Editable => ffi::ATK_STATE_EDITABLE,
            Self::Enabled => ffi::ATK_STATE_ENABLED,
            Self::Expandable => ffi::ATK_STATE_EXPANDABLE,
            Self::Expanded => ffi::ATK_STATE_EXPANDED,
            Self::Focusable => ffi::ATK_STATE_FOCUSABLE,
            Self::Focused => ffi::ATK_STATE_FOCUSED,
            Self::Horizontal => ffi::ATK_STATE_HORIZONTAL,
            Self::Iconified => ffi::ATK_STATE_ICONIFIED,
            Self::Modal => ffi::ATK_STATE_MODAL,
            Self::MultiLine => ffi::ATK_STATE_MULTI_LINE,
            Self::Multiselectable => ffi::ATK_STATE_MULTISELECTABLE,
            Self::Opaque => ffi::ATK_STATE_OPAQUE,
            Self::Pressed => ffi::ATK_STATE_PRESSED,
            Self::Resizable => ffi::ATK_STATE_RESIZABLE,
            Self::Selectable => ffi::ATK_STATE_SELECTABLE,
            Self::Selected => ffi::ATK_STATE_SELECTED,
            Self::Sensitive => ffi::ATK_STATE_SENSITIVE,
            Self::Showing => ffi::ATK_STATE_SHOWING,
            Self::SingleLine => ffi::ATK_STATE_SINGLE_LINE,
            Self::Stale => ffi::ATK_STATE_STALE,
            Self::Transient => ffi::ATK_STATE_TRANSIENT,
            Self::Vertical => ffi::ATK_STATE_VERTICAL,
            Self::Visible => ffi::ATK_STATE_VISIBLE,
            Self::ManagesDescendants => ffi::ATK_STATE_MANAGES_DESCENDANTS,
            Self::Indeterminate => ffi::ATK_STATE_INDETERMINATE,
            Self::Truncated => ffi::ATK_STATE_TRUNCATED,
            Self::Required => ffi::ATK_STATE_REQUIRED,
            Self::InvalidEntry => ffi::ATK_STATE_INVALID_ENTRY,
            Self::SupportsAutocompletion => ffi::ATK_STATE_SUPPORTS_AUTOCOMPLETION,
            Self::SelectableText => ffi::ATK_STATE_SELECTABLE_TEXT,
            Self::Default => ffi::ATK_STATE_DEFAULT,
            Self::Animated => ffi::ATK_STATE_ANIMATED,
            Self::Visited => ffi::ATK_STATE_VISITED,
            Self::Checkable => ffi::ATK_STATE_CHECKABLE,
            Self::HasPopup => ffi::ATK_STATE_HAS_POPUP,
            Self::HasTooltip => ffi::ATK_STATE_HAS_TOOLTIP,
            Self::ReadOnly => ffi::ATK_STATE_READ_ONLY,
            Self::LastDefined => ffi::ATK_STATE_LAST_DEFINED,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AtkStateType> for StateType {
    unsafe fn from_glib(value: ffi::AtkStateType) -> Self {
        skip_assert_initialized!();
        match value {
            ffi::ATK_STATE_INVALID => Self::Invalid,
            ffi::ATK_STATE_ACTIVE => Self::Active,
            ffi::ATK_STATE_ARMED => Self::Armed,
            ffi::ATK_STATE_BUSY => Self::Busy,
            ffi::ATK_STATE_CHECKED => Self::Checked,
            ffi::ATK_STATE_DEFUNCT => Self::Defunct,
            ffi::ATK_STATE_EDITABLE => Self::Editable,
            ffi::ATK_STATE_ENABLED => Self::Enabled,
            ffi::ATK_STATE_EXPANDABLE => Self::Expandable,
            ffi::ATK_STATE_EXPANDED => Self::Expanded,
            ffi::ATK_STATE_FOCUSABLE => Self::Focusable,
            ffi::ATK_STATE_FOCUSED => Self::Focused,
            ffi::ATK_STATE_HORIZONTAL => Self::Horizontal,
            ffi::ATK_STATE_ICONIFIED => Self::Iconified,
            ffi::ATK_STATE_MODAL => Self::Modal,
            ffi::ATK_STATE_MULTI_LINE => Self::MultiLine,
            ffi::ATK_STATE_MULTISELECTABLE => Self::Multiselectable,
            ffi::ATK_STATE_OPAQUE => Self::Opaque,
            ffi::ATK_STATE_PRESSED => Self::Pressed,
            ffi::ATK_STATE_RESIZABLE => Self::Resizable,
            ffi::ATK_STATE_SELECTABLE => Self::Selectable,
            ffi::ATK_STATE_SELECTED => Self::Selected,
            ffi::ATK_STATE_SENSITIVE => Self::Sensitive,
            ffi::ATK_STATE_SHOWING => Self::Showing,
            ffi::ATK_STATE_SINGLE_LINE => Self::SingleLine,
            ffi::ATK_STATE_STALE => Self::Stale,
            ffi::ATK_STATE_TRANSIENT => Self::Transient,
            ffi::ATK_STATE_VERTICAL => Self::Vertical,
            ffi::ATK_STATE_VISIBLE => Self::Visible,
            ffi::ATK_STATE_MANAGES_DESCENDANTS => Self::ManagesDescendants,
            ffi::ATK_STATE_INDETERMINATE => Self::Indeterminate,
            ffi::ATK_STATE_TRUNCATED => Self::Truncated,
            ffi::ATK_STATE_REQUIRED => Self::Required,
            ffi::ATK_STATE_INVALID_ENTRY => Self::InvalidEntry,
            ffi::ATK_STATE_SUPPORTS_AUTOCOMPLETION => Self::SupportsAutocompletion,
            ffi::ATK_STATE_SELECTABLE_TEXT => Self::SelectableText,
            ffi::ATK_STATE_DEFAULT => Self::Default,
            ffi::ATK_STATE_ANIMATED => Self::Animated,
            ffi::ATK_STATE_VISITED => Self::Visited,
            ffi::ATK_STATE_CHECKABLE => Self::Checkable,
            ffi::ATK_STATE_HAS_POPUP => Self::HasPopup,
            ffi::ATK_STATE_HAS_TOOLTIP => Self::HasTooltip,
            ffi::ATK_STATE_READ_ONLY => Self::ReadOnly,
            ffi::ATK_STATE_LAST_DEFINED => Self::LastDefined,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for StateType {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::atk_state_type_get_type()) }
    }
}

impl glib::value::ValueType for StateType {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for StateType {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for StateType {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

/// Describes the text attributes supported
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AtkTextAttribute")]
pub enum TextAttribute {
    /// Invalid attribute, like bad spelling or grammar.
    #[doc(alias = "ATK_TEXT_ATTR_INVALID")]
    Invalid,
    /// The pixel width of the left margin
    #[doc(alias = "ATK_TEXT_ATTR_LEFT_MARGIN")]
    LeftMargin,
    /// The pixel width of the right margin
    #[doc(alias = "ATK_TEXT_ATTR_RIGHT_MARGIN")]
    RightMargin,
    /// The number of pixels that the text is indented
    #[doc(alias = "ATK_TEXT_ATTR_INDENT")]
    Indent,
    /// Either "true" or "false" indicating whether text is visible or not
    #[doc(alias = "ATK_TEXT_ATTR_INVISIBLE")]
    Invisible,
    /// Either "true" or "false" indicating whether text is editable or not
    #[doc(alias = "ATK_TEXT_ATTR_EDITABLE")]
    Editable,
    /// Pixels of blank space to leave above each newline-terminated line.
    #[doc(alias = "ATK_TEXT_ATTR_PIXELS_ABOVE_LINES")]
    PixelsAboveLines,
    /// Pixels of blank space to leave below each newline-terminated line.
    #[doc(alias = "ATK_TEXT_ATTR_PIXELS_BELOW_LINES")]
    PixelsBelowLines,
    /// Pixels of blank space to leave between wrapped lines inside the same newline-terminated line (paragraph).
    #[doc(alias = "ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP")]
    PixelsInsideWrap,
    /// "true" or "false" whether to make the background color for each character the height of the highest font used on the current line, or the height of the font used for the current character.
    #[doc(alias = "ATK_TEXT_ATTR_BG_FULL_HEIGHT")]
    BgFullHeight,
    /// Number of pixels that the characters are risen above the baseline. See also ATK_TEXT_ATTR_TEXT_POSITION.
    #[doc(alias = "ATK_TEXT_ATTR_RISE")]
    Rise,
    /// "none", "single", "double", "low", or "error"
    #[doc(alias = "ATK_TEXT_ATTR_UNDERLINE")]
    Underline,
    /// "true" or "false" whether the text is strikethrough
    #[doc(alias = "ATK_TEXT_ATTR_STRIKETHROUGH")]
    Strikethrough,
    /// The size of the characters in points. eg: 10
    #[doc(alias = "ATK_TEXT_ATTR_SIZE")]
    Size,
    /// The scale of the characters. The value is a string representation of a double
    #[doc(alias = "ATK_TEXT_ATTR_SCALE")]
    Scale,
    /// The weight of the characters.
    #[doc(alias = "ATK_TEXT_ATTR_WEIGHT")]
    Weight,
    /// The language used
    #[doc(alias = "ATK_TEXT_ATTR_LANGUAGE")]
    Language,
    /// The font family name
    #[doc(alias = "ATK_TEXT_ATTR_FAMILY_NAME")]
    FamilyName,
    /// The background color. The value is an RGB value of the format "`u`,`u`,`u`"
    #[doc(alias = "ATK_TEXT_ATTR_BG_COLOR")]
    BgColor,
    /// The foreground color. The value is an RGB value of the format "`u`,`u`,`u`"
    #[doc(alias = "ATK_TEXT_ATTR_FG_COLOR")]
    FgColor,
    /// "true" if a `GdkBitmap` is set for stippling the background color.
    #[doc(alias = "ATK_TEXT_ATTR_BG_STIPPLE")]
    BgStipple,
    /// "true" if a `GdkBitmap` is set for stippling the foreground color.
    #[doc(alias = "ATK_TEXT_ATTR_FG_STIPPLE")]
    FgStipple,
    /// The wrap mode of the text, if any. Values are "none", "char", "word", or "word_char".
    #[doc(alias = "ATK_TEXT_ATTR_WRAP_MODE")]
    WrapMode,
    /// The direction of the text, if set. Values are "none", "ltr" or "rtl"
    #[doc(alias = "ATK_TEXT_ATTR_DIRECTION")]
    Direction,
    /// The justification of the text, if set. Values are "left", "right", "center" or "fill"
    #[doc(alias = "ATK_TEXT_ATTR_JUSTIFICATION")]
    Justification,
    /// The stretch of the text, if set. Values are "ultra_condensed", "extra_condensed", "condensed", "semi_condensed", "normal", "semi_expanded", "expanded", "extra_expanded" or "ultra_expanded"
    #[doc(alias = "ATK_TEXT_ATTR_STRETCH")]
    Stretch,
    /// The capitalization variant of the text, if set. Values are "normal" or "small_caps"
    #[doc(alias = "ATK_TEXT_ATTR_VARIANT")]
    Variant,
    /// The slant style of the text, if set. Values are "normal", "oblique" or "italic"
    #[doc(alias = "ATK_TEXT_ATTR_STYLE")]
    Style,
    /// The vertical position with respect to the baseline. Values are "baseline", "super", or "sub". Note that a super or sub text attribute refers to position with respect to the baseline of the prior character.
    #[doc(alias = "ATK_TEXT_ATTR_TEXT_POSITION")]
    TextPosition,
    /// not a valid text attribute, used for finding end of enumeration
    #[doc(alias = "ATK_TEXT_ATTR_LAST_DEFINED")]
    LastDefined,
    #[doc(hidden)]
    __Unknown(i32),
}

impl TextAttribute {
    #[doc(alias = "atk_text_attribute_for_name")]
    pub fn for_name(name: &str) -> TextAttribute {
        assert_initialized_main_thread!();
        unsafe { from_glib(ffi::atk_text_attribute_for_name(name.to_glib_none().0)) }
    }

    #[doc(alias = "atk_text_attribute_get_name")]
    #[doc(alias = "get_name")]
    pub fn name(self) -> Option<glib::GString> {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::atk_text_attribute_get_name(self.into_glib())) }
    }

    #[doc(alias = "atk_text_attribute_get_value")]
    #[doc(alias = "get_value")]
    pub fn value(self, index_: i32) -> Option<glib::GString> {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::atk_text_attribute_get_value(self.into_glib(), index_)) }
    }
}

impl fmt::Display for TextAttribute {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "TextAttribute::{}",
            match *self {
                Self::Invalid => "Invalid",
                Self::LeftMargin => "LeftMargin",
                Self::RightMargin => "RightMargin",
                Self::Indent => "Indent",
                Self::Invisible => "Invisible",
                Self::Editable => "Editable",
                Self::PixelsAboveLines => "PixelsAboveLines",
                Self::PixelsBelowLines => "PixelsBelowLines",
                Self::PixelsInsideWrap => "PixelsInsideWrap",
                Self::BgFullHeight => "BgFullHeight",
                Self::Rise => "Rise",
                Self::Underline => "Underline",
                Self::Strikethrough => "Strikethrough",
                Self::Size => "Size",
                Self::Scale => "Scale",
                Self::Weight => "Weight",
                Self::Language => "Language",
                Self::FamilyName => "FamilyName",
                Self::BgColor => "BgColor",
                Self::FgColor => "FgColor",
                Self::BgStipple => "BgStipple",
                Self::FgStipple => "FgStipple",
                Self::WrapMode => "WrapMode",
                Self::Direction => "Direction",
                Self::Justification => "Justification",
                Self::Stretch => "Stretch",
                Self::Variant => "Variant",
                Self::Style => "Style",
                Self::TextPosition => "TextPosition",
                Self::LastDefined => "LastDefined",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl IntoGlib for TextAttribute {
    type GlibType = ffi::AtkTextAttribute;

    fn into_glib(self) -> ffi::AtkTextAttribute {
        match self {
            Self::Invalid => ffi::ATK_TEXT_ATTR_INVALID,
            Self::LeftMargin => ffi::ATK_TEXT_ATTR_LEFT_MARGIN,
            Self::RightMargin => ffi::ATK_TEXT_ATTR_RIGHT_MARGIN,
            Self::Indent => ffi::ATK_TEXT_ATTR_INDENT,
            Self::Invisible => ffi::ATK_TEXT_ATTR_INVISIBLE,
            Self::Editable => ffi::ATK_TEXT_ATTR_EDITABLE,
            Self::PixelsAboveLines => ffi::ATK_TEXT_ATTR_PIXELS_ABOVE_LINES,
            Self::PixelsBelowLines => ffi::ATK_TEXT_ATTR_PIXELS_BELOW_LINES,
            Self::PixelsInsideWrap => ffi::ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP,
            Self::BgFullHeight => ffi::ATK_TEXT_ATTR_BG_FULL_HEIGHT,
            Self::Rise => ffi::ATK_TEXT_ATTR_RISE,
            Self::Underline => ffi::ATK_TEXT_ATTR_UNDERLINE,
            Self::Strikethrough => ffi::ATK_TEXT_ATTR_STRIKETHROUGH,
            Self::Size => ffi::ATK_TEXT_ATTR_SIZE,
            Self::Scale => ffi::ATK_TEXT_ATTR_SCALE,
            Self::Weight => ffi::ATK_TEXT_ATTR_WEIGHT,
            Self::Language => ffi::ATK_TEXT_ATTR_LANGUAGE,
            Self::FamilyName => ffi::ATK_TEXT_ATTR_FAMILY_NAME,
            Self::BgColor => ffi::ATK_TEXT_ATTR_BG_COLOR,
            Self::FgColor => ffi::ATK_TEXT_ATTR_FG_COLOR,
            Self::BgStipple => ffi::ATK_TEXT_ATTR_BG_STIPPLE,
            Self::FgStipple => ffi::ATK_TEXT_ATTR_FG_STIPPLE,
            Self::WrapMode => ffi::ATK_TEXT_ATTR_WRAP_MODE,
            Self::Direction => ffi::ATK_TEXT_ATTR_DIRECTION,
            Self::Justification => ffi::ATK_TEXT_ATTR_JUSTIFICATION,
            Self::Stretch => ffi::ATK_TEXT_ATTR_STRETCH,
            Self::Variant => ffi::ATK_TEXT_ATTR_VARIANT,
            Self::Style => ffi::ATK_TEXT_ATTR_STYLE,
            Self::TextPosition => ffi::ATK_TEXT_ATTR_TEXT_POSITION,
            Self::LastDefined => ffi::ATK_TEXT_ATTR_LAST_DEFINED,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AtkTextAttribute> for TextAttribute {
    unsafe fn from_glib(value: ffi::AtkTextAttribute) -> Self {
        skip_assert_initialized!();
        match value {
            ffi::ATK_TEXT_ATTR_INVALID => Self::Invalid,
            ffi::ATK_TEXT_ATTR_LEFT_MARGIN => Self::LeftMargin,
            ffi::ATK_TEXT_ATTR_RIGHT_MARGIN => Self::RightMargin,
            ffi::ATK_TEXT_ATTR_INDENT => Self::Indent,
            ffi::ATK_TEXT_ATTR_INVISIBLE => Self::Invisible,
            ffi::ATK_TEXT_ATTR_EDITABLE => Self::Editable,
            ffi::ATK_TEXT_ATTR_PIXELS_ABOVE_LINES => Self::PixelsAboveLines,
            ffi::ATK_TEXT_ATTR_PIXELS_BELOW_LINES => Self::PixelsBelowLines,
            ffi::ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP => Self::PixelsInsideWrap,
            ffi::ATK_TEXT_ATTR_BG_FULL_HEIGHT => Self::BgFullHeight,
            ffi::ATK_TEXT_ATTR_RISE => Self::Rise,
            ffi::ATK_TEXT_ATTR_UNDERLINE => Self::Underline,
            ffi::ATK_TEXT_ATTR_STRIKETHROUGH => Self::Strikethrough,
            ffi::ATK_TEXT_ATTR_SIZE => Self::Size,
            ffi::ATK_TEXT_ATTR_SCALE => Self::Scale,
            ffi::ATK_TEXT_ATTR_WEIGHT => Self::Weight,
            ffi::ATK_TEXT_ATTR_LANGUAGE => Self::Language,
            ffi::ATK_TEXT_ATTR_FAMILY_NAME => Self::FamilyName,
            ffi::ATK_TEXT_ATTR_BG_COLOR => Self::BgColor,
            ffi::ATK_TEXT_ATTR_FG_COLOR => Self::FgColor,
            ffi::ATK_TEXT_ATTR_BG_STIPPLE => Self::BgStipple,
            ffi::ATK_TEXT_ATTR_FG_STIPPLE => Self::FgStipple,
            ffi::ATK_TEXT_ATTR_WRAP_MODE => Self::WrapMode,
            ffi::ATK_TEXT_ATTR_DIRECTION => Self::Direction,
            ffi::ATK_TEXT_ATTR_JUSTIFICATION => Self::Justification,
            ffi::ATK_TEXT_ATTR_STRETCH => Self::Stretch,
            ffi::ATK_TEXT_ATTR_VARIANT => Self::Variant,
            ffi::ATK_TEXT_ATTR_STYLE => Self::Style,
            ffi::ATK_TEXT_ATTR_TEXT_POSITION => Self::TextPosition,
            ffi::ATK_TEXT_ATTR_LAST_DEFINED => Self::LastDefined,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for TextAttribute {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::atk_text_attribute_get_type()) }
    }
}

impl glib::value::ValueType for TextAttribute {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for TextAttribute {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for TextAttribute {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

/// Text boundary types used for specifying boundaries for regions of text.
/// This enumeration is deprecated since 2.9.4 and should not be used. Use
/// AtkTextGranularity with `atk_text_get_string_at_offset` instead.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AtkTextBoundary")]
pub enum TextBoundary {
    /// Boundary is the boundary between characters
    /// (including non-printing characters)
    #[doc(alias = "ATK_TEXT_BOUNDARY_CHAR")]
    Char,
    /// Boundary is the start (i.e. first character) of a word.
    #[doc(alias = "ATK_TEXT_BOUNDARY_WORD_START")]
    WordStart,
    /// Boundary is the end (i.e. last
    /// character) of a word.
    #[doc(alias = "ATK_TEXT_BOUNDARY_WORD_END")]
    WordEnd,
    /// Boundary is the first character in a sentence.
    #[doc(alias = "ATK_TEXT_BOUNDARY_SENTENCE_START")]
    SentenceStart,
    /// Boundary is the last (terminal)
    /// character in a sentence; in languages which use "sentence stop"
    /// punctuation such as English, the boundary is thus the '.', '?', or
    /// similar terminal punctuation character.
    #[doc(alias = "ATK_TEXT_BOUNDARY_SENTENCE_END")]
    SentenceEnd,
    /// Boundary is the initial character of the content or a
    /// character immediately following a newline, linefeed, or return character.
    #[doc(alias = "ATK_TEXT_BOUNDARY_LINE_START")]
    LineStart,
    /// Boundary is the linefeed, or return
    /// character.
    #[doc(alias = "ATK_TEXT_BOUNDARY_LINE_END")]
    LineEnd,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for TextBoundary {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "TextBoundary::{}",
            match *self {
                Self::Char => "Char",
                Self::WordStart => "WordStart",
                Self::WordEnd => "WordEnd",
                Self::SentenceStart => "SentenceStart",
                Self::SentenceEnd => "SentenceEnd",
                Self::LineStart => "LineStart",
                Self::LineEnd => "LineEnd",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl IntoGlib for TextBoundary {
    type GlibType = ffi::AtkTextBoundary;

    fn into_glib(self) -> ffi::AtkTextBoundary {
        match self {
            Self::Char => ffi::ATK_TEXT_BOUNDARY_CHAR,
            Self::WordStart => ffi::ATK_TEXT_BOUNDARY_WORD_START,
            Self::WordEnd => ffi::ATK_TEXT_BOUNDARY_WORD_END,
            Self::SentenceStart => ffi::ATK_TEXT_BOUNDARY_SENTENCE_START,
            Self::SentenceEnd => ffi::ATK_TEXT_BOUNDARY_SENTENCE_END,
            Self::LineStart => ffi::ATK_TEXT_BOUNDARY_LINE_START,
            Self::LineEnd => ffi::ATK_TEXT_BOUNDARY_LINE_END,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AtkTextBoundary> for TextBoundary {
    unsafe fn from_glib(value: ffi::AtkTextBoundary) -> Self {
        skip_assert_initialized!();
        match value {
            ffi::ATK_TEXT_BOUNDARY_CHAR => Self::Char,
            ffi::ATK_TEXT_BOUNDARY_WORD_START => Self::WordStart,
            ffi::ATK_TEXT_BOUNDARY_WORD_END => Self::WordEnd,
            ffi::ATK_TEXT_BOUNDARY_SENTENCE_START => Self::SentenceStart,
            ffi::ATK_TEXT_BOUNDARY_SENTENCE_END => Self::SentenceEnd,
            ffi::ATK_TEXT_BOUNDARY_LINE_START => Self::LineStart,
            ffi::ATK_TEXT_BOUNDARY_LINE_END => Self::LineEnd,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for TextBoundary {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::atk_text_boundary_get_type()) }
    }
}

impl glib::value::ValueType for TextBoundary {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for TextBoundary {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for TextBoundary {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

/// Describes the type of clipping required.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AtkTextClipType")]
pub enum TextClipType {
    /// No clipping to be done
    #[doc(alias = "ATK_TEXT_CLIP_NONE")]
    None,
    /// Text clipped by min coordinate is omitted
    #[doc(alias = "ATK_TEXT_CLIP_MIN")]
    Min,
    /// Text clipped by max coordinate is omitted
    #[doc(alias = "ATK_TEXT_CLIP_MAX")]
    Max,
    /// Only text fully within mix/max bound is retained
    #[doc(alias = "ATK_TEXT_CLIP_BOTH")]
    Both,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for TextClipType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "TextClipType::{}",
            match *self {
                Self::None => "None",
                Self::Min => "Min",
                Self::Max => "Max",
                Self::Both => "Both",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl IntoGlib for TextClipType {
    type GlibType = ffi::AtkTextClipType;

    fn into_glib(self) -> ffi::AtkTextClipType {
        match self {
            Self::None => ffi::ATK_TEXT_CLIP_NONE,
            Self::Min => ffi::ATK_TEXT_CLIP_MIN,
            Self::Max => ffi::ATK_TEXT_CLIP_MAX,
            Self::Both => ffi::ATK_TEXT_CLIP_BOTH,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AtkTextClipType> for TextClipType {
    unsafe fn from_glib(value: ffi::AtkTextClipType) -> Self {
        skip_assert_initialized!();
        match value {
            ffi::ATK_TEXT_CLIP_NONE => Self::None,
            ffi::ATK_TEXT_CLIP_MIN => Self::Min,
            ffi::ATK_TEXT_CLIP_MAX => Self::Max,
            ffi::ATK_TEXT_CLIP_BOTH => Self::Both,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for TextClipType {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::atk_text_clip_type_get_type()) }
    }
}

impl glib::value::ValueType for TextClipType {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for TextClipType {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for TextClipType {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

/// Text granularity types used for specifying the granularity of the region of
/// text we are interested in.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AtkTextGranularity")]
pub enum TextGranularity {
    /// Granularity is defined by the boundaries between characters
    /// (including non-printing characters)
    #[doc(alias = "ATK_TEXT_GRANULARITY_CHAR")]
    Char,
    /// Granularity is defined by the boundaries of a word,
    /// starting at the beginning of the current word and finishing at the beginning of
    /// the following one, if present.
    #[doc(alias = "ATK_TEXT_GRANULARITY_WORD")]
    Word,
    /// Granularity is defined by the boundaries of a sentence,
    /// starting at the beginning of the current sentence and finishing at the beginning of
    /// the following one, if present.
    #[doc(alias = "ATK_TEXT_GRANULARITY_SENTENCE")]
    Sentence,
    /// Granularity is defined by the boundaries of a line,
    /// starting at the beginning of the current line and finishing at the beginning of
    /// the following one, if present.
    #[doc(alias = "ATK_TEXT_GRANULARITY_LINE")]
    Line,
    /// Granularity is defined by the boundaries of a paragraph,
    /// starting at the beginning of the current paragraph and finishing at the beginning of
    /// the following one, if present.
    #[doc(alias = "ATK_TEXT_GRANULARITY_PARAGRAPH")]
    Paragraph,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for TextGranularity {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "TextGranularity::{}",
            match *self {
                Self::Char => "Char",
                Self::Word => "Word",
                Self::Sentence => "Sentence",
                Self::Line => "Line",
                Self::Paragraph => "Paragraph",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl IntoGlib for TextGranularity {
    type GlibType = ffi::AtkTextGranularity;

    fn into_glib(self) -> ffi::AtkTextGranularity {
        match self {
            Self::Char => ffi::ATK_TEXT_GRANULARITY_CHAR,
            Self::Word => ffi::ATK_TEXT_GRANULARITY_WORD,
            Self::Sentence => ffi::ATK_TEXT_GRANULARITY_SENTENCE,
            Self::Line => ffi::ATK_TEXT_GRANULARITY_LINE,
            Self::Paragraph => ffi::ATK_TEXT_GRANULARITY_PARAGRAPH,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AtkTextGranularity> for TextGranularity {
    unsafe fn from_glib(value: ffi::AtkTextGranularity) -> Self {
        skip_assert_initialized!();
        match value {
            ffi::ATK_TEXT_GRANULARITY_CHAR => Self::Char,
            ffi::ATK_TEXT_GRANULARITY_WORD => Self::Word,
            ffi::ATK_TEXT_GRANULARITY_SENTENCE => Self::Sentence,
            ffi::ATK_TEXT_GRANULARITY_LINE => Self::Line,
            ffi::ATK_TEXT_GRANULARITY_PARAGRAPH => Self::Paragraph,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for TextGranularity {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::atk_text_granularity_get_type()) }
    }
}

impl glib::value::ValueType for TextGranularity {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for TextGranularity {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for TextGranularity {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

/// Default types for a given value. Those are defined in order to
/// easily get localized strings to describe a given value or a given
/// subrange, using [`localized_name()`][Self::localized_name()].
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AtkValueType")]
pub enum ValueType {
    #[doc(alias = "ATK_VALUE_VERY_WEAK")]
    VeryWeak,
    #[doc(alias = "ATK_VALUE_WEAK")]
    Weak,
    #[doc(alias = "ATK_VALUE_ACCEPTABLE")]
    Acceptable,
    #[doc(alias = "ATK_VALUE_STRONG")]
    Strong,
    #[doc(alias = "ATK_VALUE_VERY_STRONG")]
    VeryStrong,
    #[doc(alias = "ATK_VALUE_VERY_LOW")]
    VeryLow,
    #[doc(alias = "ATK_VALUE_LOW")]
    Low,
    #[doc(alias = "ATK_VALUE_MEDIUM")]
    Medium,
    #[doc(alias = "ATK_VALUE_HIGH")]
    High,
    #[doc(alias = "ATK_VALUE_VERY_HIGH")]
    VeryHigh,
    #[doc(alias = "ATK_VALUE_VERY_BAD")]
    VeryBad,
    #[doc(alias = "ATK_VALUE_BAD")]
    Bad,
    #[doc(alias = "ATK_VALUE_GOOD")]
    Good,
    #[doc(alias = "ATK_VALUE_VERY_GOOD")]
    VeryGood,
    #[doc(alias = "ATK_VALUE_BEST")]
    Best,
    #[doc(alias = "ATK_VALUE_LAST_DEFINED")]
    LastDefined,
    #[doc(hidden)]
    __Unknown(i32),
}

impl ValueType {
    #[doc(alias = "atk_value_type_get_localized_name")]
    #[doc(alias = "get_localized_name")]
    pub fn localized_name(self) -> Option<glib::GString> {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::atk_value_type_get_localized_name(self.into_glib())) }
    }

    #[doc(alias = "atk_value_type_get_name")]
    #[doc(alias = "get_name")]
    pub fn name(self) -> Option<glib::GString> {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::atk_value_type_get_name(self.into_glib())) }
    }
}

impl fmt::Display for ValueType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "ValueType::{}",
            match *self {
                Self::VeryWeak => "VeryWeak",
                Self::Weak => "Weak",
                Self::Acceptable => "Acceptable",
                Self::Strong => "Strong",
                Self::VeryStrong => "VeryStrong",
                Self::VeryLow => "VeryLow",
                Self::Low => "Low",
                Self::Medium => "Medium",
                Self::High => "High",
                Self::VeryHigh => "VeryHigh",
                Self::VeryBad => "VeryBad",
                Self::Bad => "Bad",
                Self::Good => "Good",
                Self::VeryGood => "VeryGood",
                Self::Best => "Best",
                Self::LastDefined => "LastDefined",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl IntoGlib for ValueType {
    type GlibType = ffi::AtkValueType;

    fn into_glib(self) -> ffi::AtkValueType {
        match self {
            Self::VeryWeak => ffi::ATK_VALUE_VERY_WEAK,
            Self::Weak => ffi::ATK_VALUE_WEAK,
            Self::Acceptable => ffi::ATK_VALUE_ACCEPTABLE,
            Self::Strong => ffi::ATK_VALUE_STRONG,
            Self::VeryStrong => ffi::ATK_VALUE_VERY_STRONG,
            Self::VeryLow => ffi::ATK_VALUE_VERY_LOW,
            Self::Low => ffi::ATK_VALUE_LOW,
            Self::Medium => ffi::ATK_VALUE_MEDIUM,
            Self::High => ffi::ATK_VALUE_HIGH,
            Self::VeryHigh => ffi::ATK_VALUE_VERY_HIGH,
            Self::VeryBad => ffi::ATK_VALUE_VERY_BAD,
            Self::Bad => ffi::ATK_VALUE_BAD,
            Self::Good => ffi::ATK_VALUE_GOOD,
            Self::VeryGood => ffi::ATK_VALUE_VERY_GOOD,
            Self::Best => ffi::ATK_VALUE_BEST,
            Self::LastDefined => ffi::ATK_VALUE_LAST_DEFINED,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AtkValueType> for ValueType {
    unsafe fn from_glib(value: ffi::AtkValueType) -> Self {
        skip_assert_initialized!();
        match value {
            ffi::ATK_VALUE_VERY_WEAK => Self::VeryWeak,
            ffi::ATK_VALUE_WEAK => Self::Weak,
            ffi::ATK_VALUE_ACCEPTABLE => Self::Acceptable,
            ffi::ATK_VALUE_STRONG => Self::Strong,
            ffi::ATK_VALUE_VERY_STRONG => Self::VeryStrong,
            ffi::ATK_VALUE_VERY_LOW => Self::VeryLow,
            ffi::ATK_VALUE_LOW => Self::Low,
            ffi::ATK_VALUE_MEDIUM => Self::Medium,
            ffi::ATK_VALUE_HIGH => Self::High,
            ffi::ATK_VALUE_VERY_HIGH => Self::VeryHigh,
            ffi::ATK_VALUE_VERY_BAD => Self::VeryBad,
            ffi::ATK_VALUE_BAD => Self::Bad,
            ffi::ATK_VALUE_GOOD => Self::Good,
            ffi::ATK_VALUE_VERY_GOOD => Self::VeryGood,
            ffi::ATK_VALUE_BEST => Self::Best,
            ffi::ATK_VALUE_LAST_DEFINED => Self::LastDefined,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for ValueType {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::atk_value_type_get_type()) }
    }
}

impl glib::value::ValueType for ValueType {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for ValueType {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for ValueType {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}