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 /// The ::drag-data-received signal is emitted on the drop site when the
501 /// dragged data has been received. If the data was received in order to
502 /// determine whether the drop will be accepted, the handler is expected
503 /// to call `gdk_drag_status()` and not finish the drag.
504 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
505 /// (and this is the last target to be received), the handler for this
506 /// signal is expected to process the received data and then call
507 /// `gtk_drag_finish()`, setting the `success` parameter depending on
508 /// whether the data was processed successfully.
509 ///
510 /// Applications must create some means to determine why the signal was emitted
511 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
512 ///
513 /// The handler may inspect the selected action with
514 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
515 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
516 /// shown in the following example:
517 ///
518 ///
519 /// **⚠️ The following code is in C ⚠️**
520 ///
521 /// ```C
522 /// void
523 /// drag_data_received (GtkWidget *widget,
524 /// GdkDragContext *context,
525 /// gint x,
526 /// gint y,
527 /// GtkSelectionData *data,
528 /// guint info,
529 /// guint time)
530 /// {
531 /// if ((data->length >= 0) && (data->format == 8))
532 /// {
533 /// GdkDragAction action;
534 ///
535 /// // handle data here
536 ///
537 /// action = gdk_drag_context_get_selected_action (context);
538 /// if (action == GDK_ACTION_ASK)
539 /// {
540 /// GtkWidget *dialog;
541 /// gint response;
542 ///
543 /// dialog = gtk_message_dialog_new (NULL,
544 /// GTK_DIALOG_MODAL |
545 /// GTK_DIALOG_DESTROY_WITH_PARENT,
546 /// GTK_MESSAGE_INFO,
547 /// GTK_BUTTONS_YES_NO,
548 /// "Move the data ?\n");
549 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
550 /// gtk_widget_destroy (dialog);
551 ///
552 /// if (response == GTK_RESPONSE_YES)
553 /// action = GDK_ACTION_MOVE;
554 /// else
555 /// action = GDK_ACTION_COPY;
556 /// }
557 ///
558 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
559 /// }
560 /// else
561 /// gtk_drag_finish (context, FALSE, FALSE, time);
562 /// }
563 /// ```
564 ///
565 ///
566 ///
567 ///
568 /// #### `drag-drop`
569 /// The ::drag-drop signal is emitted on the drop site when the user drops
570 /// the data onto the widget. The signal handler must determine whether
571 /// the cursor position is in a drop zone or not. If it is not in a drop
572 /// zone, it returns [`false`] and no further processing is necessary.
573 /// Otherwise, the handler returns [`true`]. In this case, the handler must
574 /// ensure that `gtk_drag_finish()` is called to let the source know that
575 /// the drop is done. The call to `gtk_drag_finish()` can be done either
576 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
577 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
578 /// or more of the supported targets.
579 ///
580 ///
581 ///
582 ///
583 /// #### `drag-end`
584 /// The ::drag-end signal is emitted on the drag source when a drag is
585 /// finished. A typical reason to connect to this signal is to undo
586 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
587 ///
588 ///
589 ///
590 ///
591 /// #### `drag-failed`
592 /// The ::drag-failed signal is emitted on the drag source when a drag has
593 /// failed. The signal handler may hook custom code to handle a failed DnD
594 /// operation based on the type of error, it returns [`true`] is the failure has
595 /// been already handled (not showing the default "drag operation failed"
596 /// animation), otherwise it returns [`false`].
597 ///
598 ///
599 ///
600 ///
601 /// #### `drag-leave`
602 /// The ::drag-leave signal is emitted on the drop site when the cursor
603 /// leaves the widget. A typical reason to connect to this signal is to
604 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
605 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
606 ///
607 ///
608 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
609 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
610 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
611 ///
612 ///
613 ///
614 ///
615 /// #### `drag-motion`
616 /// The ::drag-motion signal is emitted on the drop site when the user
617 /// moves the cursor over the widget during a drag. The signal handler
618 /// must determine whether the cursor position is in a drop zone or not.
619 /// If it is not in a drop zone, it returns [`false`] and no further processing
620 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
621 /// handler is responsible for providing the necessary information for
622 /// displaying feedback to the user, by calling `gdk_drag_status()`.
623 ///
624 /// If the decision whether the drop will be accepted or rejected can't be
625 /// made based solely on the cursor position and the type of the data, the
626 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
627 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
628 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
629 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
630 /// when using the drag-motion signal that way.
631 ///
632 /// Also note that there is no drag-enter signal. The drag receiver has to
633 /// keep track of whether he has received any drag-motion signals since the
634 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
635 /// an "enter" signal. Upon an "enter", the handler will typically highlight
636 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
637 ///
638 ///
639 /// **⚠️ The following code is in C ⚠️**
640 ///
641 /// ```C
642 /// static void
643 /// drag_motion (GtkWidget *widget,
644 /// GdkDragContext *context,
645 /// gint x,
646 /// gint y,
647 /// guint time)
648 /// {
649 /// GdkAtom target;
650 ///
651 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
652 ///
653 /// if (!private_data->drag_highlight)
654 /// {
655 /// private_data->drag_highlight = 1;
656 /// gtk_drag_highlight (widget);
657 /// }
658 ///
659 /// target = gtk_drag_dest_find_target (widget, context, NULL);
660 /// if (target == GDK_NONE)
661 /// gdk_drag_status (context, 0, time);
662 /// else
663 /// {
664 /// private_data->pending_status
665 /// = gdk_drag_context_get_suggested_action (context);
666 /// gtk_drag_get_data (widget, context, target, time);
667 /// }
668 ///
669 /// return TRUE;
670 /// }
671 ///
672 /// static void
673 /// drag_data_received (GtkWidget *widget,
674 /// GdkDragContext *context,
675 /// gint x,
676 /// gint y,
677 /// GtkSelectionData *selection_data,
678 /// guint info,
679 /// guint time)
680 /// {
681 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
682 ///
683 /// if (private_data->suggested_action)
684 /// {
685 /// private_data->suggested_action = 0;
686 ///
687 /// // We are getting this data due to a request in drag_motion,
688 /// // rather than due to a request in drag_drop, so we are just
689 /// // supposed to call gdk_drag_status(), not actually paste in
690 /// // the data.
691 ///
692 /// str = gtk_selection_data_get_text (selection_data);
693 /// if (!data_is_acceptable (str))
694 /// gdk_drag_status (context, 0, time);
695 /// else
696 /// gdk_drag_status (context,
697 /// private_data->suggested_action,
698 /// time);
699 /// }
700 /// else
701 /// {
702 /// // accept the drop
703 /// }
704 /// }
705 /// ```
706 ///
707 ///
708 ///
709 ///
710 /// #### `draw`
711 /// This signal is emitted when a widget is supposed to render itself.
712 /// The `widget`'s top left corner must be painted at the origin of
713 /// the passed in context and be sized to the values returned by
714 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
715 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
716 ///
717 /// Signal handlers connected to this signal can modify the cairo
718 /// context passed as `cr` in any way they like and don't need to
719 /// restore it. The signal emission takes care of calling `cairo_save()`
720 /// before and `cairo_restore()` after invoking the handler.
721 ///
722 /// The signal handler will get a `cr` with a clip region already set to the
723 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
724 /// widgets that want to avoid redrawing themselves completely can get the full
725 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
726 /// get a finer-grained representation of the dirty region with
727 /// `cairo_copy_clip_rectangle_list()`.
728 ///
729 ///
730 ///
731 ///
732 /// #### `enter-notify-event`
733 /// The ::enter-notify-event will be emitted when the pointer enters
734 /// the `widget`'s window.
735 ///
736 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
737 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
738 ///
739 /// This signal will be sent to the grab widget if there is one.
740 ///
741 ///
742 ///
743 ///
744 /// #### `event`
745 /// The GTK+ main loop will emit three signals for each GDK event delivered
746 /// to a widget: one generic ::event signal, another, more specific,
747 /// signal that matches the type of event delivered (e.g.
748 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
749 /// [`event-after`][struct@crate::Widget#event-after] signal.
750 ///
751 ///
752 ///
753 ///
754 /// #### `event-after`
755 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
756 /// the second more specific signal, ::event-after will be emitted
757 /// regardless of the previous two signals handlers return values.
758 ///
759 ///
760 ///
761 ///
762 /// #### `focus`
763 ///
764 ///
765 ///
766 /// #### `focus-in-event`
767 /// The ::focus-in-event signal will be emitted when the keyboard focus
768 /// enters the `widget`'s window.
769 ///
770 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
771 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
772 ///
773 ///
774 ///
775 ///
776 /// #### `focus-out-event`
777 /// The ::focus-out-event signal will be emitted when the keyboard focus
778 /// leaves the `widget`'s window.
779 ///
780 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
781 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
782 ///
783 ///
784 ///
785 ///
786 /// #### `grab-broken-event`
787 /// Emitted when a pointer or keyboard grab on a window belonging
788 /// to `widget` gets broken.
789 ///
790 /// On X11, this happens when the grab window becomes unviewable
791 /// (i.e. it or one of its ancestors is unmapped), or if the same
792 /// application grabs the pointer or keyboard again.
793 ///
794 ///
795 ///
796 ///
797 /// #### `grab-focus`
798 /// Action
799 ///
800 ///
801 /// #### `grab-notify`
802 /// The ::grab-notify signal is emitted when a widget becomes
803 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
804 /// another widget, or when it becomes unshadowed due to a grab
805 /// being removed.
806 ///
807 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
808 /// grab widget in the grab stack of its window group is not
809 /// its ancestor.
810 ///
811 ///
812 ///
813 ///
814 /// #### `hide`
815 /// The ::hide signal is emitted when `widget` is hidden, for example with
816 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
817 ///
818 ///
819 ///
820 ///
821 /// #### `hierarchy-changed`
822 /// The ::hierarchy-changed signal is emitted when the
823 /// anchored state of a widget changes. A widget is
824 /// “anchored” when its toplevel
825 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
826 /// a widget changes from un-anchored to anchored or vice-versa.
827 ///
828 ///
829 ///
830 ///
831 /// #### `key-press-event`
832 /// The ::key-press-event signal is emitted when a key is pressed. The signal
833 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
834 ///
835 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
836 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
837 ///
838 /// This signal will be sent to the grab widget if there is one.
839 ///
840 ///
841 ///
842 ///
843 /// #### `key-release-event`
844 /// The ::key-release-event signal is emitted when a key is released.
845 ///
846 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
847 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
848 ///
849 /// This signal will be sent to the grab widget if there is one.
850 ///
851 ///
852 ///
853 ///
854 /// #### `keynav-failed`
855 /// Gets emitted if keyboard navigation fails.
856 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
857 ///
858 ///
859 ///
860 ///
861 /// #### `leave-notify-event`
862 /// The ::leave-notify-event will be emitted when the pointer leaves
863 /// the `widget`'s window.
864 ///
865 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
866 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
867 ///
868 /// This signal will be sent to the grab widget if there is one.
869 ///
870 ///
871 ///
872 ///
873 /// #### `map`
874 /// The ::map signal is emitted when `widget` is going to be mapped, that is
875 /// when the widget is visible (which is controlled with
876 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
877 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
878 /// be emitted.
879 ///
880 /// The ::map signal can be used to determine whether a widget will be drawn,
881 /// for instance it can resume an animation that was stopped during the
882 /// emission of [`unmap`][struct@crate::Widget#unmap].
883 ///
884 ///
885 ///
886 ///
887 /// #### `map-event`
888 /// The ::map-event signal will be emitted when the `widget`'s window is
889 /// mapped. A window is mapped when it becomes visible on the screen.
890 ///
891 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
892 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
893 /// automatically for all new windows.
894 ///
895 ///
896 ///
897 ///
898 /// #### `mnemonic-activate`
899 /// The default handler for this signal activates `widget` if `group_cycling`
900 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
901 ///
902 ///
903 ///
904 ///
905 /// #### `motion-notify-event`
906 /// The ::motion-notify-event signal is emitted when the pointer moves
907 /// over the widget's [`gdk::Window`][crate::gdk::Window].
908 ///
909 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
910 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
911 ///
912 /// This signal will be sent to the grab widget if there is one.
913 ///
914 ///
915 ///
916 ///
917 /// #### `move-focus`
918 /// Action
919 ///
920 ///
921 /// #### `parent-set`
922 /// The ::parent-set signal is emitted when a new parent
923 /// has been set on a widget.
924 ///
925 ///
926 ///
927 ///
928 /// #### `popup-menu`
929 /// This signal gets emitted whenever a widget should pop up a context
930 /// menu. This usually happens through the standard key binding mechanism;
931 /// by pressing a certain key while a widget is focused, the user can cause
932 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
933 /// a menu with clipboard commands. See the
934 /// [Popup Menu Migration Checklist][checklist-popup-menu]
935 /// for an example of how to use this signal.
936 ///
937 /// Action
938 ///
939 ///
940 /// #### `property-notify-event`
941 /// The ::property-notify-event signal will be emitted when a property on
942 /// the `widget`'s window has been changed or deleted.
943 ///
944 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
945 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
946 ///
947 ///
948 ///
949 ///
950 /// #### `proximity-in-event`
951 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
952 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
953 ///
954 /// This signal will be sent to the grab widget if there is one.
955 ///
956 ///
957 ///
958 ///
959 /// #### `proximity-out-event`
960 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
961 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
962 ///
963 /// This signal will be sent to the grab widget if there is one.
964 ///
965 ///
966 ///
967 ///
968 /// #### `query-tooltip`
969 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
970 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
971 /// focus in keyboard mode.
972 ///
973 /// Using the given coordinates, the signal handler should determine
974 /// whether a tooltip should be shown for `widget`. If this is the case
975 /// [`true`] should be returned, [`false`] otherwise. Note that if
976 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
977 /// should not be used.
978 ///
979 /// The signal handler is free to manipulate `tooltip` with the therefore
980 /// destined function calls.
981 ///
982 ///
983 ///
984 ///
985 /// #### `realize`
986 /// The ::realize signal is emitted when `widget` is associated with a
987 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
988 /// widget has been mapped (that is, it is going to be drawn).
989 ///
990 ///
991 ///
992 ///
993 /// #### `screen-changed`
994 /// The ::screen-changed signal gets emitted when the
995 /// screen of a widget has changed.
996 ///
997 ///
998 ///
999 ///
1000 /// #### `scroll-event`
1001 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1002 /// range is pressed. Wheel mice are usually configured to generate
1003 /// button press events for buttons 4 and 5 when the wheel is turned.
1004 ///
1005 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1006 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1007 ///
1008 /// This signal will be sent to the grab widget if there is one.
1009 ///
1010 ///
1011 ///
1012 ///
1013 /// #### `selection-clear-event`
1014 /// The ::selection-clear-event signal will be emitted when the
1015 /// the `widget`'s window has lost ownership of a selection.
1016 ///
1017 ///
1018 ///
1019 ///
1020 /// #### `selection-get`
1021 ///
1022 ///
1023 ///
1024 /// #### `selection-notify-event`
1025 ///
1026 ///
1027 ///
1028 /// #### `selection-received`
1029 ///
1030 ///
1031 ///
1032 /// #### `selection-request-event`
1033 /// The ::selection-request-event signal will be emitted when
1034 /// another client requests ownership of the selection owned by
1035 /// the `widget`'s window.
1036 ///
1037 ///
1038 ///
1039 ///
1040 /// #### `show`
1041 /// The ::show signal is emitted when `widget` is shown, for example with
1042 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1043 ///
1044 ///
1045 ///
1046 ///
1047 /// #### `show-help`
1048 /// Action
1049 ///
1050 ///
1051 /// #### `size-allocate`
1052 ///
1053 ///
1054 ///
1055 /// #### `state-changed`
1056 /// The ::state-changed signal is emitted when the widget state changes.
1057 /// See `gtk_widget_get_state()`.
1058 ///
1059 ///
1060 ///
1061 ///
1062 /// #### `state-flags-changed`
1063 /// The ::state-flags-changed signal is emitted when the widget state
1064 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1065 ///
1066 ///
1067 ///
1068 ///
1069 /// #### `style-set`
1070 /// The ::style-set signal is emitted when a new style has been set
1071 /// on a widget. Note that style-modifying functions like
1072 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1073 ///
1074 /// Note that this signal is emitted for changes to the deprecated
1075 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1076 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1077 ///
1078 ///
1079 ///
1080 ///
1081 /// #### `style-updated`
1082 /// The ::style-updated signal is a convenience signal that is emitted when the
1083 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1084 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1085 ///
1086 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1087 /// cause this signal to be emitted.
1088 ///
1089 ///
1090 ///
1091 ///
1092 /// #### `touch-event`
1093 ///
1094 ///
1095 ///
1096 /// #### `unmap`
1097 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1098 /// means that either it or any of its parents up to the toplevel widget have
1099 /// been set as hidden.
1100 ///
1101 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1102 /// used to, for example, stop an animation on the widget.
1103 ///
1104 ///
1105 ///
1106 ///
1107 /// #### `unmap-event`
1108 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1109 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1110 ///
1111 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1112 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1113 /// automatically for all new windows.
1114 ///
1115 ///
1116 ///
1117 ///
1118 /// #### `unrealize`
1119 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1120 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1121 /// called or the widget has been unmapped (that is, it is going to be
1122 /// hidden).
1123 ///
1124 ///
1125 ///
1126 ///
1127 /// #### `visibility-notify-event`
1128 /// The ::visibility-notify-event will be emitted when the `widget`'s
1129 /// window is obscured or unobscured.
1130 ///
1131 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1132 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1133 ///
1134 ///
1135 ///
1136 ///
1137 /// #### `window-state-event`
1138 /// The ::window-state-event will be emitted when the state of the
1139 /// toplevel window associated to the `widget` changes.
1140 ///
1141 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1142 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1143 /// this mask automatically for all new windows.
1144 ///
1145 ///
1146 /// </details>
1147 ///
1148 /// # Implements
1149 ///
1150 /// [`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]
1151 #[doc(alias = "GtkListBoxRow")]
1152 pub struct ListBoxRow(Object<ffi::GtkListBoxRow, ffi::GtkListBoxRowClass>) @extends Bin, Container, Widget, @implements Buildable, Actionable;
1153
1154 match fn {
1155 type_ => || ffi::gtk_list_box_row_get_type(),
1156 }
1157}
1158
1159impl ListBoxRow {
1160 pub const NONE: Option<&'static ListBoxRow> = None;
1161
1162 /// Creates a new [`ListBoxRow`][crate::ListBoxRow], to be used as a child of a [`ListBox`][crate::ListBox].
1163 ///
1164 /// # Returns
1165 ///
1166 /// a new [`ListBoxRow`][crate::ListBoxRow]
1167 #[doc(alias = "gtk_list_box_row_new")]
1168 pub fn new() -> ListBoxRow {
1169 assert_initialized_main_thread!();
1170 unsafe { Widget::from_glib_none(ffi::gtk_list_box_row_new()).unsafe_cast() }
1171 }
1172
1173 // rustdoc-stripper-ignore-next
1174 /// Creates a new builder-pattern struct instance to construct [`ListBoxRow`] objects.
1175 ///
1176 /// This method returns an instance of [`ListBoxRowBuilder`](crate::builders::ListBoxRowBuilder) which can be used to create [`ListBoxRow`] objects.
1177 pub fn builder() -> ListBoxRowBuilder {
1178 ListBoxRowBuilder::new()
1179 }
1180}
1181
1182impl Default for ListBoxRow {
1183 fn default() -> Self {
1184 Self::new()
1185 }
1186}
1187
1188// rustdoc-stripper-ignore-next
1189/// A [builder-pattern] type to construct [`ListBoxRow`] objects.
1190///
1191/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1192#[must_use = "The builder must be built to be used"]
1193pub struct ListBoxRowBuilder {
1194 builder: glib::object::ObjectBuilder<'static, ListBoxRow>,
1195}
1196
1197impl ListBoxRowBuilder {
1198 fn new() -> Self {
1199 Self {
1200 builder: glib::object::Object::builder(),
1201 }
1202 }
1203
1204 /// The property determines whether the [`row-activated`][struct@crate::ListBox#row-activated]
1205 /// signal will be emitted for this row.
1206 pub fn activatable(self, activatable: bool) -> Self {
1207 Self {
1208 builder: self.builder.property("activatable", activatable),
1209 }
1210 }
1211
1212 /// The property determines whether this row can be selected.
1213 pub fn selectable(self, selectable: bool) -> Self {
1214 Self {
1215 builder: self.builder.property("selectable", selectable),
1216 }
1217 }
1218
1219 pub fn border_width(self, border_width: u32) -> Self {
1220 Self {
1221 builder: self.builder.property("border-width", border_width),
1222 }
1223 }
1224
1225 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1226 Self {
1227 builder: self.builder.property("child", child.clone().upcast()),
1228 }
1229 }
1230
1231 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1232 Self {
1233 builder: self.builder.property("resize-mode", resize_mode),
1234 }
1235 }
1236
1237 pub fn app_paintable(self, app_paintable: bool) -> Self {
1238 Self {
1239 builder: self.builder.property("app-paintable", app_paintable),
1240 }
1241 }
1242
1243 pub fn can_default(self, can_default: bool) -> Self {
1244 Self {
1245 builder: self.builder.property("can-default", can_default),
1246 }
1247 }
1248
1249 pub fn can_focus(self, can_focus: bool) -> Self {
1250 Self {
1251 builder: self.builder.property("can-focus", can_focus),
1252 }
1253 }
1254
1255 pub fn events(self, events: gdk::EventMask) -> Self {
1256 Self {
1257 builder: self.builder.property("events", events),
1258 }
1259 }
1260
1261 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1262 pub fn expand(self, expand: bool) -> Self {
1263 Self {
1264 builder: self.builder.property("expand", expand),
1265 }
1266 }
1267
1268 /// Whether the widget should grab focus when it is clicked with the mouse.
1269 ///
1270 /// This property is only relevant for widgets that can take focus.
1271 ///
1272 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1273 /// GtkComboBox) implemented this property individually.
1274 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1275 Self {
1276 builder: self.builder.property("focus-on-click", focus_on_click),
1277 }
1278 }
1279
1280 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1281 pub fn halign(self, halign: Align) -> Self {
1282 Self {
1283 builder: self.builder.property("halign", halign),
1284 }
1285 }
1286
1287 pub fn has_default(self, has_default: bool) -> Self {
1288 Self {
1289 builder: self.builder.property("has-default", has_default),
1290 }
1291 }
1292
1293 pub fn has_focus(self, has_focus: bool) -> Self {
1294 Self {
1295 builder: self.builder.property("has-focus", has_focus),
1296 }
1297 }
1298
1299 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1300 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1301 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1302 /// whether it will provide a tooltip or not.
1303 ///
1304 /// Note that setting this property to [`true`] for the first time will change
1305 /// the event masks of the GdkWindows of this widget to include leave-notify
1306 /// and motion-notify events. This cannot and will not be undone when the
1307 /// property is set to [`false`] again.
1308 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1309 Self {
1310 builder: self.builder.property("has-tooltip", has_tooltip),
1311 }
1312 }
1313
1314 pub fn height_request(self, height_request: i32) -> Self {
1315 Self {
1316 builder: self.builder.property("height-request", height_request),
1317 }
1318 }
1319
1320 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1321 pub fn hexpand(self, hexpand: bool) -> Self {
1322 Self {
1323 builder: self.builder.property("hexpand", hexpand),
1324 }
1325 }
1326
1327 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1328 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1329 Self {
1330 builder: self.builder.property("hexpand-set", hexpand_set),
1331 }
1332 }
1333
1334 pub fn is_focus(self, is_focus: bool) -> Self {
1335 Self {
1336 builder: self.builder.property("is-focus", is_focus),
1337 }
1338 }
1339
1340 /// Sets all four sides' margin at once. If read, returns max
1341 /// margin on any side.
1342 pub fn margin(self, margin: i32) -> Self {
1343 Self {
1344 builder: self.builder.property("margin", margin),
1345 }
1346 }
1347
1348 /// Margin on bottom side of widget.
1349 ///
1350 /// This property adds margin outside of the widget's normal size
1351 /// request, the margin will be added in addition to the size from
1352 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1353 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1354 Self {
1355 builder: self.builder.property("margin-bottom", margin_bottom),
1356 }
1357 }
1358
1359 /// Margin on end of widget, horizontally. This property supports
1360 /// left-to-right and right-to-left text directions.
1361 ///
1362 /// This property adds margin outside of the widget's normal size
1363 /// request, the margin will be added in addition to the size from
1364 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1365 pub fn margin_end(self, margin_end: i32) -> Self {
1366 Self {
1367 builder: self.builder.property("margin-end", margin_end),
1368 }
1369 }
1370
1371 /// Margin on start of widget, horizontally. This property supports
1372 /// left-to-right and right-to-left text directions.
1373 ///
1374 /// This property adds margin outside of the widget's normal size
1375 /// request, the margin will be added in addition to the size from
1376 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1377 pub fn margin_start(self, margin_start: i32) -> Self {
1378 Self {
1379 builder: self.builder.property("margin-start", margin_start),
1380 }
1381 }
1382
1383 /// Margin on top side of widget.
1384 ///
1385 /// This property adds margin outside of the widget's normal size
1386 /// request, the margin will be added in addition to the size from
1387 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1388 pub fn margin_top(self, margin_top: i32) -> Self {
1389 Self {
1390 builder: self.builder.property("margin-top", margin_top),
1391 }
1392 }
1393
1394 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1395 Self {
1396 builder: self.builder.property("name", name.into()),
1397 }
1398 }
1399
1400 pub fn no_show_all(self, no_show_all: bool) -> Self {
1401 Self {
1402 builder: self.builder.property("no-show-all", no_show_all),
1403 }
1404 }
1405
1406 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1407 /// more details about window opacity.
1408 ///
1409 /// Before 3.8 this was only available in GtkWindow
1410 pub fn opacity(self, opacity: f64) -> Self {
1411 Self {
1412 builder: self.builder.property("opacity", opacity),
1413 }
1414 }
1415
1416 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1417 Self {
1418 builder: self.builder.property("parent", parent.clone().upcast()),
1419 }
1420 }
1421
1422 pub fn receives_default(self, receives_default: bool) -> Self {
1423 Self {
1424 builder: self.builder.property("receives-default", receives_default),
1425 }
1426 }
1427
1428 pub fn sensitive(self, sensitive: bool) -> Self {
1429 Self {
1430 builder: self.builder.property("sensitive", sensitive),
1431 }
1432 }
1433
1434 /// Sets the text of tooltip to be the given string, which is marked up
1435 /// with the [Pango text markup language][PangoMarkupFormat].
1436 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1437 ///
1438 /// This is a convenience property which will take care of getting the
1439 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1440 /// will automatically be set to [`true`] and there will be taken care of
1441 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1442 ///
1443 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1444 /// are set, the last one wins.
1445 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1446 Self {
1447 builder: self
1448 .builder
1449 .property("tooltip-markup", tooltip_markup.into()),
1450 }
1451 }
1452
1453 /// Sets the text of tooltip to be the given string.
1454 ///
1455 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1456 ///
1457 /// This is a convenience property which will take care of getting the
1458 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1459 /// will automatically be set to [`true`] and there will be taken care of
1460 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1461 ///
1462 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1463 /// are set, the last one wins.
1464 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1465 Self {
1466 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1467 }
1468 }
1469
1470 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1471 pub fn valign(self, valign: Align) -> Self {
1472 Self {
1473 builder: self.builder.property("valign", valign),
1474 }
1475 }
1476
1477 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1478 pub fn vexpand(self, vexpand: bool) -> Self {
1479 Self {
1480 builder: self.builder.property("vexpand", vexpand),
1481 }
1482 }
1483
1484 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1485 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1486 Self {
1487 builder: self.builder.property("vexpand-set", vexpand_set),
1488 }
1489 }
1490
1491 pub fn visible(self, visible: bool) -> Self {
1492 Self {
1493 builder: self.builder.property("visible", visible),
1494 }
1495 }
1496
1497 pub fn width_request(self, width_request: i32) -> Self {
1498 Self {
1499 builder: self.builder.property("width-request", width_request),
1500 }
1501 }
1502
1503 pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
1504 Self {
1505 builder: self.builder.property("action-name", action_name.into()),
1506 }
1507 }
1508
1509 pub fn action_target(self, action_target: &glib::Variant) -> Self {
1510 Self {
1511 builder: self
1512 .builder
1513 .property("action-target", action_target.clone()),
1514 }
1515 }
1516
1517 // rustdoc-stripper-ignore-next
1518 /// Build the [`ListBoxRow`].
1519 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1520 pub fn build(self) -> ListBoxRow {
1521 assert_initialized_main_thread!();
1522 self.builder.build()
1523 }
1524}
1525
1526/// Trait containing all [`struct@ListBoxRow`] methods.
1527///
1528/// # Implementors
1529///
1530/// [`ListBoxRow`][struct@crate::ListBoxRow]
1531pub trait ListBoxRowExt: IsA<ListBoxRow> + 'static {
1532 /// Marks `self` as changed, causing any state that depends on this
1533 /// to be updated. This affects sorting, filtering and headers.
1534 ///
1535 /// Note that calls to this method must be in sync with the data
1536 /// used for the row functions. For instance, if the list is
1537 /// mirroring some external data set, and *two* rows changed in the
1538 /// external data set then when you call [`changed()`][Self::changed()]
1539 /// on the first row the sort function must only read the new data
1540 /// for the first of the two changed rows, otherwise the resorting
1541 /// of the rows will be wrong.
1542 ///
1543 /// This generally means that if you don’t fully control the data
1544 /// model you have to duplicate the data that affects the listbox
1545 /// row functions into the row widgets themselves. Another alternative
1546 /// is to call [`ListBoxExt::invalidate_sort()`][crate::prelude::ListBoxExt::invalidate_sort()] on any model change,
1547 /// but that is more expensive.
1548 #[doc(alias = "gtk_list_box_row_changed")]
1549 fn changed(&self) {
1550 unsafe {
1551 ffi::gtk_list_box_row_changed(self.as_ref().to_glib_none().0);
1552 }
1553 }
1554
1555 /// Gets the value of the [`activatable`][struct@crate::ListBoxRow#activatable] property
1556 /// for this row.
1557 ///
1558 /// # Returns
1559 ///
1560 /// [`true`] if the row is activatable
1561 #[doc(alias = "gtk_list_box_row_get_activatable")]
1562 #[doc(alias = "get_activatable")]
1563 #[doc(alias = "activatable")]
1564 fn is_activatable(&self) -> bool {
1565 unsafe {
1566 from_glib(ffi::gtk_list_box_row_get_activatable(
1567 self.as_ref().to_glib_none().0,
1568 ))
1569 }
1570 }
1571
1572 /// Returns the current header of the `self`. This can be used
1573 /// in a `GtkListBoxUpdateHeaderFunc` to see if there is a header
1574 /// set already, and if so to update the state of it.
1575 ///
1576 /// # Returns
1577 ///
1578 /// the current header, or [`None`] if none
1579 #[doc(alias = "gtk_list_box_row_get_header")]
1580 #[doc(alias = "get_header")]
1581 fn header(&self) -> Option<Widget> {
1582 unsafe {
1583 from_glib_none(ffi::gtk_list_box_row_get_header(
1584 self.as_ref().to_glib_none().0,
1585 ))
1586 }
1587 }
1588
1589 /// Gets the current index of the `self` in its [`ListBox`][crate::ListBox] container.
1590 ///
1591 /// # Returns
1592 ///
1593 /// the index of the `self`, or -1 if the `self` is not in a listbox
1594 #[doc(alias = "gtk_list_box_row_get_index")]
1595 #[doc(alias = "get_index")]
1596 fn index(&self) -> i32 {
1597 unsafe { ffi::gtk_list_box_row_get_index(self.as_ref().to_glib_none().0) }
1598 }
1599
1600 /// Gets the value of the [`selectable`][struct@crate::ListBoxRow#selectable] property
1601 /// for this row.
1602 ///
1603 /// # Returns
1604 ///
1605 /// [`true`] if the row is selectable
1606 #[doc(alias = "gtk_list_box_row_get_selectable")]
1607 #[doc(alias = "get_selectable")]
1608 #[doc(alias = "selectable")]
1609 fn is_selectable(&self) -> bool {
1610 unsafe {
1611 from_glib(ffi::gtk_list_box_row_get_selectable(
1612 self.as_ref().to_glib_none().0,
1613 ))
1614 }
1615 }
1616
1617 /// Returns whether the child is currently selected in its
1618 /// [`ListBox`][crate::ListBox] container.
1619 ///
1620 /// # Returns
1621 ///
1622 /// [`true`] if `self` is selected
1623 #[doc(alias = "gtk_list_box_row_is_selected")]
1624 fn is_selected(&self) -> bool {
1625 unsafe {
1626 from_glib(ffi::gtk_list_box_row_is_selected(
1627 self.as_ref().to_glib_none().0,
1628 ))
1629 }
1630 }
1631
1632 /// Set the [`activatable`][struct@crate::ListBoxRow#activatable] property for this row.
1633 /// ## `activatable`
1634 /// [`true`] to mark the row as activatable
1635 #[doc(alias = "gtk_list_box_row_set_activatable")]
1636 #[doc(alias = "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 #[doc(alias = "selectable")]
1666 fn set_selectable(&self, selectable: bool) {
1667 unsafe {
1668 ffi::gtk_list_box_row_set_selectable(
1669 self.as_ref().to_glib_none().0,
1670 selectable.into_glib(),
1671 );
1672 }
1673 }
1674
1675 /// This is a keybinding signal, which will cause this row to be activated.
1676 ///
1677 /// If you want to be notified when the user activates a row (by key or not),
1678 /// use the [`row-activated`][struct@crate::ListBox#row-activated] signal on the row’s parent [`ListBox`][crate::ListBox].
1679 #[doc(alias = "activate")]
1680 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1681 unsafe extern "C" fn activate_trampoline<P: IsA<ListBoxRow>, F: Fn(&P) + 'static>(
1682 this: *mut ffi::GtkListBoxRow,
1683 f: glib::ffi::gpointer,
1684 ) {
1685 unsafe {
1686 let f: &F = &*(f as *const F);
1687 f(ListBoxRow::from_glib_borrow(this).unsafe_cast_ref())
1688 }
1689 }
1690 unsafe {
1691 let f: Box_<F> = Box_::new(f);
1692 connect_raw(
1693 self.as_ptr() as *mut _,
1694 c"activate".as_ptr(),
1695 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1696 activate_trampoline::<Self, F> as *const (),
1697 )),
1698 Box_::into_raw(f),
1699 )
1700 }
1701 }
1702
1703 fn emit_activate(&self) {
1704 self.emit_by_name::<()>("activate", &[]);
1705 }
1706
1707 #[doc(alias = "activatable")]
1708 fn connect_activatable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1709 unsafe extern "C" fn notify_activatable_trampoline<
1710 P: IsA<ListBoxRow>,
1711 F: Fn(&P) + 'static,
1712 >(
1713 this: *mut ffi::GtkListBoxRow,
1714 _param_spec: glib::ffi::gpointer,
1715 f: glib::ffi::gpointer,
1716 ) {
1717 unsafe {
1718 let f: &F = &*(f as *const F);
1719 f(ListBoxRow::from_glib_borrow(this).unsafe_cast_ref())
1720 }
1721 }
1722 unsafe {
1723 let f: Box_<F> = Box_::new(f);
1724 connect_raw(
1725 self.as_ptr() as *mut _,
1726 c"notify::activatable".as_ptr(),
1727 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1728 notify_activatable_trampoline::<Self, F> as *const (),
1729 )),
1730 Box_::into_raw(f),
1731 )
1732 }
1733 }
1734
1735 #[doc(alias = "selectable")]
1736 fn connect_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1737 unsafe extern "C" fn notify_selectable_trampoline<
1738 P: IsA<ListBoxRow>,
1739 F: Fn(&P) + 'static,
1740 >(
1741 this: *mut ffi::GtkListBoxRow,
1742 _param_spec: glib::ffi::gpointer,
1743 f: glib::ffi::gpointer,
1744 ) {
1745 unsafe {
1746 let f: &F = &*(f as *const F);
1747 f(ListBoxRow::from_glib_borrow(this).unsafe_cast_ref())
1748 }
1749 }
1750 unsafe {
1751 let f: Box_<F> = Box_::new(f);
1752 connect_raw(
1753 self.as_ptr() as *mut _,
1754 c"notify::selectable".as_ptr(),
1755 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1756 notify_selectable_trampoline::<Self, F> as *const (),
1757 )),
1758 Box_::into_raw(f),
1759 )
1760 }
1761 }
1762}
1763
1764impl<O: IsA<ListBoxRow>> ListBoxRowExt for O {}