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