1use gdk;
6use glib::object::Cast;
7use glib::object::IsA;
8use glib::signal::connect_raw;
9use glib::signal::SignalHandlerId;
10use glib::translate::*;
11use glib::GString;
12use glib::StaticType;
13use glib::ToValue;
14use glib::Value;
15use glib_sys;
16use gtk_sys;
17use pango;
18use std::boxed::Box as Box_;
19use std::fmt;
20use std::mem::transmute;
21use Align;
22use Buildable;
23use Container;
24use ReliefStyle;
25use ResizeMode;
26use ToolItem;
27use ToolShell;
28use Widget;
29
30glib_wrapper! {
31 pub struct ToolItemGroup(Object<gtk_sys::GtkToolItemGroup, gtk_sys::GtkToolItemGroupClass, ToolItemGroupClass>) @extends Container, Widget, @implements Buildable, ToolShell;
32
33 match fn {
34 get_type => || gtk_sys::gtk_tool_item_group_get_type(),
35 }
36}
37
38impl ToolItemGroup {
39 pub fn new(label: &str) -> ToolItemGroup {
40 assert_initialized_main_thread!();
41 unsafe {
42 Widget::from_glib_none(gtk_sys::gtk_tool_item_group_new(label.to_glib_none().0))
43 .unsafe_cast()
44 }
45 }
46}
47
48pub struct ToolItemGroupBuilder {
49 collapsed: Option<bool>,
50 ellipsize: Option<pango::EllipsizeMode>,
51 header_relief: Option<ReliefStyle>,
52 label: Option<String>,
53 label_widget: Option<Widget>,
54 border_width: Option<u32>,
55 child: Option<Widget>,
56 resize_mode: Option<ResizeMode>,
57 app_paintable: Option<bool>,
58 can_default: Option<bool>,
59 can_focus: Option<bool>,
60 events: Option<gdk::EventMask>,
61 expand: Option<bool>,
62 #[cfg(any(feature = "v3_20", feature = "dox"))]
63 focus_on_click: Option<bool>,
64 halign: Option<Align>,
65 has_default: Option<bool>,
66 has_focus: Option<bool>,
67 has_tooltip: Option<bool>,
68 height_request: Option<i32>,
69 hexpand: Option<bool>,
70 hexpand_set: Option<bool>,
71 is_focus: Option<bool>,
72 margin: Option<i32>,
73 margin_bottom: Option<i32>,
74 margin_end: Option<i32>,
75 margin_start: Option<i32>,
76 margin_top: Option<i32>,
77 name: Option<String>,
78 no_show_all: Option<bool>,
79 opacity: Option<f64>,
80 parent: Option<Container>,
81 receives_default: Option<bool>,
82 sensitive: Option<bool>,
83 tooltip_markup: Option<String>,
85 tooltip_text: Option<String>,
86 valign: Option<Align>,
87 vexpand: Option<bool>,
88 vexpand_set: Option<bool>,
89 visible: Option<bool>,
90 width_request: Option<i32>,
91}
92
93impl ToolItemGroupBuilder {
94 pub fn new() -> Self {
95 Self {
96 collapsed: None,
97 ellipsize: None,
98 header_relief: None,
99 label: None,
100 label_widget: None,
101 border_width: None,
102 child: None,
103 resize_mode: None,
104 app_paintable: None,
105 can_default: None,
106 can_focus: None,
107 events: None,
108 expand: None,
109 #[cfg(any(feature = "v3_20", feature = "dox"))]
110 focus_on_click: None,
111 halign: None,
112 has_default: None,
113 has_focus: None,
114 has_tooltip: None,
115 height_request: None,
116 hexpand: None,
117 hexpand_set: None,
118 is_focus: None,
119 margin: None,
120 margin_bottom: None,
121 margin_end: None,
122 margin_start: None,
123 margin_top: None,
124 name: None,
125 no_show_all: None,
126 opacity: None,
127 parent: None,
128 receives_default: None,
129 sensitive: None,
130 tooltip_markup: None,
131 tooltip_text: None,
132 valign: None,
133 vexpand: None,
134 vexpand_set: None,
135 visible: None,
136 width_request: None,
137 }
138 }
139
140 pub fn build(self) -> ToolItemGroup {
141 let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
142 if let Some(ref collapsed) = self.collapsed {
143 properties.push(("collapsed", collapsed));
144 }
145 if let Some(ref ellipsize) = self.ellipsize {
146 properties.push(("ellipsize", ellipsize));
147 }
148 if let Some(ref header_relief) = self.header_relief {
149 properties.push(("header-relief", header_relief));
150 }
151 if let Some(ref label) = self.label {
152 properties.push(("label", label));
153 }
154 if let Some(ref label_widget) = self.label_widget {
155 properties.push(("label-widget", label_widget));
156 }
157 if let Some(ref border_width) = self.border_width {
158 properties.push(("border-width", border_width));
159 }
160 if let Some(ref child) = self.child {
161 properties.push(("child", child));
162 }
163 if let Some(ref resize_mode) = self.resize_mode {
164 properties.push(("resize-mode", resize_mode));
165 }
166 if let Some(ref app_paintable) = self.app_paintable {
167 properties.push(("app-paintable", app_paintable));
168 }
169 if let Some(ref can_default) = self.can_default {
170 properties.push(("can-default", can_default));
171 }
172 if let Some(ref can_focus) = self.can_focus {
173 properties.push(("can-focus", can_focus));
174 }
175 if let Some(ref events) = self.events {
176 properties.push(("events", events));
177 }
178 if let Some(ref expand) = self.expand {
179 properties.push(("expand", expand));
180 }
181 #[cfg(any(feature = "v3_20", feature = "dox"))]
182 {
183 if let Some(ref focus_on_click) = self.focus_on_click {
184 properties.push(("focus-on-click", focus_on_click));
185 }
186 }
187 if let Some(ref halign) = self.halign {
188 properties.push(("halign", halign));
189 }
190 if let Some(ref has_default) = self.has_default {
191 properties.push(("has-default", has_default));
192 }
193 if let Some(ref has_focus) = self.has_focus {
194 properties.push(("has-focus", has_focus));
195 }
196 if let Some(ref has_tooltip) = self.has_tooltip {
197 properties.push(("has-tooltip", has_tooltip));
198 }
199 if let Some(ref height_request) = self.height_request {
200 properties.push(("height-request", height_request));
201 }
202 if let Some(ref hexpand) = self.hexpand {
203 properties.push(("hexpand", hexpand));
204 }
205 if let Some(ref hexpand_set) = self.hexpand_set {
206 properties.push(("hexpand-set", hexpand_set));
207 }
208 if let Some(ref is_focus) = self.is_focus {
209 properties.push(("is-focus", is_focus));
210 }
211 if let Some(ref margin) = self.margin {
212 properties.push(("margin", margin));
213 }
214 if let Some(ref margin_bottom) = self.margin_bottom {
215 properties.push(("margin-bottom", margin_bottom));
216 }
217 if let Some(ref margin_end) = self.margin_end {
218 properties.push(("margin-end", margin_end));
219 }
220 if let Some(ref margin_start) = self.margin_start {
221 properties.push(("margin-start", margin_start));
222 }
223 if let Some(ref margin_top) = self.margin_top {
224 properties.push(("margin-top", margin_top));
225 }
226 if let Some(ref name) = self.name {
227 properties.push(("name", name));
228 }
229 if let Some(ref no_show_all) = self.no_show_all {
230 properties.push(("no-show-all", no_show_all));
231 }
232 if let Some(ref opacity) = self.opacity {
233 properties.push(("opacity", opacity));
234 }
235 if let Some(ref parent) = self.parent {
236 properties.push(("parent", parent));
237 }
238 if let Some(ref receives_default) = self.receives_default {
239 properties.push(("receives-default", receives_default));
240 }
241 if let Some(ref sensitive) = self.sensitive {
242 properties.push(("sensitive", sensitive));
243 }
244 if let Some(ref tooltip_markup) = self.tooltip_markup {
245 properties.push(("tooltip-markup", tooltip_markup));
246 }
247 if let Some(ref tooltip_text) = self.tooltip_text {
248 properties.push(("tooltip-text", tooltip_text));
249 }
250 if let Some(ref valign) = self.valign {
251 properties.push(("valign", valign));
252 }
253 if let Some(ref vexpand) = self.vexpand {
254 properties.push(("vexpand", vexpand));
255 }
256 if let Some(ref vexpand_set) = self.vexpand_set {
257 properties.push(("vexpand-set", vexpand_set));
258 }
259 if let Some(ref visible) = self.visible {
260 properties.push(("visible", visible));
261 }
262 if let Some(ref width_request) = self.width_request {
263 properties.push(("width-request", width_request));
264 }
265 glib::Object::new(ToolItemGroup::static_type(), &properties)
266 .expect("object new")
267 .downcast()
268 .expect("downcast")
269 }
270
271 pub fn collapsed(mut self, collapsed: bool) -> Self {
272 self.collapsed = Some(collapsed);
273 self
274 }
275
276 pub fn ellipsize(mut self, ellipsize: pango::EllipsizeMode) -> Self {
277 self.ellipsize = Some(ellipsize);
278 self
279 }
280
281 pub fn header_relief(mut self, header_relief: ReliefStyle) -> Self {
282 self.header_relief = Some(header_relief);
283 self
284 }
285
286 pub fn label(mut self, label: &str) -> Self {
287 self.label = Some(label.to_string());
288 self
289 }
290
291 pub fn label_widget(mut self, label_widget: &Widget) -> Self {
292 self.label_widget = Some(label_widget.clone());
293 self
294 }
295
296 pub fn border_width(mut self, border_width: u32) -> Self {
297 self.border_width = Some(border_width);
298 self
299 }
300
301 pub fn child(mut self, child: &Widget) -> Self {
302 self.child = Some(child.clone());
303 self
304 }
305
306 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
307 self.resize_mode = Some(resize_mode);
308 self
309 }
310
311 pub fn app_paintable(mut self, app_paintable: bool) -> Self {
312 self.app_paintable = Some(app_paintable);
313 self
314 }
315
316 pub fn can_default(mut self, can_default: bool) -> Self {
317 self.can_default = Some(can_default);
318 self
319 }
320
321 pub fn can_focus(mut self, can_focus: bool) -> Self {
322 self.can_focus = Some(can_focus);
323 self
324 }
325
326 pub fn events(mut self, events: gdk::EventMask) -> Self {
327 self.events = Some(events);
328 self
329 }
330
331 pub fn expand(mut self, expand: bool) -> Self {
332 self.expand = Some(expand);
333 self
334 }
335
336 #[cfg(any(feature = "v3_20", feature = "dox"))]
337 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
338 self.focus_on_click = Some(focus_on_click);
339 self
340 }
341
342 pub fn halign(mut self, halign: Align) -> Self {
343 self.halign = Some(halign);
344 self
345 }
346
347 pub fn has_default(mut self, has_default: bool) -> Self {
348 self.has_default = Some(has_default);
349 self
350 }
351
352 pub fn has_focus(mut self, has_focus: bool) -> Self {
353 self.has_focus = Some(has_focus);
354 self
355 }
356
357 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
358 self.has_tooltip = Some(has_tooltip);
359 self
360 }
361
362 pub fn height_request(mut self, height_request: i32) -> Self {
363 self.height_request = Some(height_request);
364 self
365 }
366
367 pub fn hexpand(mut self, hexpand: bool) -> Self {
368 self.hexpand = Some(hexpand);
369 self
370 }
371
372 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
373 self.hexpand_set = Some(hexpand_set);
374 self
375 }
376
377 pub fn is_focus(mut self, is_focus: bool) -> Self {
378 self.is_focus = Some(is_focus);
379 self
380 }
381
382 pub fn margin(mut self, margin: i32) -> Self {
383 self.margin = Some(margin);
384 self
385 }
386
387 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
388 self.margin_bottom = Some(margin_bottom);
389 self
390 }
391
392 pub fn margin_end(mut self, margin_end: i32) -> Self {
393 self.margin_end = Some(margin_end);
394 self
395 }
396
397 pub fn margin_start(mut self, margin_start: i32) -> Self {
398 self.margin_start = Some(margin_start);
399 self
400 }
401
402 pub fn margin_top(mut self, margin_top: i32) -> Self {
403 self.margin_top = Some(margin_top);
404 self
405 }
406
407 pub fn name(mut self, name: &str) -> Self {
408 self.name = Some(name.to_string());
409 self
410 }
411
412 pub fn no_show_all(mut self, no_show_all: bool) -> Self {
413 self.no_show_all = Some(no_show_all);
414 self
415 }
416
417 pub fn opacity(mut self, opacity: f64) -> Self {
418 self.opacity = Some(opacity);
419 self
420 }
421
422 pub fn parent(mut self, parent: &Container) -> Self {
423 self.parent = Some(parent.clone());
424 self
425 }
426
427 pub fn receives_default(mut self, receives_default: bool) -> Self {
428 self.receives_default = Some(receives_default);
429 self
430 }
431
432 pub fn sensitive(mut self, sensitive: bool) -> Self {
433 self.sensitive = Some(sensitive);
434 self
435 }
436
437 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
438 self.tooltip_markup = Some(tooltip_markup.to_string());
439 self
440 }
441
442 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
443 self.tooltip_text = Some(tooltip_text.to_string());
444 self
445 }
446
447 pub fn valign(mut self, valign: Align) -> Self {
448 self.valign = Some(valign);
449 self
450 }
451
452 pub fn vexpand(mut self, vexpand: bool) -> Self {
453 self.vexpand = Some(vexpand);
454 self
455 }
456
457 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
458 self.vexpand_set = Some(vexpand_set);
459 self
460 }
461
462 pub fn visible(mut self, visible: bool) -> Self {
463 self.visible = Some(visible);
464 self
465 }
466
467 pub fn width_request(mut self, width_request: i32) -> Self {
468 self.width_request = Some(width_request);
469 self
470 }
471}
472
473pub const NONE_TOOL_ITEM_GROUP: Option<&ToolItemGroup> = None;
474
475pub trait ToolItemGroupExt: 'static {
476 fn get_collapsed(&self) -> bool;
477
478 fn get_drop_item(&self, x: i32, y: i32) -> Option<ToolItem>;
479
480 fn get_ellipsize(&self) -> pango::EllipsizeMode;
481
482 fn get_header_relief(&self) -> ReliefStyle;
483
484 fn get_item_position<P: IsA<ToolItem>>(&self, item: &P) -> i32;
485
486 fn get_label(&self) -> Option<GString>;
487
488 fn get_label_widget(&self) -> Option<Widget>;
489
490 fn get_n_items(&self) -> u32;
491
492 fn get_nth_item(&self, index: u32) -> Option<ToolItem>;
493
494 fn insert<P: IsA<ToolItem>>(&self, item: &P, position: i32);
495
496 fn set_collapsed(&self, collapsed: bool);
497
498 fn set_ellipsize(&self, ellipsize: pango::EllipsizeMode);
499
500 fn set_header_relief(&self, style: ReliefStyle);
501
502 fn set_item_position<P: IsA<ToolItem>>(&self, item: &P, position: i32);
503
504 fn set_label(&self, label: &str);
505
506 fn set_label_widget<P: IsA<Widget>>(&self, label_widget: &P);
507
508 fn get_item_expand<T: IsA<ToolItem>>(&self, item: &T) -> bool;
509
510 fn set_item_expand<T: IsA<ToolItem>>(&self, item: &T, expand: bool);
511
512 fn get_item_fill<T: IsA<ToolItem>>(&self, item: &T) -> bool;
513
514 fn set_item_fill<T: IsA<ToolItem>>(&self, item: &T, fill: bool);
515
516 fn get_item_homogeneous<T: IsA<ToolItem>>(&self, item: &T) -> bool;
517
518 fn set_item_homogeneous<T: IsA<ToolItem>>(&self, item: &T, homogeneous: bool);
519
520 fn get_item_new_row<T: IsA<ToolItem>>(&self, item: &T) -> bool;
521
522 fn set_item_new_row<T: IsA<ToolItem>>(&self, item: &T, new_row: bool);
523
524 fn connect_property_collapsed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
525
526 fn connect_property_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
527
528 fn connect_property_header_relief_notify<F: Fn(&Self) + 'static>(
529 &self,
530 f: F,
531 ) -> SignalHandlerId;
532
533 fn connect_property_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
534
535 fn connect_property_label_widget_notify<F: Fn(&Self) + 'static>(&self, f: F)
536 -> SignalHandlerId;
537}
538
539impl<O: IsA<ToolItemGroup>> ToolItemGroupExt for O {
540 fn get_collapsed(&self) -> bool {
541 unsafe {
542 from_glib(gtk_sys::gtk_tool_item_group_get_collapsed(
543 self.as_ref().to_glib_none().0,
544 ))
545 }
546 }
547
548 fn get_drop_item(&self, x: i32, y: i32) -> Option<ToolItem> {
549 unsafe {
550 from_glib_none(gtk_sys::gtk_tool_item_group_get_drop_item(
551 self.as_ref().to_glib_none().0,
552 x,
553 y,
554 ))
555 }
556 }
557
558 fn get_ellipsize(&self) -> pango::EllipsizeMode {
559 unsafe {
560 from_glib(gtk_sys::gtk_tool_item_group_get_ellipsize(
561 self.as_ref().to_glib_none().0,
562 ))
563 }
564 }
565
566 fn get_header_relief(&self) -> ReliefStyle {
567 unsafe {
568 from_glib(gtk_sys::gtk_tool_item_group_get_header_relief(
569 self.as_ref().to_glib_none().0,
570 ))
571 }
572 }
573
574 fn get_item_position<P: IsA<ToolItem>>(&self, item: &P) -> i32 {
575 unsafe {
576 gtk_sys::gtk_tool_item_group_get_item_position(
577 self.as_ref().to_glib_none().0,
578 item.as_ref().to_glib_none().0,
579 )
580 }
581 }
582
583 fn get_label(&self) -> Option<GString> {
584 unsafe {
585 from_glib_none(gtk_sys::gtk_tool_item_group_get_label(
586 self.as_ref().to_glib_none().0,
587 ))
588 }
589 }
590
591 fn get_label_widget(&self) -> Option<Widget> {
592 unsafe {
593 from_glib_none(gtk_sys::gtk_tool_item_group_get_label_widget(
594 self.as_ref().to_glib_none().0,
595 ))
596 }
597 }
598
599 fn get_n_items(&self) -> u32 {
600 unsafe { gtk_sys::gtk_tool_item_group_get_n_items(self.as_ref().to_glib_none().0) }
601 }
602
603 fn get_nth_item(&self, index: u32) -> Option<ToolItem> {
604 unsafe {
605 from_glib_none(gtk_sys::gtk_tool_item_group_get_nth_item(
606 self.as_ref().to_glib_none().0,
607 index,
608 ))
609 }
610 }
611
612 fn insert<P: IsA<ToolItem>>(&self, item: &P, position: i32) {
613 unsafe {
614 gtk_sys::gtk_tool_item_group_insert(
615 self.as_ref().to_glib_none().0,
616 item.as_ref().to_glib_none().0,
617 position,
618 );
619 }
620 }
621
622 fn set_collapsed(&self, collapsed: bool) {
623 unsafe {
624 gtk_sys::gtk_tool_item_group_set_collapsed(
625 self.as_ref().to_glib_none().0,
626 collapsed.to_glib(),
627 );
628 }
629 }
630
631 fn set_ellipsize(&self, ellipsize: pango::EllipsizeMode) {
632 unsafe {
633 gtk_sys::gtk_tool_item_group_set_ellipsize(
634 self.as_ref().to_glib_none().0,
635 ellipsize.to_glib(),
636 );
637 }
638 }
639
640 fn set_header_relief(&self, style: ReliefStyle) {
641 unsafe {
642 gtk_sys::gtk_tool_item_group_set_header_relief(
643 self.as_ref().to_glib_none().0,
644 style.to_glib(),
645 );
646 }
647 }
648
649 fn set_item_position<P: IsA<ToolItem>>(&self, item: &P, position: i32) {
650 unsafe {
651 gtk_sys::gtk_tool_item_group_set_item_position(
652 self.as_ref().to_glib_none().0,
653 item.as_ref().to_glib_none().0,
654 position,
655 );
656 }
657 }
658
659 fn set_label(&self, label: &str) {
660 unsafe {
661 gtk_sys::gtk_tool_item_group_set_label(
662 self.as_ref().to_glib_none().0,
663 label.to_glib_none().0,
664 );
665 }
666 }
667
668 fn set_label_widget<P: IsA<Widget>>(&self, label_widget: &P) {
669 unsafe {
670 gtk_sys::gtk_tool_item_group_set_label_widget(
671 self.as_ref().to_glib_none().0,
672 label_widget.as_ref().to_glib_none().0,
673 );
674 }
675 }
676
677 fn get_item_expand<T: IsA<ToolItem>>(&self, item: &T) -> bool {
678 unsafe {
679 let mut value = Value::from_type(<bool as StaticType>::static_type());
680 gtk_sys::gtk_container_child_get_property(
681 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
682 item.to_glib_none().0 as *mut _,
683 b"expand\0".as_ptr() as *const _,
684 value.to_glib_none_mut().0,
685 );
686 value.get().unwrap()
687 }
688 }
689
690 fn set_item_expand<T: IsA<ToolItem>>(&self, item: &T, expand: bool) {
691 unsafe {
692 gtk_sys::gtk_container_child_set_property(
693 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
694 item.to_glib_none().0 as *mut _,
695 b"expand\0".as_ptr() as *const _,
696 Value::from(&expand).to_glib_none().0,
697 );
698 }
699 }
700
701 fn get_item_fill<T: IsA<ToolItem>>(&self, item: &T) -> bool {
702 unsafe {
703 let mut value = Value::from_type(<bool as StaticType>::static_type());
704 gtk_sys::gtk_container_child_get_property(
705 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
706 item.to_glib_none().0 as *mut _,
707 b"fill\0".as_ptr() as *const _,
708 value.to_glib_none_mut().0,
709 );
710 value.get().unwrap()
711 }
712 }
713
714 fn set_item_fill<T: IsA<ToolItem>>(&self, item: &T, fill: bool) {
715 unsafe {
716 gtk_sys::gtk_container_child_set_property(
717 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
718 item.to_glib_none().0 as *mut _,
719 b"fill\0".as_ptr() as *const _,
720 Value::from(&fill).to_glib_none().0,
721 );
722 }
723 }
724
725 fn get_item_homogeneous<T: IsA<ToolItem>>(&self, item: &T) -> bool {
726 unsafe {
727 let mut value = Value::from_type(<bool as StaticType>::static_type());
728 gtk_sys::gtk_container_child_get_property(
729 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
730 item.to_glib_none().0 as *mut _,
731 b"homogeneous\0".as_ptr() as *const _,
732 value.to_glib_none_mut().0,
733 );
734 value.get().unwrap()
735 }
736 }
737
738 fn set_item_homogeneous<T: IsA<ToolItem>>(&self, item: &T, homogeneous: bool) {
739 unsafe {
740 gtk_sys::gtk_container_child_set_property(
741 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
742 item.to_glib_none().0 as *mut _,
743 b"homogeneous\0".as_ptr() as *const _,
744 Value::from(&homogeneous).to_glib_none().0,
745 );
746 }
747 }
748
749 fn get_item_new_row<T: IsA<ToolItem>>(&self, item: &T) -> bool {
750 unsafe {
751 let mut value = Value::from_type(<bool as StaticType>::static_type());
752 gtk_sys::gtk_container_child_get_property(
753 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
754 item.to_glib_none().0 as *mut _,
755 b"new-row\0".as_ptr() as *const _,
756 value.to_glib_none_mut().0,
757 );
758 value.get().unwrap()
759 }
760 }
761
762 fn set_item_new_row<T: IsA<ToolItem>>(&self, item: &T, new_row: bool) {
763 unsafe {
764 gtk_sys::gtk_container_child_set_property(
765 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
766 item.to_glib_none().0 as *mut _,
767 b"new-row\0".as_ptr() as *const _,
768 Value::from(&new_row).to_glib_none().0,
769 );
770 }
771 }
772
773 fn connect_property_collapsed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
774 unsafe extern "C" fn notify_collapsed_trampoline<P, F: Fn(&P) + 'static>(
775 this: *mut gtk_sys::GtkToolItemGroup,
776 _param_spec: glib_sys::gpointer,
777 f: glib_sys::gpointer,
778 ) where
779 P: IsA<ToolItemGroup>,
780 {
781 let f: &F = &*(f as *const F);
782 f(&ToolItemGroup::from_glib_borrow(this).unsafe_cast())
783 }
784 unsafe {
785 let f: Box_<F> = Box_::new(f);
786 connect_raw(
787 self.as_ptr() as *mut _,
788 b"notify::collapsed\0".as_ptr() as *const _,
789 Some(transmute(notify_collapsed_trampoline::<Self, F> as usize)),
790 Box_::into_raw(f),
791 )
792 }
793 }
794
795 fn connect_property_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
796 unsafe extern "C" fn notify_ellipsize_trampoline<P, F: Fn(&P) + 'static>(
797 this: *mut gtk_sys::GtkToolItemGroup,
798 _param_spec: glib_sys::gpointer,
799 f: glib_sys::gpointer,
800 ) where
801 P: IsA<ToolItemGroup>,
802 {
803 let f: &F = &*(f as *const F);
804 f(&ToolItemGroup::from_glib_borrow(this).unsafe_cast())
805 }
806 unsafe {
807 let f: Box_<F> = Box_::new(f);
808 connect_raw(
809 self.as_ptr() as *mut _,
810 b"notify::ellipsize\0".as_ptr() as *const _,
811 Some(transmute(notify_ellipsize_trampoline::<Self, F> as usize)),
812 Box_::into_raw(f),
813 )
814 }
815 }
816
817 fn connect_property_header_relief_notify<F: Fn(&Self) + 'static>(
818 &self,
819 f: F,
820 ) -> SignalHandlerId {
821 unsafe extern "C" fn notify_header_relief_trampoline<P, F: Fn(&P) + 'static>(
822 this: *mut gtk_sys::GtkToolItemGroup,
823 _param_spec: glib_sys::gpointer,
824 f: glib_sys::gpointer,
825 ) where
826 P: IsA<ToolItemGroup>,
827 {
828 let f: &F = &*(f as *const F);
829 f(&ToolItemGroup::from_glib_borrow(this).unsafe_cast())
830 }
831 unsafe {
832 let f: Box_<F> = Box_::new(f);
833 connect_raw(
834 self.as_ptr() as *mut _,
835 b"notify::header-relief\0".as_ptr() as *const _,
836 Some(transmute(
837 notify_header_relief_trampoline::<Self, F> as usize,
838 )),
839 Box_::into_raw(f),
840 )
841 }
842 }
843
844 fn connect_property_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
845 unsafe extern "C" fn notify_label_trampoline<P, F: Fn(&P) + 'static>(
846 this: *mut gtk_sys::GtkToolItemGroup,
847 _param_spec: glib_sys::gpointer,
848 f: glib_sys::gpointer,
849 ) where
850 P: IsA<ToolItemGroup>,
851 {
852 let f: &F = &*(f as *const F);
853 f(&ToolItemGroup::from_glib_borrow(this).unsafe_cast())
854 }
855 unsafe {
856 let f: Box_<F> = Box_::new(f);
857 connect_raw(
858 self.as_ptr() as *mut _,
859 b"notify::label\0".as_ptr() as *const _,
860 Some(transmute(notify_label_trampoline::<Self, F> as usize)),
861 Box_::into_raw(f),
862 )
863 }
864 }
865
866 fn connect_property_label_widget_notify<F: Fn(&Self) + 'static>(
867 &self,
868 f: F,
869 ) -> SignalHandlerId {
870 unsafe extern "C" fn notify_label_widget_trampoline<P, F: Fn(&P) + 'static>(
871 this: *mut gtk_sys::GtkToolItemGroup,
872 _param_spec: glib_sys::gpointer,
873 f: glib_sys::gpointer,
874 ) where
875 P: IsA<ToolItemGroup>,
876 {
877 let f: &F = &*(f as *const F);
878 f(&ToolItemGroup::from_glib_borrow(this).unsafe_cast())
879 }
880 unsafe {
881 let f: Box_<F> = Box_::new(f);
882 connect_raw(
883 self.as_ptr() as *mut _,
884 b"notify::label-widget\0".as_ptr() as *const _,
885 Some(transmute(
886 notify_label_widget_trampoline::<Self, F> as usize,
887 )),
888 Box_::into_raw(f),
889 )
890 }
891 }
892}
893
894impl fmt::Display for ToolItemGroup {
895 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
896 write!(f, "ToolItemGroup")
897 }
898}