gtk4/auto/action_bar.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 ffi, Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Overflow,
7 Widget,
8};
9use glib::{
10 prelude::*,
11 signal::{connect_raw, SignalHandlerId},
12 translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17 /// Presents contextual actions.
18 ///
19 /// <picture>
20 /// <source srcset="action-bar-dark.png" media="(prefers-color-scheme: dark)">
21 /// <img alt="An example GtkActionBar" src="action-bar.png">
22 /// </picture>
23 ///
24 /// [`ActionBar`][crate::ActionBar] is expected to be displayed below the content and expand
25 /// horizontally to fill the area.
26 ///
27 /// It allows placing children at the start or the end. In addition, it
28 /// contains an internal centered box which is centered with respect to
29 /// the full width of the box, even if the children at either side take
30 /// up different amounts of space.
31 ///
32 /// # GtkActionBar as GtkBuildable
33 ///
34 /// The [`ActionBar`][crate::ActionBar] implementation of the [`Buildable`][crate::Buildable] interface supports
35 /// adding children at the start or end sides by specifying “start” or “end” as
36 /// the “type” attribute of a `<child>` element, or setting the center widget
37 /// by specifying “center” value.
38 ///
39 /// # CSS nodes
40 ///
41 /// ```text
42 /// actionbar
43 /// ╰── revealer
44 /// ╰── box
45 /// ├── box.start
46 /// │ ╰── [start children]
47 /// ├── [center widget]
48 /// ╰── box.end
49 /// ╰── [end children]
50 /// ```
51 ///
52 /// A [`ActionBar`][crate::ActionBar]'s CSS node is called `actionbar`. It contains a `revealer`
53 /// subnode, which contains a `box` subnode, which contains two `box` subnodes at
54 /// the start and end of the action bar, with `start` and `end` style classes
55 /// respectively, as well as a center node that represents the center child.
56 ///
57 /// Each of the boxes contains children packed for that side.
58 ///
59 /// ## Properties
60 ///
61 ///
62 /// #### `revealed`
63 /// Controls whether the action bar shows its contents.
64 ///
65 /// Readable | Writeable
66 /// <details><summary><h4>Widget</h4></summary>
67 ///
68 ///
69 /// #### `can-focus`
70 /// Whether the widget or any of its descendents can accept
71 /// the input focus.
72 ///
73 /// This property is meant to be set by widget implementations,
74 /// typically in their instance init function.
75 ///
76 /// Readable | Writeable
77 ///
78 ///
79 /// #### `can-target`
80 /// Whether the widget can receive pointer events.
81 ///
82 /// Readable | Writeable
83 ///
84 ///
85 /// #### `css-classes`
86 /// A list of css classes applied to this widget.
87 ///
88 /// Readable | Writeable
89 ///
90 ///
91 /// #### `css-name`
92 /// The name of this widget in the CSS tree.
93 ///
94 /// This property is meant to be set by widget implementations,
95 /// typically in their instance init function.
96 ///
97 /// Readable | Writeable | Construct Only
98 ///
99 ///
100 /// #### `cursor`
101 /// The cursor used by @widget.
102 ///
103 /// Readable | Writeable
104 ///
105 ///
106 /// #### `focus-on-click`
107 /// Whether the widget should grab focus when it is clicked with the mouse.
108 ///
109 /// This property is only relevant for widgets that can take focus.
110 ///
111 /// Readable | Writeable
112 ///
113 ///
114 /// #### `focusable`
115 /// Whether this widget itself will accept the input focus.
116 ///
117 /// Readable | Writeable
118 ///
119 ///
120 /// #### `halign`
121 /// How to distribute horizontal space if widget gets extra space.
122 ///
123 /// Readable | Writeable
124 ///
125 ///
126 /// #### `has-default`
127 /// Whether the widget is the default widget.
128 ///
129 /// Readable
130 ///
131 ///
132 /// #### `has-focus`
133 /// Whether the widget has the input focus.
134 ///
135 /// Readable
136 ///
137 ///
138 /// #### `has-tooltip`
139 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
140 /// signal on @widget.
141 ///
142 /// A true value indicates that @widget can have a tooltip, in this case
143 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
144 /// determine whether it will provide a tooltip or not.
145 ///
146 /// Readable | Writeable
147 ///
148 ///
149 /// #### `height-request`
150 /// Overrides for height request of the widget.
151 ///
152 /// If this is -1, the natural request will be used.
153 ///
154 /// Readable | Writeable
155 ///
156 ///
157 /// #### `hexpand`
158 /// Whether to expand horizontally.
159 ///
160 /// Readable | Writeable
161 ///
162 ///
163 /// #### `hexpand-set`
164 /// Whether to use the `hexpand` property.
165 ///
166 /// Readable | Writeable
167 ///
168 ///
169 /// #### `layout-manager`
170 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
171 /// the preferred size of the widget, and allocate its children.
172 ///
173 /// This property is meant to be set by widget implementations,
174 /// typically in their instance init function.
175 ///
176 /// Readable | Writeable
177 ///
178 ///
179 /// #### `limit-events`
180 /// Makes this widget act like a modal dialog, with respect to
181 /// event delivery.
182 ///
183 /// Global event controllers will not handle events with targets
184 /// inside the widget, unless they are set up to ignore propagation
185 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
186 ///
187 /// Readable | Writeable
188 ///
189 ///
190 /// #### `margin-bottom`
191 /// Margin on bottom side of widget.
192 ///
193 /// This property adds margin outside of the widget's normal size
194 /// request, the margin will be added in addition to the size from
195 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
196 ///
197 /// Readable | Writeable
198 ///
199 ///
200 /// #### `margin-end`
201 /// Margin on end of widget, horizontally.
202 ///
203 /// This property supports left-to-right and right-to-left text
204 /// directions.
205 ///
206 /// This property adds margin outside of the widget's normal size
207 /// request, the margin will be added in addition to the size from
208 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
209 ///
210 /// Readable | Writeable
211 ///
212 ///
213 /// #### `margin-start`
214 /// Margin on start of widget, horizontally.
215 ///
216 /// This property supports left-to-right and right-to-left text
217 /// directions.
218 ///
219 /// This property adds margin outside of the widget's normal size
220 /// request, the margin will be added in addition to the size from
221 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
222 ///
223 /// Readable | Writeable
224 ///
225 ///
226 /// #### `margin-top`
227 /// Margin on top side of widget.
228 ///
229 /// This property adds margin outside of the widget's normal size
230 /// request, the margin will be added in addition to the size from
231 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
232 ///
233 /// Readable | Writeable
234 ///
235 ///
236 /// #### `name`
237 /// The name of the widget.
238 ///
239 /// Readable | Writeable
240 ///
241 ///
242 /// #### `opacity`
243 /// The requested opacity of the widget.
244 ///
245 /// Readable | Writeable
246 ///
247 ///
248 /// #### `overflow`
249 /// How content outside the widget's content area is treated.
250 ///
251 /// This property is meant to be set by widget implementations,
252 /// typically in their instance init function.
253 ///
254 /// Readable | Writeable
255 ///
256 ///
257 /// #### `parent`
258 /// The parent widget of this widget.
259 ///
260 /// Readable
261 ///
262 ///
263 /// #### `receives-default`
264 /// Whether the widget will receive the default action when it is focused.
265 ///
266 /// Readable | Writeable
267 ///
268 ///
269 /// #### `root`
270 /// The [`Root`][crate::Root] widget of the widget tree containing this widget.
271 ///
272 /// This will be `NULL` if the widget is not contained in a root widget.
273 ///
274 /// Readable
275 ///
276 ///
277 /// #### `scale-factor`
278 /// The scale factor of the widget.
279 ///
280 /// Readable
281 ///
282 ///
283 /// #### `sensitive`
284 /// Whether the widget responds to input.
285 ///
286 /// Readable | Writeable
287 ///
288 ///
289 /// #### `tooltip-markup`
290 /// Sets the text of tooltip to be the given string, which is marked up
291 /// with Pango markup.
292 ///
293 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
294 ///
295 /// This is a convenience property which will take care of getting the
296 /// tooltip shown if the given string is not `NULL`:
297 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
298 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
299 /// the default signal handler.
300 ///
301 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
302 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
303 ///
304 /// Readable | Writeable
305 ///
306 ///
307 /// #### `tooltip-text`
308 /// Sets the text of tooltip to be the given string.
309 ///
310 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
311 ///
312 /// This is a convenience property which will take care of getting the
313 /// tooltip shown if the given string is not `NULL`:
314 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
315 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
316 /// the default signal handler.
317 ///
318 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
319 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
320 ///
321 /// Readable | Writeable
322 ///
323 ///
324 /// #### `valign`
325 /// How to distribute vertical space if widget gets extra space.
326 ///
327 /// Readable | Writeable
328 ///
329 ///
330 /// #### `vexpand`
331 /// Whether to expand vertically.
332 ///
333 /// Readable | Writeable
334 ///
335 ///
336 /// #### `vexpand-set`
337 /// Whether to use the `vexpand` property.
338 ///
339 /// Readable | Writeable
340 ///
341 ///
342 /// #### `visible`
343 /// Whether the widget is visible.
344 ///
345 /// Readable | Writeable
346 ///
347 ///
348 /// #### `width-request`
349 /// Overrides for width request of the widget.
350 ///
351 /// If this is -1, the natural request will be used.
352 ///
353 /// Readable | Writeable
354 /// </details>
355 /// <details><summary><h4>Accessible</h4></summary>
356 ///
357 ///
358 /// #### `accessible-role`
359 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
360 ///
361 /// The accessible role cannot be changed once set.
362 ///
363 /// Readable | Writeable
364 /// </details>
365 ///
366 /// # Implements
367 ///
368 /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
369 #[doc(alias = "GtkActionBar")]
370 pub struct ActionBar(Object<ffi::GtkActionBar>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
371
372 match fn {
373 type_ => || ffi::gtk_action_bar_get_type(),
374 }
375}
376
377impl ActionBar {
378 /// Creates a new action bar widget.
379 ///
380 /// # Returns
381 ///
382 /// a new [`ActionBar`][crate::ActionBar]
383 #[doc(alias = "gtk_action_bar_new")]
384 pub fn new() -> ActionBar {
385 assert_initialized_main_thread!();
386 unsafe { Widget::from_glib_none(ffi::gtk_action_bar_new()).unsafe_cast() }
387 }
388
389 // rustdoc-stripper-ignore-next
390 /// Creates a new builder-pattern struct instance to construct [`ActionBar`] objects.
391 ///
392 /// This method returns an instance of [`ActionBarBuilder`](crate::builders::ActionBarBuilder) which can be used to create [`ActionBar`] objects.
393 pub fn builder() -> ActionBarBuilder {
394 ActionBarBuilder::new()
395 }
396
397 /// Retrieves the center bar widget of the bar.
398 ///
399 /// # Returns
400 ///
401 /// the center widget
402 #[doc(alias = "gtk_action_bar_get_center_widget")]
403 #[doc(alias = "get_center_widget")]
404 pub fn center_widget(&self) -> Option<Widget> {
405 unsafe { from_glib_none(ffi::gtk_action_bar_get_center_widget(self.to_glib_none().0)) }
406 }
407
408 /// Gets whether the contents of the action bar are revealed.
409 ///
410 /// # Returns
411 ///
412 /// the current value of the [`revealed`][struct@crate::ActionBar#revealed]
413 /// property
414 #[doc(alias = "gtk_action_bar_get_revealed")]
415 #[doc(alias = "get_revealed")]
416 #[doc(alias = "revealed")]
417 pub fn is_revealed(&self) -> bool {
418 unsafe { from_glib(ffi::gtk_action_bar_get_revealed(self.to_glib_none().0)) }
419 }
420
421 /// Adds a child to the action bar, packed with reference to the
422 /// end of the action bar.
423 /// ## `child`
424 /// the widget to be added
425 #[doc(alias = "gtk_action_bar_pack_end")]
426 pub fn pack_end(&self, child: &impl IsA<Widget>) {
427 unsafe {
428 ffi::gtk_action_bar_pack_end(self.to_glib_none().0, child.as_ref().to_glib_none().0);
429 }
430 }
431
432 /// Adds a child to the action, packed with reference to the
433 /// start of the action bar.
434 /// ## `child`
435 /// the widget to be added
436 #[doc(alias = "gtk_action_bar_pack_start")]
437 pub fn pack_start(&self, child: &impl IsA<Widget>) {
438 unsafe {
439 ffi::gtk_action_bar_pack_start(self.to_glib_none().0, child.as_ref().to_glib_none().0);
440 }
441 }
442
443 /// Removes a child from the action bar.
444 /// ## `child`
445 /// the widget to be removed
446 #[doc(alias = "gtk_action_bar_remove")]
447 pub fn remove(&self, child: &impl IsA<Widget>) {
448 unsafe {
449 ffi::gtk_action_bar_remove(self.to_glib_none().0, child.as_ref().to_glib_none().0);
450 }
451 }
452
453 /// Sets the center widget for the action bar.
454 /// ## `center_widget`
455 /// a widget to use for the center
456 #[doc(alias = "gtk_action_bar_set_center_widget")]
457 pub fn set_center_widget(&self, center_widget: Option<&impl IsA<Widget>>) {
458 unsafe {
459 ffi::gtk_action_bar_set_center_widget(
460 self.to_glib_none().0,
461 center_widget.map(|p| p.as_ref()).to_glib_none().0,
462 );
463 }
464 }
465
466 /// Reveals or conceals the content of the action bar.
467 ///
468 /// Note: this does not show or hide the action bar in the
469 /// [`visible`][struct@crate::Widget#visible] sense, so revealing has
470 /// no effect if the action bar is hidden.
471 /// ## `revealed`
472 /// the new value for the property
473 #[doc(alias = "gtk_action_bar_set_revealed")]
474 #[doc(alias = "revealed")]
475 pub fn set_revealed(&self, revealed: bool) {
476 unsafe {
477 ffi::gtk_action_bar_set_revealed(self.to_glib_none().0, revealed.into_glib());
478 }
479 }
480
481 #[doc(alias = "revealed")]
482 pub fn connect_revealed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
483 unsafe extern "C" fn notify_revealed_trampoline<F: Fn(&ActionBar) + 'static>(
484 this: *mut ffi::GtkActionBar,
485 _param_spec: glib::ffi::gpointer,
486 f: glib::ffi::gpointer,
487 ) {
488 let f: &F = &*(f as *const F);
489 f(&from_glib_borrow(this))
490 }
491 unsafe {
492 let f: Box_<F> = Box_::new(f);
493 connect_raw(
494 self.as_ptr() as *mut _,
495 c"notify::revealed".as_ptr() as *const _,
496 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
497 notify_revealed_trampoline::<F> as *const (),
498 )),
499 Box_::into_raw(f),
500 )
501 }
502 }
503}
504
505impl Default for ActionBar {
506 fn default() -> Self {
507 Self::new()
508 }
509}
510
511// rustdoc-stripper-ignore-next
512/// A [builder-pattern] type to construct [`ActionBar`] objects.
513///
514/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
515#[must_use = "The builder must be built to be used"]
516pub struct ActionBarBuilder {
517 builder: glib::object::ObjectBuilder<'static, ActionBar>,
518}
519
520impl ActionBarBuilder {
521 fn new() -> Self {
522 Self {
523 builder: glib::object::Object::builder(),
524 }
525 }
526
527 /// Controls whether the action bar shows its contents.
528 pub fn revealed(self, revealed: bool) -> Self {
529 Self {
530 builder: self.builder.property("revealed", revealed),
531 }
532 }
533
534 /// Whether the widget or any of its descendents can accept
535 /// the input focus.
536 ///
537 /// This property is meant to be set by widget implementations,
538 /// typically in their instance init function.
539 pub fn can_focus(self, can_focus: bool) -> Self {
540 Self {
541 builder: self.builder.property("can-focus", can_focus),
542 }
543 }
544
545 /// Whether the widget can receive pointer events.
546 pub fn can_target(self, can_target: bool) -> Self {
547 Self {
548 builder: self.builder.property("can-target", can_target),
549 }
550 }
551
552 /// A list of css classes applied to this widget.
553 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
554 Self {
555 builder: self.builder.property("css-classes", css_classes.into()),
556 }
557 }
558
559 /// The name of this widget in the CSS tree.
560 ///
561 /// This property is meant to be set by widget implementations,
562 /// typically in their instance init function.
563 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
564 Self {
565 builder: self.builder.property("css-name", css_name.into()),
566 }
567 }
568
569 /// The cursor used by @widget.
570 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
571 Self {
572 builder: self.builder.property("cursor", cursor.clone()),
573 }
574 }
575
576 /// Whether the widget should grab focus when it is clicked with the mouse.
577 ///
578 /// This property is only relevant for widgets that can take focus.
579 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
580 Self {
581 builder: self.builder.property("focus-on-click", focus_on_click),
582 }
583 }
584
585 /// Whether this widget itself will accept the input focus.
586 pub fn focusable(self, focusable: bool) -> Self {
587 Self {
588 builder: self.builder.property("focusable", focusable),
589 }
590 }
591
592 /// How to distribute horizontal space if widget gets extra space.
593 pub fn halign(self, halign: Align) -> Self {
594 Self {
595 builder: self.builder.property("halign", halign),
596 }
597 }
598
599 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
600 /// signal on @widget.
601 ///
602 /// A true value indicates that @widget can have a tooltip, in this case
603 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
604 /// determine whether it will provide a tooltip or not.
605 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
606 Self {
607 builder: self.builder.property("has-tooltip", has_tooltip),
608 }
609 }
610
611 /// Overrides for height request of the widget.
612 ///
613 /// If this is -1, the natural request will be used.
614 pub fn height_request(self, height_request: i32) -> Self {
615 Self {
616 builder: self.builder.property("height-request", height_request),
617 }
618 }
619
620 /// Whether to expand horizontally.
621 pub fn hexpand(self, hexpand: bool) -> Self {
622 Self {
623 builder: self.builder.property("hexpand", hexpand),
624 }
625 }
626
627 /// Whether to use the `hexpand` property.
628 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
629 Self {
630 builder: self.builder.property("hexpand-set", hexpand_set),
631 }
632 }
633
634 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
635 /// the preferred size of the widget, and allocate its children.
636 ///
637 /// This property is meant to be set by widget implementations,
638 /// typically in their instance init function.
639 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
640 Self {
641 builder: self
642 .builder
643 .property("layout-manager", layout_manager.clone().upcast()),
644 }
645 }
646
647 /// Makes this widget act like a modal dialog, with respect to
648 /// event delivery.
649 ///
650 /// Global event controllers will not handle events with targets
651 /// inside the widget, unless they are set up to ignore propagation
652 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
653 #[cfg(feature = "v4_18")]
654 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
655 pub fn limit_events(self, limit_events: bool) -> Self {
656 Self {
657 builder: self.builder.property("limit-events", limit_events),
658 }
659 }
660
661 /// Margin on bottom side of widget.
662 ///
663 /// This property adds margin outside of the widget's normal size
664 /// request, the margin will be added in addition to the size from
665 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
666 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
667 Self {
668 builder: self.builder.property("margin-bottom", margin_bottom),
669 }
670 }
671
672 /// Margin on end of widget, horizontally.
673 ///
674 /// This property supports left-to-right and right-to-left text
675 /// directions.
676 ///
677 /// This property adds margin outside of the widget's normal size
678 /// request, the margin will be added in addition to the size from
679 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
680 pub fn margin_end(self, margin_end: i32) -> Self {
681 Self {
682 builder: self.builder.property("margin-end", margin_end),
683 }
684 }
685
686 /// Margin on start of widget, horizontally.
687 ///
688 /// This property supports left-to-right and right-to-left text
689 /// directions.
690 ///
691 /// This property adds margin outside of the widget's normal size
692 /// request, the margin will be added in addition to the size from
693 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
694 pub fn margin_start(self, margin_start: i32) -> Self {
695 Self {
696 builder: self.builder.property("margin-start", margin_start),
697 }
698 }
699
700 /// Margin on top side of widget.
701 ///
702 /// This property adds margin outside of the widget's normal size
703 /// request, the margin will be added in addition to the size from
704 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
705 pub fn margin_top(self, margin_top: i32) -> Self {
706 Self {
707 builder: self.builder.property("margin-top", margin_top),
708 }
709 }
710
711 /// The name of the widget.
712 pub fn name(self, name: impl Into<glib::GString>) -> Self {
713 Self {
714 builder: self.builder.property("name", name.into()),
715 }
716 }
717
718 /// The requested opacity of the widget.
719 pub fn opacity(self, opacity: f64) -> Self {
720 Self {
721 builder: self.builder.property("opacity", opacity),
722 }
723 }
724
725 /// How content outside the widget's content area is treated.
726 ///
727 /// This property is meant to be set by widget implementations,
728 /// typically in their instance init function.
729 pub fn overflow(self, overflow: Overflow) -> Self {
730 Self {
731 builder: self.builder.property("overflow", overflow),
732 }
733 }
734
735 /// Whether the widget will receive the default action when it is focused.
736 pub fn receives_default(self, receives_default: bool) -> Self {
737 Self {
738 builder: self.builder.property("receives-default", receives_default),
739 }
740 }
741
742 /// Whether the widget responds to input.
743 pub fn sensitive(self, sensitive: bool) -> Self {
744 Self {
745 builder: self.builder.property("sensitive", sensitive),
746 }
747 }
748
749 /// Sets the text of tooltip to be the given string, which is marked up
750 /// with Pango markup.
751 ///
752 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
753 ///
754 /// This is a convenience property which will take care of getting the
755 /// tooltip shown if the given string is not `NULL`:
756 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
757 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
758 /// the default signal handler.
759 ///
760 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
761 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
762 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
763 Self {
764 builder: self
765 .builder
766 .property("tooltip-markup", tooltip_markup.into()),
767 }
768 }
769
770 /// Sets the text of tooltip to be the given string.
771 ///
772 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
773 ///
774 /// This is a convenience property which will take care of getting the
775 /// tooltip shown if the given string is not `NULL`:
776 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
777 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
778 /// the default signal handler.
779 ///
780 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
781 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
782 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
783 Self {
784 builder: self.builder.property("tooltip-text", tooltip_text.into()),
785 }
786 }
787
788 /// How to distribute vertical space if widget gets extra space.
789 pub fn valign(self, valign: Align) -> Self {
790 Self {
791 builder: self.builder.property("valign", valign),
792 }
793 }
794
795 /// Whether to expand vertically.
796 pub fn vexpand(self, vexpand: bool) -> Self {
797 Self {
798 builder: self.builder.property("vexpand", vexpand),
799 }
800 }
801
802 /// Whether to use the `vexpand` property.
803 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
804 Self {
805 builder: self.builder.property("vexpand-set", vexpand_set),
806 }
807 }
808
809 /// Whether the widget is visible.
810 pub fn visible(self, visible: bool) -> Self {
811 Self {
812 builder: self.builder.property("visible", visible),
813 }
814 }
815
816 /// Overrides for width request of the widget.
817 ///
818 /// If this is -1, the natural request will be used.
819 pub fn width_request(self, width_request: i32) -> Self {
820 Self {
821 builder: self.builder.property("width-request", width_request),
822 }
823 }
824
825 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
826 ///
827 /// The accessible role cannot be changed once set.
828 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
829 Self {
830 builder: self.builder.property("accessible-role", accessible_role),
831 }
832 }
833
834 // rustdoc-stripper-ignore-next
835 /// Build the [`ActionBar`].
836 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
837 pub fn build(self) -> ActionBar {
838 assert_initialized_main_thread!();
839 self.builder.build()
840 }
841}