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
// 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::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use glib::StaticType;
use glib::Type;
use gobject_sys;
use gtk_sys;

bitflags! {
    /// Accelerator flags used with `AccelGroup::connect`.
    pub struct AccelFlags: u32 {
        /// Accelerator is visible
        const VISIBLE = 1;
        /// Accelerator not removable
        const LOCKED = 2;
        /// Mask
        const MASK = 7;
    }
}

#[doc(hidden)]
impl ToGlib for AccelFlags {
    type GlibType = gtk_sys::GtkAccelFlags;

    fn to_glib(&self) -> gtk_sys::GtkAccelFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkAccelFlags> for AccelFlags {
    fn from_glib(value: gtk_sys::GtkAccelFlags) -> AccelFlags {
        skip_assert_initialized!();
        AccelFlags::from_bits_truncate(value)
    }
}

impl StaticType for AccelFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_accel_flags_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for AccelFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for AccelFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for AccelFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// Types of user actions that may be blocked by `GtkApplicationExt::inhibit`.
    pub struct ApplicationInhibitFlags: u32 {
        /// Inhibit ending the user session
        ///  by logging out or by shutting down the computer
        const LOGOUT = 1;
        /// Inhibit user switching
        const SWITCH = 2;
        /// Inhibit suspending the
        ///  session or computer
        const SUSPEND = 4;
        /// Inhibit the session being
        ///  marked as idle (and possibly locked)
        const IDLE = 8;
    }
}

#[doc(hidden)]
impl ToGlib for ApplicationInhibitFlags {
    type GlibType = gtk_sys::GtkApplicationInhibitFlags;

    fn to_glib(&self) -> gtk_sys::GtkApplicationInhibitFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkApplicationInhibitFlags> for ApplicationInhibitFlags {
    fn from_glib(value: gtk_sys::GtkApplicationInhibitFlags) -> ApplicationInhibitFlags {
        skip_assert_initialized!();
        ApplicationInhibitFlags::from_bits_truncate(value)
    }
}

impl StaticType for ApplicationInhibitFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_application_inhibit_flags_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for ApplicationInhibitFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for ApplicationInhibitFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for ApplicationInhibitFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// These options can be used to influence the display and behaviour of a `Calendar`.
    pub struct CalendarDisplayOptions: u32 {
        /// Specifies that the month and year should be displayed.
        const SHOW_HEADING = 1;
        /// Specifies that three letter day descriptions should be present.
        const SHOW_DAY_NAMES = 2;
        /// Prevents the user from switching months with the calendar.
        const NO_MONTH_CHANGE = 4;
        /// Displays each week numbers of the current year, down the
        /// left side of the calendar.
        const SHOW_WEEK_NUMBERS = 8;
        /// Just show an indicator, not the full details
        /// text when details are provided. See `CalendarExt::set_detail_func`.
        const SHOW_DETAILS = 32;
    }
}

#[doc(hidden)]
impl ToGlib for CalendarDisplayOptions {
    type GlibType = gtk_sys::GtkCalendarDisplayOptions;

