gtk/auto/tool_item_group.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::{Align, Buildable, Container, ReliefStyle, ResizeMode, ToolItem, ToolShell, Widget};
6use glib::{
7 prelude::*,
8 signal::{connect_raw, SignalHandlerId},
9 translate::*,
10};
11use std::{boxed::Box as Box_, fmt, mem::transmute};
12
13glib::wrapper! {
14 /// A [`ToolItemGroup`][crate::ToolItemGroup] is used together with [`ToolPalette`][crate::ToolPalette] to add
15 /// `GtkToolItems` to a palette like container with different
16 /// categories and drag and drop support.
17 ///
18 /// # CSS nodes
19 ///
20 /// GtkToolItemGroup has a single CSS node named toolitemgroup.
21 ///
22 /// ## Properties
23 ///
24 ///
25 /// #### `collapsed`
26 /// Readable | Writeable
27 ///
28 ///
29 /// #### `ellipsize`
30 /// Readable | Writeable
31 ///
32 ///
33 /// #### `header-relief`
34 /// Readable | Writeable
35 ///
36 ///
37 /// #### `label`
38 /// Readable | Writeable
39 ///
40 ///
41 /// #### `label-widget`
42 /// Readable | Writeable
43 /// <details><summary><h4>Container</h4></summary>
44 ///
45 ///
46 /// #### `border-width`
47 /// Readable | Writeable
48 ///
49 ///
50 /// #### `child`
51 /// Writeable
52 ///
53 ///
54 /// #### `resize-mode`
55 /// Readable | Writeable
56 /// </details>
57 /// <details><summary><h4>Widget</h4></summary>
58 ///
59 ///
60 /// #### `app-paintable`
61 /// Readable | Writeable
62 ///
63 ///
64 /// #### `can-default`
65 /// Readable | Writeable
66 ///
67 ///
68 /// #### `can-focus`
69 /// Readable | Writeable
70 ///
71 ///
72 /// #### `composite-child`
73 /// Readable
74 ///
75 ///
76 /// #### `double-buffered`
77 /// Whether the widget is double buffered.
78 ///
79 /// Readable | Writeable
80 ///
81 ///
82 /// #### `events`
83 /// Readable | Writeable
84 ///
85 ///
86 /// #### `expand`
87 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
88 ///
89 /// Readable | Writeable
90 ///
91 ///
92 /// #### `focus-on-click`
93 /// Whether the widget should grab focus when it is clicked with the mouse.
94 ///
95 /// This property is only relevant for widgets that can take focus.
96 ///
97 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
98 /// GtkComboBox) implemented this property individually.
99 ///
100 /// Readable | Writeable
101 ///
102 ///
103 /// #### `halign`
104 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
105 ///
106 /// Readable | Writeable
107 ///
108 ///
109 /// #### `has-default`
110 /// Readable | Writeable
111 ///
112 ///
113 /// #### `has-focus`
114 /// Readable | Writeable
115 ///
116 ///
117 /// #### `has-tooltip`
118 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
119 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
120 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
121 /// whether it will provide a tooltip or not.
122 ///
123 /// Note that setting this property to [`true`] for the first time will change
124 /// the event masks of the GdkWindows of this widget to include leave-notify
125 /// and motion-notify events. This cannot and will not be undone when the
126 /// property is set to [`false`] again.
127 ///
128 /// Readable | Writeable
129 ///
130 ///
131 /// #### `height-request`
132 /// Readable | Writeable
133 ///
134 ///
135 /// #### `hexpand`
136 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
137 ///
138 /// Readable | Writeable
139 ///
140 ///
141 /// #### `hexpand-set`
142 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
143 ///
144 /// Readable | Writeable
145 ///
146 ///
147 /// #### `is-focus`
148 /// Readable | Writeable
149 ///
150 ///
151 /// #### `margin`
152 /// Sets all four sides' margin at once. If read, returns max
153 /// margin on any side.
154 ///
155 /// Readable | Writeable
156 ///
157 ///
158 /// #### `margin-bottom`
159 /// Margin on bottom side of widget.
160 ///
161 /// This property adds margin outside of the widget's normal size
162 /// request, the margin will be added in addition to the size from
163 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
164 ///
165 /// Readable | Writeable
166 ///
167 ///
168 /// #### `margin-end`
169 /// Margin on end of widget, horizontally. This property supports
170 /// left-to-right and right-to-left text directions.
171 ///
172 /// This property adds margin outside of the widget's normal size
173 /// request, the margin will be added in addition to the size from
174 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
175 ///
176 /// Readable | Writeable
177 ///
178 ///
179 /// #### `margin-left`
180 /// Margin on left side of widget.
181 ///
182 /// This property adds margin outside of the widget's normal size
183 /// request, the margin will be added in addition to the size from
184 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
185 ///
186 /// Readable | Writeable
187 ///
188 ///
189 /// #### `margin-right`
190 /// Margin on right side of widget.
191 ///
192 /// This property adds margin outside of the widget's normal size
193 /// request, the margin will be added in addition to the size from
194 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
195 ///
196 /// Readable | Writeable
197 ///
198 ///
199 /// #### `margin-start`
200 /// Margin on start of widget, horizontally. This property supports
201 /// left-to-right and right-to-left text directions.
202 ///
203 /// This property adds margin outside of the widget's normal size
204 /// request, the margin will be added in addition to the size from
205 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
206 ///
207 /// Readable | Writeable
208 ///
209 ///
210 /// #### `margin-top`
211 /// Margin on top side of widget.
212 ///
213 /// This property adds margin outside of the widget's normal size
214 /// request, the margin will be added in addition to the size from
215 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
216 ///
217 /// Readable | Writeable
218 ///
219 ///
220 /// #### `name`
221 /// Readable | Writeable
222 ///
223 ///
224 /// #### `no-show-all`
225 /// Readable | Writeable
226 ///
227 ///
228 /// #### `opacity`
229 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
230 /// more details about window opacity.
231 ///
232 /// Before 3.8 this was only available in GtkWindow
233 ///
234 /// Readable | Writeable
235 ///
236 ///
237 /// #### `parent`
238 /// Readable | Writeable
239 ///
240 ///
241 /// #### `receives-default`
242 /// Readable | Writeable
243 ///
244 ///
245 /// #### `scale-factor`
246 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
247 /// more details about widget scaling.
248 ///
249 /// Readable
250 ///
251 ///
252 /// #### `sensitive`
253 /// Readable | Writeable
254 ///
255 ///
256 /// #### `style`
257 /// The style of the widget, which contains information about how it will look (colors, etc).
258 ///
259 /// Readable | Writeable
260 ///
261 ///
262 /// #### `tooltip-markup`
263 /// Sets the text of tooltip to be the given string, which is marked up
264 /// with the [Pango text markup language][PangoMarkupFormat].
265 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
266 ///
267 /// This is a convenience property which will take care of getting the
268 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
269 /// will automatically be set to [`true`] and there will be taken care of
270 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
271 ///
272 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
273 /// are set, the last one wins.
274 ///
275 /// Readable | Writeable
276 ///
277 ///
278 /// #### `tooltip-text`
279 /// Sets the text of tooltip to be the given string.
280 ///
281 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
282 ///
283 /// This is a convenience property which will take care of getting the
284 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
285 /// will automatically be set to [`true`] and there will be taken care of
286 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
287 ///
288 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
289 /// are set, the last one wins.
290 ///
291 /// Readable | Writeable
292 ///
293 ///
294 /// #### `valign`
295 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
296 ///
297 /// Readable | Writeable
298 ///
299 ///
300 /// #### `vexpand`
301 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
302 ///
303 /// Readable | Writeable
304 ///
305 ///
306 /// #### `vexpand-set`
307 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
308 ///
309 /// Readable | Writeable
310 ///
311 ///
312 /// #### `visible`
313 /// Readable | Writeable
314 ///
315 ///
316 /// #### `width-request`
317 /// Readable | Writeable
318 ///
319 ///
320 /// #### `window`
321 /// The widget's window if it is realized, [`None`] otherwise.
322 ///
323 /// Readable
324 /// </details>
325 ///
326 /// # Implements
327 ///
328 /// [`ToolItemGroupExt`][trait@crate::prelude::ToolItemGroupExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ToolShellExt`][trait@crate::prelude::ToolShellExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
329 #[doc(alias = "GtkToolItemGroup")]
330 pub struct ToolItemGroup(Object<ffi::GtkToolItemGroup, ffi::GtkToolItemGroupClass>) @extends Container, Widget, @implements Buildable, ToolShell;
331
332 match fn {
333 type_ => || ffi::gtk_tool_item_group_get_type(),
334 }
335}
336
337impl ToolItemGroup {
338 pub const NONE: Option<&'static ToolItemGroup> = None;
339
340 /// Creates a new tool item group with label `label`.
341 /// ## `label`
342 /// the label of the new group
343 ///
344 /// # Returns
345 ///
346 /// a new [`ToolItemGroup`][crate::ToolItemGroup].
347 #[doc(alias = "gtk_tool_item_group_new")]
348 pub fn new(label: &str) -> ToolItemGroup {
349 assert_initialized_main_thread!();
350 unsafe {
351 Widget::from_glib_none(ffi::gtk_tool_item_group_new(label.to_glib_none().0))
352 .unsafe_cast()
353 }
354 }
355
356 // rustdoc-stripper-ignore-next
357 /// Creates a new builder-pattern struct instance to construct [`ToolItemGroup`] objects.
358 ///
359 /// This method returns an instance of [`ToolItemGroupBuilder`](crate::builders::ToolItemGroupBuilder) which can be used to create [`ToolItemGroup`] objects.
360 pub fn builder() -> ToolItemGroupBuilder {
361 ToolItemGroupBuilder::new()
362 }
363}
364
365impl Default for ToolItemGroup {
366 fn default() -> Self {
367 glib::object::Object::new::<Self>()
368 }
369}
370
371// rustdoc-stripper-ignore-next
372/// A [builder-pattern] type to construct [`ToolItemGroup`] objects.
373///
374/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
375#[must_use = "The builder must be built to be used"]
376pub struct ToolItemGroupBuilder {
377 builder: glib::object::ObjectBuilder<'static, ToolItemGroup>,
378}
379
380impl ToolItemGroupBuilder {
381 fn new() -> Self {
382 Self {
383 builder: glib::object::Object::builder(),
384 }
385 }
386
387 pub fn collapsed(self, collapsed: bool) -> Self {
388 Self {
389 builder: self.builder.property("collapsed", collapsed),
390 }
391 }
392
393 pub fn ellipsize(self, ellipsize: pango::EllipsizeMode) -> Self {
394 Self {
395 builder: self.builder.property("ellipsize", ellipsize),
396 }
397 }
398
399 pub fn header_relief(self, header_relief: ReliefStyle) -> Self {
400 Self {
401 builder: self.builder.property("header-relief", header_relief),
402 }
403 }
404
405 pub fn label(self, label: impl Into<glib::GString>) -> Self {
406 Self {
407 builder: self.builder.property("label", label.into()),
408 }
409 }
410
411 pub fn label_widget(self, label_widget: &impl IsA<Widget>) -> Self {
412 Self {
413 builder: self
414 .builder
415 .property("label-widget", label_widget.clone().upcast()),
416 }
417 }
418
419 pub fn border_width(self, border_width: u32) -> Self {
420 Self {
421 builder: self.builder.property("border-width", border_width),
422 }
423 }
424
425 pub fn child(self, child: &impl IsA<Widget>) -> Self {
426 Self {
427 builder: self.builder.property("child", child.clone().upcast()),
428 }
429 }
430
431 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
432 Self {
433 builder: self.builder.property("resize-mode", resize_mode),
434 }
435 }
436
437 pub fn app_paintable(self, app_paintable: bool) -> Self {
438 Self {
439 builder: self.builder.property("app-paintable", app_paintable),
440 }
441 }
442
443 pub fn can_default(self, can_default: bool) -> Self {
444 Self {
445 builder: self.builder.property("can-default", can_default),
446 }
447 }
448
449 pub fn can_focus(self, can_focus: bool) -> Self {
450 Self {
451 builder: self.builder.property("can-focus", can_focus),
452 }
453 }
454
455 pub fn events(self, events: gdk::EventMask) -> Self {
456 Self {
457 builder: self.builder.property("events", events),
458 }
459 }
460
461 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
462 pub fn expand(self, expand: bool) -> Self {
463 Self {
464 builder: self.builder.property("expand", expand),
465 }
466 }
467
468 /// Whether the widget should grab focus when it is clicked with the mouse.
469 ///
470 /// This property is only relevant for widgets that can take focus.
471 ///
472 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
473 /// GtkComboBox) implemented this property individually.
474 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
475 Self {
476 builder: self.builder.property("focus-on-click", focus_on_click),
477 }
478 }
479
480 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
481 pub fn halign(self, halign: Align) -> Self {
482 Self {
483 builder: self.builder.property("halign", halign),
484 }
485 }
486
487 pub fn has_default(self, has_default: bool) -> Self {
488 Self {
489 builder: self.builder.property("has-default", has_default),
490 }
491 }
492
493 pub fn has_focus(self, has_focus: bool) -> Self {
494 Self {
495 builder: self.builder.property("has-focus", has_focus),
496 }
497 }
498
499 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
500 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
501 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
502 /// whether it will provide a tooltip or not.
503 ///
504 /// Note that setting this property to [`true`] for the first time will change
505 /// the event masks of the GdkWindows of this widget to include leave-notify
506 /// and motion-notify events. This cannot and will not be undone when the
507 /// property is set to [`false`] again.
508 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
509 Self {
510 builder: self.builder.property("has-tooltip", has_tooltip),
511 }
512 }
513
514 pub fn height_request(self, height_request: i32) -> Self {
515 Self {
516 builder: self.builder.property("height-request", height_request),
517 }
518 }
519
520 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
521 pub fn hexpand(self, hexpand: bool) -> Self {
522 Self {
523 builder: self.builder.property("hexpand", hexpand),
524 }
525 }
526
527 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
528 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
529 Self {
530 builder: self.builder.property("hexpand-set", hexpand_set),
531 }
532 }
533
534 pub fn is_focus(self, is_focus: bool) -> Self {
535 Self {
536 builder: self.builder.property("is-focus", is_focus),
537 }
538 }
539
540 /// Sets all four sides' margin at once. If read, returns max
541 /// margin on any side.
542 pub fn margin(self, margin: i32) -> Self {
543 Self {
544 builder: self.builder.property("margin", margin),
545 }
546 }
547
548 /// Margin on bottom side of widget.
549 ///
550 /// This property adds margin outside of the widget's normal size
551 /// request, the margin will be added in addition to the size from
552 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
553 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
554 Self {
555 builder: self.builder.property("margin-bottom", margin_bottom),
556 }
557 }
558
559 /// Margin on end of widget, horizontally. This property supports
560 /// left-to-right and right-to-left text directions.
561 ///
562 /// This property adds margin outside of the widget's normal size
563 /// request, the margin will be added in addition to the size from
564 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
565 pub fn margin_end(self, margin_end: i32) -> Self {
566 Self {
567 builder: self.builder.property("margin-end", margin_end),
568 }
569 }
570
571 /// Margin on start of widget, horizontally. This property supports
572 /// left-to-right and right-to-left text directions.
573 ///
574 /// This property adds margin outside of the widget's normal size
575 /// request, the margin will be added in addition to the size from
576 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
577 pub fn margin_start(self, margin_start: i32) -> Self {
578 Self {
579 builder: self.builder.property("margin-start", margin_start),
580 }
581 }
582
583 /// Margin on top side of widget.
584 ///
585 /// This property adds margin outside of the widget's normal size
586 /// request, the margin will be added in addition to the size from
587 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
588 pub fn margin_top(self, margin_top: i32) -> Self {
589 Self {
590 builder: self.builder.property("margin-top", margin_top),
591 }
592 }
593
594 pub fn name(self, name: impl Into<glib::GString>) -> Self {
595 Self {
596 builder: self.builder.property("name", name.into()),
597 }
598 }
599
600 pub fn no_show_all(self, no_show_all: bool) -> Self {
601 Self {
602 builder: self.builder.property("no-show-all", no_show_all),
603 }
604 }
605
606 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
607 /// more details about window opacity.
608 ///
609 /// Before 3.8 this was only available in GtkWindow
610 pub fn opacity(self, opacity: f64) -> Self {
611 Self {
612 builder: self.builder.property("opacity", opacity),
613 }
614 }
615
616 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
617 Self {
618 builder: self.builder.property("parent", parent.clone().upcast()),
619 }
620 }
621
622 pub fn receives_default(self, receives_default: bool) -> Self {
623 Self {
624 builder: self.builder.property("receives-default", receives_default),
625 }
626 }
627
628 pub fn sensitive(self, sensitive: bool) -> Self {
629 Self {
630 builder: self.builder.property("sensitive", sensitive),
631 }
632 }
633
634 /// Sets the text of tooltip to be the given string, which is marked up
635 /// with the [Pango text markup language][PangoMarkupFormat].
636 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
637 ///
638 /// This is a convenience property which will take care of getting the
639 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
640 /// will automatically be set to [`true`] and there will be taken care of
641 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
642 ///
643 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
644 /// are set, the last one wins.
645 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
646 Self {
647 builder: self
648 .builder
649 .property("tooltip-markup", tooltip_markup.into()),
650 }
651 }
652
653 /// Sets the text of tooltip to be the given string.
654 ///
655 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
656 ///
657 /// This is a convenience property which will take care of getting the
658 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
659 /// will automatically be set to [`true`] and there will be taken care of
660 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
661 ///
662 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
663 /// are set, the last one wins.
664 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
665 Self {
666 builder: self.builder.property("tooltip-text", tooltip_text.into()),
667 }
668 }
669
670 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
671 pub fn valign(self, valign: Align) -> Self {
672 Self {
673 builder: self.builder.property("valign", valign),
674 }
675 }
676
677 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
678 pub fn vexpand(self, vexpand: bool) -> Self {
679 Self {
680 builder: self.builder.property("vexpand", vexpand),
681 }
682 }
683
684 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
685 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
686 Self {
687 builder: self.builder.property("vexpand-set", vexpand_set),
688 }
689 }
690
691 pub fn visible(self, visible: bool) -> Self {
692 Self {
693 builder: self.builder.property("visible", visible),
694 }
695 }
696
697 pub fn width_request(self, width_request: i32) -> Self {
698 Self {
699 builder: self.builder.property("width-request", width_request),
700 }
701 }
702
703 // rustdoc-stripper-ignore-next
704 /// Build the [`ToolItemGroup`].
705 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
706 pub fn build(self) -> ToolItemGroup {
707 self.builder.build()
708 }
709}
710
711mod sealed {
712 pub trait Sealed {}
713 impl<T: super::IsA<super::ToolItemGroup>> Sealed for T {}
714}
715
716/// Trait containing all [`struct@ToolItemGroup`] methods.
717///
718/// # Implementors
719///
720/// [`ToolItemGroup`][struct@crate::ToolItemGroup]
721pub trait ToolItemGroupExt: IsA<ToolItemGroup> + sealed::Sealed + 'static {
722 /// Gets whether `self` is collapsed or expanded.
723 ///
724 /// # Returns
725 ///
726 /// [`true`] if `self` is collapsed, [`false`] if it is expanded
727 #[doc(alias = "gtk_tool_item_group_get_collapsed")]
728 #[doc(alias = "get_collapsed")]
729 fn is_collapsed(&self) -> bool {
730 unsafe {
731 from_glib(ffi::gtk_tool_item_group_get_collapsed(
732 self.as_ref().to_glib_none().0,
733 ))
734 }
735 }
736
737 /// Gets the tool item at position (x, y).
738 /// ## `x`
739 /// the x position
740 /// ## `y`
741 /// the y position
742 ///
743 /// # Returns
744 ///
745 /// the [`ToolItem`][crate::ToolItem] at position (x, y)
746 #[doc(alias = "gtk_tool_item_group_get_drop_item")]
747 #[doc(alias = "get_drop_item")]
748 fn drop_item(&self, x: i32, y: i32) -> Option<ToolItem> {
749 unsafe {
750 from_glib_none(ffi::gtk_tool_item_group_get_drop_item(
751 self.as_ref().to_glib_none().0,
752 x,
753 y,
754 ))
755 }
756 }
757
758 /// Gets the ellipsization mode of `self`.
759 ///
760 /// # Returns
761 ///
762 /// the [`pango::EllipsizeMode`][crate::pango::EllipsizeMode] of `self`
763 #[doc(alias = "gtk_tool_item_group_get_ellipsize")]
764 #[doc(alias = "get_ellipsize")]
765 fn ellipsize(&self) -> pango::EllipsizeMode {
766 unsafe {
767 from_glib(ffi::gtk_tool_item_group_get_ellipsize(
768 self.as_ref().to_glib_none().0,
769 ))
770 }
771 }
772
773 /// Gets the relief mode of the header button of `self`.
774 ///
775 /// # Returns
776 ///
777 /// the [`ReliefStyle`][crate::ReliefStyle]
778 #[doc(alias = "gtk_tool_item_group_get_header_relief")]
779 #[doc(alias = "get_header_relief")]
780 fn header_relief(&self) -> ReliefStyle {
781 unsafe {
782 from_glib(ffi::gtk_tool_item_group_get_header_relief(
783 self.as_ref().to_glib_none().0,
784 ))
785 }
786 }
787
788 /// Gets the position of `item` in `self` as index.
789 /// ## `item`
790 /// a [`ToolItem`][crate::ToolItem]
791 ///
792 /// # Returns
793 ///
794 /// the index of `item` in `self` or -1 if `item` is no child of `self`
795 #[doc(alias = "gtk_tool_item_group_get_item_position")]
796 #[doc(alias = "get_item_position")]
797 fn item_position(&self, item: &impl IsA<ToolItem>) -> i32 {
798 unsafe {
799 ffi::gtk_tool_item_group_get_item_position(
800 self.as_ref().to_glib_none().0,
801 item.as_ref().to_glib_none().0,
802 )
803 }
804 }
805
806 /// Gets the label of `self`.
807 ///
808 /// # Returns
809 ///
810 /// the label of `self`. The label is an internal string of `self`
811 /// and must not be modified. Note that [`None`] is returned if a custom
812 /// label has been set with [`set_label_widget()`][Self::set_label_widget()]
813 #[doc(alias = "gtk_tool_item_group_get_label")]
814 #[doc(alias = "get_label")]
815 fn label(&self) -> Option<glib::GString> {
816 unsafe {
817 from_glib_none(ffi::gtk_tool_item_group_get_label(
818 self.as_ref().to_glib_none().0,
819 ))
820 }
821 }
822
823 /// Gets the label widget of `self`.
824 /// See [`set_label_widget()`][Self::set_label_widget()].
825 ///
826 /// # Returns
827 ///
828 /// the label widget of `self`
829 #[doc(alias = "gtk_tool_item_group_get_label_widget")]
830 #[doc(alias = "get_label_widget")]
831 fn label_widget(&self) -> Option<Widget> {
832 unsafe {
833 from_glib_none(ffi::gtk_tool_item_group_get_label_widget(
834 self.as_ref().to_glib_none().0,
835 ))
836 }
837 }
838
839 /// Gets the number of tool items in `self`.
840 ///
841 /// # Returns
842 ///
843 /// the number of tool items in `self`
844 #[doc(alias = "gtk_tool_item_group_get_n_items")]
845 #[doc(alias = "get_n_items")]
846 fn n_items(&self) -> u32 {
847 unsafe { ffi::gtk_tool_item_group_get_n_items(self.as_ref().to_glib_none().0) }
848 }
849
850 /// Gets the tool item at `index` in group.
851 /// ## `index`
852 /// the index
853 ///
854 /// # Returns
855 ///
856 /// the [`ToolItem`][crate::ToolItem] at index
857 #[doc(alias = "gtk_tool_item_group_get_nth_item")]
858 #[doc(alias = "get_nth_item")]
859 fn nth_item(&self, index: u32) -> Option<ToolItem> {
860 unsafe {
861 from_glib_none(ffi::gtk_tool_item_group_get_nth_item(
862 self.as_ref().to_glib_none().0,
863 index,
864 ))
865 }
866 }
867
868 /// Inserts `item` at `position` in the list of children of `self`.
869 /// ## `item`
870 /// the [`ToolItem`][crate::ToolItem] to insert into `self`
871 /// ## `position`
872 /// the position of `item` in `self`, starting with 0.
873 /// The position -1 means end of list.
874 #[doc(alias = "gtk_tool_item_group_insert")]
875 fn insert(&self, item: &impl IsA<ToolItem>, position: i32) {
876 unsafe {
877 ffi::gtk_tool_item_group_insert(
878 self.as_ref().to_glib_none().0,
879 item.as_ref().to_glib_none().0,
880 position,
881 );
882 }
883 }
884
885 /// Sets whether the `self` should be collapsed or expanded.
886 /// ## `collapsed`
887 /// whether the `self` should be collapsed or expanded
888 #[doc(alias = "gtk_tool_item_group_set_collapsed")]
889 fn set_collapsed(&self, collapsed: bool) {
890 unsafe {
891 ffi::gtk_tool_item_group_set_collapsed(
892 self.as_ref().to_glib_none().0,
893 collapsed.into_glib(),
894 );
895 }
896 }
897
898 /// Sets the ellipsization mode which should be used by labels in `self`.
899 /// ## `ellipsize`
900 /// the [`pango::EllipsizeMode`][crate::pango::EllipsizeMode] labels in `self` should use
901 #[doc(alias = "gtk_tool_item_group_set_ellipsize")]
902 fn set_ellipsize(&self, ellipsize: pango::EllipsizeMode) {
903 unsafe {
904 ffi::gtk_tool_item_group_set_ellipsize(
905 self.as_ref().to_glib_none().0,
906 ellipsize.into_glib(),
907 );
908 }
909 }
910
911 /// Set the button relief of the group header.
912 /// See [`ButtonExt::set_relief()`][crate::prelude::ButtonExt::set_relief()] for details.
913 /// ## `style`
914 /// the [`ReliefStyle`][crate::ReliefStyle]
915 #[doc(alias = "gtk_tool_item_group_set_header_relief")]
916 fn set_header_relief(&self, style: ReliefStyle) {
917 unsafe {
918 ffi::gtk_tool_item_group_set_header_relief(
919 self.as_ref().to_glib_none().0,
920 style.into_glib(),
921 );
922 }
923 }
924
925 /// Sets the position of `item` in the list of children of `self`.
926 /// ## `item`
927 /// the [`ToolItem`][crate::ToolItem] to move to a new position, should
928 /// be a child of `self`.
929 /// ## `position`
930 /// the new position of `item` in `self`, starting with 0.
931 /// The position -1 means end of list.
932 #[doc(alias = "gtk_tool_item_group_set_item_position")]
933 fn set_item_position(&self, item: &impl IsA<ToolItem>, position: i32) {
934 unsafe {
935 ffi::gtk_tool_item_group_set_item_position(
936 self.as_ref().to_glib_none().0,
937 item.as_ref().to_glib_none().0,
938 position,
939 );
940 }
941 }
942
943 /// Sets the label of the tool item group. The label is displayed in the header
944 /// of the group.
945 /// ## `label`
946 /// the new human-readable label of of the group
947 #[doc(alias = "gtk_tool_item_group_set_label")]
948 fn set_label(&self, label: &str) {
949 unsafe {
950 ffi::gtk_tool_item_group_set_label(
951 self.as_ref().to_glib_none().0,
952 label.to_glib_none().0,
953 );
954 }
955 }
956
957 /// Sets the label of the tool item group.
958 /// The label widget is displayed in the header of the group, in place
959 /// of the usual label.
960 /// ## `label_widget`
961 /// the widget to be displayed in place of the usual label
962 #[doc(alias = "gtk_tool_item_group_set_label_widget")]
963 fn set_label_widget(&self, label_widget: &impl IsA<Widget>) {
964 unsafe {
965 ffi::gtk_tool_item_group_set_label_widget(
966 self.as_ref().to_glib_none().0,
967 label_widget.as_ref().to_glib_none().0,
968 );
969 }
970 }
971
972 fn item_expands<T: IsA<ToolItem>>(&self, item: &T) -> bool {
973 crate::prelude::ContainerExtManual::child_property(
974 self.as_ref(),
975 &item.clone().upcast(),
976 "expand",
977 )
978 }
979
980 fn set_item_expand<T: IsA<ToolItem>>(&self, item: &T, expand: bool) {
981 crate::prelude::ContainerExtManual::child_set_property(
982 self.as_ref(),
983 &item.clone().upcast(),
984 "expand",
985 &expand,
986 )
987 }
988
989 fn item_fills<T: IsA<ToolItem>>(&self, item: &T) -> bool {
990 crate::prelude::ContainerExtManual::child_property(
991 self.as_ref(),
992 &item.clone().upcast(),
993 "fill",
994 )
995 }
996
997 fn set_item_fill<T: IsA<ToolItem>>(&self, item: &T, fill: bool) {
998 crate::prelude::ContainerExtManual::child_set_property(
999 self.as_ref(),
1000 &item.clone().upcast(),
1001 "fill",
1002 &fill,
1003 )
1004 }
1005
1006 fn item_is_homogeneous<T: IsA<ToolItem>>(&self, item: &T) -> bool {
1007 crate::prelude::ContainerExtManual::child_property(
1008 self.as_ref(),
1009 &item.clone().upcast(),
1010 "homogeneous",
1011 )
1012 }
1013
1014 fn set_item_homogeneous<T: IsA<ToolItem>>(&self, item: &T, homogeneous: bool) {
1015 crate::prelude::ContainerExtManual::child_set_property(
1016 self.as_ref(),
1017 &item.clone().upcast(),
1018 "homogeneous",
1019 &homogeneous,
1020 )
1021 }
1022
1023 #[doc(alias = "item.new-row")]
1024 fn item_is_new_row<T: IsA<ToolItem>>(&self, item: &T) -> bool {
1025 crate::prelude::ContainerExtManual::child_property(
1026 self.as_ref(),
1027 &item.clone().upcast(),
1028 "new-row",
1029 )
1030 }
1031
1032 #[doc(alias = "item.new-row")]
1033 fn set_item_new_row<T: IsA<ToolItem>>(&self, item: &T, new_row: bool) {
1034 crate::prelude::ContainerExtManual::child_set_property(
1035 self.as_ref(),
1036 &item.clone().upcast(),
1037 "new-row",
1038 &new_row,
1039 )
1040 }
1041
1042 #[doc(alias = "collapsed")]
1043 fn connect_collapsed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1044 unsafe extern "C" fn notify_collapsed_trampoline<
1045 P: IsA<ToolItemGroup>,
1046 F: Fn(&P) + 'static,
1047 >(
1048 this: *mut ffi::GtkToolItemGroup,
1049 _param_spec: glib::ffi::gpointer,
1050 f: glib::ffi::gpointer,
1051 ) {
1052 let f: &F = &*(f as *const F);
1053 f(ToolItemGroup::from_glib_borrow(this).unsafe_cast_ref())
1054 }
1055 unsafe {
1056 let f: Box_<F> = Box_::new(f);
1057 connect_raw(
1058 self.as_ptr() as *mut _,
1059 b"notify::collapsed\0".as_ptr() as *const _,
1060 Some(transmute::<_, unsafe extern "C" fn()>(
1061 notify_collapsed_trampoline::<Self, F> as *const (),
1062 )),
1063 Box_::into_raw(f),
1064 )
1065 }
1066 }
1067
1068 #[doc(alias = "ellipsize")]
1069 fn connect_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1070 unsafe extern "C" fn notify_ellipsize_trampoline<
1071 P: IsA<ToolItemGroup>,
1072 F: Fn(&P) + 'static,
1073 >(
1074 this: *mut ffi::GtkToolItemGroup,
1075 _param_spec: glib::ffi::gpointer,
1076 f: glib::ffi::gpointer,
1077 ) {
1078 let f: &F = &*(f as *const F);
1079 f(ToolItemGroup::from_glib_borrow(this).unsafe_cast_ref())
1080 }
1081 unsafe {
1082 let f: Box_<F> = Box_::new(f);
1083 connect_raw(
1084 self.as_ptr() as *mut _,
1085 b"notify::ellipsize\0".as_ptr() as *const _,
1086 Some(transmute::<_, unsafe extern "C" fn()>(
1087 notify_ellipsize_trampoline::<Self, F> as *const (),
1088 )),
1089 Box_::into_raw(f),
1090 )
1091 }
1092 }
1093
1094 #[doc(alias = "header-relief")]
1095 fn connect_header_relief_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1096 unsafe extern "C" fn notify_header_relief_trampoline<
1097 P: IsA<ToolItemGroup>,
1098 F: Fn(&P) + 'static,
1099 >(
1100 this: *mut ffi::GtkToolItemGroup,
1101 _param_spec: glib::ffi::gpointer,
1102 f: glib::ffi::gpointer,
1103 ) {
1104 let f: &F = &*(f as *const F);
1105 f(ToolItemGroup::from_glib_borrow(this).unsafe_cast_ref())
1106 }
1107 unsafe {
1108 let f: Box_<F> = Box_::new(f);
1109 connect_raw(
1110 self.as_ptr() as *mut _,
1111 b"notify::header-relief\0".as_ptr() as *const _,
1112 Some(transmute::<_, unsafe extern "C" fn()>(
1113 notify_header_relief_trampoline::<Self, F> as *const (),
1114 )),
1115 Box_::into_raw(f),
1116 )
1117 }
1118 }
1119
1120 #[doc(alias = "label")]
1121 fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1122 unsafe extern "C" fn notify_label_trampoline<P: IsA<ToolItemGroup>, F: Fn(&P) + 'static>(
1123 this: *mut ffi::GtkToolItemGroup,
1124 _param_spec: glib::ffi::gpointer,
1125 f: glib::ffi::gpointer,
1126 ) {
1127 let f: &F = &*(f as *const F);
1128 f(ToolItemGroup::from_glib_borrow(this).unsafe_cast_ref())
1129 }
1130 unsafe {
1131 let f: Box_<F> = Box_::new(f);
1132 connect_raw(
1133 self.as_ptr() as *mut _,
1134 b"notify::label\0".as_ptr() as *const _,
1135 Some(transmute::<_, unsafe extern "C" fn()>(
1136 notify_label_trampoline::<Self, F> as *const (),
1137 )),
1138 Box_::into_raw(f),
1139 )
1140 }
1141 }
1142
1143 #[doc(alias = "label-widget")]
1144 fn connect_label_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1145 unsafe extern "C" fn notify_label_widget_trampoline<
1146 P: IsA<ToolItemGroup>,
1147 F: Fn(&P) + 'static,
1148 >(
1149 this: *mut ffi::GtkToolItemGroup,
1150 _param_spec: glib::ffi::gpointer,
1151 f: glib::ffi::gpointer,
1152 ) {
1153 let f: &F = &*(f as *const F);
1154 f(ToolItemGroup::from_glib_borrow(this).unsafe_cast_ref())
1155 }
1156 unsafe {
1157 let f: Box_<F> = Box_::new(f);
1158 connect_raw(
1159 self.as_ptr() as *mut _,
1160 b"notify::label-widget\0".as_ptr() as *const _,
1161 Some(transmute::<_, unsafe extern "C" fn()>(
1162 notify_label_widget_trampoline::<Self, F> as *const (),
1163 )),
1164 Box_::into_raw(f),
1165 )
1166 }
1167 }
1168}
1169
1170impl<O: IsA<ToolItemGroup>> ToolItemGroupExt for O {}
1171
1172impl fmt::Display for ToolItemGroup {
1173 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1174 f.write_str("ToolItemGroup")
1175 }
1176}