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