    fn to_glib(&self) -> gtk_sys::GtkCalendarDisplayOptions {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkCalendarDisplayOptions> for CalendarDisplayOptions {
    fn from_glib(value: gtk_sys::GtkCalendarDisplayOptions) -> CalendarDisplayOptions {
        skip_assert_initialized!();
        CalendarDisplayOptions::from_bits_truncate(value)
    }
}

impl StaticType for CalendarDisplayOptions {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_calendar_display_options_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for CalendarDisplayOptions {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for CalendarDisplayOptions {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for CalendarDisplayOptions {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// Tells how a cell is to be rendered.
    pub struct CellRendererState: u32 {
        /// The cell is currently selected, and
        ///  probably has a selection colored background to render to.
        const SELECTED = 1;
        /// The mouse is hovering over the cell.
        const PRELIT = 2;
        /// The cell is drawn in an insensitive manner
        const INSENSITIVE = 4;
        /// The cell is in a sorted row
        const SORTED = 8;
        /// The cell is in the focus row.
        const FOCUSED = 16;
        /// The cell is in a row that can be expanded. Since 3.4
        const EXPANDABLE = 32;
        /// The cell is in a row that is expanded. Since 3.4
        const EXPANDED = 64;
    }
}

#[doc(hidden)]
impl ToGlib for CellRendererState {
    type GlibType = gtk_sys::GtkCellRendererState;

    fn to_glib(&self) -> gtk_sys::GtkCellRendererState {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkCellRendererState> for CellRendererState {
    fn from_glib(value: gtk_sys::GtkCellRendererState) -> CellRendererState {
        skip_assert_initialized!();
        CellRendererState::from_bits_truncate(value)
    }
}

impl StaticType for CellRendererState {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_cell_renderer_state_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for CellRendererState {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for CellRendererState {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for CellRendererState {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// The `DestDefaults` enumeration specifies the various
    /// types of action that will be taken on behalf
    /// of the user for a drag destination site.
    pub struct DestDefaults: u32 {
        /// If set for a widget, GTK+, during a drag over this
        ///  widget will check if the drag matches this widget’s list of possible targets
        ///  and actions.
        ///  GTK+ will then call `gdk_drag_status` as appropriate.
        const MOTION = 1;
        /// If set for a widget, GTK+ will draw a highlight on
        ///  this widget as long as a drag is over this widget and the widget drag format
        ///  and action are acceptable.
        const HIGHLIGHT = 2;
        /// If set for a widget, when a drop occurs, GTK+ will
        ///  will check if the drag matches this widget’s list of possible targets and
        ///  actions. If so, GTK+ will call `WidgetExt::drag_get_data` on behalf of the widget.
        ///  Whether or not the drop is successful, GTK+ will call `gtk_drag_finish`. If
        ///  the action was a move, then if the drag was successful, then `true` will be
        ///  passed for the `delete` parameter to `gtk_drag_finish`.
        const DROP = 4;
        /// If set, specifies that all default actions should
        ///  be taken.
        const ALL = 7;
    }
}

#[doc(hidden)]
impl ToGlib for DestDefaults {
    type GlibType = gtk_sys::GtkDestDefaults;

    fn to_glib(&self) -> gtk_sys::GtkDestDefaults {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkDestDefaults> for DestDefaults {
    fn from_glib(value: gtk_sys::GtkDestDefaults) -> DestDefaults {
        skip_assert_initialized!();
        DestDefaults::from_bits_truncate(value)
    }
}

impl StaticType for DestDefaults {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_dest_defaults_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for DestDefaults {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for DestDefaults {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for DestDefaults {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// Flags used to influence dialog construction.
    pub struct DialogFlags: u32 {
        /// Make the constructed dialog modal,
        ///  see `GtkWindowExt::set_modal`
        const MODAL = 1;
        /// Destroy the dialog when its
        ///  parent is destroyed, see `GtkWindowExt::set_destroy_with_parent`
        const DESTROY_WITH_PARENT = 2;
        /// Create dialog with actions in header
        ///  bar instead of action area. Since 3.12.
        const USE_HEADER_BAR = 4;
    }
}

#[doc(hidden)]
impl ToGlib for DialogFlags {
    type GlibType = gtk_sys::GtkDialogFlags;

    fn to_glib(&self) -> gtk_sys::GtkDialogFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkDialogFlags> for DialogFlags {
    fn from_glib(value: gtk_sys::GtkDialogFlags) -> DialogFlags {
        skip_assert_initialized!();
        DialogFlags::from_bits_truncate(value)
    }
}

impl StaticType for DialogFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_dialog_flags_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for DialogFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for DialogFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for DialogFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
bitflags! {
    /// Describes the behavior of a `EventControllerScroll`.
    pub struct EventControllerScrollFlags: u32 {
        /// Don't emit scroll.
        const NONE = 0;
        /// Emit scroll with vertical deltas.
        const VERTICAL = 1;
        /// Emit scroll with horizontal deltas.
        const HORIZONTAL = 2;
        /// Only emit deltas that are multiples of 1.
        const DISCRETE = 4;
        /// Emit `EventControllerScroll::decelerate`
        ///  after continuous scroll finishes.
        const KINETIC = 8;
        /// Emit scroll on both axes.
        ///
        /// Feature: `v3_24`
        ///
        const BOTH_AXES = 3;
    }
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for EventControllerScrollFlags {
    type GlibType = gtk_sys::GtkEventControllerScrollFlags;

    fn to_glib(&self) -> gtk_sys::GtkEventControllerScrollFlags {
        self.bits()
    }
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
#[doc(hidden)]
impl FromGlib<gtk_sys::GtkEventControllerScrollFlags> for EventControllerScrollFlags {
    fn from_glib(value: gtk_sys::GtkEventControllerScrollFlags) -> EventControllerScrollFlags {
        skip_assert_initialized!();
        EventControllerScrollFlags::from_bits_truncate(value)
    }
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
impl StaticType for EventControllerScrollFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_event_controller_scroll_flags_get_type()) }
    }
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
impl<'a> FromValueOptional<'a> for EventControllerScrollFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
impl<'a> FromValue<'a> for EventControllerScrollFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
impl SetValue for EventControllerScrollFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// These flags indicate what parts of a `FileFilterInfo` struct
    /// are filled or need to be filled.
    pub struct FileFilterFlags: u32 {
        /// the filename of the file being tested
        const FILENAME = 1;
        /// the URI for the file being tested
        const URI = 2;
        /// the string that will be used to
        ///  display the file in the file chooser
        const DISPLAY_NAME = 4;
        /// the mime type of the file
        const MIME_TYPE = 8;
    }
}

#[doc(hidden)]
impl ToGlib for FileFilterFlags {
    type GlibType = gtk_sys::GtkFileFilterFlags;

    fn to_glib(&self) -> gtk_sys::GtkFileFilterFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkFileFilterFlags> for FileFilterFlags {
    fn from_glib(value: gtk_sys::GtkFileFilterFlags) -> FileFilterFlags {
        skip_assert_initialized!();
        FileFilterFlags::from_bits_truncate(value)
    }
}

impl StaticType for FileFilterFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_file_filter_flags_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for FileFilterFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for FileFilterFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for FileFilterFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
bitflags! {
    /// This enumeration specifies the granularity of font selection
    /// that is desired in a font chooser.
    ///
    /// This enumeration may be extended in the future; applications should
    /// ignore unknown values.
    pub struct FontChooserLevel: u32 {
        /// Allow selecting a font family
        const FAMILY = 0;
        /// Allow selecting a specific font face
        const STYLE = 1;
        /// Allow selecting a specific font size
        const SIZE = 2;
        const VARIATIONS = 4;
        /// Allow selecting specific OpenType font features
        ///
        /// Feature: `v3_24`
        ///
        const FEATURES = 8;
    }
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for FontChooserLevel {
    type GlibType = gtk_sys::GtkFontChooserLevel;

    fn to_glib(&self) -> gtk_sys::GtkFontChooserLevel {
        self.bits()
    }
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
#[doc(hidden)]
impl FromGlib<gtk_sys::GtkFontChooserLevel> for FontChooserLevel {
    fn from_glib(value: gtk_sys::GtkFontChooserLevel) -> FontChooserLevel {
        skip_assert_initialized!();
        FontChooserLevel::from_bits_truncate(value)
    }
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
impl StaticType for FontChooserLevel {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_font_chooser_level_get_type()) }
    }
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
impl<'a> FromValueOptional<'a> for FontChooserLevel {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
impl<'a> FromValue<'a> for FontChooserLevel {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
impl SetValue for FontChooserLevel {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// Used to specify options for `IconThemeExt::lookup_icon`
    pub struct IconLookupFlags: u32 {
        /// Never get SVG icons, even if gdk-pixbuf
        ///  supports them. Cannot be used together with `IconLookupFlags::ForceSvg`.
        const NO_SVG = 1;
        /// Get SVG icons, even if gdk-pixbuf
        ///  doesn’t support them.
        ///  Cannot be used together with `IconLookupFlags::NoSvg`.
        const FORCE_SVG = 2;
        /// When passed to
        ///  `IconThemeExt::lookup_icon` includes builtin icons
        ///  as well as files. For a builtin icon, `IconInfo::get_filename`
        ///  is `None` and you need to call `IconInfo::get_builtin_pixbuf`.
        const USE_BUILTIN = 4;
        /// Try to shorten icon name at '-'
        ///  characters before looking at inherited themes. This flag is only
        ///  supported in functions that take a single icon name. For more general
        ///  fallback, see `IconTheme::choose_icon`. Since 2.12.
        const GENERIC_FALLBACK = 8;
        /// Always get the icon scaled to the
        ///  requested size. Since 2.14.
        const FORCE_SIZE = 16;
        /// Try to always load regular icons, even
        ///  when symbolic icon names are given. Since 3.14.
        const FORCE_REGULAR = 32;
        /// Try to always load symbolic icons, even
        ///  when regular icon names are given. Since 3.14.
        const FORCE_SYMBOLIC = 64;
        /// Try to load a variant of the icon for left-to-right
        ///  text direction. Since 3.14.
        const DIR_LTR = 128;
        /// Try to load a variant of the icon for right-to-left
        ///  text direction. Since 3.14.
        const DIR_RTL = 256;
    }
}

#[doc(hidden)]
impl ToGlib for IconLookupFlags {
    type GlibType = gtk_sys::GtkIconLookupFlags;

    fn to_glib(&self) -> gtk_sys::GtkIconLookupFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkIconLookupFlags> for IconLookupFlags {
    fn from_glib(value: gtk_sys::GtkIconLookupFlags) -> IconLookupFlags {
        skip_assert_initialized!();
        IconLookupFlags::from_bits_truncate(value)
    }
}

impl StaticType for IconLookupFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_icon_lookup_flags_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for IconLookupFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for IconLookupFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for IconLookupFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// Describes hints that might be taken into account by input methods
    /// or applications. Note that input methods may already tailor their
    /// behaviour according to the `InputPurpose` of the entry.
    ///
    /// Some common sense is expected when using these flags - mixing
    /// `InputHints::Lowercase` with any of the uppercase hints makes no sense.
    ///
    /// This enumeration may be extended in the future; input methods should
    /// ignore unknown values.
    pub struct InputHints: u32 {
        /// No special behaviour suggested
        const NONE = 0;
        /// Suggest checking for typos
        const SPELLCHECK = 1;
        /// Suggest not checking for typos
        const NO_SPELLCHECK = 2;
        /// Suggest word completion
        const WORD_COMPLETION = 4;
        /// Suggest to convert all text to lowercase
        const LOWERCASE = 8;
        /// Suggest to capitalize all text
        const UPPERCASE_CHARS = 16;
        /// Suggest to capitalize the first
        ///  character of each word
        const UPPERCASE_WORDS = 32;
        /// Suggest to capitalize the
        ///  first word of each sentence
        const UPPERCASE_SENTENCES = 64;
        /// Suggest to not show an onscreen keyboard
        ///  (e.g for a calculator that already has all the keys).
        const INHIBIT_OSK = 128;
        /// The text is vertical. Since 3.18
        const VERTICAL_WRITING = 256;
        /// Suggest offering Emoji support. Since 3.22.20
        #[cfg(any(feature = "v3_22_20", feature = "dox"))]
        const EMOJI = 512;
        /// Suggest not offering Emoji support. Since 3.22.20
        #[cfg(any(feature = "v3_22_20", feature = "dox"))]
        const NO_EMOJI = 1024;
    }
}

#[doc(hidden)]
impl ToGlib for InputHints {
    type GlibType = gtk_sys::GtkInputHints;

    fn to_glib(&self) -> gtk_sys::GtkInputHints {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkInputHints> for InputHints {
    fn from_glib(value: gtk_sys::GtkInputHints) -> InputHints {
        skip_assert_initialized!();
        InputHints::from_bits_truncate(value)
    }
}

impl StaticType for InputHints {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_input_hints_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for InputHints {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for InputHints {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for InputHints {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// Describes how a rendered element connects to adjacent elements.
    pub struct JunctionSides: u32 {
        /// No junctions.
        const NONE = 0;
        /// Element connects on the top-left corner.
        const CORNER_TOPLEFT = 1;
        /// Element connects on the top-right corner.
        const CORNER_TOPRIGHT = 2;
        /// Element connects on the bottom-left corner.
        const CORNER_BOTTOMLEFT = 4;
        /// Element connects on the bottom-right corner.
        const CORNER_BOTTOMRIGHT = 8;
        /// Element connects on the top side.
        const TOP = 3;
        /// Element connects on the bottom side.
        const BOTTOM = 12;
        /// Element connects on the left side.
        const LEFT = 5;
        /// Element connects on the right side.
        const RIGHT = 10;
    }
}

#[doc(hidden)]
impl ToGlib for JunctionSides {
    type GlibType = gtk_sys::GtkJunctionSides;

    fn to_glib(&self) -> gtk_sys::GtkJunctionSides {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkJunctionSides> for JunctionSides {
    fn from_glib(value: gtk_sys::GtkJunctionSides) -> JunctionSides {
        skip_assert_initialized!();
        JunctionSides::from_bits_truncate(value)
    }
}

impl StaticType for JunctionSides {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_junction_sides_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for JunctionSides {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for JunctionSides {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for JunctionSides {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// These flags serve two purposes. First, the application can call `PlacesSidebar::set_open_flags`
    /// using these flags as a bitmask. This tells the sidebar that the application is able to open
    /// folders selected from the sidebar in various ways, for example, in new tabs or in new windows in
    /// addition to the normal mode.
    ///
    /// Second, when one of these values gets passed back to the application in the
    /// `PlacesSidebar::open-location` signal, it means that the application should
    /// open the selected location in the normal way, in a new tab, or in a new
    /// window. The sidebar takes care of determining the desired way to open the location,
    /// based on the modifier keys that the user is pressing at the time the selection is made.
    ///
    /// If the application never calls `PlacesSidebar::set_open_flags`, then the sidebar will only
    /// use `PlacesOpenFlags::Normal` in the `PlacesSidebar::open-location` signal. This is the
    /// default mode of operation.
    pub struct PlacesOpenFlags: u32 {
        /// This is the default mode that `PlacesSidebar` uses if no other flags
        ///  are specified. It indicates that the calling application should open the selected location
        ///  in the normal way, for example, in the folder view beside the sidebar.
        const NORMAL = 1;
        /// When passed to `PlacesSidebar::set_open_flags`, this indicates
        ///  that the application can open folders selected from the sidebar in new tabs. This value
        ///  will be passed to the `PlacesSidebar::open-location` signal when the user selects
        ///  that a location be opened in a new tab instead of in the standard fashion.
        const NEW_TAB = 2;
        /// Similar to `PlacesOpenFlags::NewTab`, but indicates that the application
        ///  can open folders in new windows.
        const NEW_WINDOW = 4;
    }
}

#[doc(hidden)]
impl ToGlib for PlacesOpenFlags {
    type GlibType = gtk_sys::GtkPlacesOpenFlags;

    fn to_glib(&self) -> gtk_sys::GtkPlacesOpenFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkPlacesOpenFlags> for PlacesOpenFlags {
    fn from_glib(value: gtk_sys::GtkPlacesOpenFlags) -> PlacesOpenFlags {
        skip_assert_initialized!();
        PlacesOpenFlags::from_bits_truncate(value)
    }
}

impl StaticType for PlacesOpenFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_places_open_flags_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for PlacesOpenFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for PlacesOpenFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for PlacesOpenFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// These flags indicate what parts of a `RecentFilterInfo` struct
    /// are filled or need to be filled.
    pub struct RecentFilterFlags: u32 {
        /// the URI of the file being tested
        const URI = 1;
        /// the string that will be used to
        ///  display the file in the recent chooser
        const DISPLAY_NAME = 2;
        /// the mime type of the file
        const MIME_TYPE = 4;
        /// the list of applications that have
        ///  registered the file
        const APPLICATION = 8;
        /// the groups to which the file belongs to
        const GROUP = 16;
        /// the number of days elapsed since the file
        ///  has been registered
        const AGE = 32;
    }
}

#[doc(hidden)]
impl ToGlib for RecentFilterFlags {
    type GlibType = gtk_sys::GtkRecentFilterFlags;

    fn to_glib(&self) -> gtk_sys::GtkRecentFilterFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkRecentFilterFlags> for RecentFilterFlags {
    fn from_glib(value: gtk_sys::GtkRecentFilterFlags) -> RecentFilterFlags {
        skip_assert_initialized!();
        RecentFilterFlags::from_bits_truncate(value)
    }
}

impl StaticType for RecentFilterFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_recent_filter_flags_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for RecentFilterFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for RecentFilterFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for RecentFilterFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// Describes a region within a widget.
    pub struct RegionFlags: u32 {
        /// Region has an even number within a set.
        const EVEN = 1;
        /// Region has an odd number within a set.
        const ODD = 2;
        /// Region is the first one within a set.
        const FIRST = 4;
        /// Region is the last one within a set.
        const LAST = 8;
        /// Region is the only one within a set.
        const ONLY = 16;
        /// Region is part of a sorted area.
        const SORTED = 32;
    }
}

#[doc(hidden)]
impl ToGlib for RegionFlags {
    type GlibType = gtk_sys::GtkRegionFlags;

    fn to_glib(&self) -> gtk_sys::GtkRegionFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkRegionFlags> for RegionFlags {
    fn from_glib(value: gtk_sys::GtkRegionFlags) -> RegionFlags {
        skip_assert_initialized!();
        RegionFlags::from_bits_truncate(value)
    }
}

impl StaticType for RegionFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_region_flags_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for RegionFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for RegionFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for RegionFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// Describes a widget state. Widget states are used to match the widget
    /// against CSS pseudo-classes. Note that GTK extends the regular CSS
    /// classes and sometimes uses different names.
    pub struct StateFlags: u32 {
        /// State during normal operation.
        const NORMAL = 0;
        /// Widget is active.
        const ACTIVE = 1;
        /// Widget has a mouse pointer over it.
        const PRELIGHT = 2;
        /// Widget is selected.
        const SELECTED = 4;
        /// Widget is insensitive.
        const INSENSITIVE = 8;
        /// Widget is inconsistent.
        const INCONSISTENT = 16;
        /// Widget has the keyboard focus.
        const FOCUSED = 32;
        /// Widget is in a background toplevel window.
        const BACKDROP = 64;
        /// Widget is in left-to-right text direction. Since 3.8
        const DIR_LTR = 128;
        /// Widget is in right-to-left text direction. Since 3.8
        const DIR_RTL = 256;
        /// Widget is a link. Since 3.12
        const LINK = 512;
        /// The location the widget points to has already been visited. Since 3.12
        const VISITED = 1024;
        /// Widget is checked. Since 3.14
        const CHECKED = 2048;
        /// Widget is highlighted as a drop target for DND. Since 3.20
        const DROP_ACTIVE = 4096;
    }
}

#[doc(hidden)]
impl ToGlib for StateFlags {
    type GlibType = gtk_sys::GtkStateFlags;

    fn to_glib(&self) -> gtk_sys::GtkStateFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkStateFlags> for StateFlags {
    fn from_glib(value: gtk_sys::GtkStateFlags) -> StateFlags {
        skip_assert_initialized!();
        StateFlags::from_bits_truncate(value)
    }
}

impl StaticType for StateFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_state_flags_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for StateFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for StateFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for StateFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
bitflags! {
    /// Flags that modify the behavior of `StyleContextExt::to_string`.
    /// New values may be added to this enumeration.
    pub struct StyleContextPrintFlags: u32 {
        const NONE = 0;
        /// Print the entire tree of
        ///  CSS nodes starting at the style context's node
        const RECURSE = 1;
        /// Show the values of the
        ///  CSS properties for each node
        ///
        /// Feature: `v3_20`
        ///
        const SHOW_STYLE = 2;
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for StyleContextPrintFlags {
    type GlibType = gtk_sys::GtkStyleContextPrintFlags;

    fn to_glib(&self) -> gtk_sys::GtkStyleContextPrintFlags {
        self.bits()
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
#[doc(hidden)]
impl FromGlib<gtk_sys::GtkStyleContextPrintFlags> for StyleContextPrintFlags {
    fn from_glib(value: gtk_sys::GtkStyleContextPrintFlags) -> StyleContextPrintFlags {
        skip_assert_initialized!();
        StyleContextPrintFlags::from_bits_truncate(value)
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
impl StaticType for StyleContextPrintFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_style_context_print_flags_get_type()) }
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
impl<'a> FromValueOptional<'a> for StyleContextPrintFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
impl<'a> FromValue<'a> for StyleContextPrintFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
impl SetValue for StyleContextPrintFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// The `TargetFlags` enumeration is used to specify
    /// constraints on a `TargetEntry`.
    pub struct TargetFlags: u32 {
        /// If this is set, the target will only be selected
        ///  for drags within a single application.
        const SAME_APP = 1;
        /// If this is set, the target will only be selected
        ///  for drags within a single widget.
        const SAME_WIDGET = 2;
        /// If this is set, the target will not be selected
        ///  for drags within a single application.
        const OTHER_APP = 4;
        /// If this is set, the target will not be selected
        ///  for drags withing a single widget.
        const OTHER_WIDGET = 8;
    }
}

#[doc(hidden)]
impl ToGlib for TargetFlags {
    type GlibType = gtk_sys::GtkTargetFlags;

    fn to_glib(&self) -> gtk_sys::GtkTargetFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkTargetFlags> for TargetFlags {
    fn from_glib(value: gtk_sys::GtkTargetFlags) -> TargetFlags {
        skip_assert_initialized!();
        TargetFlags::from_bits_truncate(value)
    }
}

impl StaticType for TargetFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_target_flags_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for TargetFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for TargetFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for TargetFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// Flags affecting how a search is done.
    ///
    /// If neither `TextSearchFlags::VisibleOnly` nor `TextSearchFlags::TextOnly` are
    /// enabled, the match must be exact; the special 0xFFFC character will match
    /// embedded pixbufs or child widgets.
    pub struct TextSearchFlags: u32 {
        /// Search only visible data. A search match may
        /// have invisible text interspersed.
        const VISIBLE_ONLY = 1;
        /// Search only text. A match may have pixbufs or
        /// child widgets mixed inside the matched range.
        const TEXT_ONLY = 2;
        /// The text will be matched regardless of
        /// what case it is in.
        const CASE_INSENSITIVE = 4;
    }
}

#[doc(hidden)]
impl ToGlib for TextSearchFlags {
    type GlibType = gtk_sys::GtkTextSearchFlags;

    fn to_glib(&self) -> gtk_sys::GtkTextSearchFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkTextSearchFlags> for TextSearchFlags {
    fn from_glib(value: gtk_sys::GtkTextSearchFlags) -> TextSearchFlags {
        skip_assert_initialized!();
        TextSearchFlags::from_bits_truncate(value)
    }
}

impl StaticType for TextSearchFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_text_search_flags_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for TextSearchFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for TextSearchFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for TextSearchFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// Flags used to specify the supported drag targets.
    pub struct ToolPaletteDragTargets: u32 {
        /// Support drag of items.
        const ITEMS = 1;
        /// Support drag of groups.
        const GROUPS = 2;
    }
}

#[doc(hidden)]
impl ToGlib for ToolPaletteDragTargets {
    type GlibType = gtk_sys::GtkToolPaletteDragTargets;

    fn to_glib(&self) -> gtk_sys::GtkToolPaletteDragTargets {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkToolPaletteDragTargets> for ToolPaletteDragTargets {
    fn from_glib(value: gtk_sys::GtkToolPaletteDragTargets) -> ToolPaletteDragTargets {
        skip_assert_initialized!();
        ToolPaletteDragTargets::from_bits_truncate(value)
    }
}

impl StaticType for ToolPaletteDragTargets {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_tool_palette_drag_targets_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for ToolPaletteDragTargets {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for ToolPaletteDragTargets {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for ToolPaletteDragTargets {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// These flags indicate various properties of a `TreeModel`.
    ///
    /// They are returned by `TreeModel::get_flags`, and must be
    /// static for the lifetime of the object. A more complete description
    /// of `TreeModelFlags::ItersPersist` can be found in the overview of
    /// this section.
    pub struct TreeModelFlags: u32 {
        /// iterators survive all signals
        ///  emitted by the tree
        const ITERS_PERSIST = 1;
        /// the model is a list only, and never
        ///  has children
        const LIST_ONLY = 2;
    }
}

#[doc(hidden)]
impl ToGlib for TreeModelFlags {
    type GlibType = gtk_sys::GtkTreeModelFlags;

    fn to_glib(&self) -> gtk_sys::GtkTreeModelFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gtk_sys::GtkTreeModelFlags> for TreeModelFlags {
    fn from_glib(value: gtk_sys::GtkTreeModelFlags) -> TreeModelFlags {
        skip_assert_initialized!();
        TreeModelFlags::from_bits_truncate(value)
    }
}

impl StaticType for TreeModelFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gtk_sys::gtk_tree_model_flags_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for TreeModelFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for TreeModelFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for TreeModelFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}