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