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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

use crate::ffi;
#[cfg(feature = "v1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
use glib::{bitflags::bitflags, prelude::*, translate::*};

#[cfg(feature = "v1_2")]
bitflags! {
    /// Describes available shortcuts in an [`TabView`][crate::TabView].
    ///
    /// Shortcuts can be set with [`shortcuts`][struct@crate::TabView#shortcuts], or added/removed
    /// individually with [`TabView::add_shortcuts()`][crate::TabView::add_shortcuts()] and
    /// [`TabView::remove_shortcuts()`][crate::TabView::remove_shortcuts()].
    ///
    /// New values may be added to this enumeration over time.
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "AdwTabViewShortcuts")]
    pub struct TabViewShortcuts: u32 {
        /// No shortcuts
        #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_NONE")]
        const NONE = ffi::ADW_TAB_VIEW_SHORTCUT_NONE as _;
        /// <kbd>Ctrl</kbd>+<kbd>Tab</kbd> - switch to the next page
        #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_TAB")]
        const CONTROL_TAB = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_TAB as _;
        /// <kbd>Shift</kbd>+<kbd>Ctrl</kbd>+<kbd>Tab</kbd> - switch to the previous
        ///   page
        #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_TAB")]
        const CONTROL_SHIFT_TAB = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_TAB as _;
        /// <kbd>Ctrl</kbd>+<kbd>Page Up</kbd> - switch to the previous page
        #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_PAGE_UP")]
        const CONTROL_PAGE_UP = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_PAGE_UP as _;
        /// <kbd>Ctrl</kbd>+<kbd>Page Down</kbd> - switch to the next page
        #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_PAGE_DOWN")]
        const CONTROL_PAGE_DOWN = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_PAGE_DOWN as _;
        /// <kbd>Ctrl</kbd>+<kbd>Home</kbd> - switch to the first page
        #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_HOME")]
        const CONTROL_HOME = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_HOME as _;
        /// <kbd>Ctrl</kbd>+<kbd>End</kbd> - switch to the last page
        #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_END")]
        const CONTROL_END = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_END as _;
        /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Page Up</kbd> - move the selected
        ///   page backward
        #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_PAGE_UP")]
        const CONTROL_SHIFT_PAGE_UP = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_PAGE_UP as _;
        /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Page Down</kbd> - move the selected
        ///   page forward
        #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_PAGE_DOWN")]
        const CONTROL_SHIFT_PAGE_DOWN = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_PAGE_DOWN as _;
        /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Home</kbd> - move the selected page
        ///   at the start
        #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_HOME")]
        const CONTROL_SHIFT_HOME = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_HOME as _;
        /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>End</kbd> - move the current page at
        ///   the end
        #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_END")]
        const CONTROL_SHIFT_END = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_END as _;
        /// <kbd>Alt</kbd>+<kbd>1</kbd>⋯<kbd>9</kbd> - switch to pages 1-9
        #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_ALT_DIGITS")]
        const ALT_DIGITS = ffi::ADW_TAB_VIEW_SHORTCUT_ALT_DIGITS as _;
        /// <kbd>Alt</kbd>+<kbd>0</kbd> - switch to page 10
        #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_ALT_ZERO")]
        const ALT_ZERO = ffi::ADW_TAB_VIEW_SHORTCUT_ALT_ZERO as _;
        /// All of the shortcuts
        #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_ALL_SHORTCUTS")]
        const ALL_SHORTCUTS = ffi::ADW_TAB_VIEW_SHORTCUT_ALL_SHORTCUTS as _;
    }
}

#[cfg(feature = "v1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
#[doc(hidden)]
impl IntoGlib for TabViewShortcuts {
    type GlibType = ffi::AdwTabViewShortcuts;

    #[inline]
    fn into_glib(self) -> ffi::AdwTabViewShortcuts {
        self.bits()
    }
}

#[cfg(feature = "v1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
#[doc(hidden)]
impl FromGlib<ffi::AdwTabViewShortcuts> for TabViewShortcuts {
    #[inline]
    unsafe fn from_glib(value: ffi::AdwTabViewShortcuts) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

#[cfg(feature = "v1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
impl StaticType for TabViewShortcuts {
    #[inline]
    #[doc(alias = "adw_tab_view_shortcuts_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::adw_tab_view_shortcuts_get_type()) }
    }
}

#[cfg(feature = "v1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
impl glib::HasParamSpec for TabViewShortcuts {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder
    }
}

#[cfg(feature = "v1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
impl glib::value::ValueType for TabViewShortcuts {
    type Type = Self;
}

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

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

#[cfg(feature = "v1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
impl ToValue for TabViewShortcuts {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

#[cfg(feature = "v1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
impl From<TabViewShortcuts> for glib::Value {
    #[inline]
    fn from(v: TabViewShortcuts) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}