libpanel/auto/frame.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::{ffi, FrameHeader, Position, Widget};
7#[cfg(feature = "v1_2")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
9use glib::object::ObjectType as _;
10use glib::{
11 prelude::*,
12 signal::{connect_raw, SignalHandlerId},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 /// The [`Frame`][crate::Frame] is a widget containing panels to display in an
19 /// area. The widgets are added internally in an [class`Adw`] to
20 /// display them one at a time like in a stack.
21 ///
22 /// A [`Frame`][crate::Frame] can also have a header widget that will be displayed
23 /// above the panels.
24 ///
25 /// ## Properties
26 ///
27 ///
28 /// #### `closeable`
29 /// Readable
30 ///
31 ///
32 /// #### `empty`
33 /// Readable
34 ///
35 ///
36 /// #### `placeholder`
37 /// Readable | Writeable
38 ///
39 ///
40 /// #### `visible-child`
41 /// Readable | Writeable
42 /// <details><summary><h4>Widget</h4></summary>
43 ///
44 ///
45 /// #### `can-focus`
46 /// Whether the widget or any of its descendents can accept
47 /// the input focus.
48 ///
49 /// This property is meant to be set by widget implementations,
50 /// typically in their instance init function.
51 ///
52 /// Readable | Writeable
53 ///
54 ///
55 /// #### `can-target`
56 /// Whether the widget can receive pointer events.
57 ///
58 /// Readable | Writeable
59 ///
60 ///
61 /// #### `css-classes`
62 /// A list of css classes applied to this widget.
63 ///
64 /// Readable | Writeable
65 ///
66 ///
67 /// #### `css-name`
68 /// The name of this widget in the CSS tree.
69 ///
70 /// This property is meant to be set by widget implementations,
71 /// typically in their instance init function.
72 ///
73 /// Readable | Writeable | Construct Only
74 ///
75 ///
76 /// #### `cursor`
77 /// The cursor used by `widget`.
78 ///
79 /// Readable | Writeable
80 ///
81 ///
82 /// #### `focus-on-click`
83 /// Whether the widget should grab focus when it is clicked with the mouse.
84 ///
85 /// This property is only relevant for widgets that can take focus.
86 ///
87 /// Readable | Writeable
88 ///
89 ///
90 /// #### `focusable`
91 /// Whether this widget itself will accept the input focus.
92 ///
93 /// Readable | Writeable
94 ///
95 ///
96 /// #### `halign`
97 /// How to distribute horizontal space if widget gets extra space.
98 ///
99 /// Readable | Writeable
100 ///
101 ///
102 /// #### `has-default`
103 /// Whether the widget is the default widget.
104 ///
105 /// Readable
106 ///
107 ///
108 /// #### `has-focus`
109 /// Whether the widget has the input focus.
110 ///
111 /// Readable
112 ///
113 ///
114 /// #### `has-tooltip`
115 /// Enables or disables the emission of the [signal`Gtk`::query-tooltip]
116 /// signal on `widget`.
117 ///
118 /// A true value indicates that `widget` can have a tooltip, in this case
119 /// the widget will be queried using [signal`Gtk`::query-tooltip] to
120 /// determine whether it will provide a tooltip or not.
121 ///
122 /// Readable | Writeable
123 ///
124 ///
125 /// #### `height-request`
126 /// Overrides for height request of the widget.
127 ///
128 /// If this is -1, the natural request will be used.
129 ///
130 /// Readable | Writeable
131 ///
132 ///
133 /// #### `hexpand`
134 /// Whether to expand horizontally.
135 ///
136 /// Readable | Writeable
137 ///
138 ///
139 /// #### `hexpand-set`
140 /// Whether to use the `hexpand` property.
141 ///
142 /// Readable | Writeable
143 ///
144 ///
145 /// #### `layout-manager`
146 /// The [class`Gtk`] instance to use to compute
147 /// the preferred size of the widget, and allocate its children.
148 ///
149 /// This property is meant to be set by widget implementations,
150 /// typically in their instance init function.
151 ///
152 /// Readable | Writeable
153 ///
154 ///
155 /// #### `limit-events`
156 /// Makes this widget act like a modal dialog, with respect to
157 /// event delivery.
158 ///
159 /// Global event controllers will not handle events with targets
160 /// inside the widget, unless they are set up to ignore propagation
161 /// limits. See [method`Gtk`.set_propagation_limit].
162 ///
163 /// Readable | Writeable
164 ///
165 ///
166 /// #### `margin-bottom`
167 /// Margin on bottom side of widget.
168 ///
169 /// This property adds margin outside of the widget's normal size
170 /// request, the margin will be added in addition to the size from
171 /// [method`Gtk`.set_size_request] for example.
172 ///
173 /// Readable | Writeable
174 ///
175 ///
176 /// #### `margin-end`
177 /// Margin on end of widget, horizontally.
178 ///
179 /// This property supports left-to-right and right-to-left text
180 /// directions.
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 /// [method`Gtk`.set_size_request] for example.
185 ///
186 /// Readable | Writeable
187 ///
188 ///
189 /// #### `margin-start`
190 /// Margin on start of widget, horizontally.
191 ///
192 /// This property supports left-to-right and right-to-left text
193 /// directions.
194 ///
195 /// This property adds margin outside of the widget's normal size
196 /// request, the margin will be added in addition to the size from
197 /// [method`Gtk`.set_size_request] for example.
198 ///
199 /// Readable | Writeable
200 ///
201 ///
202 /// #### `margin-top`
203 /// Margin on top side of widget.
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 /// [method`Gtk`.set_size_request] for example.
208 ///
209 /// Readable | Writeable
210 ///
211 ///
212 /// #### `name`
213 /// The name of the widget.
214 ///
215 /// Readable | Writeable
216 ///
217 ///
218 /// #### `opacity`
219 /// The requested opacity of the widget.
220 ///
221 /// Readable | Writeable
222 ///
223 ///
224 /// #### `overflow`
225 /// How content outside the widget's content area is treated.
226 ///
227 /// This property is meant to be set by widget implementations,
228 /// typically in their instance init function.
229 ///
230 /// Readable | Writeable
231 ///
232 ///
233 /// #### `parent`
234 /// The parent widget of this widget.
235 ///
236 /// Readable
237 ///
238 ///
239 /// #### `receives-default`
240 /// Whether the widget will receive the default action when it is focused.
241 ///
242 /// Readable | Writeable
243 ///
244 ///
245 /// #### `root`
246 /// The `GtkRoot` widget of the widget tree containing this widget.
247 ///
248 /// This will be `NULL` if the widget is not contained in a root widget.
249 ///
250 /// Readable
251 ///
252 ///
253 /// #### `scale-factor`
254 /// The scale factor of the widget.
255 ///
256 /// Readable
257 ///
258 ///
259 /// #### `sensitive`
260 /// Whether the widget responds to input.
261 ///
262 /// Readable | Writeable
263 ///
264 ///
265 /// #### `tooltip-markup`
266 /// Sets the text of tooltip to be the given string, which is marked up
267 /// with Pango markup.
268 ///
269 /// Also see [method`Gtk`.set_markup].
270 ///
271 /// This is a convenience property which will take care of getting the
272 /// tooltip shown if the given string is not `NULL`:
273 /// [property`Gtk`:has-tooltip] will automatically be set to true
274 /// and there will be taken care of [signal`Gtk`::query-tooltip] in
275 /// the default signal handler.
276 ///
277 /// Note that if both [property`Gtk`:tooltip-text] and
278 /// [property`Gtk`:tooltip-markup] are set, the last one wins.
279 ///
280 /// Readable | Writeable
281 ///
282 ///
283 /// #### `tooltip-text`
284 /// Sets the text of tooltip to be the given string.
285 ///
286 /// Also see [method`Gtk`.set_text].
287 ///
288 /// This is a convenience property which will take care of getting the
289 /// tooltip shown if the given string is not `NULL`:
290 /// [property`Gtk`:has-tooltip] will automatically be set to true
291 /// and there will be taken care of [signal`Gtk`::query-tooltip] in
292 /// the default signal handler.
293 ///
294 /// Note that if both [property`Gtk`:tooltip-text] and
295 /// [property`Gtk`:tooltip-markup] are set, the last one wins.
296 ///
297 /// Readable | Writeable
298 ///
299 ///
300 /// #### `valign`
301 /// How to distribute vertical space if widget gets extra space.
302 ///
303 /// Readable | Writeable
304 ///
305 ///
306 /// #### `vexpand`
307 /// Whether to expand vertically.
308 ///
309 /// Readable | Writeable
310 ///
311 ///
312 /// #### `vexpand-set`
313 /// Whether to use the `vexpand` property.
314 ///
315 /// Readable | Writeable
316 ///
317 ///
318 /// #### `visible`
319 /// Whether the widget is visible.
320 ///
321 /// Readable | Writeable
322 ///
323 ///
324 /// #### `width-request`
325 /// Overrides for width request of the widget.
326 ///
327 /// If this is -1, the natural request will be used.
328 ///
329 /// Readable | Writeable
330 /// </details>
331 /// <details><summary><h4>Accessible</h4></summary>
332 ///
333 ///
334 /// #### `accessible-role`
335 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
336 ///
337 /// The accessible role cannot be changed once set.
338 ///
339 /// Readable | Writeable
340 /// </details>
341 /// <details><summary><h4>Orientable</h4></summary>
342 ///
343 ///
344 /// #### `orientation`
345 /// The orientation of the orientable.
346 ///
347 /// Readable | Writeable
348 /// </details>
349 ///
350 /// ## Signals
351 ///
352 ///
353 /// #### `adopt-widget`
354 /// This signal is emitted when the frame should decide if it can adopt
355 /// a [`Widget`][crate::Widget] dropped on the frame.
356 ///
357 /// If `GDK_EVENT_STOP` is returned, then the widget will not be adopted.
358 ///
359 ///
360 ///
361 ///
362 /// #### `page-closed`
363 /// This signal is emitted when the page widget will be closed.
364 ///
365 ///
366 /// <details><summary><h4>Widget</h4></summary>
367 ///
368 ///
369 /// #### `destroy`
370 /// Signals that all holders of a reference to the widget should release
371 /// the reference that they hold.
372 ///
373 /// May result in finalization of the widget if all references are released.
374 ///
375 /// This signal is not suitable for saving widget state.
376 ///
377 ///
378 ///
379 ///
380 /// #### `direction-changed`
381 /// Emitted when the text direction of a widget changes.
382 ///
383 ///
384 ///
385 ///
386 /// #### `hide`
387 /// Emitted when `widget` is hidden.
388 ///
389 ///
390 ///
391 ///
392 /// #### `keynav-failed`
393 /// Emitted if keyboard navigation fails.
394 ///
395 /// See [method`Gtk`.keynav_failed] for details.
396 ///
397 ///
398 ///
399 ///
400 /// #### `map`
401 /// Emitted when `widget` is going to be mapped.
402 ///
403 /// A widget is mapped when the widget is visible (which is controlled with
404 /// [property`Gtk`:visible]) and all its parents up to the toplevel widget
405 /// are also visible.
406 ///
407 /// The `::map` signal can be used to determine whether a widget will be drawn,
408 /// for instance it can resume an animation that was stopped during the
409 /// emission of [signal`Gtk`::unmap].
410 ///
411 ///
412 ///
413 ///
414 /// #### `mnemonic-activate`
415 /// Emitted when a widget is activated via a mnemonic.
416 ///
417 /// The default handler for this signal activates `widget` if `group_cycling`
418 /// is false, or just makes `widget` grab focus if `group_cycling` is true.
419 ///
420 ///
421 ///
422 ///
423 /// #### `move-focus`
424 /// Emitted when the focus is moved.
425 ///
426 /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
427 ///
428 /// The default bindings for this signal are `<kbd>`Tab`</kbd>` to move forward,
429 /// and `<kbd>`Shift`</kbd>`+`<kbd>`Tab`</kbd>` to move backward.
430 ///
431 /// Action
432 ///
433 ///
434 /// #### `query-tooltip`
435 /// Emitted when the widget’s tooltip is about to be shown.
436 ///
437 /// This happens when the [property`Gtk`:has-tooltip] property
438 /// is true and the hover timeout has expired with the cursor hovering
439 /// above `widget`; or emitted when `widget` got focus in keyboard mode.
440 ///
441 /// Using the given coordinates, the signal handler should determine
442 /// whether a tooltip should be shown for `widget`. If this is the case
443 /// true should be returned, false otherwise. Note that if `keyboard_mode`
444 /// is true, the values of `x` and `y` are undefined and should not be used.
445 ///
446 /// The signal handler is free to manipulate `tooltip` with the therefore
447 /// destined function calls.
448 ///
449 ///
450 ///
451 ///
452 /// #### `realize`
453 /// Emitted when `widget` is associated with a `GdkSurface`.
454 ///
455 /// This means that [method`Gtk`.realize] has been called
456 /// or the widget has been mapped (that is, it is going to be drawn).
457 ///
458 ///
459 ///
460 ///
461 /// #### `show`
462 /// Emitted when `widget` is shown.
463 ///
464 ///
465 ///
466 ///
467 /// #### `state-flags-changed`
468 /// Emitted when the widget state changes.
469 ///
470 /// See [method`Gtk`.get_state_flags].
471 ///
472 ///
473 ///
474 ///
475 /// #### `unmap`
476 /// Emitted when `widget` is going to be unmapped.
477 ///
478 /// A widget is unmapped when either it or any of its parents up to the
479 /// toplevel widget have been set as hidden.
480 ///
481 /// As `::unmap` indicates that a widget will not be shown any longer,
482 /// it can be used to, for example, stop an animation on the widget.
483 ///
484 ///
485 ///
486 ///
487 /// #### `unrealize`
488 /// Emitted when the `GdkSurface` associated with `widget` is destroyed.
489 ///
490 /// This means that [method`Gtk`.unrealize] has been called
491 /// or the widget has been unmapped (that is, it is going to be hidden).
492 ///
493 ///
494 /// </details>
495 ///
496 /// # Implements
497 ///
498 /// [`PanelFrameExt`][trait@crate::prelude::PanelFrameExt], [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`], [`trait@gtk::prelude::OrientableExt`]
499 #[doc(alias = "PanelFrame")]
500 pub struct Frame(Object<ffi::PanelFrame, ffi::PanelFrameClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
501
502 match fn {
503 type_ => || ffi::panel_frame_get_type(),
504 }
505}
506
507impl Frame {
508 pub const NONE: Option<&'static Frame> = None;
509
510 /// Create a new [`Frame`][crate::Frame].
511 ///
512 /// # Returns
513 ///
514 /// a newly created [`Frame`][crate::Frame] object.
515 #[doc(alias = "panel_frame_new")]
516 pub fn new() -> Frame {
517 assert_initialized_main_thread!();
518 unsafe { gtk::Widget::from_glib_none(ffi::panel_frame_new()).unsafe_cast() }
519 }
520
521 // rustdoc-stripper-ignore-next
522 /// Creates a new builder-pattern struct instance to construct [`Frame`] objects.
523 ///
524 /// This method returns an instance of [`FrameBuilder`](crate::builders::FrameBuilder) which can be used to create [`Frame`] objects.
525 pub fn builder() -> FrameBuilder {
526 FrameBuilder::new()
527 }
528}
529
530impl Default for Frame {
531 fn default() -> Self {
532 Self::new()
533 }
534}
535
536// rustdoc-stripper-ignore-next
537/// A [builder-pattern] type to construct [`Frame`] objects.
538///
539/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
540#[must_use = "The builder must be built to be used"]
541pub struct FrameBuilder {
542 builder: glib::object::ObjectBuilder<'static, Frame>,
543}
544
545impl FrameBuilder {
546 fn new() -> Self {
547 Self {
548 builder: glib::object::Object::builder(),
549 }
550 }
551
552 pub fn placeholder(self, placeholder: &impl IsA<gtk::Widget>) -> Self {
553 Self {
554 builder: self
555 .builder
556 .property("placeholder", placeholder.clone().upcast()),
557 }
558 }
559
560 pub fn visible_child(self, visible_child: &impl IsA<Widget>) -> Self {
561 Self {
562 builder: self
563 .builder
564 .property("visible-child", visible_child.clone().upcast()),
565 }
566 }
567
568 /// Whether the widget or any of its descendents can accept
569 /// the input focus.
570 ///
571 /// This property is meant to be set by widget implementations,
572 /// typically in their instance init function.
573 pub fn can_focus(self, can_focus: bool) -> Self {
574 Self {
575 builder: self.builder.property("can-focus", can_focus),
576 }
577 }
578
579 /// Whether the widget can receive pointer events.
580 pub fn can_target(self, can_target: bool) -> Self {
581 Self {
582 builder: self.builder.property("can-target", can_target),
583 }
584 }
585
586 /// A list of css classes applied to this widget.
587 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
588 Self {
589 builder: self.builder.property("css-classes", css_classes.into()),
590 }
591 }
592
593 /// The name of this widget in the CSS tree.
594 ///
595 /// This property is meant to be set by widget implementations,
596 /// typically in their instance init function.
597 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
598 Self {
599 builder: self.builder.property("css-name", css_name.into()),
600 }
601 }
602
603 /// The cursor used by `widget`.
604 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
605 Self {
606 builder: self.builder.property("cursor", cursor.clone()),
607 }
608 }
609
610 /// Whether the widget should grab focus when it is clicked with the mouse.
611 ///
612 /// This property is only relevant for widgets that can take focus.
613 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
614 Self {
615 builder: self.builder.property("focus-on-click", focus_on_click),
616 }
617 }
618
619 /// Whether this widget itself will accept the input focus.
620 pub fn focusable(self, focusable: bool) -> Self {
621 Self {
622 builder: self.builder.property("focusable", focusable),
623 }
624 }
625
626 /// How to distribute horizontal space if widget gets extra space.
627 pub fn halign(self, halign: gtk::Align) -> Self {
628 Self {
629 builder: self.builder.property("halign", halign),
630 }
631 }
632
633 /// Enables or disables the emission of the [signal`Gtk`::query-tooltip]
634 /// signal on `widget`.
635 ///
636 /// A true value indicates that `widget` can have a tooltip, in this case
637 /// the widget will be queried using [signal`Gtk`::query-tooltip] to
638 /// determine whether it will provide a tooltip or not.
639 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
640 Self {
641 builder: self.builder.property("has-tooltip", has_tooltip),
642 }
643 }
644
645 /// Overrides for height request of the widget.
646 ///
647 /// If this is -1, the natural request will be used.
648 pub fn height_request(self, height_request: i32) -> Self {
649 Self {
650 builder: self.builder.property("height-request", height_request),
651 }
652 }
653
654 /// Whether to expand horizontally.
655 pub fn hexpand(self, hexpand: bool) -> Self {
656 Self {
657 builder: self.builder.property("hexpand", hexpand),
658 }
659 }
660
661 /// Whether to use the `hexpand` property.
662 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
663 Self {
664 builder: self.builder.property("hexpand-set", hexpand_set),
665 }
666 }
667
668 /// The [class`Gtk`] instance to use to compute
669 /// the preferred size of the widget, and allocate its children.
670 ///
671 /// This property is meant to be set by widget implementations,
672 /// typically in their instance init function.
673 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
674 Self {
675 builder: self
676 .builder
677 .property("layout-manager", layout_manager.clone().upcast()),
678 }
679 }
680
681 /// Makes this widget act like a modal dialog, with respect to
682 /// event delivery.
683 ///
684 /// Global event controllers will not handle events with targets
685 /// inside the widget, unless they are set up to ignore propagation
686 /// limits. See [method`Gtk`.set_propagation_limit].
687 #[cfg(feature = "gtk_v4_18")]
688 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
689 pub fn limit_events(self, limit_events: bool) -> Self {
690 Self {
691 builder: self.builder.property("limit-events", limit_events),
692 }
693 }
694
695 /// Margin on bottom side of widget.
696 ///
697 /// This property adds margin outside of the widget's normal size
698 /// request, the margin will be added in addition to the size from
699 /// [method`Gtk`.set_size_request] for example.
700 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
701 Self {
702 builder: self.builder.property("margin-bottom", margin_bottom),
703 }
704 }
705
706 /// Margin on end of widget, horizontally.
707 ///
708 /// This property supports left-to-right and right-to-left text
709 /// directions.
710 ///
711 /// This property adds margin outside of the widget's normal size
712 /// request, the margin will be added in addition to the size from
713 /// [method`Gtk`.set_size_request] for example.
714 pub fn margin_end(self, margin_end: i32) -> Self {
715 Self {
716 builder: self.builder.property("margin-end", margin_end),
717 }
718 }
719
720 /// Margin on start of widget, horizontally.
721 ///
722 /// This property supports left-to-right and right-to-left text
723 /// directions.
724 ///
725 /// This property adds margin outside of the widget's normal size
726 /// request, the margin will be added in addition to the size from
727 /// [method`Gtk`.set_size_request] for example.
728 pub fn margin_start(self, margin_start: i32) -> Self {
729 Self {
730 builder: self.builder.property("margin-start", margin_start),
731 }
732 }
733
734 /// Margin on top side of widget.
735 ///
736 /// This property adds margin outside of the widget's normal size
737 /// request, the margin will be added in addition to the size from
738 /// [method`Gtk`.set_size_request] for example.
739 pub fn margin_top(self, margin_top: i32) -> Self {
740 Self {
741 builder: self.builder.property("margin-top", margin_top),
742 }
743 }
744
745 /// The name of the widget.
746 pub fn name(self, name: impl Into<glib::GString>) -> Self {
747 Self {
748 builder: self.builder.property("name", name.into()),
749 }
750 }
751
752 /// The requested opacity of the widget.
753 pub fn opacity(self, opacity: f64) -> Self {
754 Self {
755 builder: self.builder.property("opacity", opacity),
756 }
757 }
758
759 /// How content outside the widget's content area is treated.
760 ///
761 /// This property is meant to be set by widget implementations,
762 /// typically in their instance init function.
763 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
764 Self {
765 builder: self.builder.property("overflow", overflow),
766 }
767 }
768
769 /// Whether the widget will receive the default action when it is focused.
770 pub fn receives_default(self, receives_default: bool) -> Self {
771 Self {
772 builder: self.builder.property("receives-default", receives_default),
773 }
774 }
775
776 /// Whether the widget responds to input.
777 pub fn sensitive(self, sensitive: bool) -> Self {
778 Self {
779 builder: self.builder.property("sensitive", sensitive),
780 }
781 }
782
783 /// Sets the text of tooltip to be the given string, which is marked up
784 /// with Pango markup.
785 ///
786 /// Also see [method`Gtk`.set_markup].
787 ///
788 /// This is a convenience property which will take care of getting the
789 /// tooltip shown if the given string is not `NULL`:
790 /// [property`Gtk`:has-tooltip] will automatically be set to true
791 /// and there will be taken care of [signal`Gtk`::query-tooltip] in
792 /// the default signal handler.
793 ///
794 /// Note that if both [property`Gtk`:tooltip-text] and
795 /// [property`Gtk`:tooltip-markup] are set, the last one wins.
796 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
797 Self {
798 builder: self
799 .builder
800 .property("tooltip-markup", tooltip_markup.into()),
801 }
802 }
803
804 /// Sets the text of tooltip to be the given string.
805 ///
806 /// Also see [method`Gtk`.set_text].
807 ///
808 /// This is a convenience property which will take care of getting the
809 /// tooltip shown if the given string is not `NULL`:
810 /// [property`Gtk`:has-tooltip] will automatically be set to true
811 /// and there will be taken care of [signal`Gtk`::query-tooltip] in
812 /// the default signal handler.
813 ///
814 /// Note that if both [property`Gtk`:tooltip-text] and
815 /// [property`Gtk`:tooltip-markup] are set, the last one wins.
816 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
817 Self {
818 builder: self.builder.property("tooltip-text", tooltip_text.into()),
819 }
820 }
821
822 /// How to distribute vertical space if widget gets extra space.
823 pub fn valign(self, valign: gtk::Align) -> Self {
824 Self {
825 builder: self.builder.property("valign", valign),
826 }
827 }
828
829 /// Whether to expand vertically.
830 pub fn vexpand(self, vexpand: bool) -> Self {
831 Self {
832 builder: self.builder.property("vexpand", vexpand),
833 }
834 }
835
836 /// Whether to use the `vexpand` property.
837 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
838 Self {
839 builder: self.builder.property("vexpand-set", vexpand_set),
840 }
841 }
842
843 /// Whether the widget is visible.
844 pub fn visible(self, visible: bool) -> Self {
845 Self {
846 builder: self.builder.property("visible", visible),
847 }
848 }
849
850 /// Overrides for width request of the widget.
851 ///
852 /// If this is -1, the natural request will be used.
853 pub fn width_request(self, width_request: i32) -> Self {
854 Self {
855 builder: self.builder.property("width-request", width_request),
856 }
857 }
858
859 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
860 ///
861 /// The accessible role cannot be changed once set.
862 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
863 Self {
864 builder: self.builder.property("accessible-role", accessible_role),
865 }
866 }
867
868 /// The orientation of the orientable.
869 pub fn orientation(self, orientation: gtk::Orientation) -> Self {
870 Self {
871 builder: self.builder.property("orientation", orientation),
872 }
873 }
874
875 // rustdoc-stripper-ignore-next
876 /// Build the [`Frame`].
877 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
878 pub fn build(self) -> Frame {
879 assert_initialized_main_thread!();
880 self.builder.build()
881 }
882}
883
884/// Trait containing all [`struct@Frame`] methods.
885///
886/// # Implementors
887///
888/// [`Frame`][struct@crate::Frame]
889pub trait PanelFrameExt: IsA<Frame> + 'static {
890 /// Adds a widget to the frame.
891 /// ## `panel`
892 /// a [`Widget`][crate::Widget] to add
893 #[doc(alias = "panel_frame_add")]
894 fn add(&self, panel: &impl IsA<Widget>) {
895 unsafe {
896 ffi::panel_frame_add(
897 self.as_ref().to_glib_none().0,
898 panel.as_ref().to_glib_none().0,
899 );
900 }
901 }
902
903 /// Add `panel` before `sibling` in the [`Frame`][crate::Frame].
904 /// ## `panel`
905 /// the [`Widget`][crate::Widget] to add.
906 /// ## `sibling`
907 /// the sibling [`Widget`][crate::Widget] to add the panel before.
908 #[doc(alias = "panel_frame_add_before")]
909 fn add_before(&self, panel: &impl IsA<Widget>, sibling: &impl IsA<Widget>) {
910 unsafe {
911 ffi::panel_frame_add_before(
912 self.as_ref().to_glib_none().0,
913 panel.as_ref().to_glib_none().0,
914 sibling.as_ref().to_glib_none().0,
915 );
916 }
917 }
918
919 /// Tells if the panel frame is closeable.
920 ///
921 /// # Returns
922 ///
923 /// [`true`] if the panel frame is closeable.
924 #[doc(alias = "panel_frame_get_closeable")]
925 #[doc(alias = "get_closeable")]
926 #[doc(alias = "closeable")]
927 fn is_closeable(&self) -> bool {
928 unsafe {
929 from_glib(ffi::panel_frame_get_closeable(
930 self.as_ref().to_glib_none().0,
931 ))
932 }
933 }
934
935 /// Tells if the panel frame is empty.
936 ///
937 /// # Returns
938 ///
939 /// [`true`] if the panel is empty.
940 #[doc(alias = "panel_frame_get_empty")]
941 #[doc(alias = "get_empty")]
942 #[doc(alias = "empty")]
943 fn is_empty(&self) -> bool {
944 unsafe { from_glib(ffi::panel_frame_get_empty(self.as_ref().to_glib_none().0)) }
945 }
946
947 /// Gets the header for the frame.
948 ///
949 /// # Returns
950 ///
951 /// a [`FrameHeader`][crate::FrameHeader] or [`None`]
952 #[doc(alias = "panel_frame_get_header")]
953 #[doc(alias = "get_header")]
954 fn header(&self) -> Option<FrameHeader> {
955 unsafe { from_glib_none(ffi::panel_frame_get_header(self.as_ref().to_glib_none().0)) }
956 }
957
958 /// Gets the number of pages in the panel frame.
959 ///
960 /// # Returns
961 ///
962 /// The number of pages.
963 #[doc(alias = "panel_frame_get_n_pages")]
964 #[doc(alias = "get_n_pages")]
965 fn n_pages(&self) -> u32 {
966 unsafe { ffi::panel_frame_get_n_pages(self.as_ref().to_glib_none().0) }
967 }
968
969 /// Gets the page with the given index, if any.
970 /// ## `n`
971 /// the index of the page
972 ///
973 /// # Returns
974 ///
975 /// a [`Widget`][crate::Widget] or [`None`]
976 #[doc(alias = "panel_frame_get_page")]
977 #[doc(alias = "get_page")]
978 fn page(&self, n: u32) -> Option<Widget> {
979 unsafe { from_glib_none(ffi::panel_frame_get_page(self.as_ref().to_glib_none().0, n)) }
980 }
981
982 /// Get the pages for the frame.
983 ///
984 /// # Returns
985 ///
986 /// a [`gtk::SelectionModel`][crate::gtk::SelectionModel]
987 #[doc(alias = "panel_frame_get_pages")]
988 #[doc(alias = "get_pages")]
989 fn pages(&self) -> gtk::SelectionModel {
990 unsafe { from_glib_full(ffi::panel_frame_get_pages(self.as_ref().to_glib_none().0)) }
991 }
992
993 /// Gets the placeholder widget, if any.
994 ///
995 /// # Returns
996 ///
997 /// a [`gtk::Widget`][crate::gtk::Widget] or [`None`]
998 #[doc(alias = "panel_frame_get_placeholder")]
999 #[doc(alias = "get_placeholder")]
1000 fn placeholder(&self) -> Option<gtk::Widget> {
1001 unsafe {
1002 from_glib_none(ffi::panel_frame_get_placeholder(
1003 self.as_ref().to_glib_none().0,
1004 ))
1005 }
1006 }
1007
1008 /// Gets the [`Position`][crate::Position] for the frame.
1009 ///
1010 /// # Returns
1011 ///
1012 /// a [`Position`][crate::Position]
1013 #[doc(alias = "panel_frame_get_position")]
1014 #[doc(alias = "get_position")]
1015 fn position(&self) -> Position {
1016 unsafe {
1017 from_glib_full(ffi::panel_frame_get_position(
1018 self.as_ref().to_glib_none().0,
1019 ))
1020 }
1021 }
1022
1023 /// Gets the requested size for the panel frame.
1024 ///
1025 /// # Returns
1026 ///
1027 /// the requested size.
1028 #[doc(alias = "panel_frame_get_requested_size")]
1029 #[doc(alias = "get_requested_size")]
1030 fn requested_size(&self) -> i32 {
1031 unsafe { ffi::panel_frame_get_requested_size(self.as_ref().to_glib_none().0) }
1032 }
1033
1034 /// Gets the widget of the currently visible child.
1035 ///
1036 /// # Returns
1037 ///
1038 /// a [`Widget`][crate::Widget] or [`None`]
1039 #[doc(alias = "panel_frame_get_visible_child")]
1040 #[doc(alias = "get_visible_child")]
1041 #[doc(alias = "visible-child")]
1042 fn visible_child(&self) -> Option<Widget> {
1043 unsafe {
1044 from_glib_none(ffi::panel_frame_get_visible_child(
1045 self.as_ref().to_glib_none().0,
1046 ))
1047 }
1048 }
1049
1050 /// Removes a widget from the frame.
1051 /// ## `panel`
1052 /// a [`Widget`][crate::Widget] to remove.
1053 #[doc(alias = "panel_frame_remove")]
1054 fn remove(&self, panel: &impl IsA<Widget>) {
1055 unsafe {
1056 ffi::panel_frame_remove(
1057 self.as_ref().to_glib_none().0,
1058 panel.as_ref().to_glib_none().0,
1059 );
1060 }
1061 }
1062
1063 /// Set pinned state of `child`.
1064 /// ## `child`
1065 /// a [`Widget`][crate::Widget]
1066 /// ## `pinned`
1067 /// if `widget` should be pinned
1068 #[cfg(feature = "v1_2")]
1069 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1070 #[doc(alias = "panel_frame_set_child_pinned")]
1071 fn set_child_pinned(&self, child: &impl IsA<Widget>, pinned: bool) {
1072 unsafe {
1073 ffi::panel_frame_set_child_pinned(
1074 self.as_ref().to_glib_none().0,
1075 child.as_ref().to_glib_none().0,
1076 pinned.into_glib(),
1077 );
1078 }
1079 }
1080
1081 /// Sets the header for the frame, such as a [`FrameSwitcher`][crate::FrameSwitcher].
1082 /// ## `header`
1083 /// a [`FrameHeader`][crate::FrameHeader]
1084 #[doc(alias = "panel_frame_set_header")]
1085 fn set_header(&self, header: Option<&impl IsA<FrameHeader>>) {
1086 unsafe {
1087 ffi::panel_frame_set_header(
1088 self.as_ref().to_glib_none().0,
1089 header.map(|p| p.as_ref()).to_glib_none().0,
1090 );
1091 }
1092 }
1093
1094 /// Sets the placeholder widget for the frame.
1095 ///
1096 /// The placeholder widget is displayed when there are no pages
1097 /// to display in the frame.
1098 /// ## `placeholder`
1099 /// a [`gtk::Widget`][crate::gtk::Widget] or [`None`]
1100 #[doc(alias = "panel_frame_set_placeholder")]
1101 #[doc(alias = "placeholder")]
1102 fn set_placeholder(&self, placeholder: Option<&impl IsA<gtk::Widget>>) {
1103 unsafe {
1104 ffi::panel_frame_set_placeholder(
1105 self.as_ref().to_glib_none().0,
1106 placeholder.map(|p| p.as_ref()).to_glib_none().0,
1107 );
1108 }
1109 }
1110
1111 /// Sets the requested size for the panel frame.
1112 /// ## `requested_size`
1113 /// the requested size.
1114 #[doc(alias = "panel_frame_set_requested_size")]
1115 fn set_requested_size(&self, requested_size: i32) {
1116 unsafe {
1117 ffi::panel_frame_set_requested_size(self.as_ref().to_glib_none().0, requested_size);
1118 }
1119 }
1120
1121 /// Sets the current page to the child specified in `widget`.
1122 /// ## `widget`
1123 /// a [`Widget`][crate::Widget]
1124 #[doc(alias = "panel_frame_set_visible_child")]
1125 #[doc(alias = "visible-child")]
1126 fn set_visible_child(&self, widget: &impl IsA<Widget>) {
1127 unsafe {
1128 ffi::panel_frame_set_visible_child(
1129 self.as_ref().to_glib_none().0,
1130 widget.as_ref().to_glib_none().0,
1131 );
1132 }
1133 }
1134
1135 /// This signal is emitted when the frame should decide if it can adopt
1136 /// a [`Widget`][crate::Widget] dropped on the frame.
1137 ///
1138 /// If `GDK_EVENT_STOP` is returned, then the widget will not be adopted.
1139 /// ## `widget`
1140 /// a [`Widget`][crate::Widget]
1141 ///
1142 /// # Returns
1143 ///
1144 /// `GDK_EVENT_STOP` or `GDK_EVENT_PROPAGATE`
1145 #[cfg(feature = "v1_2")]
1146 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1147 #[doc(alias = "adopt-widget")]
1148 fn connect_adopt_widget<F: Fn(&Self, &Widget) -> bool + 'static>(
1149 &self,
1150 f: F,
1151 ) -> SignalHandlerId {
1152 unsafe extern "C" fn adopt_widget_trampoline<
1153 P: IsA<Frame>,
1154 F: Fn(&P, &Widget) -> bool + 'static,
1155 >(
1156 this: *mut ffi::PanelFrame,
1157 widget: *mut ffi::PanelWidget,
1158 f: glib::ffi::gpointer,
1159 ) -> glib::ffi::gboolean {
1160 let f: &F = &*(f as *const F);
1161 f(
1162 Frame::from_glib_borrow(this).unsafe_cast_ref(),
1163 &from_glib_borrow(widget),
1164 )
1165 .into_glib()
1166 }
1167 unsafe {
1168 let f: Box_<F> = Box_::new(f);
1169 connect_raw(
1170 self.as_ptr() as *mut _,
1171 c"adopt-widget".as_ptr() as *const _,
1172 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1173 adopt_widget_trampoline::<Self, F> as *const (),
1174 )),
1175 Box_::into_raw(f),
1176 )
1177 }
1178 }
1179
1180 /// This signal is emitted when the page widget will be closed.
1181 /// ## `widget`
1182 /// a [`Widget`][crate::Widget]
1183 #[cfg(feature = "v1_2")]
1184 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1185 #[doc(alias = "page-closed")]
1186 fn connect_page_closed<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
1187 unsafe extern "C" fn page_closed_trampoline<P: IsA<Frame>, F: Fn(&P, &Widget) + 'static>(
1188 this: *mut ffi::PanelFrame,
1189 widget: *mut ffi::PanelWidget,
1190 f: glib::ffi::gpointer,
1191 ) {
1192 let f: &F = &*(f as *const F);
1193 f(
1194 Frame::from_glib_borrow(this).unsafe_cast_ref(),
1195 &from_glib_borrow(widget),
1196 )
1197 }
1198 unsafe {
1199 let f: Box_<F> = Box_::new(f);
1200 connect_raw(
1201 self.as_ptr() as *mut _,
1202 c"page-closed".as_ptr() as *const _,
1203 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1204 page_closed_trampoline::<Self, F> as *const (),
1205 )),
1206 Box_::into_raw(f),
1207 )
1208 }
1209 }
1210
1211 #[doc(alias = "closeable")]
1212 fn connect_closeable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1213 unsafe extern "C" fn notify_closeable_trampoline<P: IsA<Frame>, F: Fn(&P) + 'static>(
1214 this: *mut ffi::PanelFrame,
1215 _param_spec: glib::ffi::gpointer,
1216 f: glib::ffi::gpointer,
1217 ) {
1218 let f: &F = &*(f as *const F);
1219 f(Frame::from_glib_borrow(this).unsafe_cast_ref())
1220 }
1221 unsafe {
1222 let f: Box_<F> = Box_::new(f);
1223 connect_raw(
1224 self.as_ptr() as *mut _,
1225 c"notify::closeable".as_ptr() as *const _,
1226 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1227 notify_closeable_trampoline::<Self, F> as *const (),
1228 )),
1229 Box_::into_raw(f),
1230 )
1231 }
1232 }
1233
1234 #[doc(alias = "empty")]
1235 fn connect_empty_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1236 unsafe extern "C" fn notify_empty_trampoline<P: IsA<Frame>, F: Fn(&P) + 'static>(
1237 this: *mut ffi::PanelFrame,
1238 _param_spec: glib::ffi::gpointer,
1239 f: glib::ffi::gpointer,
1240 ) {
1241 let f: &F = &*(f as *const F);
1242 f(Frame::from_glib_borrow(this).unsafe_cast_ref())
1243 }
1244 unsafe {
1245 let f: Box_<F> = Box_::new(f);
1246 connect_raw(
1247 self.as_ptr() as *mut _,
1248 c"notify::empty".as_ptr() as *const _,
1249 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1250 notify_empty_trampoline::<Self, F> as *const (),
1251 )),
1252 Box_::into_raw(f),
1253 )
1254 }
1255 }
1256
1257 #[doc(alias = "placeholder")]
1258 fn connect_placeholder_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1259 unsafe extern "C" fn notify_placeholder_trampoline<P: IsA<Frame>, F: Fn(&P) + 'static>(
1260 this: *mut ffi::PanelFrame,
1261 _param_spec: glib::ffi::gpointer,
1262 f: glib::ffi::gpointer,
1263 ) {
1264 let f: &F = &*(f as *const F);
1265 f(Frame::from_glib_borrow(this).unsafe_cast_ref())
1266 }
1267 unsafe {
1268 let f: Box_<F> = Box_::new(f);
1269 connect_raw(
1270 self.as_ptr() as *mut _,
1271 c"notify::placeholder".as_ptr() as *const _,
1272 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1273 notify_placeholder_trampoline::<Self, F> as *const (),
1274 )),
1275 Box_::into_raw(f),
1276 )
1277 }
1278 }
1279
1280 #[doc(alias = "visible-child")]
1281 fn connect_visible_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1282 unsafe extern "C" fn notify_visible_child_trampoline<P: IsA<Frame>, F: Fn(&P) + 'static>(
1283 this: *mut ffi::PanelFrame,
1284 _param_spec: glib::ffi::gpointer,
1285 f: glib::ffi::gpointer,
1286 ) {
1287 let f: &F = &*(f as *const F);
1288 f(Frame::from_glib_borrow(this).unsafe_cast_ref())
1289 }
1290 unsafe {
1291 let f: Box_<F> = Box_::new(f);
1292 connect_raw(
1293 self.as_ptr() as *mut _,
1294 c"notify::visible-child".as_ptr() as *const _,
1295 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1296 notify_visible_child_trampoline::<Self, F> as *const (),
1297 )),
1298 Box_::into_raw(f),
1299 )
1300 }
1301 }
1302}
1303
1304impl<O: IsA<Frame>> PanelFrameExt for O {}