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