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