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 
5 use crate::Align;
6 use crate::Bin;
7 use crate::Buildable;
8 use crate::Container;
9 use crate::IconSize;
10 use crate::Orientation;
11 use crate::ReliefStyle;
12 use crate::ResizeMode;
13 use crate::SizeGroup;
14 use crate::ToolbarStyle;
15 use crate::Widget;
16 use glib::object::Cast;
17 use glib::object::IsA;
18 use glib::signal::connect_raw;
19 use glib::signal::SignalHandlerId;
20 use glib::translate::*;
21 use glib::StaticType;
22 use glib::ToValue;
23 use std::boxed::Box as Box_;
24 use std::fmt;
25 use std::mem::transmute;
26 
27 glib::wrapper! {
28     #[doc(alias = "GtkToolItem")]
29     pub struct ToolItem(Object<ffi::GtkToolItem, ffi::GtkToolItemClass>) @extends Bin, Container, Widget, @implements Buildable;
30 
31     match fn {
32         type_ => || ffi::gtk_tool_item_get_type(),
33     }
34 }
35 
36 impl ToolItem {
37     #[doc(alias = "gtk_tool_item_new")]
new() -> ToolItem38     pub fn new() -> ToolItem {
39         assert_initialized_main_thread!();
40         unsafe { from_glib_none(ffi::gtk_tool_item_new()) }
41     }
42 
43     // rustdoc-stripper-ignore-next
44     /// Creates a new builder-pattern struct instance to construct [`ToolItem`] objects.
45     ///
46     /// This method returns an instance of [`ToolItemBuilder`] which can be used to create [`ToolItem`] objects.
builder() -> ToolItemBuilder47     pub fn builder() -> ToolItemBuilder {
48         ToolItemBuilder::default()
49     }
50 }
51 
52 impl Default for ToolItem {
default() -> Self53     fn default() -> Self {
54         Self::new()
55     }
56 }
57 
58 #[derive(Clone, Default)]
59 // rustdoc-stripper-ignore-next
60 /// A [builder-pattern] type to construct [`ToolItem`] objects.
61 ///
62 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
63 pub struct ToolItemBuilder {
64     is_important: Option<bool>,
65     visible_horizontal: Option<bool>,
66     visible_vertical: Option<bool>,
67     border_width: Option<u32>,
68     child: Option<Widget>,
69     resize_mode: Option<ResizeMode>,
70     app_paintable: Option<bool>,
71     can_default: Option<bool>,
72     can_focus: Option<bool>,
73     events: Option<gdk::EventMask>,
74     expand: Option<bool>,
75     #[cfg(any(feature = "v3_20", feature = "dox"))]
76     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
77     focus_on_click: Option<bool>,
78     halign: Option<Align>,
79     has_default: Option<bool>,
80     has_focus: Option<bool>,
81     has_tooltip: Option<bool>,
82     height_request: Option<i32>,
83     hexpand: Option<bool>,
84     hexpand_set: Option<bool>,
85     is_focus: Option<bool>,
86     margin: Option<i32>,
87     margin_bottom: Option<i32>,
88     margin_end: Option<i32>,
89     margin_start: Option<i32>,
90     margin_top: Option<i32>,
91     name: Option<String>,
92     no_show_all: Option<bool>,
93     opacity: Option<f64>,
94     parent: Option<Container>,
95     receives_default: Option<bool>,
96     sensitive: Option<bool>,
97     tooltip_markup: Option<String>,
98     tooltip_text: Option<String>,
99     valign: Option<Align>,
100     vexpand: Option<bool>,
101     vexpand_set: Option<bool>,
102     visible: Option<bool>,
103     width_request: Option<i32>,
104 }
105 
106 impl ToolItemBuilder {
107     // rustdoc-stripper-ignore-next
108     /// Create a new [`ToolItemBuilder`].
new() -> Self109     pub fn new() -> Self {
110         Self::default()
111     }
112 
113     // rustdoc-stripper-ignore-next
114     /// Build the [`ToolItem`].
build(self) -> ToolItem115     pub fn build(self) -> ToolItem {
116         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
117         if let Some(ref is_important) = self.is_important {
118             properties.push(("is-important", is_important));
119         }
120         if let Some(ref visible_horizontal) = self.visible_horizontal {
121             properties.push(("visible-horizontal", visible_horizontal));
122         }
123         if let Some(ref visible_vertical) = self.visible_vertical {
124             properties.push(("visible-vertical", visible_vertical));
125         }
126         if let Some(ref border_width) = self.border_width {
127             properties.push(("border-width", border_width));
128         }
129         if let Some(ref child) = self.child {
130             properties.push(("child", child));
131         }
132         if let Some(ref resize_mode) = self.resize_mode {
133             properties.push(("resize-mode", resize_mode));
134         }
135         if let Some(ref app_paintable) = self.app_paintable {
136             properties.push(("app-paintable", app_paintable));
137         }
138         if let Some(ref can_default) = self.can_default {
139             properties.push(("can-default", can_default));
140         }
141         if let Some(ref can_focus) = self.can_focus {
142             properties.push(("can-focus", can_focus));
143         }
144         if let Some(ref events) = self.events {
145             properties.push(("events", events));
146         }
147         if let Some(ref expand) = self.expand {
148             properties.push(("expand", expand));
149         }
150         #[cfg(any(feature = "v3_20", feature = "dox"))]
151         if let Some(ref focus_on_click) = self.focus_on_click {
152             properties.push(("focus-on-click", focus_on_click));
153         }
154         if let Some(ref halign) = self.halign {
155             properties.push(("halign", halign));
156         }
157         if let Some(ref has_default) = self.has_default {
158             properties.push(("has-default", has_default));
159         }
160         if let Some(ref has_focus) = self.has_focus {
161             properties.push(("has-focus", has_focus));
162         }
163         if let Some(ref has_tooltip) = self.has_tooltip {
164             properties.push(("has-tooltip", has_tooltip));
165         }
166         if let Some(ref height_request) = self.height_request {
167             properties.push(("height-request", height_request));
168         }
169         if let Some(ref hexpand) = self.hexpand {
170             properties.push(("hexpand", hexpand));
171         }
172         if let Some(ref hexpand_set) = self.hexpand_set {
173             properties.push(("hexpand-set", hexpand_set));
174         }
175         if let Some(ref is_focus) = self.is_focus {
176             properties.push(("is-focus", is_focus));
177         }
178         if let Some(ref margin) = self.margin {
179             properties.push(("margin", margin));
180         }
181         if let Some(ref margin_bottom) = self.margin_bottom {
182             properties.push(("margin-bottom", margin_bottom));
183         }
184         if let Some(ref margin_end) = self.margin_end {
185             properties.push(("margin-end", margin_end));
186         }
187         if let Some(ref margin_start) = self.margin_start {
188             properties.push(("margin-start", margin_start));
189         }
190         if let Some(ref margin_top) = self.margin_top {
191             properties.push(("margin-top", margin_top));
192         }
193         if let Some(ref name) = self.name {
194             properties.push(("name", name));
195         }
196         if let Some(ref no_show_all) = self.no_show_all {
197             properties.push(("no-show-all", no_show_all));
198         }
199         if let Some(ref opacity) = self.opacity {
200             properties.push(("opacity", opacity));
201         }
202         if let Some(ref parent) = self.parent {
203             properties.push(("parent", parent));
204         }
205         if let Some(ref receives_default) = self.receives_default {
206             properties.push(("receives-default", receives_default));
207         }
208         if let Some(ref sensitive) = self.sensitive {
209             properties.push(("sensitive", sensitive));
210         }
211         if let Some(ref tooltip_markup) = self.tooltip_markup {
212             properties.push(("tooltip-markup", tooltip_markup));
213         }
214         if let Some(ref tooltip_text) = self.tooltip_text {
215             properties.push(("tooltip-text", tooltip_text));
216         }
217         if let Some(ref valign) = self.valign {
218             properties.push(("valign", valign));
219         }
220         if let Some(ref vexpand) = self.vexpand {
221             properties.push(("vexpand", vexpand));
222         }
223         if let Some(ref vexpand_set) = self.vexpand_set {
224             properties.push(("vexpand-set", vexpand_set));
225         }
226         if let Some(ref visible) = self.visible {
227             properties.push(("visible", visible));
228         }
229         if let Some(ref width_request) = self.width_request {
230             properties.push(("width-request", width_request));
231         }
232         glib::Object::new::<ToolItem>(&properties)
233             .expect("Failed to create an instance of ToolItem")
234     }
235 
is_important(mut self, is_important: bool) -> Self236     pub fn is_important(mut self, is_important: bool) -> Self {
237         self.is_important = Some(is_important);
238         self
239     }
240 
visible_horizontal(mut self, visible_horizontal: bool) -> Self241     pub fn visible_horizontal(mut self, visible_horizontal: bool) -> Self {
242         self.visible_horizontal = Some(visible_horizontal);
243         self
244     }
245 
visible_vertical(mut self, visible_vertical: bool) -> Self246     pub fn visible_vertical(mut self, visible_vertical: bool) -> Self {
247         self.visible_vertical = Some(visible_vertical);
248         self
249     }
250 
border_width(mut self, border_width: u32) -> Self251     pub fn border_width(mut self, border_width: u32) -> Self {
252         self.border_width = Some(border_width);
253         self
254     }
255 
child<P: IsA<Widget>>(mut self, child: &P) -> Self256     pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self {
257         self.child = Some(child.clone().upcast());
258         self
259     }
260 
resize_mode(mut self, resize_mode: ResizeMode) -> Self261     pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
262         self.resize_mode = Some(resize_mode);
263         self
264     }
265 
app_paintable(mut self, app_paintable: bool) -> Self266     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
267         self.app_paintable = Some(app_paintable);
268         self
269     }
270 
can_default(mut self, can_default: bool) -> Self271     pub fn can_default(mut self, can_default: bool) -> Self {
272         self.can_default = Some(can_default);
273         self
274     }
275 
can_focus(mut self, can_focus: bool) -> Self276     pub fn can_focus(mut self, can_focus: bool) -> Self {
277         self.can_focus = Some(can_focus);
278         self
279     }
280 
events(mut self, events: gdk::EventMask) -> Self281     pub fn events(mut self, events: gdk::EventMask) -> Self {
282         self.events = Some(events);
283         self
284     }
285 
expand(mut self, expand: bool) -> Self286     pub fn expand(mut self, expand: bool) -> Self {
287         self.expand = Some(expand);
288         self
289     }
290 
291     #[cfg(any(feature = "v3_20", feature = "dox"))]
292     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
focus_on_click(mut self, focus_on_click: bool) -> Self293     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
294         self.focus_on_click = Some(focus_on_click);
295         self
296     }
297 
halign(mut self, halign: Align) -> Self298     pub fn halign(mut self, halign: Align) -> Self {
299         self.halign = Some(halign);
300         self
301     }
302 
has_default(mut self, has_default: bool) -> Self303     pub fn has_default(mut self, has_default: bool) -> Self {
304         self.has_default = Some(has_default);
305         self
306     }
307 
has_focus(mut self, has_focus: bool) -> Self308     pub fn has_focus(mut self, has_focus: bool) -> Self {
309         self.has_focus = Some(has_focus);
310         self
311     }
312 
has_tooltip(mut self, has_tooltip: bool) -> Self313     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
314         self.has_tooltip = Some(has_tooltip);
315         self
316     }
317 
height_request(mut self, height_request: i32) -> Self318     pub fn height_request(mut self, height_request: i32) -> Self {
319         self.height_request = Some(height_request);
320         self
321     }
322 
hexpand(mut self, hexpand: bool) -> Self323     pub fn hexpand(mut self, hexpand: bool) -> Self {
324         self.hexpand = Some(hexpand);
325         self
326     }
327 
hexpand_set(mut self, hexpand_set: bool) -> Self328     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
329         self.hexpand_set = Some(hexpand_set);
330         self
331     }
332 
is_focus(mut self, is_focus: bool) -> Self333     pub fn is_focus(mut self, is_focus: bool) -> Self {
334         self.is_focus = Some(is_focus);
335         self
336     }
337 
margin(mut self, margin: i32) -> Self338     pub fn margin(mut self, margin: i32) -> Self {
339         self.margin = Some(margin);
340         self
341     }
342 
margin_bottom(mut self, margin_bottom: i32) -> Self343     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
344         self.margin_bottom = Some(margin_bottom);
345         self
346     }
347 
margin_end(mut self, margin_end: i32) -> Self348     pub fn margin_end(mut self, margin_end: i32) -> Self {
349         self.margin_end = Some(margin_end);
350         self
351     }
352 
margin_start(mut self, margin_start: i32) -> Self353     pub fn margin_start(mut self, margin_start: i32) -> Self {
354         self.margin_start = Some(margin_start);
355         self
356     }
357 
margin_top(mut self, margin_top: i32) -> Self358     pub fn margin_top(mut self, margin_top: i32) -> Self {
359         self.margin_top = Some(margin_top);
360         self
361     }
362 
name(mut self, name: &str) -> Self363     pub fn name(mut self, name: &str) -> Self {
364         self.name = Some(name.to_string());
365         self
366     }
367 
no_show_all(mut self, no_show_all: bool) -> Self368     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
369         self.no_show_all = Some(no_show_all);
370         self
371     }
372 
opacity(mut self, opacity: f64) -> Self373     pub fn opacity(mut self, opacity: f64) -> Self {
374         self.opacity = Some(opacity);
375         self
376     }
377 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self378     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
379         self.parent = Some(parent.clone().upcast());
380         self
381     }
382 
receives_default(mut self, receives_default: bool) -> Self383     pub fn receives_default(mut self, receives_default: bool) -> Self {
384         self.receives_default = Some(receives_default);
385         self
386     }
387 
sensitive(mut self, sensitive: bool) -> Self388     pub fn sensitive(mut self, sensitive: bool) -> Self {
389         self.sensitive = Some(sensitive);
390         self
391     }
392 
tooltip_markup(mut self, tooltip_markup: &str) -> Self393     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
394         self.tooltip_markup = Some(tooltip_markup.to_string());
395         self
396     }
397 
tooltip_text(mut self, tooltip_text: &str) -> Self398     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
399         self.tooltip_text = Some(tooltip_text.to_string());
400         self
401     }
402 
valign(mut self, valign: Align) -> Self403     pub fn valign(mut self, valign: Align) -> Self {
404         self.valign = Some(valign);
405         self
406     }
407 
vexpand(mut self, vexpand: bool) -> Self408     pub fn vexpand(mut self, vexpand: bool) -> Self {
409         self.vexpand = Some(vexpand);
410         self
411     }
412 
vexpand_set(mut self, vexpand_set: bool) -> Self413     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
414         self.vexpand_set = Some(vexpand_set);
415         self
416     }
417 
visible(mut self, visible: bool) -> Self418     pub fn visible(mut self, visible: bool) -> Self {
419         self.visible = Some(visible);
420         self
421     }
422 
width_request(mut self, width_request: i32) -> Self423     pub fn width_request(mut self, width_request: i32) -> Self {
424         self.width_request = Some(width_request);
425         self
426     }
427 }
428 
429 pub const NONE_TOOL_ITEM: Option<&ToolItem> = None;
430 
431 pub trait ToolItemExt: 'static {
432     #[doc(alias = "gtk_tool_item_get_ellipsize_mode")]
433     #[doc(alias = "get_ellipsize_mode")]
ellipsize_mode(&self) -> pango::EllipsizeMode434     fn ellipsize_mode(&self) -> pango::EllipsizeMode;
435 
436     #[doc(alias = "gtk_tool_item_get_expand")]
437     #[doc(alias = "get_expand")]
expands(&self) -> bool438     fn expands(&self) -> bool;
439 
440     #[doc(alias = "gtk_tool_item_get_homogeneous")]
441     #[doc(alias = "get_homogeneous")]
is_homogeneous(&self) -> bool442     fn is_homogeneous(&self) -> bool;
443 
444     #[doc(alias = "gtk_tool_item_get_icon_size")]
445     #[doc(alias = "get_icon_size")]
icon_size(&self) -> IconSize446     fn icon_size(&self) -> IconSize;
447 
448     #[doc(alias = "gtk_tool_item_get_is_important")]
449     #[doc(alias = "get_is_important")]
is_important(&self) -> bool450     fn is_important(&self) -> bool;
451 
452     #[doc(alias = "gtk_tool_item_get_orientation")]
453     #[doc(alias = "get_orientation")]
orientation(&self) -> Orientation454     fn orientation(&self) -> Orientation;
455 
456     #[doc(alias = "gtk_tool_item_get_proxy_menu_item")]
457     #[doc(alias = "get_proxy_menu_item")]
proxy_menu_item(&self, menu_item_id: &str) -> Option<Widget>458     fn proxy_menu_item(&self, menu_item_id: &str) -> Option<Widget>;
459 
460     #[doc(alias = "gtk_tool_item_get_relief_style")]
461     #[doc(alias = "get_relief_style")]
relief_style(&self) -> ReliefStyle462     fn relief_style(&self) -> ReliefStyle;
463 
464     #[doc(alias = "gtk_tool_item_get_text_alignment")]
465     #[doc(alias = "get_text_alignment")]
text_alignment(&self) -> f32466     fn text_alignment(&self) -> f32;
467 
468     #[doc(alias = "gtk_tool_item_get_text_orientation")]
469     #[doc(alias = "get_text_orientation")]
text_orientation(&self) -> Orientation470     fn text_orientation(&self) -> Orientation;
471 
472     #[doc(alias = "gtk_tool_item_get_text_size_group")]
473     #[doc(alias = "get_text_size_group")]
text_size_group(&self) -> Option<SizeGroup>474     fn text_size_group(&self) -> Option<SizeGroup>;
475 
476     #[doc(alias = "gtk_tool_item_get_toolbar_style")]
477     #[doc(alias = "get_toolbar_style")]
toolbar_style(&self) -> ToolbarStyle478     fn toolbar_style(&self) -> ToolbarStyle;
479 
480     #[doc(alias = "gtk_tool_item_get_use_drag_window")]
481     #[doc(alias = "get_use_drag_window")]
uses_drag_window(&self) -> bool482     fn uses_drag_window(&self) -> bool;
483 
484     #[doc(alias = "gtk_tool_item_get_visible_horizontal")]
485     #[doc(alias = "get_visible_horizontal")]
is_visible_horizontal(&self) -> bool486     fn is_visible_horizontal(&self) -> bool;
487 
488     #[doc(alias = "gtk_tool_item_get_visible_vertical")]
489     #[doc(alias = "get_visible_vertical")]
is_visible_vertical(&self) -> bool490     fn is_visible_vertical(&self) -> bool;
491 
492     #[doc(alias = "gtk_tool_item_rebuild_menu")]
rebuild_menu(&self)493     fn rebuild_menu(&self);
494 
495     #[doc(alias = "gtk_tool_item_retrieve_proxy_menu_item")]
retrieve_proxy_menu_item(&self) -> Option<Widget>496     fn retrieve_proxy_menu_item(&self) -> Option<Widget>;
497 
498     #[doc(alias = "gtk_tool_item_set_expand")]
set_expand(&self, expand: bool)499     fn set_expand(&self, expand: bool);
500 
501     #[doc(alias = "gtk_tool_item_set_homogeneous")]
set_homogeneous(&self, homogeneous: bool)502     fn set_homogeneous(&self, homogeneous: bool);
503 
504     #[doc(alias = "gtk_tool_item_set_is_important")]
set_is_important(&self, is_important: bool)505     fn set_is_important(&self, is_important: bool);
506 
507     #[doc(alias = "gtk_tool_item_set_proxy_menu_item")]
set_proxy_menu_item<P: IsA<Widget>>(&self, menu_item_id: &str, menu_item: Option<&P>)508     fn set_proxy_menu_item<P: IsA<Widget>>(&self, menu_item_id: &str, menu_item: Option<&P>);
509 
510     #[doc(alias = "gtk_tool_item_set_use_drag_window")]
set_use_drag_window(&self, use_drag_window: bool)511     fn set_use_drag_window(&self, use_drag_window: bool);
512 
513     #[doc(alias = "gtk_tool_item_set_visible_horizontal")]
set_visible_horizontal(&self, visible_horizontal: bool)514     fn set_visible_horizontal(&self, visible_horizontal: bool);
515 
516     #[doc(alias = "gtk_tool_item_set_visible_vertical")]
set_visible_vertical(&self, visible_vertical: bool)517     fn set_visible_vertical(&self, visible_vertical: bool);
518 
519     #[doc(alias = "gtk_tool_item_toolbar_reconfigured")]
toolbar_reconfigured(&self)520     fn toolbar_reconfigured(&self);
521 
522     #[doc(alias = "create-menu-proxy")]
connect_create_menu_proxy<F: Fn(&Self) -> glib::signal::Inhibit + 'static>( &self, f: F, ) -> SignalHandlerId523     fn connect_create_menu_proxy<F: Fn(&Self) -> glib::signal::Inhibit + 'static>(
524         &self,
525         f: F,
526     ) -> SignalHandlerId;
527 
528     #[doc(alias = "toolbar-reconfigured")]
connect_toolbar_reconfigured<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId529     fn connect_toolbar_reconfigured<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
530 
531     #[doc(alias = "is-important")]
connect_is_important_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId532     fn connect_is_important_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
533 
534     #[doc(alias = "visible-horizontal")]
connect_visible_horizontal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId535     fn connect_visible_horizontal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
536 
537     #[doc(alias = "visible-vertical")]
connect_visible_vertical_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId538     fn connect_visible_vertical_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
539 }
540 
541 impl<O: IsA<ToolItem>> ToolItemExt for O {
ellipsize_mode(&self) -> pango::EllipsizeMode542     fn ellipsize_mode(&self) -> pango::EllipsizeMode {
543         unsafe {
544             from_glib(ffi::gtk_tool_item_get_ellipsize_mode(
545                 self.as_ref().to_glib_none().0,
546             ))
547         }
548     }
549 
expands(&self) -> bool550     fn expands(&self) -> bool {
551         unsafe {
552             from_glib(ffi::gtk_tool_item_get_expand(
553                 self.as_ref().to_glib_none().0,
554             ))
555         }
556     }
557 
is_homogeneous(&self) -> bool558     fn is_homogeneous(&self) -> bool {
559         unsafe {
560             from_glib(ffi::gtk_tool_item_get_homogeneous(
561                 self.as_ref().to_glib_none().0,
562             ))
563         }
564     }
565 
icon_size(&self) -> IconSize566     fn icon_size(&self) -> IconSize {
567         unsafe {
568             from_glib(ffi::gtk_tool_item_get_icon_size(
569                 self.as_ref().to_glib_none().0,
570             ))
571         }
572     }
573 
is_important(&self) -> bool574     fn is_important(&self) -> bool {
575         unsafe {
576             from_glib(ffi::gtk_tool_item_get_is_important(
577                 self.as_ref().to_glib_none().0,
578             ))
579         }
580     }
581 
orientation(&self) -> Orientation582     fn orientation(&self) -> Orientation {
583         unsafe {
584             from_glib(ffi::gtk_tool_item_get_orientation(
585                 self.as_ref().to_glib_none().0,
586             ))
587         }
588     }
589 
proxy_menu_item(&self, menu_item_id: &str) -> Option<Widget>590     fn proxy_menu_item(&self, menu_item_id: &str) -> Option<Widget> {
591         unsafe {
592             from_glib_none(ffi::gtk_tool_item_get_proxy_menu_item(
593                 self.as_ref().to_glib_none().0,
594                 menu_item_id.to_glib_none().0,
595             ))
596         }
597     }
598 
relief_style(&self) -> ReliefStyle599     fn relief_style(&self) -> ReliefStyle {
600         unsafe {
601             from_glib(ffi::gtk_tool_item_get_relief_style(
602                 self.as_ref().to_glib_none().0,
603             ))
604         }
605     }
606 
text_alignment(&self) -> f32607     fn text_alignment(&self) -> f32 {
608         unsafe { ffi::gtk_tool_item_get_text_alignment(self.as_ref().to_glib_none().0) }
609     }
610 
text_orientation(&self) -> Orientation611     fn text_orientation(&self) -> Orientation {
612         unsafe {
613             from_glib(ffi::gtk_tool_item_get_text_orientation(
614                 self.as_ref().to_glib_none().0,
615             ))
616         }
617     }
618 
text_size_group(&self) -> Option<SizeGroup>619     fn text_size_group(&self) -> Option<SizeGroup> {
620         unsafe {
621             from_glib_none(ffi::gtk_tool_item_get_text_size_group(
622                 self.as_ref().to_glib_none().0,
623             ))
624         }
625     }
626 
toolbar_style(&self) -> ToolbarStyle627     fn toolbar_style(&self) -> ToolbarStyle {
628         unsafe {
629             from_glib(ffi::gtk_tool_item_get_toolbar_style(
630                 self.as_ref().to_glib_none().0,
631             ))
632         }
633     }
634 
uses_drag_window(&self) -> bool635     fn uses_drag_window(&self) -> bool {
636         unsafe {
637             from_glib(ffi::gtk_tool_item_get_use_drag_window(
638                 self.as_ref().to_glib_none().0,
639             ))
640         }
641     }
642 
is_visible_horizontal(&self) -> bool643     fn is_visible_horizontal(&self) -> bool {
644         unsafe {
645             from_glib(ffi::gtk_tool_item_get_visible_horizontal(
646                 self.as_ref().to_glib_none().0,
647             ))
648         }
649     }
650 
is_visible_vertical(&self) -> bool651     fn is_visible_vertical(&self) -> bool {
652         unsafe {
653             from_glib(ffi::gtk_tool_item_get_visible_vertical(
654                 self.as_ref().to_glib_none().0,
655             ))
656         }
657     }
658 
rebuild_menu(&self)659     fn rebuild_menu(&self) {
660         unsafe {
661             ffi::gtk_tool_item_rebuild_menu(self.as_ref().to_glib_none().0);
662         }
663     }
664 
retrieve_proxy_menu_item(&self) -> Option<Widget>665     fn retrieve_proxy_menu_item(&self) -> Option<Widget> {
666         unsafe {
667             from_glib_none(ffi::gtk_tool_item_retrieve_proxy_menu_item(
668                 self.as_ref().to_glib_none().0,
669             ))
670         }
671     }
672 
set_expand(&self, expand: bool)673     fn set_expand(&self, expand: bool) {
674         unsafe {
675             ffi::gtk_tool_item_set_expand(self.as_ref().to_glib_none().0, expand.into_glib());
676         }
677     }
678 
set_homogeneous(&self, homogeneous: bool)679     fn set_homogeneous(&self, homogeneous: bool) {
680         unsafe {
681             ffi::gtk_tool_item_set_homogeneous(
682                 self.as_ref().to_glib_none().0,
683                 homogeneous.into_glib(),
684             );
685         }
686     }
687 
set_is_important(&self, is_important: bool)688     fn set_is_important(&self, is_important: bool) {
689         unsafe {
690             ffi::gtk_tool_item_set_is_important(
691                 self.as_ref().to_glib_none().0,
692                 is_important.into_glib(),
693             );
694         }
695     }
696 
set_proxy_menu_item<P: IsA<Widget>>(&self, menu_item_id: &str, menu_item: Option<&P>)697     fn set_proxy_menu_item<P: IsA<Widget>>(&self, menu_item_id: &str, menu_item: Option<&P>) {
698         unsafe {
699             ffi::gtk_tool_item_set_proxy_menu_item(
700                 self.as_ref().to_glib_none().0,
701                 menu_item_id.to_glib_none().0,
702                 menu_item.map(|p| p.as_ref()).to_glib_none().0,
703             );
704         }
705     }
706 
set_use_drag_window(&self, use_drag_window: bool)707     fn set_use_drag_window(&self, use_drag_window: bool) {
708         unsafe {
709             ffi::gtk_tool_item_set_use_drag_window(
710                 self.as_ref().to_glib_none().0,
711                 use_drag_window.into_glib(),
712             );
713         }
714     }
715 
set_visible_horizontal(&self, visible_horizontal: bool)716     fn set_visible_horizontal(&self, visible_horizontal: bool) {
717         unsafe {
718             ffi::gtk_tool_item_set_visible_horizontal(
719                 self.as_ref().to_glib_none().0,
720                 visible_horizontal.into_glib(),
721             );
722         }
723     }
724 
set_visible_vertical(&self, visible_vertical: bool)725     fn set_visible_vertical(&self, visible_vertical: bool) {
726         unsafe {
727             ffi::gtk_tool_item_set_visible_vertical(
728                 self.as_ref().to_glib_none().0,
729                 visible_vertical.into_glib(),
730             );
731         }
732     }
733 
toolbar_reconfigured(&self)734     fn toolbar_reconfigured(&self) {
735         unsafe {
736             ffi::gtk_tool_item_toolbar_reconfigured(self.as_ref().to_glib_none().0);
737         }
738     }
739 
connect_create_menu_proxy<F: Fn(&Self) -> glib::signal::Inhibit + 'static>( &self, f: F, ) -> SignalHandlerId740     fn connect_create_menu_proxy<F: Fn(&Self) -> glib::signal::Inhibit + 'static>(
741         &self,
742         f: F,
743     ) -> SignalHandlerId {
744         unsafe extern "C" fn create_menu_proxy_trampoline<
745             P: IsA<ToolItem>,
746             F: Fn(&P) -> glib::signal::Inhibit + 'static,
747         >(
748             this: *mut ffi::GtkToolItem,
749             f: glib::ffi::gpointer,
750         ) -> glib::ffi::gboolean {
751             let f: &F = &*(f as *const F);
752             f(ToolItem::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
753         }
754         unsafe {
755             let f: Box_<F> = Box_::new(f);
756             connect_raw(
757                 self.as_ptr() as *mut _,
758                 b"create-menu-proxy\0".as_ptr() as *const _,
759                 Some(transmute::<_, unsafe extern "C" fn()>(
760                     create_menu_proxy_trampoline::<Self, F> as *const (),
761                 )),
762                 Box_::into_raw(f),
763             )
764         }
765     }
766 
connect_toolbar_reconfigured<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId767     fn connect_toolbar_reconfigured<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
768         unsafe extern "C" fn toolbar_reconfigured_trampoline<
769             P: IsA<ToolItem>,
770             F: Fn(&P) + 'static,
771         >(
772             this: *mut ffi::GtkToolItem,
773             f: glib::ffi::gpointer,
774         ) {
775             let f: &F = &*(f as *const F);
776             f(ToolItem::from_glib_borrow(this).unsafe_cast_ref())
777         }
778         unsafe {
779             let f: Box_<F> = Box_::new(f);
780             connect_raw(
781                 self.as_ptr() as *mut _,
782                 b"toolbar-reconfigured\0".as_ptr() as *const _,
783                 Some(transmute::<_, unsafe extern "C" fn()>(
784                     toolbar_reconfigured_trampoline::<Self, F> as *const (),
785                 )),
786                 Box_::into_raw(f),
787             )
788         }
789     }
790 
connect_is_important_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId791     fn connect_is_important_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
792         unsafe extern "C" fn notify_is_important_trampoline<
793             P: IsA<ToolItem>,
794             F: Fn(&P) + 'static,
795         >(
796             this: *mut ffi::GtkToolItem,
797             _param_spec: glib::ffi::gpointer,
798             f: glib::ffi::gpointer,
799         ) {
800             let f: &F = &*(f as *const F);
801             f(ToolItem::from_glib_borrow(this).unsafe_cast_ref())
802         }
803         unsafe {
804             let f: Box_<F> = Box_::new(f);
805             connect_raw(
806                 self.as_ptr() as *mut _,
807                 b"notify::is-important\0".as_ptr() as *const _,
808                 Some(transmute::<_, unsafe extern "C" fn()>(
809                     notify_is_important_trampoline::<Self, F> as *const (),
810                 )),
811                 Box_::into_raw(f),
812             )
813         }
814     }
815 
connect_visible_horizontal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId816     fn connect_visible_horizontal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
817         unsafe extern "C" fn notify_visible_horizontal_trampoline<
818             P: IsA<ToolItem>,
819             F: Fn(&P) + 'static,
820         >(
821             this: *mut ffi::GtkToolItem,
822             _param_spec: glib::ffi::gpointer,
823             f: glib::ffi::gpointer,
824         ) {
825             let f: &F = &*(f as *const F);
826             f(ToolItem::from_glib_borrow(this).unsafe_cast_ref())
827         }
828         unsafe {
829             let f: Box_<F> = Box_::new(f);
830             connect_raw(
831                 self.as_ptr() as *mut _,
832                 b"notify::visible-horizontal\0".as_ptr() as *const _,
833                 Some(transmute::<_, unsafe extern "C" fn()>(
834                     notify_visible_horizontal_trampoline::<Self, F> as *const (),
835                 )),
836                 Box_::into_raw(f),
837             )
838         }
839     }
840 
connect_visible_vertical_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId841     fn connect_visible_vertical_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
842         unsafe extern "C" fn notify_visible_vertical_trampoline<
843             P: IsA<ToolItem>,
844             F: Fn(&P) + 'static,
845         >(
846             this: *mut ffi::GtkToolItem,
847             _param_spec: glib::ffi::gpointer,
848             f: glib::ffi::gpointer,
849         ) {
850             let f: &F = &*(f as *const F);
851             f(ToolItem::from_glib_borrow(this).unsafe_cast_ref())
852         }
853         unsafe {
854             let f: Box_<F> = Box_::new(f);
855             connect_raw(
856                 self.as_ptr() as *mut _,
857                 b"notify::visible-vertical\0".as_ptr() as *const _,
858                 Some(transmute::<_, unsafe extern "C" fn()>(
859                     notify_visible_vertical_trampoline::<Self, F> as *const (),
860                 )),
861                 Box_::into_raw(f),
862             )
863         }
864     }
865 }
866 
867 impl fmt::Display for ToolItem {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result868     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
869         f.write_str("ToolItem")
870     }
871 }
872