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