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