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