gtk/auto/radio_menu_item.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 Actionable, Align, Bin, Buildable, CheckMenuItem, Container, Menu, MenuItem, 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 ///
19 /// ]|
20 ///
21 /// GtkRadioMenuItem has a main CSS node with name menuitem, and a subnode
22 /// with name radio, which gets the .left or .right style class.
23 ///
24 /// ## Properties
25 ///
26 ///
27 /// #### `group`
28 /// The radio menu item whose group this widget belongs to.
29 ///
30 /// Writable
31 /// <details><summary><h4>CheckMenuItem</h4></summary>
32 ///
33 ///
34 /// #### `active`
35 /// Readable | Writable
36 ///
37 ///
38 /// #### `draw-as-radio`
39 /// Readable | Writable
40 ///
41 ///
42 /// #### `inconsistent`
43 /// Readable | Writable
44 /// </details>
45 /// <details><summary><h4>MenuItem</h4></summary>
46 ///
47 ///
48 /// #### `accel-path`
49 /// Sets the accelerator path of the menu item, through which runtime
50 /// changes of the menu item's accelerator caused by the user can be
51 /// identified and saved to persistant storage.
52 ///
53 /// Readable | Writable
54 ///
55 ///
56 /// #### `label`
57 /// The text for the child label.
58 ///
59 /// Readable | Writable
60 ///
61 ///
62 /// #### `right-justified`
63 /// Sets whether the menu item appears justified
64 /// at the right side of a menu bar.
65 ///
66 /// Readable | Writable
67 ///
68 ///
69 /// #### `submenu`
70 /// The submenu attached to the menu item, or [`None`] if it has none.
71 ///
72 /// Readable | Writable
73 ///
74 ///
75 /// #### `use-underline`
76 /// [`true`] if underlines in the text indicate mnemonics.
77 ///
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>Actionable</h4></summary>
363 ///
364 ///
365 /// #### `action-name`
366 /// Readable | Writable
367 ///
368 ///
369 /// #### `action-target`
370 /// Readable | Writable
371 /// </details>
372 /// <details><summary><h4>Activatable</h4></summary>
373 ///
374 ///
375 /// #### `related-action`
376 /// call `gtk_activatable_do_set_related_action()` when it changes.
377 ///
378 /// Readable | Writable
379 ///
380 ///
381 /// #### `use-action-appearance`
382 /// widget when it changes.
383 ///
384 /// Readable | Writable
385 /// </details>
386 ///
387 /// ## Signals
388 ///
389 ///
390 /// #### `group-changed`
391 ///
392 /// <details><summary><h4>CheckMenuItem</h4></summary>
393 ///
394 ///
395 /// #### `toggled`
396 /// This signal is emitted when the state of the check box is changed.
397 ///
398 /// A signal handler can use [`CheckMenuItemExt::is_active()`][crate::prelude::CheckMenuItemExt::is_active()]
399 /// to discover the new state.
400 ///
401 ///
402 /// </details>
403 /// <details><summary><h4>MenuItem</h4></summary>
404 ///
405 ///
406 /// #### `activate`
407 /// Emitted when the item is activated.
408 ///
409 /// Action
410 ///
411 ///
412 /// #### `activate-item`
413 /// Emitted when the item is activated, but also if the menu item has a
414 /// submenu. For normal applications, the relevant signal is
415 /// [`activate`][struct@crate::MenuItem#activate].
416 ///
417 ///
418 ///
419 ///
420 /// #### `deselect`
421 ///
422 ///
423 ///
424 /// #### `select`
425 ///
426 ///
427 ///
428 /// #### `toggle-size-allocate`
429 ///
430 ///
431 ///
432 /// #### `toggle-size-request`
433 ///
434 /// </details>
435 /// <details><summary><h4>Container</h4></summary>
436 ///
437 ///
438 /// #### `add`
439 ///
440 ///
441 ///
442 /// #### `check-resize`
443 ///
444 ///
445 ///
446 /// #### `remove`
447 ///
448 ///
449 ///
450 /// #### `set-focus-child`
451 ///
452 /// </details>
453 /// <details><summary><h4>Widget</h4></summary>
454 ///
455 ///
456 /// #### `accel-closures-changed`
457 ///
458 ///
459 ///
460 /// #### `button-press-event`
461 /// The ::button-press-event signal will be emitted when a button
462 /// (typically from a mouse) is pressed.
463 ///
464 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
465 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
466 ///
467 /// This signal will be sent to the grab widget if there is one.
468 ///
469 ///
470 ///
471 ///
472 /// #### `button-release-event`
473 /// The ::button-release-event signal will be emitted when a button
474 /// (typically from a mouse) is released.
475 ///
476 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
477 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
478 ///
479 /// This signal will be sent to the grab widget if there is one.
480 ///
481 ///
482 ///
483 ///
484 /// #### `can-activate-accel`
485 /// Determines whether an accelerator that activates the signal
486 /// identified by `signal_id` can currently be activated.
487 /// This signal is present to allow applications and derived
488 /// widgets to override the default [`Widget`][crate::Widget] handling
489 /// for determining whether an accelerator can be activated.
490 ///
491 ///
492 ///
493 ///
494 /// #### `child-notify`
495 /// The ::child-notify signal is emitted for each
496 /// [child property][child-properties] that has
497 /// changed on an object. The signal's detail holds the property name.
498 ///
499 /// Detailed
500 ///
501 ///
502 /// #### `composited-changed`
503 /// The ::composited-changed signal is emitted when the composited
504 /// status of `widgets` screen changes.
505 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
506 ///
507 /// Action
508 ///
509 ///
510 /// #### `configure-event`
511 /// The ::configure-event signal will be emitted when the size, position or
512 /// stacking of the `widget`'s window has changed.
513 ///
514 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
515 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
516 /// automatically for all new windows.
517 ///
518 ///
519 ///
520 ///
521 /// #### `damage-event`
522 /// Emitted when a redirected window belonging to `widget` gets drawn into.
523 /// The region/area members of the event shows what area of the redirected
524 /// drawable was drawn into.
525 ///
526 ///
527 ///
528 ///
529 /// #### `delete-event`
530 /// The ::delete-event signal is emitted if a user requests that
531 /// a toplevel window is closed. The default handler for this signal
532 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
533 /// this signal will cause the window to be hidden instead, so that
534 /// it can later be shown again without reconstructing it.
535 ///
536 ///
537 ///
538 ///
539 /// #### `destroy`
540 /// Signals that all holders of a reference to the widget should release
541 /// the reference that they hold. May result in finalization of the widget
542 /// if all references are released.
543 ///
544 /// This signal is not suitable for saving widget state.
545 ///
546 ///
547 ///
548 ///
549 /// #### `destroy-event`
550 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
551 /// You rarely get this signal, because most widgets disconnect themselves
552 /// from their window before they destroy it, so no widget owns the
553 /// window at destroy time.
554 ///
555 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
556 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
557 /// automatically for all new windows.
558 ///
559 ///
560 ///
561 ///
562 /// #### `direction-changed`
563 /// The ::direction-changed signal is emitted when the text direction
564 /// of a widget changes.
565 ///
566 ///
567 ///
568 ///
569 /// #### `drag-begin`
570 /// The ::drag-begin signal is emitted on the drag source when a drag is
571 /// started. A typical reason to connect to this signal is to set up a
572 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
573 ///
574 /// Note that some widgets set up a drag icon in the default handler of
575 /// this signal, so you may have to use `g_signal_connect_after()` to
576 /// override what the default handler did.
577 ///
578 ///
579 ///
580 ///
581 /// #### `drag-data-delete`
582 /// The ::drag-data-delete signal is emitted on the drag source when a drag
583 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
584 /// handler is responsible for deleting the data that has been dropped. What
585 /// "delete" means depends on the context of the drag operation.
586 ///
587 ///
588 ///
589 ///
590 /// #### `drag-data-get`
591 /// The ::drag-data-get signal is emitted on the drag source when the drop
592 /// site requests the data which is dragged. It is the responsibility of
593 /// the signal handler to fill `data` with the data in the format which
594 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
595 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
596 ///
597 ///
598 ///
599 ///
600 /// #### `drag-data-received`
601 /// format == 8))
602 /// {
603 /// GdkDragAction action;
604 ///
605 /// // handle data here
606 ///
607 /// action = gdk_drag_context_get_selected_action (context);
608 /// if (action == GDK_ACTION_ASK)
609 /// {
610 /// GtkWidget *dialog;
611 /// gint response;
612 ///
613 /// dialog = gtk_message_dialog_new (NULL,
614 /// GTK_DIALOG_MODAL |
615 /// GTK_DIALOG_DESTROY_WITH_PARENT,
616 /// GTK_MESSAGE_INFO,
617 /// GTK_BUTTONS_YES_NO,
618 /// "Move the data ?\n");
619 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
620 /// gtk_widget_destroy (dialog);
621 ///
622 /// if (response == GTK_RESPONSE_YES)
623 /// action = GDK_ACTION_MOVE;
624 /// else
625 /// action = GDK_ACTION_COPY;
626 /// }
627 ///
628 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
629 /// }
630 /// else
631 /// gtk_drag_finish (context, FALSE, FALSE, time);
632 /// }
633 /// ]|
634 ///
635 ///
636 ///
637 ///
638 /// #### `drag-drop`
639 /// The ::drag-drop signal is emitted on the drop site when the user drops
640 /// the data onto the widget. The signal handler must determine whether
641 /// the cursor position is in a drop zone or not. If it is not in a drop
642 /// zone, it returns [`false`] and no further processing is necessary.
643 /// Otherwise, the handler returns [`true`]. In this case, the handler must
644 /// ensure that `gtk_drag_finish()` is called to let the source know that
645 /// the drop is done. The call to `gtk_drag_finish()` can be done either
646 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
647 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
648 /// or more of the supported targets.
649 ///
650 ///
651 ///
652 ///
653 /// #### `drag-end`
654 /// The ::drag-end signal is emitted on the drag source when a drag is
655 /// finished. A typical reason to connect to this signal is to undo
656 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
657 ///
658 ///
659 ///
660 ///
661 /// #### `drag-failed`
662 /// The ::drag-failed signal is emitted on the drag source when a drag has
663 /// failed. The signal handler may hook custom code to handle a failed DnD
664 /// operation based on the type of error, it returns [`true`] is the failure has
665 /// been already handled (not showing the default "drag operation failed"
666 /// animation), otherwise it returns [`false`].
667 ///
668 ///
669 ///
670 ///
671 /// #### `drag-leave`
672 /// The ::drag-leave signal is emitted on the drop site when the cursor
673 /// leaves the widget. A typical reason to connect to this signal is to
674 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
675 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
676 ///
677 ///
678 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
679 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
680 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
681 ///
682 ///
683 ///
684 ///
685 /// #### `drag-motion`
686 /// suggested_action,
687 /// time);
688 /// }
689 /// else
690 /// {
691 /// // accept the drop
692 /// }
693 /// }
694 /// ]|
695 ///
696 ///
697 ///
698 ///
699 /// #### `draw`
700 /// This signal is emitted when a widget is supposed to render itself.
701 /// The `widget`'s top left corner must be painted at the origin of
702 /// the passed in context and be sized to the values returned by
703 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
704 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
705 ///
706 /// Signal handlers connected to this signal can modify the cairo
707 /// context passed as `cr` in any way they like and don't need to
708 /// restore it. The signal emission takes care of calling `cairo_save()`
709 /// before and `cairo_restore()` after invoking the handler.
710 ///
711 /// The signal handler will get a `cr` with a clip region already set to the
712 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
713 /// widgets that want to avoid redrawing themselves completely can get the full
714 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
715 /// get a finer-grained representation of the dirty region with
716 /// `cairo_copy_clip_rectangle_list()`.
717 ///
718 ///
719 ///
720 ///
721 /// #### `enter-notify-event`
722 /// The ::enter-notify-event will be emitted when the pointer enters
723 /// the `widget`'s window.
724 ///
725 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
726 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
727 ///
728 /// This signal will be sent to the grab widget if there is one.
729 ///
730 ///
731 ///
732 ///
733 /// #### `event`
734 /// The GTK+ main loop will emit three signals for each GDK event delivered
735 /// to a widget: one generic ::event signal, another, more specific,
736 /// signal that matches the type of event delivered (e.g.
737 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
738 /// [`event-after`][struct@crate::Widget#event-after] signal.
739 ///
740 ///
741 ///
742 ///
743 /// #### `event-after`
744 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
745 /// the second more specific signal, ::event-after will be emitted
746 /// regardless of the previous two signals handlers return values.
747 ///
748 ///
749 ///
750 ///
751 /// #### `focus`
752 ///
753 ///
754 ///
755 /// #### `focus-in-event`
756 /// The ::focus-in-event signal will be emitted when the keyboard focus
757 /// enters the `widget`'s window.
758 ///
759 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
760 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
761 ///
762 ///
763 ///
764 ///
765 /// #### `focus-out-event`
766 /// The ::focus-out-event signal will be emitted when the keyboard focus
767 /// leaves the `widget`'s window.
768 ///
769 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
770 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
771 ///
772 ///
773 ///
774 ///
775 /// #### `grab-broken-event`
776 /// Emitted when a pointer or keyboard grab on a window belonging
777 /// to `widget` gets broken.
778 ///
779 /// On X11, this happens when the grab window becomes unviewable
780 /// (i.e. it or one of its ancestors is unmapped), or if the same
781 /// application grabs the pointer or keyboard again.
782 ///
783 ///
784 ///
785 ///
786 /// #### `grab-focus`
787 /// Action
788 ///
789 ///
790 /// #### `grab-notify`
791 /// The ::grab-notify signal is emitted when a widget becomes
792 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
793 /// another widget, or when it becomes unshadowed due to a grab
794 /// being removed.
795 ///
796 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
797 /// grab widget in the grab stack of its window group is not
798 /// its ancestor.
799 ///
800 ///
801 ///
802 ///
803 /// #### `hide`
804 /// The ::hide signal is emitted when `widget` is hidden, for example with
805 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
806 ///
807 ///
808 ///
809 ///
810 /// #### `hierarchy-changed`
811 /// The ::hierarchy-changed signal is emitted when the
812 /// anchored state of a widget changes. A widget is
813 /// “anchored” when its toplevel
814 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
815 /// a widget changes from un-anchored to anchored or vice-versa.
816 ///
817 ///
818 ///
819 ///
820 /// #### `key-press-event`
821 /// The ::key-press-event signal is emitted when a key is pressed. The signal
822 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
823 ///
824 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
825 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
826 ///
827 /// This signal will be sent to the grab widget if there is one.
828 ///
829 ///
830 ///
831 ///
832 /// #### `key-release-event`
833 /// The ::key-release-event signal is emitted when a key is released.
834 ///
835 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
836 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
837 ///
838 /// This signal will be sent to the grab widget if there is one.
839 ///
840 ///
841 ///
842 ///
843 /// #### `keynav-failed`
844 /// Gets emitted if keyboard navigation fails.
845 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
846 ///
847 ///
848 ///
849 ///
850 /// #### `leave-notify-event`
851 /// The ::leave-notify-event will be emitted when the pointer leaves
852 /// the `widget`'s window.
853 ///
854 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
855 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
856 ///
857 /// This signal will be sent to the grab widget if there is one.
858 ///
859 ///
860 ///
861 ///
862 /// #### `map`
863 /// The ::map signal is emitted when `widget` is going to be mapped, that is
864 /// when the widget is visible (which is controlled with
865 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
866 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
867 /// be emitted.
868 ///
869 /// The ::map signal can be used to determine whether a widget will be drawn,
870 /// for instance it can resume an animation that was stopped during the
871 /// emission of [`unmap`][struct@crate::Widget#unmap].
872 ///
873 ///
874 ///
875 ///
876 /// #### `map-event`
877 /// The ::map-event signal will be emitted when the `widget`'s window is
878 /// mapped. A window is mapped when it becomes visible on the screen.
879 ///
880 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
881 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
882 /// automatically for all new windows.
883 ///
884 ///
885 ///
886 ///
887 /// #### `mnemonic-activate`
888 /// The default handler for this signal activates `widget` if `group_cycling`
889 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
890 ///
891 ///
892 ///
893 ///
894 /// #### `motion-notify-event`
895 /// The ::motion-notify-event signal is emitted when the pointer moves
896 /// over the widget's [`gdk::Window`][crate::gdk::Window].
897 ///
898 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
899 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
900 ///
901 /// This signal will be sent to the grab widget if there is one.
902 ///
903 ///
904 ///
905 ///
906 /// #### `move-focus`
907 /// Action
908 ///
909 ///
910 /// #### `parent-set`
911 /// The ::parent-set signal is emitted when a new parent
912 /// has been set on a widget.
913 ///
914 ///
915 ///
916 ///
917 /// #### `popup-menu`
918 /// This signal gets emitted whenever a widget should pop up a context
919 /// menu. This usually happens through the standard key binding mechanism;
920 /// by pressing a certain key while a widget is focused, the user can cause
921 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
922 /// a menu with clipboard commands. See the
923 /// [Popup Menu Migration Checklist][checklist-popup-menu]
924 /// for an example of how to use this signal.
925 ///
926 /// Action
927 ///
928 ///
929 /// #### `property-notify-event`
930 /// The ::property-notify-event signal will be emitted when a property on
931 /// the `widget`'s window has been changed or deleted.
932 ///
933 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
934 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
935 ///
936 ///
937 ///
938 ///
939 /// #### `proximity-in-event`
940 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
941 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
942 ///
943 /// This signal will be sent to the grab widget if there is one.
944 ///
945 ///
946 ///
947 ///
948 /// #### `proximity-out-event`
949 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
950 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
951 ///
952 /// This signal will be sent to the grab widget if there is one.
953 ///
954 ///
955 ///
956 ///
957 /// #### `query-tooltip`
958 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
959 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
960 /// focus in keyboard mode.
961 ///
962 /// Using the given coordinates, the signal handler should determine
963 /// whether a tooltip should be shown for `widget`. If this is the case
964 /// [`true`] should be returned, [`false`] otherwise. Note that if
965 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
966 /// should not be used.
967 ///
968 /// The signal handler is free to manipulate `tooltip` with the therefore
969 /// destined function calls.
970 ///
971 ///
972 ///
973 ///
974 /// #### `realize`
975 /// The ::realize signal is emitted when `widget` is associated with a
976 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
977 /// widget has been mapped (that is, it is going to be drawn).
978 ///
979 ///
980 ///
981 ///
982 /// #### `screen-changed`
983 /// The ::screen-changed signal gets emitted when the
984 /// screen of a widget has changed.
985 ///
986 ///
987 ///
988 ///
989 /// #### `scroll-event`
990 /// The ::scroll-event signal is emitted when a button in the 4 to 7
991 /// range is pressed. Wheel mice are usually configured to generate
992 /// button press events for buttons 4 and 5 when the wheel is turned.
993 ///
994 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
995 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
996 ///
997 /// This signal will be sent to the grab widget if there is one.
998 ///
999 ///
1000 ///
1001 ///
1002 /// #### `selection-clear-event`
1003 /// The ::selection-clear-event signal will be emitted when the
1004 /// the `widget`'s window has lost ownership of a selection.
1005 ///
1006 ///
1007 ///
1008 ///
1009 /// #### `selection-get`
1010 ///
1011 ///
1012 ///
1013 /// #### `selection-notify-event`
1014 ///
1015 ///
1016 ///
1017 /// #### `selection-received`
1018 ///
1019 ///
1020 ///
1021 /// #### `selection-request-event`
1022 /// The ::selection-request-event signal will be emitted when
1023 /// another client requests ownership of the selection owned by
1024 /// the `widget`'s window.
1025 ///
1026 ///
1027 ///
1028 ///
1029 /// #### `show`
1030 /// The ::show signal is emitted when `widget` is shown, for example with
1031 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1032 ///
1033 ///
1034 ///
1035 ///
1036 /// #### `show-help`
1037 /// Action
1038 ///
1039 ///
1040 /// #### `size-allocate`
1041 ///
1042 ///
1043 ///
1044 /// #### `state-changed`
1045 /// The ::state-changed signal is emitted when the widget state changes.
1046 /// See `gtk_widget_get_state()`.
1047 ///
1048 ///
1049 ///
1050 ///
1051 /// #### `state-flags-changed`
1052 /// The ::state-flags-changed signal is emitted when the widget state
1053 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1054 ///
1055 ///
1056 ///
1057 ///
1058 /// #### `style-set`
1059 /// The ::style-set signal is emitted when a new style has been set
1060 /// on a widget. Note that style-modifying functions like
1061 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1062 ///
1063 /// Note that this signal is emitted for changes to the deprecated
1064 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1065 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1066 ///
1067 ///
1068 ///
1069 ///
1070 /// #### `style-updated`
1071 /// The ::style-updated signal is a convenience signal that is emitted when the
1072 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1073 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1074 ///
1075 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1076 /// cause this signal to be emitted.
1077 ///
1078 ///
1079 ///
1080 ///
1081 /// #### `touch-event`
1082 ///
1083 ///
1084 ///
1085 /// #### `unmap`
1086 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1087 /// means that either it or any of its parents up to the toplevel widget have
1088 /// been set as hidden.
1089 ///
1090 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1091 /// used to, for example, stop an animation on the widget.
1092 ///
1093 ///
1094 ///
1095 ///
1096 /// #### `unmap-event`
1097 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1098 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1099 ///
1100 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1101 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1102 /// automatically for all new windows.
1103 ///
1104 ///
1105 ///
1106 ///
1107 /// #### `unrealize`
1108 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1109 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1110 /// called or the widget has been unmapped (that is, it is going to be
1111 /// hidden).
1112 ///
1113 ///
1114 ///
1115 ///
1116 /// #### `visibility-notify-event`
1117 /// The ::visibility-notify-event will be emitted when the `widget`'s
1118 /// window is obscured or unobscured.
1119 ///
1120 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1121 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1122 ///
1123 ///
1124 ///
1125 ///
1126 /// #### `window-state-event`
1127 /// The ::window-state-event will be emitted when the state of the
1128 /// toplevel window associated to the `widget` changes.
1129 ///
1130 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1131 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1132 /// this mask automatically for all new windows.
1133 ///
1134 ///
1135 /// </details>
1136 ///
1137 /// # Implements
1138 ///
1139 /// [`RadioMenuItemExt`][trait@crate::prelude::RadioMenuItemExt], [`CheckMenuItemExt`][trait@crate::prelude::CheckMenuItemExt], [`GtkMenuItemExt`][trait@crate::prelude::GtkMenuItemExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ActionableExt`][trait@crate::prelude::ActionableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1140 #[doc(alias = "GtkRadioMenuItem")]
1141 pub struct RadioMenuItem(Object<ffi::GtkRadioMenuItem, ffi::GtkRadioMenuItemClass>) @extends CheckMenuItem, MenuItem, Bin, Container, Widget, @implements Buildable, Actionable;
1142
1143 match fn {
1144 type_ => || ffi::gtk_radio_menu_item_get_type(),
1145 }
1146}
1147
1148impl RadioMenuItem {
1149 pub const NONE: Option<&'static RadioMenuItem> = None;
1150
1151 /// Creates a new [`RadioMenuItem`][crate::RadioMenuItem] adding it to the same group as `group`.
1152 /// ## `group`
1153 /// An existing [`RadioMenuItem`][crate::RadioMenuItem]
1154 ///
1155 /// # Returns
1156 ///
1157 /// The new [`RadioMenuItem`][crate::RadioMenuItem]
1158 #[doc(alias = "gtk_radio_menu_item_new_from_widget")]
1159 #[doc(alias = "new_from_widget")]
1160 pub fn from_widget(group: &impl IsA<RadioMenuItem>) -> RadioMenuItem {
1161 skip_assert_initialized!();
1162 unsafe {
1163 Widget::from_glib_none(ffi::gtk_radio_menu_item_new_from_widget(
1164 group.as_ref().to_glib_none().0,
1165 ))
1166 .unsafe_cast()
1167 }
1168 }
1169
1170 /// Creates a new GtkRadioMenuItem whose child is a simple GtkLabel.
1171 /// The new [`RadioMenuItem`][crate::RadioMenuItem] is added to the same group as `group`.
1172 /// ## `group`
1173 /// an existing [`RadioMenuItem`][crate::RadioMenuItem]
1174 /// ## `label`
1175 /// the text for the label
1176 ///
1177 /// # Returns
1178 ///
1179 /// The new [`RadioMenuItem`][crate::RadioMenuItem]
1180 #[doc(alias = "gtk_radio_menu_item_new_with_label_from_widget")]
1181 #[doc(alias = "new_with_label_from_widget")]
1182 pub fn with_label_from_widget(
1183 group: &impl IsA<RadioMenuItem>,
1184 label: Option<&str>,
1185 ) -> RadioMenuItem {
1186 skip_assert_initialized!();
1187 unsafe {
1188 Widget::from_glib_none(ffi::gtk_radio_menu_item_new_with_label_from_widget(
1189 group.as_ref().to_glib_none().0,
1190 label.to_glib_none().0,
1191 ))
1192 .unsafe_cast()
1193 }
1194 }
1195
1196 /// Creates a new GtkRadioMenuItem containing a label. The label will be
1197 /// created using [`Label::with_mnemonic()`][crate::Label::with_mnemonic()], so underscores in label
1198 /// indicate the mnemonic for the menu item.
1199 ///
1200 /// The new [`RadioMenuItem`][crate::RadioMenuItem] is added to the same group as `group`.
1201 /// ## `group`
1202 /// An existing [`RadioMenuItem`][crate::RadioMenuItem]
1203 /// ## `label`
1204 /// the text of the button, with an underscore in front of the
1205 /// mnemonic character
1206 ///
1207 /// # Returns
1208 ///
1209 /// The new [`RadioMenuItem`][crate::RadioMenuItem]
1210 #[doc(alias = "gtk_radio_menu_item_new_with_mnemonic_from_widget")]
1211 #[doc(alias = "new_with_mnemonic_from_widget")]
1212 pub fn with_mnemonic_from_widget(
1213 group: &impl IsA<RadioMenuItem>,
1214 label: Option<&str>,
1215 ) -> RadioMenuItem {
1216 skip_assert_initialized!();
1217 unsafe {
1218 Widget::from_glib_none(ffi::gtk_radio_menu_item_new_with_mnemonic_from_widget(
1219 group.as_ref().to_glib_none().0,
1220 label.to_glib_none().0,
1221 ))
1222 .unsafe_cast()
1223 }
1224 }
1225
1226 // rustdoc-stripper-ignore-next
1227 /// Creates a new builder-pattern struct instance to construct [`RadioMenuItem`] objects.
1228 ///
1229 /// This method returns an instance of [`RadioMenuItemBuilder`](crate::builders::RadioMenuItemBuilder) which can be used to create [`RadioMenuItem`] objects.
1230 pub fn builder() -> RadioMenuItemBuilder {
1231 RadioMenuItemBuilder::new()
1232 }
1233}
1234
1235// rustdoc-stripper-ignore-next
1236/// A [builder-pattern] type to construct [`RadioMenuItem`] objects.
1237///
1238/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1239#[must_use = "The builder must be built to be used"]
1240pub struct RadioMenuItemBuilder {
1241 builder: glib::object::ObjectBuilder<'static, RadioMenuItem>,
1242}
1243
1244impl RadioMenuItemBuilder {
1245 fn new() -> Self {
1246 Self {
1247 builder: glib::object::Object::builder(),
1248 }
1249 }
1250
1251 pub fn active(self, active: bool) -> Self {
1252 Self {
1253 builder: self.builder.property("active", active),
1254 }
1255 }
1256
1257 pub fn draw_as_radio(self, draw_as_radio: bool) -> Self {
1258 Self {
1259 builder: self.builder.property("draw-as-radio", draw_as_radio),
1260 }
1261 }
1262
1263 pub fn inconsistent(self, inconsistent: bool) -> Self {
1264 Self {
1265 builder: self.builder.property("inconsistent", inconsistent),
1266 }
1267 }
1268
1269 /// Sets the accelerator path of the menu item, through which runtime
1270 /// changes of the menu item's accelerator caused by the user can be
1271 /// identified and saved to persistant storage.
1272 pub fn accel_path(self, accel_path: impl Into<glib::GString>) -> Self {
1273 Self {
1274 builder: self.builder.property("accel-path", accel_path.into()),
1275 }
1276 }
1277
1278 /// The text for the child label.
1279 pub fn label(self, label: impl Into<glib::GString>) -> Self {
1280 Self {
1281 builder: self.builder.property("label", label.into()),
1282 }
1283 }
1284
1285 /// Sets whether the menu item appears justified
1286 /// at the right side of a menu bar.
1287 pub fn right_justified(self, right_justified: bool) -> Self {
1288 Self {
1289 builder: self.builder.property("right-justified", right_justified),
1290 }
1291 }
1292
1293 /// The submenu attached to the menu item, or [`None`] if it has none.
1294 pub fn submenu(self, submenu: &impl IsA<Menu>) -> Self {
1295 Self {
1296 builder: self.builder.property("submenu", submenu.clone().upcast()),
1297 }
1298 }
1299
1300 /// [`true`] if underlines in the text indicate mnemonics.
1301 pub fn use_underline(self, use_underline: bool) -> Self {
1302 Self {
1303 builder: self.builder.property("use-underline", use_underline),
1304 }
1305 }
1306
1307 pub fn border_width(self, border_width: u32) -> Self {
1308 Self {
1309 builder: self.builder.property("border-width", border_width),
1310 }
1311 }
1312
1313 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1314 Self {
1315 builder: self.builder.property("child", child.clone().upcast()),
1316 }
1317 }
1318
1319 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1320 Self {
1321 builder: self.builder.property("resize-mode", resize_mode),
1322 }
1323 }
1324
1325 pub fn app_paintable(self, app_paintable: bool) -> Self {
1326 Self {
1327 builder: self.builder.property("app-paintable", app_paintable),
1328 }
1329 }
1330
1331 pub fn can_default(self, can_default: bool) -> Self {
1332 Self {
1333 builder: self.builder.property("can-default", can_default),
1334 }
1335 }
1336
1337 pub fn can_focus(self, can_focus: bool) -> Self {
1338 Self {
1339 builder: self.builder.property("can-focus", can_focus),
1340 }
1341 }
1342
1343 pub fn events(self, events: gdk::EventMask) -> Self {
1344 Self {
1345 builder: self.builder.property("events", events),
1346 }
1347 }
1348
1349 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1350 pub fn expand(self, expand: bool) -> Self {
1351 Self {
1352 builder: self.builder.property("expand", expand),
1353 }
1354 }
1355
1356 /// Whether the widget should grab focus when it is clicked with the mouse.
1357 ///
1358 /// This property is only relevant for widgets that can take focus.
1359 ///
1360 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1361 /// GtkComboBox) implemented this property individually.
1362 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1363 Self {
1364 builder: self.builder.property("focus-on-click", focus_on_click),
1365 }
1366 }
1367
1368 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1369 pub fn halign(self, halign: Align) -> Self {
1370 Self {
1371 builder: self.builder.property("halign", halign),
1372 }
1373 }
1374
1375 pub fn has_default(self, has_default: bool) -> Self {
1376 Self {
1377 builder: self.builder.property("has-default", has_default),
1378 }
1379 }
1380
1381 pub fn has_focus(self, has_focus: bool) -> Self {
1382 Self {
1383 builder: self.builder.property("has-focus", has_focus),
1384 }
1385 }
1386
1387 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1388 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1389 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1390 /// whether it will provide a tooltip or not.
1391 ///
1392 /// Note that setting this property to [`true`] for the first time will change
1393 /// the event masks of the GdkWindows of this widget to include leave-notify
1394 /// and motion-notify events. This cannot and will not be undone when the
1395 /// property is set to [`false`] again.
1396 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1397 Self {
1398 builder: self.builder.property("has-tooltip", has_tooltip),
1399 }
1400 }
1401
1402 pub fn height_request(self, height_request: i32) -> Self {
1403 Self {
1404 builder: self.builder.property("height-request", height_request),
1405 }
1406 }
1407
1408 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1409 pub fn hexpand(self, hexpand: bool) -> Self {
1410 Self {
1411 builder: self.builder.property("hexpand", hexpand),
1412 }
1413 }
1414
1415 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1416 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1417 Self {
1418 builder: self.builder.property("hexpand-set", hexpand_set),
1419 }
1420 }
1421
1422 pub fn is_focus(self, is_focus: bool) -> Self {
1423 Self {
1424 builder: self.builder.property("is-focus", is_focus),
1425 }
1426 }
1427
1428 /// Sets all four sides' margin at once. If read, returns max
1429 /// margin on any side.
1430 pub fn margin(self, margin: i32) -> Self {
1431 Self {
1432 builder: self.builder.property("margin", margin),
1433 }
1434 }
1435
1436 /// Margin on bottom side of widget.
1437 ///
1438 /// This property adds margin outside of the widget's normal size
1439 /// request, the margin will be added in addition to the size from
1440 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1441 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1442 Self {
1443 builder: self.builder.property("margin-bottom", margin_bottom),
1444 }
1445 }
1446
1447 /// Margin on end of widget, horizontally. This property supports
1448 /// left-to-right and right-to-left text directions.
1449 ///
1450 /// This property adds margin outside of the widget's normal size
1451 /// request, the margin will be added in addition to the size from
1452 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1453 pub fn margin_end(self, margin_end: i32) -> Self {
1454 Self {
1455 builder: self.builder.property("margin-end", margin_end),
1456 }
1457 }
1458
1459 /// Margin on start of widget, horizontally. This property supports
1460 /// left-to-right and right-to-left text directions.
1461 ///
1462 /// This property adds margin outside of the widget's normal size
1463 /// request, the margin will be added in addition to the size from
1464 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1465 pub fn margin_start(self, margin_start: i32) -> Self {
1466 Self {
1467 builder: self.builder.property("margin-start", margin_start),
1468 }
1469 }
1470
1471 /// Margin on top side of widget.
1472 ///
1473 /// This property adds margin outside of the widget's normal size
1474 /// request, the margin will be added in addition to the size from
1475 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1476 pub fn margin_top(self, margin_top: i32) -> Self {
1477 Self {
1478 builder: self.builder.property("margin-top", margin_top),
1479 }
1480 }
1481
1482 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1483 Self {
1484 builder: self.builder.property("name", name.into()),
1485 }
1486 }
1487
1488 pub fn no_show_all(self, no_show_all: bool) -> Self {
1489 Self {
1490 builder: self.builder.property("no-show-all", no_show_all),
1491 }
1492 }
1493
1494 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1495 /// more details about window opacity.
1496 ///
1497 /// Before 3.8 this was only available in GtkWindow
1498 pub fn opacity(self, opacity: f64) -> Self {
1499 Self {
1500 builder: self.builder.property("opacity", opacity),
1501 }
1502 }
1503
1504 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1505 Self {
1506 builder: self.builder.property("parent", parent.clone().upcast()),
1507 }
1508 }
1509
1510 pub fn receives_default(self, receives_default: bool) -> Self {
1511 Self {
1512 builder: self.builder.property("receives-default", receives_default),
1513 }
1514 }
1515
1516 pub fn sensitive(self, sensitive: bool) -> Self {
1517 Self {
1518 builder: self.builder.property("sensitive", sensitive),
1519 }
1520 }
1521
1522 /// Sets the text of tooltip to be the given string, which is marked up
1523 /// with the [Pango text markup language][PangoMarkupFormat].
1524 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1525 ///
1526 /// This is a convenience property which will take care of getting the
1527 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1528 /// will automatically be set to [`true`] and there will be taken care of
1529 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1530 ///
1531 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1532 /// are set, the last one wins.
1533 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1534 Self {
1535 builder: self
1536 .builder
1537 .property("tooltip-markup", tooltip_markup.into()),
1538 }
1539 }
1540
1541 /// Sets the text of tooltip to be the given string.
1542 ///
1543 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1544 ///
1545 /// This is a convenience property which will take care of getting the
1546 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1547 /// will automatically be set to [`true`] and there will be taken care of
1548 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1549 ///
1550 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1551 /// are set, the last one wins.
1552 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1553 Self {
1554 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1555 }
1556 }
1557
1558 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1559 pub fn valign(self, valign: Align) -> Self {
1560 Self {
1561 builder: self.builder.property("valign", valign),
1562 }
1563 }
1564
1565 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1566 pub fn vexpand(self, vexpand: bool) -> Self {
1567 Self {
1568 builder: self.builder.property("vexpand", vexpand),
1569 }
1570 }
1571
1572 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1573 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1574 Self {
1575 builder: self.builder.property("vexpand-set", vexpand_set),
1576 }
1577 }
1578
1579 pub fn visible(self, visible: bool) -> Self {
1580 Self {
1581 builder: self.builder.property("visible", visible),
1582 }
1583 }
1584
1585 pub fn width_request(self, width_request: i32) -> Self {
1586 Self {
1587 builder: self.builder.property("width-request", width_request),
1588 }
1589 }
1590
1591 pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
1592 Self {
1593 builder: self.builder.property("action-name", action_name.into()),
1594 }
1595 }
1596
1597 pub fn action_target(self, action_target: &glib::Variant) -> Self {
1598 Self {
1599 builder: self
1600 .builder
1601 .property("action-target", action_target.clone()),
1602 }
1603 }
1604
1605 // rustdoc-stripper-ignore-next
1606 /// Build the [`RadioMenuItem`].
1607 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1608 pub fn build(self) -> RadioMenuItem {
1609 assert_initialized_main_thread!();
1610 self.builder.build()
1611 }
1612}
1613
1614/// Trait containing all [`struct@RadioMenuItem`] methods.
1615///
1616/// # Implementors
1617///
1618/// [`RadioMenuItem`][struct@crate::RadioMenuItem]
1619pub trait RadioMenuItemExt: IsA<RadioMenuItem> + 'static {
1620 /// Returns the group to which the radio menu item belongs, as a `GList` of
1621 /// [`RadioMenuItem`][crate::RadioMenuItem]. The list belongs to GTK+ and should not be freed.
1622 ///
1623 /// # Returns
1624 ///
1625 /// the group
1626 /// of `self`
1627 #[doc(alias = "gtk_radio_menu_item_get_group")]
1628 #[doc(alias = "get_group")]
1629 fn group(&self) -> Vec<RadioMenuItem> {
1630 unsafe {
1631 FromGlibPtrContainer::from_glib_none(ffi::gtk_radio_menu_item_get_group(
1632 self.as_ref().to_glib_none().0,
1633 ))
1634 }
1635 }
1636
1637 /// Joins a [`RadioMenuItem`][crate::RadioMenuItem] object to the group of another [`RadioMenuItem`][crate::RadioMenuItem]
1638 /// object.
1639 ///
1640 /// This function should be used by language bindings to avoid the memory
1641 /// manangement of the opaque `GSList` of [`group()`][Self::group()]
1642 /// and `gtk_radio_menu_item_set_group()`.
1643 ///
1644 /// A common way to set up a group of [`RadioMenuItem`][crate::RadioMenuItem] instances is:
1645 ///
1646 ///
1647 /// ```text
1648 /// GtkRadioMenuItem *last_item = NULL;
1649 ///
1650 /// while ( ...more items to add... )
1651 /// {
1652 /// GtkRadioMenuItem *radio_item;
1653 ///
1654 /// radio_item = gtk_radio_menu_item_new (...);
1655 ///
1656 /// gtk_radio_menu_item_join_group (radio_item, last_item);
1657 /// last_item = radio_item;
1658 /// }
1659 /// ```
1660 /// ## `group_source`
1661 /// a [`RadioMenuItem`][crate::RadioMenuItem] whose group we are
1662 /// joining, or [`None`] to remove the `self` from its current
1663 /// group
1664 #[doc(alias = "gtk_radio_menu_item_join_group")]
1665 fn join_group(&self, group_source: Option<&impl IsA<RadioMenuItem>>) {
1666 unsafe {
1667 ffi::gtk_radio_menu_item_join_group(
1668 self.as_ref().to_glib_none().0,
1669 group_source.map(|p| p.as_ref()).to_glib_none().0,
1670 );
1671 }
1672 }
1673
1674 #[doc(alias = "group-changed")]
1675 fn connect_group_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1676 unsafe extern "C" fn group_changed_trampoline<
1677 P: IsA<RadioMenuItem>,
1678 F: Fn(&P) + 'static,
1679 >(
1680 this: *mut ffi::GtkRadioMenuItem,
1681 f: glib::ffi::gpointer,
1682 ) {
1683 unsafe {
1684 let f: &F = &*(f as *const F);
1685 f(RadioMenuItem::from_glib_borrow(this).unsafe_cast_ref())
1686 }
1687 }
1688 unsafe {
1689 let f: Box_<F> = Box_::new(f);
1690 connect_raw(
1691 self.as_ptr() as *mut _,
1692 c"group-changed".as_ptr(),
1693 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1694 group_changed_trampoline::<Self, F> as *const (),
1695 )),
1696 Box_::into_raw(f),
1697 )
1698 }
1699 }
1700}
1701
1702impl<O: IsA<RadioMenuItem>> RadioMenuItemExt for O {}