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