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