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