gtk/auto/list_box_row.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::{Actionable, Align, Bin, Buildable, Container, ResizeMode, Widget, ffi};
6use glib::{
7 object::ObjectType as _,
8 prelude::*,
9 signal::{SignalHandlerId, connect_raw},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 ///
16 ///
17 /// ## Properties
18 ///
19 ///
20 /// #### `activatable`
21 /// The property determines whether the [`row-activated`][struct@crate::ListBox#row-activated]
22 /// signal will be emitted for this row.
23 ///
24 /// Readable | Writable
25 ///
26 ///
27 /// #### `selectable`
28 /// The property determines whether this row can be selected.
29 ///
30 /// Readable | Writable
31 /// <details><summary><h4>Container</h4></summary>
32 ///
33 ///
34 /// #### `border-width`
35 /// Readable | Writable
36 ///
37 ///
38 /// #### `child`
39 /// Writable
40 ///
41 ///
42 /// #### `resize-mode`
43 /// Readable | Writable
44 /// </details>
45 /// <details><summary><h4>Widget</h4></summary>
46 ///
47 ///
48 /// #### `app-paintable`
49 /// Readable | Writable
50 ///
51 ///
52 /// #### `can-default`
53 /// Readable | Writable
54 ///
55 ///
56 /// #### `can-focus`
57 /// Readable | Writable
58 ///
59 ///
60 /// #### `composite-child`
61 /// Readable
62 ///
63 ///
64 /// #### `double-buffered`
65 /// Whether the widget is double buffered.
66 ///
67 /// Readable | Writable
68 ///
69 ///
70 /// #### `events`
71 /// Readable | Writable
72 ///
73 ///
74 /// #### `expand`
75 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
76 ///
77 /// Readable | Writable
78 ///
79 ///
80 /// #### `focus-on-click`
81 /// Whether the widget should grab focus when it is clicked with the mouse.
82 ///
83 /// This property is only relevant for widgets that can take focus.
84 ///
85 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
86 /// GtkComboBox) implemented this property individually.
87 ///
88 /// Readable | Writable
89 ///
90 ///
91 /// #### `halign`
92 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
93 ///
94 /// Readable | Writable
95 ///
96 ///
97 /// #### `has-default`
98 /// Readable | Writable
99 ///
100 ///
101 /// #### `has-focus`
102 /// Readable | Writable
103 ///
104 ///
105 /// #### `has-tooltip`
106 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
107 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
108 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
109 /// whether it will provide a tooltip or not.
110 ///
111 /// Note that setting this property to [`true`] for the first time will change
112 /// the event masks of the GdkWindows of this widget to include leave-notify
113 /// and motion-notify events. This cannot and will not be undone when the
114 /// property is set to [`false`] again.
115 ///
116 /// Readable | Writable
117 ///
118 ///
119 /// #### `height-request`
120 /// Readable | Writable
121 ///
122 ///
123 /// #### `hexpand`
124 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
125 ///
126 /// Readable | Writable
127 ///
128 ///
129 /// #### `hexpand-set`
130 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
131 ///
132 /// Readable | Writable
133 ///
134 ///
135 /// #### `is-focus`
136 /// Readable | Writable
137 ///
138 ///
139 /// #### `margin`
140 /// Sets all four sides' margin at once. If read, returns max
141 /// margin on any side.
142 ///
143 /// Readable | Writable
144 ///
145 ///
146 /// #### `margin-bottom`
147 /// Margin on bottom side of widget.
148 ///
149 /// This property adds margin outside of the widget's normal size
150 /// request, the margin will be added in addition to the size from
151 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
152 ///
153 /// Readable | Writable
154 ///
155 ///
156 /// #### `margin-end`
157 /// Margin on end of widget, horizontally. This property supports
158 /// left-to-right and right-to-left text directions.
159 ///
160 /// This property adds margin outside of the widget's normal size
161 /// request, the margin will be added in addition to the size from
162 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
163 ///
164 /// Readable | Writable
165 ///
166 ///
167 /// #### `margin-left`
168 /// Margin on left side of widget.
169 ///
170 /// This property adds margin outside of the widget's normal size
171 /// request, the margin will be added in addition to the size from
172 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
173 ///
174 /// Readable | Writable
175 ///
176 ///
177 /// #### `margin-right`
178 /// Margin on right side of widget.
179 ///
180 /// This property adds margin outside of the widget's normal size
181 /// request, the margin will be added in addition to the size from
182 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
183 ///
184 /// Readable | Writable
185 ///
186 ///
187 /// #### `margin-start`
188 /// Margin on start of widget, horizontally. This property supports
189 /// left-to-right and right-to-left text 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 /// Readable | Writable
210 ///
211 ///
212 /// #### `no-show-all`
213 /// Readable | Writable
214 ///
215 ///
216 /// #### `opacity`
217 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
218 /// more details about window opacity.
219 ///
220 /// Before 3.8 this was only available in GtkWindow
221 ///
222 /// Readable | Writable
223 ///
224 ///
225 /// #### `parent`
226 /// Readable | Writable
227 ///
228 ///
229 /// #### `receives-default`
230 /// Readable | Writable
231 ///
232 ///
233 /// #### `scale-factor`
234 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
235 /// more details about widget scaling.
236 ///
237 /// Readable
238 ///
239 ///
240 /// #### `sensitive`
241 /// Readable | Writable
242 ///
243 ///
244 /// #### `style`
245 /// The style of the widget, which contains information about how it will look (colors, etc).
246 ///
247 /// Readable | Writable
248 ///
249 ///
250 /// #### `tooltip-markup`
251 /// Sets the text of tooltip to be the given string, which is marked up
252 /// with the [Pango text markup language][PangoMarkupFormat].
253 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
254 ///
255 /// This is a convenience property which will take care of getting the
256 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
257 /// will automatically be set to [`true`] and there will be taken care of
258 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
259 ///
260 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
261 /// are set, the last one wins.
262 ///
263 /// Readable | Writable
264 ///
265 ///
266 /// #### `tooltip-text`
267 /// Sets the text of tooltip to be the given string.
268 ///
269 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
270 ///
271 /// This is a convenience property which will take care of getting the
272 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
273 /// will automatically be set to [`true`] and there will be taken care of
274 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
275 ///
276 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
277 /// are set, the last one wins.
278 ///
279 /// Readable | Writable
280 ///
281 ///
282 /// #### `valign`
283 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
284 ///
285 /// Readable | Writable
286 ///
287 ///
288 /// #### `vexpand`
289 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
290 ///
291 /// Readable | Writable
292 ///
293 ///
294 /// #### `vexpand-set`
295 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
296 ///
297 /// Readable | Writable
298 ///
299 ///
300 /// #### `visible`
301 /// Readable | Writable
302 ///
303 ///
304 /// #### `width-request`
305 /// Readable | Writable
306 ///
307 ///
308 /// #### `window`
309 /// The widget's window if it is realized, [`None`] otherwise.
310 ///
311 /// Readable
312 /// </details>
313 /// <details><summary><h4>Actionable</h4></summary>
314 ///
315 ///
316 /// #### `action-name`
317 /// Readable | Writable
318 ///
319 ///
320 /// #### `action-target`
321 /// Readable | Writable
322 /// </details>
323 ///
324 /// ## Signals
325 ///
326 ///
327 /// #### `activate`
328 /// This is a keybinding signal, which will cause this row to be activated.
329 ///
330 /// If you want to be notified when the user activates a row (by key or not),
331 /// use the [`row-activated`][struct@crate::ListBox#row-activated] signal on the row’s parent [`ListBox`][crate::ListBox].
332 ///
333 /// Action
334 /// <details><summary><h4>Container</h4></summary>
335 ///
336 ///
337 /// #### `add`
338 ///
339 ///
340 ///
341 /// #### `check-resize`
342 ///
343 ///
344 ///
345 /// #### `remove`
346 ///
347 ///
348 ///
349 /// #### `set-focus-child`
350 ///
351 /// </details>
352 /// <details><summary><h4>Widget</h4></summary>
353 ///
354 ///
355 /// #### `accel-closures-changed`
356 ///
357 ///
358 ///
359 /// #### `button-press-event`
360 /// The ::button-press-event signal will be emitted when a button
361 /// (typically from a mouse) is pressed.
362 ///
363 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
364 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
365 ///
366 /// This signal will be sent to the grab widget if there is one.
367 ///
368 ///
369 ///
370 ///
371 /// #### `button-release-event`
372 /// The ::button-release-event signal will be emitted when a button
373 /// (typically from a mouse) is released.
374 ///
375 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
376 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
377 ///
378 /// This signal will be sent to the grab widget if there is one.
379 ///
380 ///
381 ///
382 ///
383 /// #### `can-activate-accel`
384 /// Determines whether an accelerator that activates the signal
385 /// identified by `signal_id` can currently be activated.
386 /// This signal is present to allow applications and derived
387 /// widgets to override the default [`Widget`][crate::Widget] handling
388 /// for determining whether an accelerator can be activated.
389 ///
390 ///
391 ///
392 ///
393 /// #### `child-notify`
394 /// The ::child-notify signal is emitted for each
395 /// [child property][child-properties] that has
396 /// changed on an object. The signal's detail holds the property name.
397 ///
398 /// Detailed
399 ///
400 ///
401 /// #### `composited-changed`
402 /// The ::composited-changed signal is emitted when the composited
403 /// status of `widgets` screen changes.
404 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
405 ///
406 /// Action
407 ///
408 ///
409 /// #### `configure-event`
410 /// The ::configure-event signal will be emitted when the size, position or
411 /// stacking of the `widget`'s window has changed.
412 ///
413 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
414 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
415 /// automatically for all new windows.
416 ///
417 ///
418 ///
419 ///
420 /// #### `damage-event`
421 /// Emitted when a redirected window belonging to `widget` gets drawn into.
422 /// The region/area members of the event shows what area of the redirected
423 /// drawable was drawn into.
424 ///
425 ///
426 ///
427 ///
428 /// #### `delete-event`
429 /// The ::delete-event signal is emitted if a user requests that
430 /// a toplevel window is closed. The default handler for this signal
431 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
432 /// this signal will cause the window to be hidden instead, so that
433 /// it can later be shown again without reconstructing it.
434 ///
435 ///
436 ///
437 ///
438 /// #### `destroy`
439 /// Signals that all holders of a reference to the widget should release
440 /// the reference that they hold. May result in finalization of the widget
441 /// if all references are released.
442 ///
443 /// This signal is not suitable for saving widget state.
444 ///
445 ///
446 ///
447 ///
448 /// #### `destroy-event`
449 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
450 /// You rarely get this signal, because most widgets disconnect themselves
451 /// from their window before they destroy it, so no widget owns the
452 /// window at destroy time.
453 ///
454 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
455 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
456 /// automatically for all new windows.
457 ///
458 ///
459 ///
460 ///
461 /// #### `direction-changed`
462 /// The ::direction-changed signal is emitted when the text direction
463 /// of a widget changes.
464 ///
465 ///
466 ///
467 ///
468 /// #### `drag-begin`
469 /// The ::drag-begin signal is emitted on the drag source when a drag is
470 /// started. A typical reason to connect to this signal is to set up a
471 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
472 ///
473 /// Note that some widgets set up a drag icon in the default handler of
474 /// this signal, so you may have to use `g_signal_connect_after()` to
475 /// override what the default handler did.
476 ///
477 ///
478 ///
479 ///
480 /// #### `drag-data-delete`
481 /// The ::drag-data-delete signal is emitted on the drag source when a drag
482 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
483 /// handler is responsible for deleting the data that has been dropped. What
484 /// "delete" means depends on the context of the drag operation.
485 ///
486 ///
487 ///
488 ///
489 /// #### `drag-data-get`
490 /// The ::drag-data-get signal is emitted on the drag source when the drop
491 /// site requests the data which is dragged. It is the responsibility of
492 /// the signal handler to fill `data` with the data in the format which
493 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
494 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
495 ///
496 ///
497 ///
498 ///
499 /// #### `drag-data-received`
500 /// format == 8))
501 /// {
502 /// GdkDragAction action;
503 ///
504 /// // handle data here
505 ///
506 /// action = gdk_drag_context_get_selected_action (context);
507 /// if (action == GDK_ACTION_ASK)
508 /// {
509 /// GtkWidget *dialog;
510 /// gint response;
511 ///
512 /// dialog = gtk_message_dialog_new (NULL,
513 /// GTK_DIALOG_MODAL |
514 /// GTK_DIALOG_DESTROY_WITH_PARENT,
515 /// GTK_MESSAGE_INFO,
516 /// GTK_BUTTONS_YES_NO,
517 /// "Move the data ?\n");
518 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
519 /// gtk_widget_destroy (dialog);
520 ///
521 /// if (response == GTK_RESPONSE_YES)
522 /// action = GDK_ACTION_MOVE;
523 /// else
524 /// action = GDK_ACTION_COPY;
525 /// }
526 ///
527 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
528 /// }
529 /// else
530 /// gtk_drag_finish (context, FALSE, FALSE, time);
531 /// }
532 /// ]|
533 ///
534 ///
535 ///
536 ///
537 /// #### `drag-drop`
538 /// The ::drag-drop signal is emitted on the drop site when the user drops
539 /// the data onto the widget. The signal handler must determine whether
540 /// the cursor position is in a drop zone or not. If it is not in a drop
541 /// zone, it returns [`false`] and no further processing is necessary.
542 /// Otherwise, the handler returns [`true`]. In this case, the handler must
543 /// ensure that `gtk_drag_finish()` is called to let the source know that
544 /// the drop is done. The call to `gtk_drag_finish()` can be done either
545 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
546 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
547 /// or more of the supported targets.
548 ///
549 ///
550 ///
551 ///
552 /// #### `drag-end`
553 /// The ::drag-end signal is emitted on the drag source when a drag is
554 /// finished. A typical reason to connect to this signal is to undo
555 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
556 ///
557 ///
558 ///
559 ///
560 /// #### `drag-failed`
561 /// The ::drag-failed signal is emitted on the drag source when a drag has
562 /// failed. The signal handler may hook custom code to handle a failed DnD
563 /// operation based on the type of error, it returns [`true`] is the failure has
564 /// been already handled (not showing the default "drag operation failed"
565 /// animation), otherwise it returns [`false`].
566 ///
567 ///
568 ///
569 ///
570 /// #### `drag-leave`
571 /// The ::drag-leave signal is emitted on the drop site when the cursor
572 /// leaves the widget. A typical reason to connect to this signal is to
573 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
574 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
575 ///
576 ///
577 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
578 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
579 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
580 ///
581 ///
582 ///
583 ///
584 /// #### `drag-motion`
585 /// suggested_action,
586 /// time);
587 /// }
588 /// else
589 /// {
590 /// // accept the drop
591 /// }
592 /// }
593 /// ]|
594 ///
595 ///
596 ///
597 ///
598 /// #### `draw`
599 /// This signal is emitted when a widget is supposed to render itself.
600 /// The `widget`'s top left corner must be painted at the origin of
601 /// the passed in context and be sized to the values returned by
602 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
603 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
604 ///
605 /// Signal handlers connected to this signal can modify the cairo
606 /// context passed as `cr` in any way they like and don't need to
607 /// restore it. The signal emission takes care of calling `cairo_save()`
608 /// before and `cairo_restore()` after invoking the handler.
609 ///
610 /// The signal handler will get a `cr` with a clip region already set to the
611 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
612 /// widgets that want to avoid redrawing themselves completely can get the full
613 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
614 /// get a finer-grained representation of the dirty region with
615 /// `cairo_copy_clip_rectangle_list()`.
616 ///
617 ///
618 ///
619 ///
620 /// #### `enter-notify-event`
621 /// The ::enter-notify-event will be emitted when the pointer enters
622 /// the `widget`'s window.
623 ///
624 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
625 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
626 ///
627 /// This signal will be sent to the grab widget if there is one.
628 ///
629 ///
630 ///
631 ///
632 /// #### `event`
633 /// The GTK+ main loop will emit three signals for each GDK event delivered
634 /// to a widget: one generic ::event signal, another, more specific,
635 /// signal that matches the type of event delivered (e.g.
636 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
637 /// [`event-after`][struct@crate::Widget#event-after] signal.
638 ///
639 ///
640 ///
641 ///
642 /// #### `event-after`
643 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
644 /// the second more specific signal, ::event-after will be emitted
645 /// regardless of the previous two signals handlers return values.
646 ///
647 ///
648 ///
649 ///
650 /// #### `focus`
651 ///
652 ///
653 ///
654 /// #### `focus-in-event`
655 /// The ::focus-in-event signal will be emitted when the keyboard focus
656 /// enters the `widget`'s window.
657 ///
658 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
659 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
660 ///
661 ///
662 ///
663 ///
664 /// #### `focus-out-event`
665 /// The ::focus-out-event signal will be emitted when the keyboard focus
666 /// leaves the `widget`'s window.
667 ///
668 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
669 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
670 ///
671 ///
672 ///
673 ///
674 /// #### `grab-broken-event`
675 /// Emitted when a pointer or keyboard grab on a window belonging
676 /// to `widget` gets broken.
677 ///
678 /// On X11, this happens when the grab window becomes unviewable
679 /// (i.e. it or one of its ancestors is unmapped), or if the same
680 /// application grabs the pointer or keyboard again.
681 ///
682 ///
683 ///
684 ///
685 /// #### `grab-focus`
686 /// Action
687 ///
688 ///
689 /// #### `grab-notify`
690 /// The ::grab-notify signal is emitted when a widget becomes
691 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
692 /// another widget, or when it becomes unshadowed due to a grab
693 /// being removed.
694 ///
695 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
696 /// grab widget in the grab stack of its window group is not
697 /// its ancestor.
698 ///
699 ///
700 ///
701 ///
702 /// #### `hide`
703 /// The ::hide signal is emitted when `widget` is hidden, for example with
704 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
705 ///
706 ///
707 ///
708 ///
709 /// #### `hierarchy-changed`
710 /// The ::hierarchy-changed signal is emitted when the
711 /// anchored state of a widget changes. A widget is
712 /// “anchored” when its toplevel
713 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
714 /// a widget changes from un-anchored to anchored or vice-versa.
715 ///
716 ///
717 ///
718 ///
719 /// #### `key-press-event`
720 /// The ::key-press-event signal is emitted when a key is pressed. The signal
721 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
722 ///
723 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
724 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
725 ///
726 /// This signal will be sent to the grab widget if there is one.
727 ///
728 ///
729 ///
730 ///
731 /// #### `key-release-event`
732 /// The ::key-release-event signal is emitted when a key is released.
733 ///
734 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
735 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
736 ///
737 /// This signal will be sent to the grab widget if there is one.
738 ///
739 ///
740 ///
741 ///
742 /// #### `keynav-failed`
743 /// Gets emitted if keyboard navigation fails.
744 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
745 ///
746 ///
747 ///
748 ///
749 /// #### `leave-notify-event`
750 /// The ::leave-notify-event will be emitted when the pointer leaves
751 /// the `widget`'s window.
752 ///
753 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
754 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
755 ///
756 /// This signal will be sent to the grab widget if there is one.
757 ///
758 ///
759 ///
760 ///
761 /// #### `map`
762 /// The ::map signal is emitted when `widget` is going to be mapped, that is
763 /// when the widget is visible (which is controlled with
764 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
765 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
766 /// be emitted.
767 ///
768 /// The ::map signal can be used to determine whether a widget will be drawn,
769 /// for instance it can resume an animation that was stopped during the
770 /// emission of [`unmap`][struct@crate::Widget#unmap].
771 ///
772 ///
773 ///
774 ///
775 /// #### `map-event`
776 /// The ::map-event signal will be emitted when the `widget`'s window is
777 /// mapped. A window is mapped when it becomes visible on the screen.
778 ///
779 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
780 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
781 /// automatically for all new windows.
782 ///
783 ///
784 ///
785 ///
786 /// #### `mnemonic-activate`
787 /// The default handler for this signal activates `widget` if `group_cycling`
788 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
789 ///
790 ///
791 ///
792 ///
793 /// #### `motion-notify-event`
794 /// The ::motion-notify-event signal is emitted when the pointer moves
795 /// over the widget's [`gdk::Window`][crate::gdk::Window].
796 ///
797 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
798 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
799 ///
800 /// This signal will be sent to the grab widget if there is one.
801 ///
802 ///
803 ///
804 ///
805 /// #### `move-focus`
806 /// Action
807 ///
808 ///
809 /// #### `parent-set`
810 /// The ::parent-set signal is emitted when a new parent
811 /// has been set on a widget.
812 ///
813 ///
814 ///
815 ///
816 /// #### `popup-menu`
817 /// This signal gets emitted whenever a widget should pop up a context
818 /// menu. This usually happens through the standard key binding mechanism;
819 /// by pressing a certain key while a widget is focused, the user can cause
820 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
821 /// a menu with clipboard commands. See the
822 /// [Popup Menu Migration Checklist][checklist-popup-menu]
823 /// for an example of how to use this signal.
824 ///
825 /// Action
826 ///
827 ///
828 /// #### `property-notify-event`
829 /// The ::property-notify-event signal will be emitted when a property on
830 /// the `widget`'s window has been changed or deleted.
831 ///
832 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
833 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
834 ///
835 ///
836 ///
837 ///
838 /// #### `proximity-in-event`
839 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
840 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
841 ///
842 /// This signal will be sent to the grab widget if there is one.
843 ///
844 ///
845 ///
846 ///
847 /// #### `proximity-out-event`
848 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
849 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
850 ///
851 /// This signal will be sent to the grab widget if there is one.
852 ///
853 ///
854 ///
855 ///
856 /// #### `query-tooltip`
857 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
858 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
859 /// focus in keyboard mode.
860 ///
861 /// Using the given coordinates, the signal handler should determine
862 /// whether a tooltip should be shown for `widget`. If this is the case
863 /// [`true`] should be returned, [`false`] otherwise. Note that if
864 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
865 /// should not be used.
866 ///
867 /// The signal handler is free to manipulate `tooltip` with the therefore
868 /// destined function calls.
869 ///
870 ///
871 ///
872 ///
873 /// #### `realize`
874 /// The ::realize signal is emitted when `widget` is associated with a
875 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
876 /// widget has been mapped (that is, it is going to be drawn).
877 ///
878 ///
879 ///
880 ///
881 /// #### `screen-changed`
882 /// The ::screen-changed signal gets emitted when the
883 /// screen of a widget has changed.
884 ///
885 ///
886 ///
887 ///
888 /// #### `scroll-event`
889 /// The ::scroll-event signal is emitted when a button in the 4 to 7
890 /// range is pressed. Wheel mice are usually configured to generate
891 /// button press events for buttons 4 and 5 when the wheel is turned.
892 ///
893 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
894 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
895 ///
896 /// This signal will be sent to the grab widget if there is one.
897 ///
898 ///
899 ///
900 ///
901 /// #### `selection-clear-event`
902 /// The ::selection-clear-event signal will be emitted when the
903 /// the `widget`'s window has lost ownership of a selection.
904 ///
905 ///
906 ///
907 ///
908 /// #### `selection-get`
909 ///
910 ///
911 ///
912 /// #### `selection-notify-event`
913 ///
914 ///
915 ///
916 /// #### `selection-received`
917 ///
918 ///
919 ///
920 /// #### `selection-request-event`
921 /// The ::selection-request-event signal will be emitted when
922 /// another client requests ownership of the selection owned by
923 /// the `widget`'s window.
924 ///
925 ///
926 ///
927 ///
928 /// #### `show`
929 /// The ::show signal is emitted when `widget` is shown, for example with
930 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
931 ///
932 ///
933 ///
934 ///
935 /// #### `show-help`
936 /// Action
937 ///
938 ///
939 /// #### `size-allocate`
940 ///
941 ///
942 ///
943 /// #### `state-changed`
944 /// The ::state-changed signal is emitted when the widget state changes.
945 /// See `gtk_widget_get_state()`.
946 ///
947 ///
948 ///
949 ///
950 /// #### `state-flags-changed`
951 /// The ::state-flags-changed signal is emitted when the widget state
952 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
953 ///
954 ///
955 ///
956 ///
957 /// #### `style-set`
958 /// The ::style-set signal is emitted when a new style has been set
959 /// on a widget. Note that style-modifying functions like
960 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
961 ///
962 /// Note that this signal is emitted for changes to the deprecated
963 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
964 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
965 ///
966 ///
967 ///
968 ///
969 /// #### `style-updated`
970 /// The ::style-updated signal is a convenience signal that is emitted when the
971 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
972 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
973 ///
974 /// Note that style-modifying functions like `gtk_widget_override_color()` also
975 /// cause this signal to be emitted.
976 ///
977 ///
978 ///
979 ///
980 /// #### `touch-event`
981 ///
982 ///
983 ///
984 /// #### `unmap`
985 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
986 /// means that either it or any of its parents up to the toplevel widget have
987 /// been set as hidden.
988 ///
989 /// As ::unmap indicates that a widget will not be shown any longer, it can be
990 /// used to, for example, stop an animation on the widget.
991 ///
992 ///
993 ///
994 ///
995 /// #### `unmap-event`
996 /// The ::unmap-event signal will be emitted when the `widget`'s window is
997 /// unmapped. A window is unmapped when it becomes invisible on the screen.
998 ///
999 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1000 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1001 /// automatically for all new windows.
1002 ///
1003 ///
1004 ///
1005 ///
1006 /// #### `unrealize`
1007 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1008 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1009 /// called or the widget has been unmapped (that is, it is going to be
1010 /// hidden).
1011 ///
1012 ///
1013 ///
1014 ///
1015 /// #### `visibility-notify-event`
1016 /// The ::visibility-notify-event will be emitted when the `widget`'s
1017 /// window is obscured or unobscured.
1018 ///
1019 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1020 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1021 ///
1022 ///
1023 ///
1024 ///
1025 /// #### `window-state-event`
1026 /// The ::window-state-event will be emitted when the state of the
1027 /// toplevel window associated to the `widget` changes.
1028 ///
1029 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1030 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1031 /// this mask automatically for all new windows.
1032 ///
1033 ///
1034 /// </details>
1035 ///
1036 /// # Implements
1037 ///
1038 /// [`ListBoxRowExt`][trait@crate::prelude::ListBoxRowExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ActionableExt`][trait@crate::prelude::ActionableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1039 #[doc(alias = "GtkListBoxRow")]
1040 pub struct ListBoxRow(Object<ffi::GtkListBoxRow, ffi::GtkListBoxRowClass>) @extends Bin, Container, Widget, @implements Buildable, Actionable;
1041
1042 match fn {
1043 type_ => || ffi::gtk_list_box_row_get_type(),
1044 }
1045}
1046
1047impl ListBoxRow {
1048 pub const NONE: Option<&'static ListBoxRow> = None;
1049
1050 /// Creates a new [`ListBoxRow`][crate::ListBoxRow], to be used as a child of a [`ListBox`][crate::ListBox].
1051 ///
1052 /// # Returns
1053 ///
1054 /// a new [`ListBoxRow`][crate::ListBoxRow]
1055 #[doc(alias = "gtk_list_box_row_new")]
1056 pub fn new() -> ListBoxRow {
1057 assert_initialized_main_thread!();
1058 unsafe { Widget::from_glib_none(ffi::gtk_list_box_row_new()).unsafe_cast() }
1059 }
1060
1061 // rustdoc-stripper-ignore-next
1062 /// Creates a new builder-pattern struct instance to construct [`ListBoxRow`] objects.
1063 ///
1064 /// This method returns an instance of [`ListBoxRowBuilder`](crate::builders::ListBoxRowBuilder) which can be used to create [`ListBoxRow`] objects.
1065 pub fn builder() -> ListBoxRowBuilder {
1066 ListBoxRowBuilder::new()
1067 }
1068}
1069
1070impl Default for ListBoxRow {
1071 fn default() -> Self {
1072 Self::new()
1073 }
1074}
1075
1076// rustdoc-stripper-ignore-next
1077/// A [builder-pattern] type to construct [`ListBoxRow`] objects.
1078///
1079/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1080#[must_use = "The builder must be built to be used"]
1081pub struct ListBoxRowBuilder {
1082 builder: glib::object::ObjectBuilder<'static, ListBoxRow>,
1083}
1084
1085impl ListBoxRowBuilder {
1086 fn new() -> Self {
1087 Self {
1088 builder: glib::object::Object::builder(),
1089 }
1090 }
1091
1092 /// The property determines whether the [`row-activated`][struct@crate::ListBox#row-activated]
1093 /// signal will be emitted for this row.
1094 pub fn activatable(self, activatable: bool) -> Self {
1095 Self {
1096 builder: self.builder.property("activatable", activatable),
1097 }
1098 }
1099
1100 /// The property determines whether this row can be selected.
1101 pub fn selectable(self, selectable: bool) -> Self {
1102 Self {
1103 builder: self.builder.property("selectable", selectable),
1104 }
1105 }
1106
1107 pub fn border_width(self, border_width: u32) -> Self {
1108 Self {
1109 builder: self.builder.property("border-width", border_width),
1110 }
1111 }
1112
1113 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1114 Self {
1115 builder: self.builder.property("child", child.clone().upcast()),
1116 }
1117 }
1118
1119 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1120 Self {
1121 builder: self.builder.property("resize-mode", resize_mode),
1122 }
1123 }
1124
1125 pub fn app_paintable(self, app_paintable: bool) -> Self {
1126 Self {
1127 builder: self.builder.property("app-paintable", app_paintable),
1128 }
1129 }
1130
1131 pub fn can_default(self, can_default: bool) -> Self {
1132 Self {
1133 builder: self.builder.property("can-default", can_default),
1134 }
1135 }
1136
1137 pub fn can_focus(self, can_focus: bool) -> Self {
1138 Self {
1139 builder: self.builder.property("can-focus", can_focus),
1140 }
1141 }
1142
1143 pub fn events(self, events: gdk::EventMask) -> Self {
1144 Self {
1145 builder: self.builder.property("events", events),
1146 }
1147 }
1148
1149 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1150 pub fn expand(self, expand: bool) -> Self {
1151 Self {
1152 builder: self.builder.property("expand", expand),
1153 }
1154 }
1155
1156 /// Whether the widget should grab focus when it is clicked with the mouse.
1157 ///
1158 /// This property is only relevant for widgets that can take focus.
1159 ///
1160 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1161 /// GtkComboBox) implemented this property individually.
1162 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1163 Self {
1164 builder: self.builder.property("focus-on-click", focus_on_click),
1165 }
1166 }
1167
1168 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1169 pub fn halign(self, halign: Align) -> Self {
1170 Self {
1171 builder: self.builder.property("halign", halign),
1172 }
1173 }
1174
1175 pub fn has_default(self, has_default: bool) -> Self {
1176 Self {
1177 builder: self.builder.property("has-default", has_default),
1178 }
1179 }
1180
1181 pub fn has_focus(self, has_focus: bool) -> Self {
1182 Self {
1183 builder: self.builder.property("has-focus", has_focus),
1184 }
1185 }
1186
1187 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1188 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1189 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1190 /// whether it will provide a tooltip or not.
1191 ///
1192 /// Note that setting this property to [`true`] for the first time will change
1193 /// the event masks of the GdkWindows of this widget to include leave-notify
1194 /// and motion-notify events. This cannot and will not be undone when the
1195 /// property is set to [`false`] again.
1196 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1197 Self {
1198 builder: self.builder.property("has-tooltip", has_tooltip),
1199 }
1200 }
1201
1202 pub fn height_request(self, height_request: i32) -> Self {
1203 Self {
1204 builder: self.builder.property("height-request", height_request),
1205 }
1206 }
1207
1208 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1209 pub fn hexpand(self, hexpand: bool) -> Self {
1210 Self {
1211 builder: self.builder.property("hexpand", hexpand),
1212 }
1213 }
1214
1215 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1216 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1217 Self {
1218 builder: self.builder.property("hexpand-set", hexpand_set),
1219 }
1220 }
1221
1222 pub fn is_focus(self, is_focus: bool) -> Self {
1223 Self {
1224 builder: self.builder.property("is-focus", is_focus),
1225 }
1226 }
1227
1228 /// Sets all four sides' margin at once. If read, returns max
1229 /// margin on any side.
1230 pub fn margin(self, margin: i32) -> Self {
1231 Self {
1232 builder: self.builder.property("margin", margin),
1233 }
1234 }
1235
1236 /// Margin on bottom side of widget.
1237 ///
1238 /// This property adds margin outside of the widget's normal size
1239 /// request, the margin will be added in addition to the size from
1240 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1241 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1242 Self {
1243 builder: self.builder.property("margin-bottom", margin_bottom),
1244 }
1245 }
1246
1247 /// Margin on end of widget, horizontally. This property supports
1248 /// left-to-right and right-to-left text directions.
1249 ///
1250 /// This property adds margin outside of the widget's normal size
1251 /// request, the margin will be added in addition to the size from
1252 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1253 pub fn margin_end(self, margin_end: i32) -> Self {
1254 Self {
1255 builder: self.builder.property("margin-end", margin_end),
1256 }
1257 }
1258
1259 /// Margin on start of widget, horizontally. This property supports
1260 /// left-to-right and right-to-left text directions.
1261 ///
1262 /// This property adds margin outside of the widget's normal size
1263 /// request, the margin will be added in addition to the size from
1264 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1265 pub fn margin_start(self, margin_start: i32) -> Self {
1266 Self {
1267 builder: self.builder.property("margin-start", margin_start),
1268 }
1269 }
1270
1271 /// Margin on top side of widget.
1272 ///
1273 /// This property adds margin outside of the widget's normal size
1274 /// request, the margin will be added in addition to the size from
1275 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1276 pub fn margin_top(self, margin_top: i32) -> Self {
1277 Self {
1278 builder: self.builder.property("margin-top", margin_top),
1279 }
1280 }
1281
1282 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1283 Self {
1284 builder: self.builder.property("name", name.into()),
1285 }
1286 }
1287
1288 pub fn no_show_all(self, no_show_all: bool) -> Self {
1289 Self {
1290 builder: self.builder.property("no-show-all", no_show_all),
1291 }
1292 }
1293
1294 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1295 /// more details about window opacity.
1296 ///
1297 /// Before 3.8 this was only available in GtkWindow
1298 pub fn opacity(self, opacity: f64) -> Self {
1299 Self {
1300 builder: self.builder.property("opacity", opacity),
1301 }
1302 }
1303
1304 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1305 Self {
1306 builder: self.builder.property("parent", parent.clone().upcast()),
1307 }
1308 }
1309
1310 pub fn receives_default(self, receives_default: bool) -> Self {
1311 Self {
1312 builder: self.builder.property("receives-default", receives_default),
1313 }
1314 }
1315
1316 pub fn sensitive(self, sensitive: bool) -> Self {
1317 Self {
1318 builder: self.builder.property("sensitive", sensitive),
1319 }
1320 }
1321
1322 /// Sets the text of tooltip to be the given string, which is marked up
1323 /// with the [Pango text markup language][PangoMarkupFormat].
1324 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1325 ///
1326 /// This is a convenience property which will take care of getting the
1327 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1328 /// will automatically be set to [`true`] and there will be taken care of
1329 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1330 ///
1331 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1332 /// are set, the last one wins.
1333 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1334 Self {
1335 builder: self
1336 .builder
1337 .property("tooltip-markup", tooltip_markup.into()),
1338 }
1339 }
1340
1341 /// Sets the text of tooltip to be the given string.
1342 ///
1343 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1344 ///
1345 /// This is a convenience property which will take care of getting the
1346 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1347 /// will automatically be set to [`true`] and there will be taken care of
1348 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1349 ///
1350 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1351 /// are set, the last one wins.
1352 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1353 Self {
1354 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1355 }
1356 }
1357
1358 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1359 pub fn valign(self, valign: Align) -> Self {
1360 Self {
1361 builder: self.builder.property("valign", valign),
1362 }
1363 }
1364
1365 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1366 pub fn vexpand(self, vexpand: bool) -> Self {
1367 Self {
1368 builder: self.builder.property("vexpand", vexpand),
1369 }
1370 }
1371
1372 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1373 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1374 Self {
1375 builder: self.builder.property("vexpand-set", vexpand_set),
1376 }
1377 }
1378
1379 pub fn visible(self, visible: bool) -> Self {
1380 Self {
1381 builder: self.builder.property("visible", visible),
1382 }
1383 }
1384
1385 pub fn width_request(self, width_request: i32) -> Self {
1386 Self {
1387 builder: self.builder.property("width-request", width_request),
1388 }
1389 }
1390
1391 pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
1392 Self {
1393 builder: self.builder.property("action-name", action_name.into()),
1394 }
1395 }
1396
1397 pub fn action_target(self, action_target: &glib::Variant) -> Self {
1398 Self {
1399 builder: self
1400 .builder
1401 .property("action-target", action_target.clone()),
1402 }
1403 }
1404
1405 // rustdoc-stripper-ignore-next
1406 /// Build the [`ListBoxRow`].
1407 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1408 pub fn build(self) -> ListBoxRow {
1409 assert_initialized_main_thread!();
1410 self.builder.build()
1411 }
1412}
1413
1414/// Trait containing all [`struct@ListBoxRow`] methods.
1415///
1416/// # Implementors
1417///
1418/// [`ListBoxRow`][struct@crate::ListBoxRow]
1419pub trait ListBoxRowExt: IsA<ListBoxRow> + 'static {
1420 /// Marks `self` as changed, causing any state that depends on this
1421 /// to be updated. This affects sorting, filtering and headers.
1422 ///
1423 /// Note that calls to this method must be in sync with the data
1424 /// used for the row functions. For instance, if the list is
1425 /// mirroring some external data set, and *two* rows changed in the
1426 /// external data set then when you call [`changed()`][Self::changed()]
1427 /// on the first row the sort function must only read the new data
1428 /// for the first of the two changed rows, otherwise the resorting
1429 /// of the rows will be wrong.
1430 ///
1431 /// This generally means that if you don’t fully control the data
1432 /// model you have to duplicate the data that affects the listbox
1433 /// row functions into the row widgets themselves. Another alternative
1434 /// is to call [`ListBoxExt::invalidate_sort()`][crate::prelude::ListBoxExt::invalidate_sort()] on any model change,
1435 /// but that is more expensive.
1436 #[doc(alias = "gtk_list_box_row_changed")]
1437 fn changed(&self) {
1438 unsafe {
1439 ffi::gtk_list_box_row_changed(self.as_ref().to_glib_none().0);
1440 }
1441 }
1442
1443 /// Gets the value of the [`activatable`][struct@crate::ListBoxRow#activatable] property
1444 /// for this row.
1445 ///
1446 /// # Returns
1447 ///
1448 /// [`true`] if the row is activatable
1449 #[doc(alias = "gtk_list_box_row_get_activatable")]
1450 #[doc(alias = "get_activatable")]
1451 #[doc(alias = "activatable")]
1452 fn is_activatable(&self) -> bool {
1453 unsafe {
1454 from_glib(ffi::gtk_list_box_row_get_activatable(
1455 self.as_ref().to_glib_none().0,
1456 ))
1457 }
1458 }
1459
1460 /// Returns the current header of the `self`. This can be used
1461 /// in a `GtkListBoxUpdateHeaderFunc` to see if there is a header
1462 /// set already, and if so to update the state of it.
1463 ///
1464 /// # Returns
1465 ///
1466 /// the current header, or [`None`] if none
1467 #[doc(alias = "gtk_list_box_row_get_header")]
1468 #[doc(alias = "get_header")]
1469 fn header(&self) -> Option<Widget> {
1470 unsafe {
1471 from_glib_none(ffi::gtk_list_box_row_get_header(
1472 self.as_ref().to_glib_none().0,
1473 ))
1474 }
1475 }
1476
1477 /// Gets the current index of the `self` in its [`ListBox`][crate::ListBox] container.
1478 ///
1479 /// # Returns
1480 ///
1481 /// the index of the `self`, or -1 if the `self` is not in a listbox
1482 #[doc(alias = "gtk_list_box_row_get_index")]
1483 #[doc(alias = "get_index")]
1484 fn index(&self) -> i32 {
1485 unsafe { ffi::gtk_list_box_row_get_index(self.as_ref().to_glib_none().0) }
1486 }
1487
1488 /// Gets the value of the [`selectable`][struct@crate::ListBoxRow#selectable] property
1489 /// for this row.
1490 ///
1491 /// # Returns
1492 ///
1493 /// [`true`] if the row is selectable
1494 #[doc(alias = "gtk_list_box_row_get_selectable")]
1495 #[doc(alias = "get_selectable")]
1496 #[doc(alias = "selectable")]
1497 fn is_selectable(&self) -> bool {
1498 unsafe {
1499 from_glib(ffi::gtk_list_box_row_get_selectable(
1500 self.as_ref().to_glib_none().0,
1501 ))
1502 }
1503 }
1504
1505 /// Returns whether the child is currently selected in its
1506 /// [`ListBox`][crate::ListBox] container.
1507 ///
1508 /// # Returns
1509 ///
1510 /// [`true`] if `self` is selected
1511 #[doc(alias = "gtk_list_box_row_is_selected")]
1512 fn is_selected(&self) -> bool {
1513 unsafe {
1514 from_glib(ffi::gtk_list_box_row_is_selected(
1515 self.as_ref().to_glib_none().0,
1516 ))
1517 }
1518 }
1519
1520 /// Set the [`activatable`][struct@crate::ListBoxRow#activatable] property for this row.
1521 /// ## `activatable`
1522 /// [`true`] to mark the row as activatable
1523 #[doc(alias = "gtk_list_box_row_set_activatable")]
1524 #[doc(alias = "activatable")]
1525 fn set_activatable(&self, activatable: bool) {
1526 unsafe {
1527 ffi::gtk_list_box_row_set_activatable(
1528 self.as_ref().to_glib_none().0,
1529 activatable.into_glib(),
1530 );
1531 }
1532 }
1533
1534 /// Sets the current header of the `self`. This is only allowed to be called
1535 /// from a `GtkListBoxUpdateHeaderFunc`. It will replace any existing
1536 /// header in the row, and be shown in front of the row in the listbox.
1537 /// ## `header`
1538 /// the header, or [`None`]
1539 #[doc(alias = "gtk_list_box_row_set_header")]
1540 fn set_header(&self, header: Option<&impl IsA<Widget>>) {
1541 unsafe {
1542 ffi::gtk_list_box_row_set_header(
1543 self.as_ref().to_glib_none().0,
1544 header.map(|p| p.as_ref()).to_glib_none().0,
1545 );
1546 }
1547 }
1548
1549 /// Set the [`selectable`][struct@crate::ListBoxRow#selectable] property for this row.
1550 /// ## `selectable`
1551 /// [`true`] to mark the row as selectable
1552 #[doc(alias = "gtk_list_box_row_set_selectable")]
1553 #[doc(alias = "selectable")]
1554 fn set_selectable(&self, selectable: bool) {
1555 unsafe {
1556 ffi::gtk_list_box_row_set_selectable(
1557 self.as_ref().to_glib_none().0,
1558 selectable.into_glib(),
1559 );
1560 }
1561 }
1562
1563 /// This is a keybinding signal, which will cause this row to be activated.
1564 ///
1565 /// If you want to be notified when the user activates a row (by key or not),
1566 /// use the [`row-activated`][struct@crate::ListBox#row-activated] signal on the row’s parent [`ListBox`][crate::ListBox].
1567 #[doc(alias = "activate")]
1568 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1569 unsafe extern "C" fn activate_trampoline<P: IsA<ListBoxRow>, F: Fn(&P) + 'static>(
1570 this: *mut ffi::GtkListBoxRow,
1571 f: glib::ffi::gpointer,
1572 ) {
1573 unsafe {
1574 let f: &F = &*(f as *const F);
1575 f(ListBoxRow::from_glib_borrow(this).unsafe_cast_ref())
1576 }
1577 }
1578 unsafe {
1579 let f: Box_<F> = Box_::new(f);
1580 connect_raw(
1581 self.as_ptr() as *mut _,
1582 c"activate".as_ptr(),
1583 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1584 activate_trampoline::<Self, F> as *const (),
1585 )),
1586 Box_::into_raw(f),
1587 )
1588 }
1589 }
1590
1591 fn emit_activate(&self) {
1592 self.emit_by_name::<()>("activate", &[]);
1593 }
1594
1595 #[doc(alias = "activatable")]
1596 fn connect_activatable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1597 unsafe extern "C" fn notify_activatable_trampoline<
1598 P: IsA<ListBoxRow>,
1599 F: Fn(&P) + 'static,
1600 >(
1601 this: *mut ffi::GtkListBoxRow,
1602 _param_spec: glib::ffi::gpointer,
1603 f: glib::ffi::gpointer,
1604 ) {
1605 unsafe {
1606 let f: &F = &*(f as *const F);
1607 f(ListBoxRow::from_glib_borrow(this).unsafe_cast_ref())
1608 }
1609 }
1610 unsafe {
1611 let f: Box_<F> = Box_::new(f);
1612 connect_raw(
1613 self.as_ptr() as *mut _,
1614 c"notify::activatable".as_ptr(),
1615 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1616 notify_activatable_trampoline::<Self, F> as *const (),
1617 )),
1618 Box_::into_raw(f),
1619 )
1620 }
1621 }
1622
1623 #[doc(alias = "selectable")]
1624 fn connect_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1625 unsafe extern "C" fn notify_selectable_trampoline<
1626 P: IsA<ListBoxRow>,
1627 F: Fn(&P) + 'static,
1628 >(
1629 this: *mut ffi::GtkListBoxRow,
1630 _param_spec: glib::ffi::gpointer,
1631 f: glib::ffi::gpointer,
1632 ) {
1633 unsafe {
1634 let f: &F = &*(f as *const F);
1635 f(ListBoxRow::from_glib_borrow(this).unsafe_cast_ref())
1636 }
1637 }
1638 unsafe {
1639 let f: Box_<F> = Box_::new(f);
1640 connect_raw(
1641 self.as_ptr() as *mut _,
1642 c"notify::selectable".as_ptr(),
1643 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1644 notify_selectable_trampoline::<Self, F> as *const (),
1645 )),
1646 Box_::into_raw(f),
1647 )
1648 }
1649 }
1650}
1651
1652impl<O: IsA<ListBoxRow>> ListBoxRowExt for O {}