Skip to main content

gtk/auto/
tool_shell.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{Buildable, IconSize, Orientation, ReliefStyle, SizeGroup, ToolbarStyle, Widget, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    /// The [`ToolShell`][crate::ToolShell] interface allows container widgets to provide additional
10    /// information when embedding [`ToolItem`][crate::ToolItem] widgets.
11    ///
12    /// # Implements
13    ///
14    /// [`ToolShellExt`][trait@crate::prelude::ToolShellExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
15    #[doc(alias = "GtkToolShell")]
16    pub struct ToolShell(Interface<ffi::GtkToolShell, ffi::GtkToolShellIface>) @requires Widget, Buildable;
17
18    match fn {
19        type_ => || ffi::gtk_tool_shell_get_type(),
20    }
21}
22
23impl ToolShell {
24    pub const NONE: Option<&'static ToolShell> = None;
25}
26
27/// Trait containing all [`struct@ToolShell`] methods.
28///
29/// # Implementors
30///
31/// [`ToolItemGroup`][struct@crate::ToolItemGroup], [`ToolShell`][struct@crate::ToolShell], [`Toolbar`][struct@crate::Toolbar]
32pub trait ToolShellExt: IsA<ToolShell> + 'static {
33    /// Retrieves the current ellipsize mode for the tool shell. Tool items must not
34    /// call this function directly, but rely on [`ToolItemExt::ellipsize_mode()`][crate::prelude::ToolItemExt::ellipsize_mode()]
35    /// instead.
36    ///
37    /// # Returns
38    ///
39    /// the current ellipsize mode of `self`
40    #[doc(alias = "gtk_tool_shell_get_ellipsize_mode")]
41    #[doc(alias = "get_ellipsize_mode")]
42    fn ellipsize_mode(&self) -> pango::EllipsizeMode {
43        unsafe {
44            from_glib(ffi::gtk_tool_shell_get_ellipsize_mode(
45                self.as_ref().to_glib_none().0,
46            ))
47        }
48    }
49
50    /// Retrieves the icon size for the tool shell. Tool items must not call this
51    /// function directly, but rely on [`ToolItemExt::icon_size()`][crate::prelude::ToolItemExt::icon_size()] instead.
52    ///
53    /// # Returns
54    ///
55    /// the current size ([`IconSize`][crate::IconSize]) for icons of `self`
56    #[doc(alias = "gtk_tool_shell_get_icon_size")]
57    #[doc(alias = "get_icon_size")]
58    fn icon_size(&self) -> IconSize {
59        unsafe {
60            from_glib(ffi::gtk_tool_shell_get_icon_size(
61                self.as_ref().to_glib_none().0,
62            ))
63        }
64    }
65
66    /// Retrieves the current orientation for the tool shell. Tool items must not
67    /// call this function directly, but rely on [`ToolItemExt::orientation()`][crate::prelude::ToolItemExt::orientation()]
68    /// instead.
69    ///
70    /// # Returns
71    ///
72    /// the current orientation of `self`
73    #[doc(alias = "gtk_tool_shell_get_orientation")]
74    #[doc(alias = "get_orientation")]
75    fn orientation(&self) -> Orientation {
76        unsafe {
77            from_glib(ffi::gtk_tool_shell_get_orientation(
78                self.as_ref().to_glib_none().0,
79            ))
80        }
81    }
82
83    /// Returns the relief style of buttons on `self`. Tool items must not call this
84    /// function directly, but rely on [`ToolItemExt::relief_style()`][crate::prelude::ToolItemExt::relief_style()] instead.
85    ///
86    /// # Returns
87    ///
88    /// The relief style of buttons on `self`.
89    #[doc(alias = "gtk_tool_shell_get_relief_style")]
90    #[doc(alias = "get_relief_style")]
91    fn relief_style(&self) -> ReliefStyle {
92        unsafe {
93            from_glib(ffi::gtk_tool_shell_get_relief_style(
94                self.as_ref().to_glib_none().0,
95            ))
96        }
97    }
98
99    /// Retrieves whether the tool shell has text, icons, or both. Tool items must
100    /// not call this function directly, but rely on [`ToolItemExt::toolbar_style()`][crate::prelude::ToolItemExt::toolbar_style()]
101    /// instead.
102    ///
103    /// # Returns
104    ///
105    /// the current style of `self`
106    #[doc(alias = "gtk_tool_shell_get_style")]
107    #[doc(alias = "get_style")]
108    fn style(&self) -> ToolbarStyle {
109        unsafe {
110            from_glib(ffi::gtk_tool_shell_get_style(
111                self.as_ref().to_glib_none().0,
112            ))
113        }
114    }
115
116    /// Retrieves the current text alignment for the tool shell. Tool items must not
117    /// call this function directly, but rely on [`ToolItemExt::text_alignment()`][crate::prelude::ToolItemExt::text_alignment()]
118    /// instead.
119    ///
120    /// # Returns
121    ///
122    /// the current text alignment of `self`
123    #[doc(alias = "gtk_tool_shell_get_text_alignment")]
124    #[doc(alias = "get_text_alignment")]
125    fn text_alignment(&self) -> f32 {
126        unsafe { ffi::gtk_tool_shell_get_text_alignment(self.as_ref().to_glib_none().0) }
127    }
128
129    /// Retrieves the current text orientation for the tool shell. Tool items must not
130    /// call this function directly, but rely on [`ToolItemExt::text_orientation()`][crate::prelude::ToolItemExt::text_orientation()]
131    /// instead.
132    ///
133    /// # Returns
134    ///
135    /// the current text orientation of `self`
136    #[doc(alias = "gtk_tool_shell_get_text_orientation")]
137    #[doc(alias = "get_text_orientation")]
138    fn text_orientation(&self) -> Orientation {
139        unsafe {
140            from_glib(ffi::gtk_tool_shell_get_text_orientation(
141                self.as_ref().to_glib_none().0,
142            ))
143        }
144    }
145
146    /// Retrieves the current text size group for the tool shell. Tool items must not
147    /// call this function directly, but rely on [`ToolItemExt::text_size_group()`][crate::prelude::ToolItemExt::text_size_group()]
148    /// instead.
149    ///
150    /// # Returns
151    ///
152    /// the current text size group of `self`
153    #[doc(alias = "gtk_tool_shell_get_text_size_group")]
154    #[doc(alias = "get_text_size_group")]
155    fn text_size_group(&self) -> Option<SizeGroup> {
156        unsafe {
157            from_glib_none(ffi::gtk_tool_shell_get_text_size_group(
158                self.as_ref().to_glib_none().0,
159            ))
160        }
161    }
162
163    /// Calling this function signals the tool shell that the overflow menu item for
164    /// tool items have changed. If there is an overflow menu and if it is visible
165    /// when this function it called, the menu will be rebuilt.
166    ///
167    /// Tool items must not call this function directly, but rely on
168    /// [`ToolItemExt::rebuild_menu()`][crate::prelude::ToolItemExt::rebuild_menu()] instead.
169    #[doc(alias = "gtk_tool_shell_rebuild_menu")]
170    fn rebuild_menu(&self) {
171        unsafe {
172            ffi::gtk_tool_shell_rebuild_menu(self.as_ref().to_glib_none().0);
173        }
174    }
175}
176
177impl<O: IsA<ToolShell>> ToolShellExt for O {}