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