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