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 /// The ::drag-data-received signal is emitted on the drop site when the
543 /// dragged data has been received. If the data was received in order to
544 /// determine whether the drop will be accepted, the handler is expected
545 /// to call `gdk_drag_status()` and not finish the drag.
546 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
547 /// (and this is the last target to be received), the handler for this
548 /// signal is expected to process the received data and then call
549 /// `gtk_drag_finish()`, setting the `success` parameter depending on
550 /// whether the data was processed successfully.
551 ///
552 /// Applications must create some means to determine why the signal was emitted
553 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
554 ///
555 /// The handler may inspect the selected action with
556 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
557 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
558 /// shown in the following example:
559 ///
560 ///
561 /// **⚠️ The following code is in C ⚠️**
562 ///
563 /// ```C
564 /// void
565 /// drag_data_received (GtkWidget *widget,
566 /// GdkDragContext *context,
567 /// gint x,
568 /// gint y,
569 /// GtkSelectionData *data,
570 /// guint info,
571 /// guint time)
572 /// {
573 /// if ((data->length >= 0) && (data->format == 8))
574 /// {
575 /// GdkDragAction action;
576 ///
577 /// // handle data here
578 ///
579 /// action = gdk_drag_context_get_selected_action (context);
580 /// if (action == GDK_ACTION_ASK)
581 /// {
582 /// GtkWidget *dialog;
583 /// gint response;
584 ///
585 /// dialog = gtk_message_dialog_new (NULL,
586 /// GTK_DIALOG_MODAL |
587 /// GTK_DIALOG_DESTROY_WITH_PARENT,
588 /// GTK_MESSAGE_INFO,
589 /// GTK_BUTTONS_YES_NO,
590 /// "Move the data ?\n");
591 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
592 /// gtk_widget_destroy (dialog);
593 ///
594 /// if (response == GTK_RESPONSE_YES)
595 /// action = GDK_ACTION_MOVE;
596 /// else
597 /// action = GDK_ACTION_COPY;
598 /// }
599 ///
600 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
601 /// }
602 /// else
603 /// gtk_drag_finish (context, FALSE, FALSE, time);
604 /// }
605 /// ```
606 ///
607 ///
608 ///
609 ///
610 /// #### `drag-drop`
611 /// The ::drag-drop signal is emitted on the drop site when the user drops
612 /// the data onto the widget. The signal handler must determine whether
613 /// the cursor position is in a drop zone or not. If it is not in a drop
614 /// zone, it returns [`false`] and no further processing is necessary.
615 /// Otherwise, the handler returns [`true`]. In this case, the handler must
616 /// ensure that `gtk_drag_finish()` is called to let the source know that
617 /// the drop is done. The call to `gtk_drag_finish()` can be done either
618 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
619 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
620 /// or more of the supported targets.
621 ///
622 ///
623 ///
624 ///
625 /// #### `drag-end`
626 /// The ::drag-end signal is emitted on the drag source when a drag is
627 /// finished. A typical reason to connect to this signal is to undo
628 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
629 ///
630 ///
631 ///
632 ///
633 /// #### `drag-failed`
634 /// The ::drag-failed signal is emitted on the drag source when a drag has
635 /// failed. The signal handler may hook custom code to handle a failed DnD
636 /// operation based on the type of error, it returns [`true`] is the failure has
637 /// been already handled (not showing the default "drag operation failed"
638 /// animation), otherwise it returns [`false`].
639 ///
640 ///
641 ///
642 ///
643 /// #### `drag-leave`
644 /// The ::drag-leave signal is emitted on the drop site when the cursor
645 /// leaves the widget. A typical reason to connect to this signal is to
646 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
647 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
648 ///
649 ///
650 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
651 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
652 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
653 ///
654 ///
655 ///
656 ///
657 /// #### `drag-motion`
658 /// The ::drag-motion signal is emitted on the drop site when the user
659 /// moves the cursor over the widget during a drag. The signal handler
660 /// must determine whether the cursor position is in a drop zone or not.
661 /// If it is not in a drop zone, it returns [`false`] and no further processing
662 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
663 /// handler is responsible for providing the necessary information for
664 /// displaying feedback to the user, by calling `gdk_drag_status()`.
665 ///
666 /// If the decision whether the drop will be accepted or rejected can't be
667 /// made based solely on the cursor position and the type of the data, the
668 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
669 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
670 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
671 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
672 /// when using the drag-motion signal that way.
673 ///
674 /// Also note that there is no drag-enter signal. The drag receiver has to
675 /// keep track of whether he has received any drag-motion signals since the
676 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
677 /// an "enter" signal. Upon an "enter", the handler will typically highlight
678 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
679 ///
680 ///
681 /// **⚠️ The following code is in C ⚠️**
682 ///
683 /// ```C
684 /// static void
685 /// drag_motion (GtkWidget *widget,
686 /// GdkDragContext *context,
687 /// gint x,
688 /// gint y,
689 /// guint time)
690 /// {
691 /// GdkAtom target;
692 ///
693 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
694 ///
695 /// if (!private_data->drag_highlight)
696 /// {
697 /// private_data->drag_highlight = 1;
698 /// gtk_drag_highlight (widget);
699 /// }
700 ///
701 /// target = gtk_drag_dest_find_target (widget, context, NULL);
702 /// if (target == GDK_NONE)
703 /// gdk_drag_status (context, 0, time);
704 /// else
705 /// {
706 /// private_data->pending_status
707 /// = gdk_drag_context_get_suggested_action (context);
708 /// gtk_drag_get_data (widget, context, target, time);
709 /// }
710 ///
711 /// return TRUE;
712 /// }
713 ///
714 /// static void
715 /// drag_data_received (GtkWidget *widget,
716 /// GdkDragContext *context,
717 /// gint x,
718 /// gint y,
719 /// GtkSelectionData *selection_data,
720 /// guint info,
721 /// guint time)
722 /// {
723 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
724 ///
725 /// if (private_data->suggested_action)
726 /// {
727 /// private_data->suggested_action = 0;
728 ///
729 /// // We are getting this data due to a request in drag_motion,
730 /// // rather than due to a request in drag_drop, so we are just
731 /// // supposed to call gdk_drag_status(), not actually paste in
732 /// // the data.
733 ///
734 /// str = gtk_selection_data_get_text (selection_data);
735 /// if (!data_is_acceptable (str))
736 /// gdk_drag_status (context, 0, time);
737 /// else
738 /// gdk_drag_status (context,
739 /// private_data->suggested_action,
740 /// time);
741 /// }
742 /// else
743 /// {
744 /// // accept the drop
745 /// }
746 /// }
747 /// ```
748 ///
749 ///
750 ///
751 ///
752 /// #### `draw`
753 /// This signal is emitted when a widget is supposed to render itself.
754 /// The `widget`'s top left corner must be painted at the origin of
755 /// the passed in context and be sized to the values returned by
756 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
757 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
758 ///
759 /// Signal handlers connected to this signal can modify the cairo
760 /// context passed as `cr` in any way they like and don't need to
761 /// restore it. The signal emission takes care of calling `cairo_save()`
762 /// before and `cairo_restore()` after invoking the handler.
763 ///
764 /// The signal handler will get a `cr` with a clip region already set to the
765 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
766 /// widgets that want to avoid redrawing themselves completely can get the full
767 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
768 /// get a finer-grained representation of the dirty region with
769 /// `cairo_copy_clip_rectangle_list()`.
770 ///
771 ///
772 ///
773 ///
774 /// #### `enter-notify-event`
775 /// The ::enter-notify-event will be emitted when the pointer enters
776 /// the `widget`'s window.
777 ///
778 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
779 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
780 ///
781 /// This signal will be sent to the grab widget if there is one.
782 ///
783 ///
784 ///
785 ///
786 /// #### `event`
787 /// The GTK+ main loop will emit three signals for each GDK event delivered
788 /// to a widget: one generic ::event signal, another, more specific,
789 /// signal that matches the type of event delivered (e.g.
790 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
791 /// [`event-after`][struct@crate::Widget#event-after] signal.
792 ///
793 ///
794 ///
795 ///
796 /// #### `event-after`
797 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
798 /// the second more specific signal, ::event-after will be emitted
799 /// regardless of the previous two signals handlers return values.
800 ///
801 ///
802 ///
803 ///
804 /// #### `focus`
805 ///
806 ///
807 ///
808 /// #### `focus-in-event`
809 /// The ::focus-in-event signal will be emitted when the keyboard focus
810 /// enters the `widget`'s window.
811 ///
812 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
813 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
814 ///
815 ///
816 ///
817 ///
818 /// #### `focus-out-event`
819 /// The ::focus-out-event signal will be emitted when the keyboard focus
820 /// leaves the `widget`'s window.
821 ///
822 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
823 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
824 ///
825 ///
826 ///
827 ///
828 /// #### `grab-broken-event`
829 /// Emitted when a pointer or keyboard grab on a window belonging
830 /// to `widget` gets broken.
831 ///
832 /// On X11, this happens when the grab window becomes unviewable
833 /// (i.e. it or one of its ancestors is unmapped), or if the same
834 /// application grabs the pointer or keyboard again.
835 ///
836 ///
837 ///
838 ///
839 /// #### `grab-focus`
840 /// Action
841 ///
842 ///
843 /// #### `grab-notify`
844 /// The ::grab-notify signal is emitted when a widget becomes
845 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
846 /// another widget, or when it becomes unshadowed due to a grab
847 /// being removed.
848 ///
849 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
850 /// grab widget in the grab stack of its window group is not
851 /// its ancestor.
852 ///
853 ///
854 ///
855 ///
856 /// #### `hide`
857 /// The ::hide signal is emitted when `widget` is hidden, for example with
858 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
859 ///
860 ///
861 ///
862 ///
863 /// #### `hierarchy-changed`
864 /// The ::hierarchy-changed signal is emitted when the
865 /// anchored state of a widget changes. A widget is
866 /// “anchored” when its toplevel
867 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
868 /// a widget changes from un-anchored to anchored or vice-versa.
869 ///
870 ///
871 ///
872 ///
873 /// #### `key-press-event`
874 /// The ::key-press-event signal is emitted when a key is pressed. The signal
875 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
876 ///
877 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
878 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
879 ///
880 /// This signal will be sent to the grab widget if there is one.
881 ///
882 ///
883 ///
884 ///
885 /// #### `key-release-event`
886 /// The ::key-release-event signal is emitted when a key is released.
887 ///
888 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
889 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
890 ///
891 /// This signal will be sent to the grab widget if there is one.
892 ///
893 ///
894 ///
895 ///
896 /// #### `keynav-failed`
897 /// Gets emitted if keyboard navigation fails.
898 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
899 ///
900 ///
901 ///
902 ///
903 /// #### `leave-notify-event`
904 /// The ::leave-notify-event will be emitted when the pointer leaves
905 /// the `widget`'s window.
906 ///
907 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
908 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
909 ///
910 /// This signal will be sent to the grab widget if there is one.
911 ///
912 ///
913 ///
914 ///
915 /// #### `map`
916 /// The ::map signal is emitted when `widget` is going to be mapped, that is
917 /// when the widget is visible (which is controlled with
918 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
919 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
920 /// be emitted.
921 ///
922 /// The ::map signal can be used to determine whether a widget will be drawn,
923 /// for instance it can resume an animation that was stopped during the
924 /// emission of [`unmap`][struct@crate::Widget#unmap].
925 ///
926 ///
927 ///
928 ///
929 /// #### `map-event`
930 /// The ::map-event signal will be emitted when the `widget`'s window is
931 /// mapped. A window is mapped when it becomes visible on the screen.
932 ///
933 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
934 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
935 /// automatically for all new windows.
936 ///
937 ///
938 ///
939 ///
940 /// #### `mnemonic-activate`
941 /// The default handler for this signal activates `widget` if `group_cycling`
942 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
943 ///
944 ///
945 ///
946 ///
947 /// #### `motion-notify-event`
948 /// The ::motion-notify-event signal is emitted when the pointer moves
949 /// over the widget's [`gdk::Window`][crate::gdk::Window].
950 ///
951 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
952 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
953 ///
954 /// This signal will be sent to the grab widget if there is one.
955 ///
956 ///
957 ///
958 ///
959 /// #### `move-focus`
960 /// Action
961 ///
962 ///
963 /// #### `parent-set`
964 /// The ::parent-set signal is emitted when a new parent
965 /// has been set on a widget.
966 ///
967 ///
968 ///
969 ///
970 /// #### `popup-menu`
971 /// This signal gets emitted whenever a widget should pop up a context
972 /// menu. This usually happens through the standard key binding mechanism;
973 /// by pressing a certain key while a widget is focused, the user can cause
974 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
975 /// a menu with clipboard commands. See the
976 /// [Popup Menu Migration Checklist][checklist-popup-menu]
977 /// for an example of how to use this signal.
978 ///
979 /// Action
980 ///
981 ///
982 /// #### `property-notify-event`
983 /// The ::property-notify-event signal will be emitted when a property on
984 /// the `widget`'s window has been changed or deleted.
985 ///
986 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
987 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
988 ///
989 ///
990 ///
991 ///
992 /// #### `proximity-in-event`
993 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
994 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
995 ///
996 /// This signal will be sent to the grab widget if there is one.
997 ///
998 ///
999 ///
1000 ///
1001 /// #### `proximity-out-event`
1002 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1003 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1004 ///
1005 /// This signal will be sent to the grab widget if there is one.
1006 ///
1007 ///
1008 ///
1009 ///
1010 /// #### `query-tooltip`
1011 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1012 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1013 /// focus in keyboard mode.
1014 ///
1015 /// Using the given coordinates, the signal handler should determine
1016 /// whether a tooltip should be shown for `widget`. If this is the case
1017 /// [`true`] should be returned, [`false`] otherwise. Note that if
1018 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1019 /// should not be used.
1020 ///
1021 /// The signal handler is free to manipulate `tooltip` with the therefore
1022 /// destined function calls.
1023 ///
1024 ///
1025 ///
1026 ///
1027 /// #### `realize`
1028 /// The ::realize signal is emitted when `widget` is associated with a
1029 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1030 /// widget has been mapped (that is, it is going to be drawn).
1031 ///
1032 ///
1033 ///
1034 ///
1035 /// #### `screen-changed`
1036 /// The ::screen-changed signal gets emitted when the
1037 /// screen of a widget has changed.
1038 ///
1039 ///
1040 ///
1041 ///
1042 /// #### `scroll-event`
1043 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1044 /// range is pressed. Wheel mice are usually configured to generate
1045 /// button press events for buttons 4 and 5 when the wheel is turned.
1046 ///
1047 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1048 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1049 ///
1050 /// This signal will be sent to the grab widget if there is one.
1051 ///
1052 ///
1053 ///
1054 ///
1055 /// #### `selection-clear-event`
1056 /// The ::selection-clear-event signal will be emitted when the
1057 /// the `widget`'s window has lost ownership of a selection.
1058 ///
1059 ///
1060 ///
1061 ///
1062 /// #### `selection-get`
1063 ///
1064 ///
1065 ///
1066 /// #### `selection-notify-event`
1067 ///
1068 ///
1069 ///
1070 /// #### `selection-received`
1071 ///
1072 ///
1073 ///
1074 /// #### `selection-request-event`
1075 /// The ::selection-request-event signal will be emitted when
1076 /// another client requests ownership of the selection owned by
1077 /// the `widget`'s window.
1078 ///
1079 ///
1080 ///
1081 ///
1082 /// #### `show`
1083 /// The ::show signal is emitted when `widget` is shown, for example with
1084 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1085 ///
1086 ///
1087 ///
1088 ///
1089 /// #### `show-help`
1090 /// Action
1091 ///
1092 ///
1093 /// #### `size-allocate`
1094 ///
1095 ///
1096 ///
1097 /// #### `state-changed`
1098 /// The ::state-changed signal is emitted when the widget state changes.
1099 /// See `gtk_widget_get_state()`.
1100 ///
1101 ///
1102 ///
1103 ///
1104 /// #### `state-flags-changed`
1105 /// The ::state-flags-changed signal is emitted when the widget state
1106 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1107 ///
1108 ///
1109 ///
1110 ///
1111 /// #### `style-set`
1112 /// The ::style-set signal is emitted when a new style has been set
1113 /// on a widget. Note that style-modifying functions like
1114 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1115 ///
1116 /// Note that this signal is emitted for changes to the deprecated
1117 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1118 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1119 ///
1120 ///
1121 ///
1122 ///
1123 /// #### `style-updated`
1124 /// The ::style-updated signal is a convenience signal that is emitted when the
1125 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1126 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1127 ///
1128 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1129 /// cause this signal to be emitted.
1130 ///
1131 ///
1132 ///
1133 ///
1134 /// #### `touch-event`
1135 ///
1136 ///
1137 ///
1138 /// #### `unmap`
1139 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1140 /// means that either it or any of its parents up to the toplevel widget have
1141 /// been set as hidden.
1142 ///
1143 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1144 /// used to, for example, stop an animation on the widget.
1145 ///
1146 ///
1147 ///
1148 ///
1149 /// #### `unmap-event`
1150 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1151 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1152 ///
1153 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1154 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1155 /// automatically for all new windows.
1156 ///
1157 ///
1158 ///
1159 ///
1160 /// #### `unrealize`
1161 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1162 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1163 /// called or the widget has been unmapped (that is, it is going to be
1164 /// hidden).
1165 ///
1166 ///
1167 ///
1168 ///
1169 /// #### `visibility-notify-event`
1170 /// The ::visibility-notify-event will be emitted when the `widget`'s
1171 /// window is obscured or unobscured.
1172 ///
1173 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1174 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1175 ///
1176 ///
1177 ///
1178 ///
1179 /// #### `window-state-event`
1180 /// The ::window-state-event will be emitted when the state of the
1181 /// toplevel window associated to the `widget` changes.
1182 ///
1183 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1184 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1185 /// this mask automatically for all new windows.
1186 ///
1187 ///
1188 /// </details>
1189 ///
1190 /// # Implements
1191 ///
1192 /// [`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]
1193 #[doc(alias = "GtkShortcutsSection")]
1194 pub struct ShortcutsSection(Object<ffi::GtkShortcutsSection, ffi::GtkShortcutsSectionClass>) @extends Box, Container, Widget, @implements Buildable, Orientable;
1195
1196 match fn {
1197 type_ => || ffi::gtk_shortcuts_section_get_type(),
1198 }
1199}
1200
1201impl ShortcutsSection {
1202 // rustdoc-stripper-ignore-next
1203 /// Creates a new builder-pattern struct instance to construct [`ShortcutsSection`] objects.
1204 ///
1205 /// This method returns an instance of [`ShortcutsSectionBuilder`](crate::builders::ShortcutsSectionBuilder) which can be used to create [`ShortcutsSection`] objects.
1206 pub fn builder() -> ShortcutsSectionBuilder {
1207 ShortcutsSectionBuilder::new()
1208 }
1209
1210 /// The maximum number of lines to allow per column. This property can
1211 /// be used to influence how the groups in this section are distributed
1212 /// across pages and columns. The default value of 15 should work in
1213 /// most cases.
1214 #[doc(alias = "max-height")]
1215 pub fn max_height(&self) -> u32 {
1216 ObjectExt::property(self, "max-height")
1217 }
1218
1219 /// The maximum number of lines to allow per column. This property can
1220 /// be used to influence how the groups in this section are distributed
1221 /// across pages and columns. The default value of 15 should work in
1222 /// most cases.
1223 #[doc(alias = "max-height")]
1224 pub fn set_max_height(&self, max_height: u32) {
1225 ObjectExt::set_property(self, "max-height", max_height)
1226 }
1227
1228 /// A unique name to identify this section among the sections
1229 /// added to the GtkShortcutsWindow. Setting the [`section-name`][struct@crate::ShortcutsWindow#section-name]
1230 /// property to this string will make this section shown in the
1231 /// GtkShortcutsWindow.
1232 #[doc(alias = "section-name")]
1233 pub fn section_name(&self) -> Option<glib::GString> {
1234 ObjectExt::property(self, "section-name")
1235 }
1236
1237 /// A unique name to identify this section among the sections
1238 /// added to the GtkShortcutsWindow. Setting the [`section-name`][struct@crate::ShortcutsWindow#section-name]
1239 /// property to this string will make this section shown in the
1240 /// GtkShortcutsWindow.
1241 #[doc(alias = "section-name")]
1242 pub fn set_section_name(&self, section_name: Option<&str>) {
1243 ObjectExt::set_property(self, "section-name", section_name)
1244 }
1245
1246 /// The string to show in the section selector of the GtkShortcutsWindow
1247 /// for this section. If there is only one section, you don't need to
1248 /// set a title, since the section selector will not be shown in this case.
1249 pub fn title(&self) -> Option<glib::GString> {
1250 ObjectExt::property(self, "title")
1251 }
1252
1253 /// The string to show in the section selector of the GtkShortcutsWindow
1254 /// for this section. If there is only one section, you don't need to
1255 /// set a title, since the section selector will not be shown in this case.
1256 pub fn set_title(&self, title: Option<&str>) {
1257 ObjectExt::set_property(self, "title", title)
1258 }
1259
1260 /// A view name to filter the groups in this section by.
1261 /// See [`view`][struct@crate::ShortcutsGroup#view].
1262 ///
1263 /// Applications are expected to use the [`view-name`][struct@crate::ShortcutsWindow#view-name]
1264 /// property for this purpose.
1265 #[doc(alias = "view-name")]
1266 pub fn view_name(&self) -> Option<glib::GString> {
1267 ObjectExt::property(self, "view-name")
1268 }
1269
1270 /// A view name to filter the groups in this section by.
1271 /// See [`view`][struct@crate::ShortcutsGroup#view].
1272 ///
1273 /// Applications are expected to use the [`view-name`][struct@crate::ShortcutsWindow#view-name]
1274 /// property for this purpose.
1275 #[doc(alias = "view-name")]
1276 pub fn set_view_name(&self, view_name: Option<&str>) {
1277 ObjectExt::set_property(self, "view-name", view_name)
1278 }
1279
1280 #[doc(alias = "change-current-page")]
1281 pub fn connect_change_current_page<F: Fn(&Self, i32) -> bool + 'static>(
1282 &self,
1283 f: F,
1284 ) -> SignalHandlerId {
1285 unsafe extern "C" fn change_current_page_trampoline<
1286 F: Fn(&ShortcutsSection, i32) -> bool + 'static,
1287 >(
1288 this: *mut ffi::GtkShortcutsSection,
1289 object: std::ffi::c_int,
1290 f: glib::ffi::gpointer,
1291 ) -> glib::ffi::gboolean {
1292 unsafe {
1293 let f: &F = &*(f as *const F);
1294 f(&from_glib_borrow(this), object).into_glib()
1295 }
1296 }
1297 unsafe {
1298 let f: Box_<F> = Box_::new(f);
1299 connect_raw(
1300 self.as_ptr() as *mut _,
1301 c"change-current-page".as_ptr(),
1302 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1303 change_current_page_trampoline::<F> as *const (),
1304 )),
1305 Box_::into_raw(f),
1306 )
1307 }
1308 }
1309
1310 pub fn emit_change_current_page(&self, object: i32) -> bool {
1311 self.emit_by_name("change-current-page", &[&object])
1312 }
1313
1314 #[doc(alias = "max-height")]
1315 pub fn connect_max_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1316 unsafe extern "C" fn notify_max_height_trampoline<F: Fn(&ShortcutsSection) + 'static>(
1317 this: *mut ffi::GtkShortcutsSection,
1318 _param_spec: glib::ffi::gpointer,
1319 f: glib::ffi::gpointer,
1320 ) {
1321 unsafe {
1322 let f: &F = &*(f as *const F);
1323 f(&from_glib_borrow(this))
1324 }
1325 }
1326 unsafe {
1327 let f: Box_<F> = Box_::new(f);
1328 connect_raw(
1329 self.as_ptr() as *mut _,
1330 c"notify::max-height".as_ptr(),
1331 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1332 notify_max_height_trampoline::<F> as *const (),
1333 )),
1334 Box_::into_raw(f),
1335 )
1336 }
1337 }
1338
1339 #[doc(alias = "section-name")]
1340 pub fn connect_section_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1341 unsafe extern "C" fn notify_section_name_trampoline<F: Fn(&ShortcutsSection) + 'static>(
1342 this: *mut ffi::GtkShortcutsSection,
1343 _param_spec: glib::ffi::gpointer,
1344 f: glib::ffi::gpointer,
1345 ) {
1346 unsafe {
1347 let f: &F = &*(f as *const F);
1348 f(&from_glib_borrow(this))
1349 }
1350 }
1351 unsafe {
1352 let f: Box_<F> = Box_::new(f);
1353 connect_raw(
1354 self.as_ptr() as *mut _,
1355 c"notify::section-name".as_ptr(),
1356 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1357 notify_section_name_trampoline::<F> as *const (),
1358 )),
1359 Box_::into_raw(f),
1360 )
1361 }
1362 }
1363
1364 #[doc(alias = "title")]
1365 pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1366 unsafe extern "C" fn notify_title_trampoline<F: Fn(&ShortcutsSection) + 'static>(
1367 this: *mut ffi::GtkShortcutsSection,
1368 _param_spec: glib::ffi::gpointer,
1369 f: glib::ffi::gpointer,
1370 ) {
1371 unsafe {
1372 let f: &F = &*(f as *const F);
1373 f(&from_glib_borrow(this))
1374 }
1375 }
1376 unsafe {
1377 let f: Box_<F> = Box_::new(f);
1378 connect_raw(
1379 self.as_ptr() as *mut _,
1380 c"notify::title".as_ptr(),
1381 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1382 notify_title_trampoline::<F> as *const (),
1383 )),
1384 Box_::into_raw(f),
1385 )
1386 }
1387 }
1388
1389 #[doc(alias = "view-name")]
1390 pub fn connect_view_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1391 unsafe extern "C" fn notify_view_name_trampoline<F: Fn(&ShortcutsSection) + 'static>(
1392 this: *mut ffi::GtkShortcutsSection,
1393 _param_spec: glib::ffi::gpointer,
1394 f: glib::ffi::gpointer,
1395 ) {
1396 unsafe {
1397 let f: &F = &*(f as *const F);
1398 f(&from_glib_borrow(this))
1399 }
1400 }
1401 unsafe {
1402 let f: Box_<F> = Box_::new(f);
1403 connect_raw(
1404 self.as_ptr() as *mut _,
1405 c"notify::view-name".as_ptr(),
1406 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1407 notify_view_name_trampoline::<F> as *const (),
1408 )),
1409 Box_::into_raw(f),
1410 )
1411 }
1412 }
1413}
1414
1415// rustdoc-stripper-ignore-next
1416/// A [builder-pattern] type to construct [`ShortcutsSection`] objects.
1417///
1418/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1419#[must_use = "The builder must be built to be used"]
1420pub struct ShortcutsSectionBuilder {
1421 builder: glib::object::ObjectBuilder<'static, ShortcutsSection>,
1422}
1423
1424impl ShortcutsSectionBuilder {
1425 fn new() -> Self {
1426 Self {
1427 builder: glib::object::Object::builder(),
1428 }
1429 }
1430
1431 /// The maximum number of lines to allow per column. This property can
1432 /// be used to influence how the groups in this section are distributed
1433 /// across pages and columns. The default value of 15 should work in
1434 /// most cases.
1435 pub fn max_height(self, max_height: u32) -> Self {
1436 Self {
1437 builder: self.builder.property("max-height", max_height),
1438 }
1439 }
1440
1441 /// A unique name to identify this section among the sections
1442 /// added to the GtkShortcutsWindow. Setting the [`section-name`][struct@crate::ShortcutsWindow#section-name]
1443 /// property to this string will make this section shown in the
1444 /// GtkShortcutsWindow.
1445 pub fn section_name(self, section_name: impl Into<glib::GString>) -> Self {
1446 Self {
1447 builder: self.builder.property("section-name", section_name.into()),
1448 }
1449 }
1450
1451 /// The string to show in the section selector of the GtkShortcutsWindow
1452 /// for this section. If there is only one section, you don't need to
1453 /// set a title, since the section selector will not be shown in this case.
1454 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1455 Self {
1456 builder: self.builder.property("title", title.into()),
1457 }
1458 }
1459
1460 /// A view name to filter the groups in this section by.
1461 /// See [`view`][struct@crate::ShortcutsGroup#view].
1462 ///
1463 /// Applications are expected to use the [`view-name`][struct@crate::ShortcutsWindow#view-name]
1464 /// property for this purpose.
1465 pub fn view_name(self, view_name: impl Into<glib::GString>) -> Self {
1466 Self {
1467 builder: self.builder.property("view-name", view_name.into()),
1468 }
1469 }
1470
1471 pub fn baseline_position(self, baseline_position: BaselinePosition) -> Self {
1472 Self {
1473 builder: self
1474 .builder
1475 .property("baseline-position", baseline_position),
1476 }
1477 }
1478
1479 pub fn homogeneous(self, homogeneous: bool) -> Self {
1480 Self {
1481 builder: self.builder.property("homogeneous", homogeneous),
1482 }
1483 }
1484
1485 pub fn spacing(self, spacing: i32) -> Self {
1486 Self {
1487 builder: self.builder.property("spacing", spacing),
1488 }
1489 }
1490
1491 pub fn border_width(self, border_width: u32) -> Self {
1492 Self {
1493 builder: self.builder.property("border-width", border_width),
1494 }
1495 }
1496
1497 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1498 Self {
1499 builder: self.builder.property("child", child.clone().upcast()),
1500 }
1501 }
1502
1503 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1504 Self {
1505 builder: self.builder.property("resize-mode", resize_mode),
1506 }
1507 }
1508
1509 pub fn app_paintable(self, app_paintable: bool) -> Self {
1510 Self {
1511 builder: self.builder.property("app-paintable", app_paintable),
1512 }
1513 }
1514
1515 pub fn can_default(self, can_default: bool) -> Self {
1516 Self {
1517 builder: self.builder.property("can-default", can_default),
1518 }
1519 }
1520
1521 pub fn can_focus(self, can_focus: bool) -> Self {
1522 Self {
1523 builder: self.builder.property("can-focus", can_focus),
1524 }
1525 }
1526
1527 pub fn events(self, events: gdk::EventMask) -> Self {
1528 Self {
1529 builder: self.builder.property("events", events),
1530 }
1531 }
1532
1533 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1534 pub fn expand(self, expand: bool) -> Self {
1535 Self {
1536 builder: self.builder.property("expand", expand),
1537 }
1538 }
1539
1540 /// Whether the widget should grab focus when it is clicked with the mouse.
1541 ///
1542 /// This property is only relevant for widgets that can take focus.
1543 ///
1544 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1545 /// GtkComboBox) implemented this property individually.
1546 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1547 Self {
1548 builder: self.builder.property("focus-on-click", focus_on_click),
1549 }
1550 }
1551
1552 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1553 pub fn halign(self, halign: Align) -> Self {
1554 Self {
1555 builder: self.builder.property("halign", halign),
1556 }
1557 }
1558
1559 pub fn has_default(self, has_default: bool) -> Self {
1560 Self {
1561 builder: self.builder.property("has-default", has_default),
1562 }
1563 }
1564
1565 pub fn has_focus(self, has_focus: bool) -> Self {
1566 Self {
1567 builder: self.builder.property("has-focus", has_focus),
1568 }
1569 }
1570
1571 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1572 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1573 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1574 /// whether it will provide a tooltip or not.
1575 ///
1576 /// Note that setting this property to [`true`] for the first time will change
1577 /// the event masks of the GdkWindows of this widget to include leave-notify
1578 /// and motion-notify events. This cannot and will not be undone when the
1579 /// property is set to [`false`] again.
1580 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1581 Self {
1582 builder: self.builder.property("has-tooltip", has_tooltip),
1583 }
1584 }
1585
1586 pub fn height_request(self, height_request: i32) -> Self {
1587 Self {
1588 builder: self.builder.property("height-request", height_request),
1589 }
1590 }
1591
1592 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1593 pub fn hexpand(self, hexpand: bool) -> Self {
1594 Self {
1595 builder: self.builder.property("hexpand", hexpand),
1596 }
1597 }
1598
1599 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1600 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1601 Self {
1602 builder: self.builder.property("hexpand-set", hexpand_set),
1603 }
1604 }
1605
1606 pub fn is_focus(self, is_focus: bool) -> Self {
1607 Self {
1608 builder: self.builder.property("is-focus", is_focus),
1609 }
1610 }
1611
1612 /// Sets all four sides' margin at once. If read, returns max
1613 /// margin on any side.
1614 pub fn margin(self, margin: i32) -> Self {
1615 Self {
1616 builder: self.builder.property("margin", margin),
1617 }
1618 }
1619
1620 /// Margin on bottom side of widget.
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_bottom(self, margin_bottom: i32) -> Self {
1626 Self {
1627 builder: self.builder.property("margin-bottom", margin_bottom),
1628 }
1629 }
1630
1631 /// Margin on end 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_end(self, margin_end: i32) -> Self {
1638 Self {
1639 builder: self.builder.property("margin-end", margin_end),
1640 }
1641 }
1642
1643 /// Margin on start of widget, horizontally. This property supports
1644 /// left-to-right and right-to-left text directions.
1645 ///
1646 /// This property adds margin outside of the widget's normal size
1647 /// request, the margin will be added in addition to the size from
1648 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1649 pub fn margin_start(self, margin_start: i32) -> Self {
1650 Self {
1651 builder: self.builder.property("margin-start", margin_start),
1652 }
1653 }
1654
1655 /// Margin on top side of widget.
1656 ///
1657 /// This property adds margin outside of the widget's normal size
1658 /// request, the margin will be added in addition to the size from
1659 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1660 pub fn margin_top(self, margin_top: i32) -> Self {
1661 Self {
1662 builder: self.builder.property("margin-top", margin_top),
1663 }
1664 }
1665
1666 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1667 Self {
1668 builder: self.builder.property("name", name.into()),
1669 }
1670 }
1671
1672 pub fn no_show_all(self, no_show_all: bool) -> Self {
1673 Self {
1674 builder: self.builder.property("no-show-all", no_show_all),
1675 }
1676 }
1677
1678 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1679 /// more details about window opacity.
1680 ///
1681 /// Before 3.8 this was only available in GtkWindow
1682 pub fn opacity(self, opacity: f64) -> Self {
1683 Self {
1684 builder: self.builder.property("opacity", opacity),
1685 }
1686 }
1687
1688 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1689 Self {
1690 builder: self.builder.property("parent", parent.clone().upcast()),
1691 }
1692 }
1693
1694 pub fn receives_default(self, receives_default: bool) -> Self {
1695 Self {
1696 builder: self.builder.property("receives-default", receives_default),
1697 }
1698 }
1699
1700 pub fn sensitive(self, sensitive: bool) -> Self {
1701 Self {
1702 builder: self.builder.property("sensitive", sensitive),
1703 }
1704 }
1705
1706 /// Sets the text of tooltip to be the given string, which is marked up
1707 /// with the [Pango text markup language][PangoMarkupFormat].
1708 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1709 ///
1710 /// This is a convenience property which will take care of getting the
1711 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1712 /// will automatically be set to [`true`] and there will be taken care of
1713 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1714 ///
1715 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1716 /// are set, the last one wins.
1717 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1718 Self {
1719 builder: self
1720 .builder
1721 .property("tooltip-markup", tooltip_markup.into()),
1722 }
1723 }
1724
1725 /// Sets the text of tooltip to be the given string.
1726 ///
1727 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1728 ///
1729 /// This is a convenience property which will take care of getting the
1730 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1731 /// will automatically be set to [`true`] and there will be taken care of
1732 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1733 ///
1734 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1735 /// are set, the last one wins.
1736 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1737 Self {
1738 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1739 }
1740 }
1741
1742 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1743 pub fn valign(self, valign: Align) -> Self {
1744 Self {
1745 builder: self.builder.property("valign", valign),
1746 }
1747 }
1748
1749 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1750 pub fn vexpand(self, vexpand: bool) -> Self {
1751 Self {
1752 builder: self.builder.property("vexpand", vexpand),
1753 }
1754 }
1755
1756 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1757 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1758 Self {
1759 builder: self.builder.property("vexpand-set", vexpand_set),
1760 }
1761 }
1762
1763 pub fn visible(self, visible: bool) -> Self {
1764 Self {
1765 builder: self.builder.property("visible", visible),
1766 }
1767 }
1768
1769 pub fn width_request(self, width_request: i32) -> Self {
1770 Self {
1771 builder: self.builder.property("width-request", width_request),
1772 }
1773 }
1774
1775 /// The orientation of the orientable.
1776 pub fn orientation(self, orientation: Orientation) -> Self {
1777 Self {
1778 builder: self.builder.property("orientation", orientation),
1779 }
1780 }
1781
1782 // rustdoc-stripper-ignore-next
1783 /// Build the [`ShortcutsSection`].
1784 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1785 pub fn build(self) -> ShortcutsSection {
1786 assert_initialized_main_thread!();
1787 self.builder.build()
1788 }
1789}