gtk/auto/calendar.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::{Align, Buildable, CalendarDisplayOptions, Container, Widget, ffi};
6use glib::{
7 object::ObjectType as _,
8 prelude::*,
9 signal::{SignalHandlerId, connect_raw},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 /// [`Calendar`][crate::Calendar] is a widget that displays a Gregorian calendar, one month
16 /// at a time. It can be created with [`new()`][Self::new()].
17 ///
18 /// The month and year currently displayed can be altered with
19 /// [`CalendarExt::select_month()`][crate::prelude::CalendarExt::select_month()]. The exact day can be selected from the
20 /// displayed month using [`CalendarExt::select_day()`][crate::prelude::CalendarExt::select_day()].
21 ///
22 /// To place a visual marker on a particular day, use [`CalendarExt::mark_day()`][crate::prelude::CalendarExt::mark_day()]
23 /// and to remove the marker, [`CalendarExt::unmark_day()`][crate::prelude::CalendarExt::unmark_day()]. Alternative, all
24 /// marks can be cleared with [`CalendarExt::clear_marks()`][crate::prelude::CalendarExt::clear_marks()].
25 ///
26 /// The way in which the calendar itself is displayed can be altered using
27 /// [`CalendarExt::set_display_options()`][crate::prelude::CalendarExt::set_display_options()].
28 ///
29 /// The selected date can be retrieved from a [`Calendar`][crate::Calendar] using
30 /// [`CalendarExt::date()`][crate::prelude::CalendarExt::date()].
31 ///
32 /// Users should be aware that, although the Gregorian calendar is the
33 /// legal calendar in most countries, it was adopted progressively
34 /// between 1582 and 1929. Display before these dates is likely to be
35 /// historically incorrect.
36 ///
37 /// ## Properties
38 ///
39 ///
40 /// #### `day`
41 /// The selected day (as a number between 1 and 31, or 0
42 /// to unselect the currently selected day).
43 /// This property gets initially set to the current day.
44 ///
45 /// Readable | Writable
46 ///
47 ///
48 /// #### `detail-height-rows`
49 /// Height of a detail cell, in rows.
50 /// A value of 0 allows any width. See [`CalendarExt::set_detail_func()`][crate::prelude::CalendarExt::set_detail_func()].
51 ///
52 /// Readable | Writable
53 ///
54 ///
55 /// #### `detail-width-chars`
56 /// Width of a detail cell, in characters.
57 /// A value of 0 allows any width. See [`CalendarExt::set_detail_func()`][crate::prelude::CalendarExt::set_detail_func()].
58 ///
59 /// Readable | Writable
60 ///
61 ///
62 /// #### `month`
63 /// The selected month (as a number between 0 and 11).
64 /// This property gets initially set to the current month.
65 ///
66 /// Readable | Writable
67 ///
68 ///
69 /// #### `no-month-change`
70 /// Determines whether the selected month can be changed.
71 ///
72 /// Readable | Writable
73 ///
74 ///
75 /// #### `show-day-names`
76 /// Determines whether day names are displayed.
77 ///
78 /// Readable | Writable
79 ///
80 ///
81 /// #### `show-details`
82 /// Determines whether details are shown directly in the widget, or if they are
83 /// available only as tooltip. When this property is set days with details are
84 /// marked.
85 ///
86 /// Readable | Writable
87 ///
88 ///
89 /// #### `show-heading`
90 /// Determines whether a heading is displayed.
91 ///
92 /// Readable | Writable
93 ///
94 ///
95 /// #### `show-week-numbers`
96 /// Determines whether week numbers are displayed.
97 ///
98 /// Readable | Writable
99 ///
100 ///
101 /// #### `year`
102 /// The selected year.
103 /// This property gets initially set to the current year.
104 ///
105 /// Readable | Writable
106 /// <details><summary><h4>Widget</h4></summary>
107 ///
108 ///
109 /// #### `app-paintable`
110 /// Readable | Writable
111 ///
112 ///
113 /// #### `can-default`
114 /// Readable | Writable
115 ///
116 ///
117 /// #### `can-focus`
118 /// Readable | Writable
119 ///
120 ///
121 /// #### `composite-child`
122 /// Readable
123 ///
124 ///
125 /// #### `double-buffered`
126 /// Whether the widget is double buffered.
127 ///
128 /// Readable | Writable
129 ///
130 ///
131 /// #### `events`
132 /// Readable | Writable
133 ///
134 ///
135 /// #### `expand`
136 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
137 ///
138 /// Readable | Writable
139 ///
140 ///
141 /// #### `focus-on-click`
142 /// Whether the widget should grab focus when it is clicked with the mouse.
143 ///
144 /// This property is only relevant for widgets that can take focus.
145 ///
146 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
147 /// GtkComboBox) implemented this property individually.
148 ///
149 /// Readable | Writable
150 ///
151 ///
152 /// #### `halign`
153 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
154 ///
155 /// Readable | Writable
156 ///
157 ///
158 /// #### `has-default`
159 /// Readable | Writable
160 ///
161 ///
162 /// #### `has-focus`
163 /// Readable | Writable
164 ///
165 ///
166 /// #### `has-tooltip`
167 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
168 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
169 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
170 /// whether it will provide a tooltip or not.
171 ///
172 /// Note that setting this property to [`true`] for the first time will change
173 /// the event masks of the GdkWindows of this widget to include leave-notify
174 /// and motion-notify events. This cannot and will not be undone when the
175 /// property is set to [`false`] again.
176 ///
177 /// Readable | Writable
178 ///
179 ///
180 /// #### `height-request`
181 /// Readable | Writable
182 ///
183 ///
184 /// #### `hexpand`
185 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
186 ///
187 /// Readable | Writable
188 ///
189 ///
190 /// #### `hexpand-set`
191 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
192 ///
193 /// Readable | Writable
194 ///
195 ///
196 /// #### `is-focus`
197 /// Readable | Writable
198 ///
199 ///
200 /// #### `margin`
201 /// Sets all four sides' margin at once. If read, returns max
202 /// margin on any side.
203 ///
204 /// Readable | Writable
205 ///
206 ///
207 /// #### `margin-bottom`
208 /// Margin on bottom side of widget.
209 ///
210 /// This property adds margin outside of the widget's normal size
211 /// request, the margin will be added in addition to the size from
212 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
213 ///
214 /// Readable | Writable
215 ///
216 ///
217 /// #### `margin-end`
218 /// Margin on end of widget, horizontally. This property supports
219 /// left-to-right and right-to-left text directions.
220 ///
221 /// This property adds margin outside of the widget's normal size
222 /// request, the margin will be added in addition to the size from
223 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
224 ///
225 /// Readable | Writable
226 ///
227 ///
228 /// #### `margin-left`
229 /// Margin on left side of widget.
230 ///
231 /// This property adds margin outside of the widget's normal size
232 /// request, the margin will be added in addition to the size from
233 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
234 ///
235 /// Readable | Writable
236 ///
237 ///
238 /// #### `margin-right`
239 /// Margin on right side of widget.
240 ///
241 /// This property adds margin outside of the widget's normal size
242 /// request, the margin will be added in addition to the size from
243 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
244 ///
245 /// Readable | Writable
246 ///
247 ///
248 /// #### `margin-start`
249 /// Margin on start of widget, horizontally. This property supports
250 /// left-to-right and right-to-left text directions.
251 ///
252 /// This property adds margin outside of the widget's normal size
253 /// request, the margin will be added in addition to the size from
254 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
255 ///
256 /// Readable | Writable
257 ///
258 ///
259 /// #### `margin-top`
260 /// Margin on top side of widget.
261 ///
262 /// This property adds margin outside of the widget's normal size
263 /// request, the margin will be added in addition to the size from
264 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
265 ///
266 /// Readable | Writable
267 ///
268 ///
269 /// #### `name`
270 /// Readable | Writable
271 ///
272 ///
273 /// #### `no-show-all`
274 /// Readable | Writable
275 ///
276 ///
277 /// #### `opacity`
278 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
279 /// more details about window opacity.
280 ///
281 /// Before 3.8 this was only available in GtkWindow
282 ///
283 /// Readable | Writable
284 ///
285 ///
286 /// #### `parent`
287 /// Readable | Writable
288 ///
289 ///
290 /// #### `receives-default`
291 /// Readable | Writable
292 ///
293 ///
294 /// #### `scale-factor`
295 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
296 /// more details about widget scaling.
297 ///
298 /// Readable
299 ///
300 ///
301 /// #### `sensitive`
302 /// Readable | Writable
303 ///
304 ///
305 /// #### `style`
306 /// The style of the widget, which contains information about how it will look (colors, etc).
307 ///
308 /// Readable | Writable
309 ///
310 ///
311 /// #### `tooltip-markup`
312 /// Sets the text of tooltip to be the given string, which is marked up
313 /// with the [Pango text markup language][PangoMarkupFormat].
314 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
315 ///
316 /// This is a convenience property which will take care of getting the
317 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
318 /// will automatically be set to [`true`] and there will be taken care of
319 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
320 ///
321 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
322 /// are set, the last one wins.
323 ///
324 /// Readable | Writable
325 ///
326 ///
327 /// #### `tooltip-text`
328 /// Sets the text of tooltip to be the given string.
329 ///
330 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
331 ///
332 /// This is a convenience property which will take care of getting the
333 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
334 /// will automatically be set to [`true`] and there will be taken care of
335 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
336 ///
337 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
338 /// are set, the last one wins.
339 ///
340 /// Readable | Writable
341 ///
342 ///
343 /// #### `valign`
344 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
345 ///
346 /// Readable | Writable
347 ///
348 ///
349 /// #### `vexpand`
350 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
351 ///
352 /// Readable | Writable
353 ///
354 ///
355 /// #### `vexpand-set`
356 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
357 ///
358 /// Readable | Writable
359 ///
360 ///
361 /// #### `visible`
362 /// Readable | Writable
363 ///
364 ///
365 /// #### `width-request`
366 /// Readable | Writable
367 ///
368 ///
369 /// #### `window`
370 /// The widget's window if it is realized, [`None`] otherwise.
371 ///
372 /// Readable
373 /// </details>
374 ///
375 /// ## Signals
376 ///
377 ///
378 /// #### `day-selected`
379 /// Emitted when the user selects a day.
380 ///
381 ///
382 ///
383 ///
384 /// #### `day-selected-double-click`
385 /// Emitted when the user double-clicks a day.
386 ///
387 ///
388 ///
389 ///
390 /// #### `month-changed`
391 /// Emitted when the user clicks a button to change the selected month on a
392 /// calendar.
393 ///
394 ///
395 ///
396 ///
397 /// #### `next-month`
398 /// Emitted when the user switched to the next month.
399 ///
400 ///
401 ///
402 ///
403 /// #### `next-year`
404 /// Emitted when user switched to the next year.
405 ///
406 ///
407 ///
408 ///
409 /// #### `prev-month`
410 /// Emitted when the user switched to the previous month.
411 ///
412 ///
413 ///
414 ///
415 /// #### `prev-year`
416 /// Emitted when user switched to the previous year.
417 ///
418 ///
419 /// <details><summary><h4>Widget</h4></summary>
420 ///
421 ///
422 /// #### `accel-closures-changed`
423 ///
424 ///
425 ///
426 /// #### `button-press-event`
427 /// The ::button-press-event signal will be emitted when a button
428 /// (typically from a mouse) is pressed.
429 ///
430 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
431 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
432 ///
433 /// This signal will be sent to the grab widget if there is one.
434 ///
435 ///
436 ///
437 ///
438 /// #### `button-release-event`
439 /// The ::button-release-event signal will be emitted when a button
440 /// (typically from a mouse) is released.
441 ///
442 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
443 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
444 ///
445 /// This signal will be sent to the grab widget if there is one.
446 ///
447 ///
448 ///
449 ///
450 /// #### `can-activate-accel`
451 /// Determines whether an accelerator that activates the signal
452 /// identified by `signal_id` can currently be activated.
453 /// This signal is present to allow applications and derived
454 /// widgets to override the default [`Widget`][crate::Widget] handling
455 /// for determining whether an accelerator can be activated.
456 ///
457 ///
458 ///
459 ///
460 /// #### `child-notify`
461 /// The ::child-notify signal is emitted for each
462 /// [child property][child-properties] that has
463 /// changed on an object. The signal's detail holds the property name.
464 ///
465 /// Detailed
466 ///
467 ///
468 /// #### `composited-changed`
469 /// The ::composited-changed signal is emitted when the composited
470 /// status of `widgets` screen changes.
471 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
472 ///
473 /// Action
474 ///
475 ///
476 /// #### `configure-event`
477 /// The ::configure-event signal will be emitted when the size, position or
478 /// stacking of the `widget`'s window has changed.
479 ///
480 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
481 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
482 /// automatically for all new windows.
483 ///
484 ///
485 ///
486 ///
487 /// #### `damage-event`
488 /// Emitted when a redirected window belonging to `widget` gets drawn into.
489 /// The region/area members of the event shows what area of the redirected
490 /// drawable was drawn into.
491 ///
492 ///
493 ///
494 ///
495 /// #### `delete-event`
496 /// The ::delete-event signal is emitted if a user requests that
497 /// a toplevel window is closed. The default handler for this signal
498 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
499 /// this signal will cause the window to be hidden instead, so that
500 /// it can later be shown again without reconstructing it.
501 ///
502 ///
503 ///
504 ///
505 /// #### `destroy`
506 /// Signals that all holders of a reference to the widget should release
507 /// the reference that they hold. May result in finalization of the widget
508 /// if all references are released.
509 ///
510 /// This signal is not suitable for saving widget state.
511 ///
512 ///
513 ///
514 ///
515 /// #### `destroy-event`
516 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
517 /// You rarely get this signal, because most widgets disconnect themselves
518 /// from their window before they destroy it, so no widget owns the
519 /// window at destroy time.
520 ///
521 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
522 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
523 /// automatically for all new windows.
524 ///
525 ///
526 ///
527 ///
528 /// #### `direction-changed`
529 /// The ::direction-changed signal is emitted when the text direction
530 /// of a widget changes.
531 ///
532 ///
533 ///
534 ///
535 /// #### `drag-begin`
536 /// The ::drag-begin signal is emitted on the drag source when a drag is
537 /// started. A typical reason to connect to this signal is to set up a
538 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
539 ///
540 /// Note that some widgets set up a drag icon in the default handler of
541 /// this signal, so you may have to use `g_signal_connect_after()` to
542 /// override what the default handler did.
543 ///
544 ///
545 ///
546 ///
547 /// #### `drag-data-delete`
548 /// The ::drag-data-delete signal is emitted on the drag source when a drag
549 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
550 /// handler is responsible for deleting the data that has been dropped. What
551 /// "delete" means depends on the context of the drag operation.
552 ///
553 ///
554 ///
555 ///
556 /// #### `drag-data-get`
557 /// The ::drag-data-get signal is emitted on the drag source when the drop
558 /// site requests the data which is dragged. It is the responsibility of
559 /// the signal handler to fill `data` with the data in the format which
560 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
561 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
562 ///
563 ///
564 ///
565 ///
566 /// #### `drag-data-received`
567 /// format == 8))
568 /// {
569 /// GdkDragAction action;
570 ///
571 /// // handle data here
572 ///
573 /// action = gdk_drag_context_get_selected_action (context);
574 /// if (action == GDK_ACTION_ASK)
575 /// {
576 /// GtkWidget *dialog;
577 /// gint response;
578 ///
579 /// dialog = gtk_message_dialog_new (NULL,
580 /// GTK_DIALOG_MODAL |
581 /// GTK_DIALOG_DESTROY_WITH_PARENT,
582 /// GTK_MESSAGE_INFO,
583 /// GTK_BUTTONS_YES_NO,
584 /// "Move the data ?\n");
585 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
586 /// gtk_widget_destroy (dialog);
587 ///
588 /// if (response == GTK_RESPONSE_YES)
589 /// action = GDK_ACTION_MOVE;
590 /// else
591 /// action = GDK_ACTION_COPY;
592 /// }
593 ///
594 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
595 /// }
596 /// else
597 /// gtk_drag_finish (context, FALSE, FALSE, time);
598 /// }
599 /// ]|
600 ///
601 ///
602 ///
603 ///
604 /// #### `drag-drop`
605 /// The ::drag-drop signal is emitted on the drop site when the user drops
606 /// the data onto the widget. The signal handler must determine whether
607 /// the cursor position is in a drop zone or not. If it is not in a drop
608 /// zone, it returns [`false`] and no further processing is necessary.
609 /// Otherwise, the handler returns [`true`]. In this case, the handler must
610 /// ensure that `gtk_drag_finish()` is called to let the source know that
611 /// the drop is done. The call to `gtk_drag_finish()` can be done either
612 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
613 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
614 /// or more of the supported targets.
615 ///
616 ///
617 ///
618 ///
619 /// #### `drag-end`
620 /// The ::drag-end signal is emitted on the drag source when a drag is
621 /// finished. A typical reason to connect to this signal is to undo
622 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
623 ///
624 ///
625 ///
626 ///
627 /// #### `drag-failed`
628 /// The ::drag-failed signal is emitted on the drag source when a drag has
629 /// failed. The signal handler may hook custom code to handle a failed DnD
630 /// operation based on the type of error, it returns [`true`] is the failure has
631 /// been already handled (not showing the default "drag operation failed"
632 /// animation), otherwise it returns [`false`].
633 ///
634 ///
635 ///
636 ///
637 /// #### `drag-leave`
638 /// The ::drag-leave signal is emitted on the drop site when the cursor
639 /// leaves the widget. A typical reason to connect to this signal is to
640 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
641 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
642 ///
643 ///
644 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
645 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
646 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
647 ///
648 ///
649 ///
650 ///
651 /// #### `drag-motion`
652 /// suggested_action,
653 /// time);
654 /// }
655 /// else
656 /// {
657 /// // accept the drop
658 /// }
659 /// }
660 /// ]|
661 ///
662 ///
663 ///
664 ///
665 /// #### `draw`
666 /// This signal is emitted when a widget is supposed to render itself.
667 /// The `widget`'s top left corner must be painted at the origin of
668 /// the passed in context and be sized to the values returned by
669 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
670 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
671 ///
672 /// Signal handlers connected to this signal can modify the cairo
673 /// context passed as `cr` in any way they like and don't need to
674 /// restore it. The signal emission takes care of calling `cairo_save()`
675 /// before and `cairo_restore()` after invoking the handler.
676 ///
677 /// The signal handler will get a `cr` with a clip region already set to the
678 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
679 /// widgets that want to avoid redrawing themselves completely can get the full
680 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
681 /// get a finer-grained representation of the dirty region with
682 /// `cairo_copy_clip_rectangle_list()`.
683 ///
684 ///
685 ///
686 ///
687 /// #### `enter-notify-event`
688 /// The ::enter-notify-event will be emitted when the pointer enters
689 /// the `widget`'s window.
690 ///
691 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
692 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
693 ///
694 /// This signal will be sent to the grab widget if there is one.
695 ///
696 ///
697 ///
698 ///
699 /// #### `event`
700 /// The GTK+ main loop will emit three signals for each GDK event delivered
701 /// to a widget: one generic ::event signal, another, more specific,
702 /// signal that matches the type of event delivered (e.g.
703 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
704 /// [`event-after`][struct@crate::Widget#event-after] signal.
705 ///
706 ///
707 ///
708 ///
709 /// #### `event-after`
710 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
711 /// the second more specific signal, ::event-after will be emitted
712 /// regardless of the previous two signals handlers return values.
713 ///
714 ///
715 ///
716 ///
717 /// #### `focus`
718 ///
719 ///
720 ///
721 /// #### `focus-in-event`
722 /// The ::focus-in-event signal will be emitted when the keyboard focus
723 /// enters the `widget`'s window.
724 ///
725 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
726 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
727 ///
728 ///
729 ///
730 ///
731 /// #### `focus-out-event`
732 /// The ::focus-out-event signal will be emitted when the keyboard focus
733 /// leaves the `widget`'s window.
734 ///
735 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
736 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
737 ///
738 ///
739 ///
740 ///
741 /// #### `grab-broken-event`
742 /// Emitted when a pointer or keyboard grab on a window belonging
743 /// to `widget` gets broken.
744 ///
745 /// On X11, this happens when the grab window becomes unviewable
746 /// (i.e. it or one of its ancestors is unmapped), or if the same
747 /// application grabs the pointer or keyboard again.
748 ///
749 ///
750 ///
751 ///
752 /// #### `grab-focus`
753 /// Action
754 ///
755 ///
756 /// #### `grab-notify`
757 /// The ::grab-notify signal is emitted when a widget becomes
758 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
759 /// another widget, or when it becomes unshadowed due to a grab
760 /// being removed.
761 ///
762 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
763 /// grab widget in the grab stack of its window group is not
764 /// its ancestor.
765 ///
766 ///
767 ///
768 ///
769 /// #### `hide`
770 /// The ::hide signal is emitted when `widget` is hidden, for example with
771 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
772 ///
773 ///
774 ///
775 ///
776 /// #### `hierarchy-changed`
777 /// The ::hierarchy-changed signal is emitted when the
778 /// anchored state of a widget changes. A widget is
779 /// “anchored” when its toplevel
780 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
781 /// a widget changes from un-anchored to anchored or vice-versa.
782 ///
783 ///
784 ///
785 ///
786 /// #### `key-press-event`
787 /// The ::key-press-event signal is emitted when a key is pressed. The signal
788 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
789 ///
790 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
791 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
792 ///
793 /// This signal will be sent to the grab widget if there is one.
794 ///
795 ///
796 ///
797 ///
798 /// #### `key-release-event`
799 /// The ::key-release-event signal is emitted when a key is released.
800 ///
801 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
802 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
803 ///
804 /// This signal will be sent to the grab widget if there is one.
805 ///
806 ///
807 ///
808 ///
809 /// #### `keynav-failed`
810 /// Gets emitted if keyboard navigation fails.
811 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
812 ///
813 ///
814 ///
815 ///
816 /// #### `leave-notify-event`
817 /// The ::leave-notify-event will be emitted when the pointer leaves
818 /// the `widget`'s window.
819 ///
820 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
821 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
822 ///
823 /// This signal will be sent to the grab widget if there is one.
824 ///
825 ///
826 ///
827 ///
828 /// #### `map`
829 /// The ::map signal is emitted when `widget` is going to be mapped, that is
830 /// when the widget is visible (which is controlled with
831 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
832 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
833 /// be emitted.
834 ///
835 /// The ::map signal can be used to determine whether a widget will be drawn,
836 /// for instance it can resume an animation that was stopped during the
837 /// emission of [`unmap`][struct@crate::Widget#unmap].
838 ///
839 ///
840 ///
841 ///
842 /// #### `map-event`
843 /// The ::map-event signal will be emitted when the `widget`'s window is
844 /// mapped. A window is mapped when it becomes visible on the screen.
845 ///
846 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
847 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
848 /// automatically for all new windows.
849 ///
850 ///
851 ///
852 ///
853 /// #### `mnemonic-activate`
854 /// The default handler for this signal activates `widget` if `group_cycling`
855 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
856 ///
857 ///
858 ///
859 ///
860 /// #### `motion-notify-event`
861 /// The ::motion-notify-event signal is emitted when the pointer moves
862 /// over the widget's [`gdk::Window`][crate::gdk::Window].
863 ///
864 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
865 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
866 ///
867 /// This signal will be sent to the grab widget if there is one.
868 ///
869 ///
870 ///
871 ///
872 /// #### `move-focus`
873 /// Action
874 ///
875 ///
876 /// #### `parent-set`
877 /// The ::parent-set signal is emitted when a new parent
878 /// has been set on a widget.
879 ///
880 ///
881 ///
882 ///
883 /// #### `popup-menu`
884 /// This signal gets emitted whenever a widget should pop up a context
885 /// menu. This usually happens through the standard key binding mechanism;
886 /// by pressing a certain key while a widget is focused, the user can cause
887 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
888 /// a menu with clipboard commands. See the
889 /// [Popup Menu Migration Checklist][checklist-popup-menu]
890 /// for an example of how to use this signal.
891 ///
892 /// Action
893 ///
894 ///
895 /// #### `property-notify-event`
896 /// The ::property-notify-event signal will be emitted when a property on
897 /// the `widget`'s window has been changed or deleted.
898 ///
899 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
900 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
901 ///
902 ///
903 ///
904 ///
905 /// #### `proximity-in-event`
906 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
907 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
908 ///
909 /// This signal will be sent to the grab widget if there is one.
910 ///
911 ///
912 ///
913 ///
914 /// #### `proximity-out-event`
915 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
916 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
917 ///
918 /// This signal will be sent to the grab widget if there is one.
919 ///
920 ///
921 ///
922 ///
923 /// #### `query-tooltip`
924 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
925 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
926 /// focus in keyboard mode.
927 ///
928 /// Using the given coordinates, the signal handler should determine
929 /// whether a tooltip should be shown for `widget`. If this is the case
930 /// [`true`] should be returned, [`false`] otherwise. Note that if
931 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
932 /// should not be used.
933 ///
934 /// The signal handler is free to manipulate `tooltip` with the therefore
935 /// destined function calls.
936 ///
937 ///
938 ///
939 ///
940 /// #### `realize`
941 /// The ::realize signal is emitted when `widget` is associated with a
942 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
943 /// widget has been mapped (that is, it is going to be drawn).
944 ///
945 ///
946 ///
947 ///
948 /// #### `screen-changed`
949 /// The ::screen-changed signal gets emitted when the
950 /// screen of a widget has changed.
951 ///
952 ///
953 ///
954 ///
955 /// #### `scroll-event`
956 /// The ::scroll-event signal is emitted when a button in the 4 to 7
957 /// range is pressed. Wheel mice are usually configured to generate
958 /// button press events for buttons 4 and 5 when the wheel is turned.
959 ///
960 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
961 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
962 ///
963 /// This signal will be sent to the grab widget if there is one.
964 ///
965 ///
966 ///
967 ///
968 /// #### `selection-clear-event`
969 /// The ::selection-clear-event signal will be emitted when the
970 /// the `widget`'s window has lost ownership of a selection.
971 ///
972 ///
973 ///
974 ///
975 /// #### `selection-get`
976 ///
977 ///
978 ///
979 /// #### `selection-notify-event`
980 ///
981 ///
982 ///
983 /// #### `selection-received`
984 ///
985 ///
986 ///
987 /// #### `selection-request-event`
988 /// The ::selection-request-event signal will be emitted when
989 /// another client requests ownership of the selection owned by
990 /// the `widget`'s window.
991 ///
992 ///
993 ///
994 ///
995 /// #### `show`
996 /// The ::show signal is emitted when `widget` is shown, for example with
997 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
998 ///
999 ///
1000 ///
1001 ///
1002 /// #### `show-help`
1003 /// Action
1004 ///
1005 ///
1006 /// #### `size-allocate`
1007 ///
1008 ///
1009 ///
1010 /// #### `state-changed`
1011 /// The ::state-changed signal is emitted when the widget state changes.
1012 /// See `gtk_widget_get_state()`.
1013 ///
1014 ///
1015 ///
1016 ///
1017 /// #### `state-flags-changed`
1018 /// The ::state-flags-changed signal is emitted when the widget state
1019 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1020 ///
1021 ///
1022 ///
1023 ///
1024 /// #### `style-set`
1025 /// The ::style-set signal is emitted when a new style has been set
1026 /// on a widget. Note that style-modifying functions like
1027 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1028 ///
1029 /// Note that this signal is emitted for changes to the deprecated
1030 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1031 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1032 ///
1033 ///
1034 ///
1035 ///
1036 /// #### `style-updated`
1037 /// The ::style-updated signal is a convenience signal that is emitted when the
1038 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1039 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1040 ///
1041 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1042 /// cause this signal to be emitted.
1043 ///
1044 ///
1045 ///
1046 ///
1047 /// #### `touch-event`
1048 ///
1049 ///
1050 ///
1051 /// #### `unmap`
1052 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1053 /// means that either it or any of its parents up to the toplevel widget have
1054 /// been set as hidden.
1055 ///
1056 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1057 /// used to, for example, stop an animation on the widget.
1058 ///
1059 ///
1060 ///
1061 ///
1062 /// #### `unmap-event`
1063 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1064 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1065 ///
1066 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1067 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1068 /// automatically for all new windows.
1069 ///
1070 ///
1071 ///
1072 ///
1073 /// #### `unrealize`
1074 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1075 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1076 /// called or the widget has been unmapped (that is, it is going to be
1077 /// hidden).
1078 ///
1079 ///
1080 ///
1081 ///
1082 /// #### `visibility-notify-event`
1083 /// The ::visibility-notify-event will be emitted when the `widget`'s
1084 /// window is obscured or unobscured.
1085 ///
1086 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1087 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1088 ///
1089 ///
1090 ///
1091 ///
1092 /// #### `window-state-event`
1093 /// The ::window-state-event will be emitted when the state of the
1094 /// toplevel window associated to the `widget` changes.
1095 ///
1096 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1097 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1098 /// this mask automatically for all new windows.
1099 ///
1100 ///
1101 /// </details>
1102 ///
1103 /// # Implements
1104 ///
1105 /// [`CalendarExt`][trait@crate::prelude::CalendarExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1106 #[doc(alias = "GtkCalendar")]
1107 pub struct Calendar(Object<ffi::GtkCalendar, ffi::GtkCalendarClass>) @extends Widget, @implements Buildable;
1108
1109 match fn {
1110 type_ => || ffi::gtk_calendar_get_type(),
1111 }
1112}
1113
1114impl Calendar {
1115 pub const NONE: Option<&'static Calendar> = None;
1116
1117 /// Creates a new calendar, with the current date being selected.
1118 ///
1119 /// # Returns
1120 ///
1121 /// a newly [`Calendar`][crate::Calendar] widget
1122 #[doc(alias = "gtk_calendar_new")]
1123 pub fn new() -> Calendar {
1124 assert_initialized_main_thread!();
1125 unsafe { Widget::from_glib_none(ffi::gtk_calendar_new()).unsafe_cast() }
1126 }
1127
1128 // rustdoc-stripper-ignore-next
1129 /// Creates a new builder-pattern struct instance to construct [`Calendar`] objects.
1130 ///
1131 /// This method returns an instance of [`CalendarBuilder`](crate::builders::CalendarBuilder) which can be used to create [`Calendar`] objects.
1132 pub fn builder() -> CalendarBuilder {
1133 CalendarBuilder::new()
1134 }
1135}
1136
1137impl Default for Calendar {
1138 fn default() -> Self {
1139 Self::new()
1140 }
1141}
1142
1143// rustdoc-stripper-ignore-next
1144/// A [builder-pattern] type to construct [`Calendar`] objects.
1145///
1146/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1147#[must_use = "The builder must be built to be used"]
1148pub struct CalendarBuilder {
1149 builder: glib::object::ObjectBuilder<'static, Calendar>,
1150}
1151
1152impl CalendarBuilder {
1153 fn new() -> Self {
1154 Self {
1155 builder: glib::object::Object::builder(),
1156 }
1157 }
1158
1159 /// The selected day (as a number between 1 and 31, or 0
1160 /// to unselect the currently selected day).
1161 /// This property gets initially set to the current day.
1162 pub fn day(self, day: i32) -> Self {
1163 Self {
1164 builder: self.builder.property("day", day),
1165 }
1166 }
1167
1168 /// Height of a detail cell, in rows.
1169 /// A value of 0 allows any width. See [`CalendarExt::set_detail_func()`][crate::prelude::CalendarExt::set_detail_func()].
1170 pub fn detail_height_rows(self, detail_height_rows: i32) -> Self {
1171 Self {
1172 builder: self
1173 .builder
1174 .property("detail-height-rows", detail_height_rows),
1175 }
1176 }
1177
1178 /// Width of a detail cell, in characters.
1179 /// A value of 0 allows any width. See [`CalendarExt::set_detail_func()`][crate::prelude::CalendarExt::set_detail_func()].
1180 pub fn detail_width_chars(self, detail_width_chars: i32) -> Self {
1181 Self {
1182 builder: self
1183 .builder
1184 .property("detail-width-chars", detail_width_chars),
1185 }
1186 }
1187
1188 /// The selected month (as a number between 0 and 11).
1189 /// This property gets initially set to the current month.
1190 pub fn month(self, month: i32) -> Self {
1191 Self {
1192 builder: self.builder.property("month", month),
1193 }
1194 }
1195
1196 /// Determines whether the selected month can be changed.
1197 pub fn no_month_change(self, no_month_change: bool) -> Self {
1198 Self {
1199 builder: self.builder.property("no-month-change", no_month_change),
1200 }
1201 }
1202
1203 /// Determines whether day names are displayed.
1204 pub fn show_day_names(self, show_day_names: bool) -> Self {
1205 Self {
1206 builder: self.builder.property("show-day-names", show_day_names),
1207 }
1208 }
1209
1210 /// Determines whether details are shown directly in the widget, or if they are
1211 /// available only as tooltip. When this property is set days with details are
1212 /// marked.
1213 pub fn show_details(self, show_details: bool) -> Self {
1214 Self {
1215 builder: self.builder.property("show-details", show_details),
1216 }
1217 }
1218
1219 /// Determines whether a heading is displayed.
1220 pub fn show_heading(self, show_heading: bool) -> Self {
1221 Self {
1222 builder: self.builder.property("show-heading", show_heading),
1223 }
1224 }
1225
1226 /// Determines whether week numbers are displayed.
1227 pub fn show_week_numbers(self, show_week_numbers: bool) -> Self {
1228 Self {
1229 builder: self
1230 .builder
1231 .property("show-week-numbers", show_week_numbers),
1232 }
1233 }
1234
1235 /// The selected year.
1236 /// This property gets initially set to the current year.
1237 pub fn year(self, year: i32) -> Self {
1238 Self {
1239 builder: self.builder.property("year", year),
1240 }
1241 }
1242
1243 pub fn app_paintable(self, app_paintable: bool) -> Self {
1244 Self {
1245 builder: self.builder.property("app-paintable", app_paintable),
1246 }
1247 }
1248
1249 pub fn can_default(self, can_default: bool) -> Self {
1250 Self {
1251 builder: self.builder.property("can-default", can_default),
1252 }
1253 }
1254
1255 pub fn can_focus(self, can_focus: bool) -> Self {
1256 Self {
1257 builder: self.builder.property("can-focus", can_focus),
1258 }
1259 }
1260
1261 pub fn events(self, events: gdk::EventMask) -> Self {
1262 Self {
1263 builder: self.builder.property("events", events),
1264 }
1265 }
1266
1267 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1268 pub fn expand(self, expand: bool) -> Self {
1269 Self {
1270 builder: self.builder.property("expand", expand),
1271 }
1272 }
1273
1274 /// Whether the widget should grab focus when it is clicked with the mouse.
1275 ///
1276 /// This property is only relevant for widgets that can take focus.
1277 ///
1278 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1279 /// GtkComboBox) implemented this property individually.
1280 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1281 Self {
1282 builder: self.builder.property("focus-on-click", focus_on_click),
1283 }
1284 }
1285
1286 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1287 pub fn halign(self, halign: Align) -> Self {
1288 Self {
1289 builder: self.builder.property("halign", halign),
1290 }
1291 }
1292
1293 pub fn has_default(self, has_default: bool) -> Self {
1294 Self {
1295 builder: self.builder.property("has-default", has_default),
1296 }
1297 }
1298
1299 pub fn has_focus(self, has_focus: bool) -> Self {
1300 Self {
1301 builder: self.builder.property("has-focus", has_focus),
1302 }
1303 }
1304
1305 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1306 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1307 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1308 /// whether it will provide a tooltip or not.
1309 ///
1310 /// Note that setting this property to [`true`] for the first time will change
1311 /// the event masks of the GdkWindows of this widget to include leave-notify
1312 /// and motion-notify events. This cannot and will not be undone when the
1313 /// property is set to [`false`] again.
1314 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1315 Self {
1316 builder: self.builder.property("has-tooltip", has_tooltip),
1317 }
1318 }
1319
1320 pub fn height_request(self, height_request: i32) -> Self {
1321 Self {
1322 builder: self.builder.property("height-request", height_request),
1323 }
1324 }
1325
1326 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1327 pub fn hexpand(self, hexpand: bool) -> Self {
1328 Self {
1329 builder: self.builder.property("hexpand", hexpand),
1330 }
1331 }
1332
1333 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1334 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1335 Self {
1336 builder: self.builder.property("hexpand-set", hexpand_set),
1337 }
1338 }
1339
1340 pub fn is_focus(self, is_focus: bool) -> Self {
1341 Self {
1342 builder: self.builder.property("is-focus", is_focus),
1343 }
1344 }
1345
1346 /// Sets all four sides' margin at once. If read, returns max
1347 /// margin on any side.
1348 pub fn margin(self, margin: i32) -> Self {
1349 Self {
1350 builder: self.builder.property("margin", margin),
1351 }
1352 }
1353
1354 /// Margin on bottom side of widget.
1355 ///
1356 /// This property adds margin outside of the widget's normal size
1357 /// request, the margin will be added in addition to the size from
1358 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1359 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1360 Self {
1361 builder: self.builder.property("margin-bottom", margin_bottom),
1362 }
1363 }
1364
1365 /// Margin on end of widget, horizontally. This property supports
1366 /// left-to-right and right-to-left text directions.
1367 ///
1368 /// This property adds margin outside of the widget's normal size
1369 /// request, the margin will be added in addition to the size from
1370 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1371 pub fn margin_end(self, margin_end: i32) -> Self {
1372 Self {
1373 builder: self.builder.property("margin-end", margin_end),
1374 }
1375 }
1376
1377 /// Margin on start of widget, horizontally. This property supports
1378 /// left-to-right and right-to-left text directions.
1379 ///
1380 /// This property adds margin outside of the widget's normal size
1381 /// request, the margin will be added in addition to the size from
1382 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1383 pub fn margin_start(self, margin_start: i32) -> Self {
1384 Self {
1385 builder: self.builder.property("margin-start", margin_start),
1386 }
1387 }
1388
1389 /// Margin on top side of widget.
1390 ///
1391 /// This property adds margin outside of the widget's normal size
1392 /// request, the margin will be added in addition to the size from
1393 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1394 pub fn margin_top(self, margin_top: i32) -> Self {
1395 Self {
1396 builder: self.builder.property("margin-top", margin_top),
1397 }
1398 }
1399
1400 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1401 Self {
1402 builder: self.builder.property("name", name.into()),
1403 }
1404 }
1405
1406 pub fn no_show_all(self, no_show_all: bool) -> Self {
1407 Self {
1408 builder: self.builder.property("no-show-all", no_show_all),
1409 }
1410 }
1411
1412 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1413 /// more details about window opacity.
1414 ///
1415 /// Before 3.8 this was only available in GtkWindow
1416 pub fn opacity(self, opacity: f64) -> Self {
1417 Self {
1418 builder: self.builder.property("opacity", opacity),
1419 }
1420 }
1421
1422 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1423 Self {
1424 builder: self.builder.property("parent", parent.clone().upcast()),
1425 }
1426 }
1427
1428 pub fn receives_default(self, receives_default: bool) -> Self {
1429 Self {
1430 builder: self.builder.property("receives-default", receives_default),
1431 }
1432 }
1433
1434 pub fn sensitive(self, sensitive: bool) -> Self {
1435 Self {
1436 builder: self.builder.property("sensitive", sensitive),
1437 }
1438 }
1439
1440 /// Sets the text of tooltip to be the given string, which is marked up
1441 /// with the [Pango text markup language][PangoMarkupFormat].
1442 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1443 ///
1444 /// This is a convenience property which will take care of getting the
1445 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1446 /// will automatically be set to [`true`] and there will be taken care of
1447 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1448 ///
1449 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1450 /// are set, the last one wins.
1451 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1452 Self {
1453 builder: self
1454 .builder
1455 .property("tooltip-markup", tooltip_markup.into()),
1456 }
1457 }
1458
1459 /// Sets the text of tooltip to be the given string.
1460 ///
1461 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1462 ///
1463 /// This is a convenience property which will take care of getting the
1464 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1465 /// will automatically be set to [`true`] and there will be taken care of
1466 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1467 ///
1468 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1469 /// are set, the last one wins.
1470 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1471 Self {
1472 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1473 }
1474 }
1475
1476 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1477 pub fn valign(self, valign: Align) -> Self {
1478 Self {
1479 builder: self.builder.property("valign", valign),
1480 }
1481 }
1482
1483 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1484 pub fn vexpand(self, vexpand: bool) -> Self {
1485 Self {
1486 builder: self.builder.property("vexpand", vexpand),
1487 }
1488 }
1489
1490 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1491 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1492 Self {
1493 builder: self.builder.property("vexpand-set", vexpand_set),
1494 }
1495 }
1496
1497 pub fn visible(self, visible: bool) -> Self {
1498 Self {
1499 builder: self.builder.property("visible", visible),
1500 }
1501 }
1502
1503 pub fn width_request(self, width_request: i32) -> Self {
1504 Self {
1505 builder: self.builder.property("width-request", width_request),
1506 }
1507 }
1508
1509 // rustdoc-stripper-ignore-next
1510 /// Build the [`Calendar`].
1511 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1512 pub fn build(self) -> Calendar {
1513 assert_initialized_main_thread!();
1514 self.builder.build()
1515 }
1516}
1517
1518/// Trait containing all [`struct@Calendar`] methods.
1519///
1520/// # Implementors
1521///
1522/// [`Calendar`][struct@crate::Calendar]
1523pub trait CalendarExt: IsA<Calendar> + 'static {
1524 /// Remove all visual markers.
1525 #[doc(alias = "gtk_calendar_clear_marks")]
1526 fn clear_marks(&self) {
1527 unsafe {
1528 ffi::gtk_calendar_clear_marks(self.as_ref().to_glib_none().0);
1529 }
1530 }
1531
1532 /// Obtains the selected date from a [`Calendar`][crate::Calendar].
1533 ///
1534 /// # Returns
1535 ///
1536 ///
1537 /// ## `year`
1538 /// location to store the year as a decimal
1539 /// number (e.g. 2011), or [`None`]
1540 ///
1541 /// ## `month`
1542 /// location to store the month number
1543 /// (between 0 and 11), or [`None`]
1544 ///
1545 /// ## `day`
1546 /// location to store the day number (between
1547 /// 1 and 31), or [`None`]
1548 #[doc(alias = "gtk_calendar_get_date")]
1549 #[doc(alias = "get_date")]
1550 fn date(&self) -> (u32, u32, u32) {
1551 unsafe {
1552 let mut year = std::mem::MaybeUninit::uninit();
1553 let mut month = std::mem::MaybeUninit::uninit();
1554 let mut day = std::mem::MaybeUninit::uninit();
1555 ffi::gtk_calendar_get_date(
1556 self.as_ref().to_glib_none().0,
1557 year.as_mut_ptr(),
1558 month.as_mut_ptr(),
1559 day.as_mut_ptr(),
1560 );
1561 (year.assume_init(), month.assume_init(), day.assume_init())
1562 }
1563 }
1564
1565 /// Returns if the `day` of the `self` is already marked.
1566 /// ## `day`
1567 /// the day number between 1 and 31.
1568 ///
1569 /// # Returns
1570 ///
1571 /// whether the day is marked.
1572 #[doc(alias = "gtk_calendar_get_day_is_marked")]
1573 #[doc(alias = "get_day_is_marked")]
1574 fn day_is_marked(&self, day: u32) -> bool {
1575 unsafe {
1576 from_glib(ffi::gtk_calendar_get_day_is_marked(
1577 self.as_ref().to_glib_none().0,
1578 day,
1579 ))
1580 }
1581 }
1582
1583 /// Queries the height of detail cells, in rows.
1584 /// See [`detail-width-chars`][struct@crate::Calendar#detail-width-chars].
1585 ///
1586 /// # Returns
1587 ///
1588 /// The height of detail cells, in rows.
1589 #[doc(alias = "gtk_calendar_get_detail_height_rows")]
1590 #[doc(alias = "get_detail_height_rows")]
1591 #[doc(alias = "detail-height-rows")]
1592 fn detail_height_rows(&self) -> i32 {
1593 unsafe { ffi::gtk_calendar_get_detail_height_rows(self.as_ref().to_glib_none().0) }
1594 }
1595
1596 /// Queries the width of detail cells, in characters.
1597 /// See [`detail-width-chars`][struct@crate::Calendar#detail-width-chars].
1598 ///
1599 /// # Returns
1600 ///
1601 /// The width of detail cells, in characters.
1602 #[doc(alias = "gtk_calendar_get_detail_width_chars")]
1603 #[doc(alias = "get_detail_width_chars")]
1604 #[doc(alias = "detail-width-chars")]
1605 fn detail_width_chars(&self) -> i32 {
1606 unsafe { ffi::gtk_calendar_get_detail_width_chars(self.as_ref().to_glib_none().0) }
1607 }
1608
1609 /// Returns the current display options of `self`.
1610 ///
1611 /// # Returns
1612 ///
1613 /// the display options.
1614 #[doc(alias = "gtk_calendar_get_display_options")]
1615 #[doc(alias = "get_display_options")]
1616 fn display_options(&self) -> CalendarDisplayOptions {
1617 unsafe {
1618 from_glib(ffi::gtk_calendar_get_display_options(
1619 self.as_ref().to_glib_none().0,
1620 ))
1621 }
1622 }
1623
1624 /// Places a visual marker on a particular day.
1625 /// ## `day`
1626 /// the day number to mark between 1 and 31.
1627 #[doc(alias = "gtk_calendar_mark_day")]
1628 fn mark_day(&self, day: u32) {
1629 unsafe {
1630 ffi::gtk_calendar_mark_day(self.as_ref().to_glib_none().0, day);
1631 }
1632 }
1633
1634 /// Selects a day from the current month.
1635 /// ## `day`
1636 /// the day number between 1 and 31, or 0 to unselect
1637 /// the currently selected day.
1638 #[doc(alias = "gtk_calendar_select_day")]
1639 fn select_day(&self, day: u32) {
1640 unsafe {
1641 ffi::gtk_calendar_select_day(self.as_ref().to_glib_none().0, day);
1642 }
1643 }
1644
1645 /// Shifts the calendar to a different month.
1646 /// ## `month`
1647 /// a month number between 0 and 11.
1648 /// ## `year`
1649 /// the year the month is in.
1650 #[doc(alias = "gtk_calendar_select_month")]
1651 fn select_month(&self, month: u32, year: u32) {
1652 unsafe {
1653 ffi::gtk_calendar_select_month(self.as_ref().to_glib_none().0, month, year);
1654 }
1655 }
1656
1657 /// Installs a function which provides Pango markup with detail information
1658 /// for each day. Examples for such details are holidays or appointments. That
1659 /// information is shown below each day when [`show-details`][struct@crate::Calendar#show-details] is set.
1660 /// A tooltip containing with full detail information is provided, if the entire
1661 /// text should not fit into the details area, or if [`show-details`][struct@crate::Calendar#show-details]
1662 /// is not set.
1663 ///
1664 /// The size of the details area can be restricted by setting the
1665 /// [`detail-width-chars`][struct@crate::Calendar#detail-width-chars] and [`detail-height-rows`][struct@crate::Calendar#detail-height-rows]
1666 /// properties.
1667 /// ## `func`
1668 /// a function providing details for each day.
1669 #[doc(alias = "gtk_calendar_set_detail_func")]
1670 fn set_detail_func<P: Fn(&Calendar, u32, u32, u32) -> Option<String> + 'static>(
1671 &self,
1672 func: P,
1673 ) {
1674 let func_data: Box_<P> = Box_::new(func);
1675 unsafe extern "C" fn func_func<
1676 P: Fn(&Calendar, u32, u32, u32) -> Option<String> + 'static,
1677 >(
1678 calendar: *mut ffi::GtkCalendar,
1679 year: std::ffi::c_uint,
1680 month: std::ffi::c_uint,
1681 day: std::ffi::c_uint,
1682 user_data: glib::ffi::gpointer,
1683 ) -> *mut std::ffi::c_char {
1684 unsafe {
1685 let calendar = from_glib_borrow(calendar);
1686 let callback = &*(user_data as *mut P);
1687 (*callback)(&calendar, year, month, day).to_glib_full()
1688 }
1689 }
1690 let func = Some(func_func::<P> as _);
1691 unsafe extern "C" fn destroy_func<
1692 P: Fn(&Calendar, u32, u32, u32) -> Option<String> + 'static,
1693 >(
1694 data: glib::ffi::gpointer,
1695 ) {
1696 unsafe {
1697 let _callback = Box_::from_raw(data as *mut P);
1698 }
1699 }
1700 let destroy_call3 = Some(destroy_func::<P> as _);
1701 let super_callback0: Box_<P> = func_data;
1702 unsafe {
1703 ffi::gtk_calendar_set_detail_func(
1704 self.as_ref().to_glib_none().0,
1705 func,
1706 Box_::into_raw(super_callback0) as *mut _,
1707 destroy_call3,
1708 );
1709 }
1710 }
1711
1712 /// Updates the height of detail cells.
1713 /// See [`detail-height-rows`][struct@crate::Calendar#detail-height-rows].
1714 /// ## `rows`
1715 /// detail height in rows.
1716 #[doc(alias = "gtk_calendar_set_detail_height_rows")]
1717 #[doc(alias = "detail-height-rows")]
1718 fn set_detail_height_rows(&self, rows: i32) {
1719 unsafe {
1720 ffi::gtk_calendar_set_detail_height_rows(self.as_ref().to_glib_none().0, rows);
1721 }
1722 }
1723
1724 /// Updates the width of detail cells.
1725 /// See [`detail-width-chars`][struct@crate::Calendar#detail-width-chars].
1726 /// ## `chars`
1727 /// detail width in characters.
1728 #[doc(alias = "gtk_calendar_set_detail_width_chars")]
1729 #[doc(alias = "detail-width-chars")]
1730 fn set_detail_width_chars(&self, chars: i32) {
1731 unsafe {
1732 ffi::gtk_calendar_set_detail_width_chars(self.as_ref().to_glib_none().0, chars);
1733 }
1734 }
1735
1736 /// Sets display options (whether to display the heading and the month
1737 /// headings).
1738 /// ## `flags`
1739 /// the display options to set
1740 #[doc(alias = "gtk_calendar_set_display_options")]
1741 fn set_display_options(&self, flags: CalendarDisplayOptions) {
1742 unsafe {
1743 ffi::gtk_calendar_set_display_options(
1744 self.as_ref().to_glib_none().0,
1745 flags.into_glib(),
1746 );
1747 }
1748 }
1749
1750 /// Removes the visual marker from a particular day.
1751 /// ## `day`
1752 /// the day number to unmark between 1 and 31.
1753 #[doc(alias = "gtk_calendar_unmark_day")]
1754 fn unmark_day(&self, day: u32) {
1755 unsafe {
1756 ffi::gtk_calendar_unmark_day(self.as_ref().to_glib_none().0, day);
1757 }
1758 }
1759
1760 /// The selected day (as a number between 1 and 31, or 0
1761 /// to unselect the currently selected day).
1762 /// This property gets initially set to the current day.
1763 fn day(&self) -> i32 {
1764 ObjectExt::property(self.as_ref(), "day")
1765 }
1766
1767 /// The selected day (as a number between 1 and 31, or 0
1768 /// to unselect the currently selected day).
1769 /// This property gets initially set to the current day.
1770 fn set_day(&self, day: i32) {
1771 ObjectExt::set_property(self.as_ref(), "day", day)
1772 }
1773
1774 /// The selected month (as a number between 0 and 11).
1775 /// This property gets initially set to the current month.
1776 fn month(&self) -> i32 {
1777 ObjectExt::property(self.as_ref(), "month")
1778 }
1779
1780 /// The selected month (as a number between 0 and 11).
1781 /// This property gets initially set to the current month.
1782 fn set_month(&self, month: i32) {
1783 ObjectExt::set_property(self.as_ref(), "month", month)
1784 }
1785
1786 /// Determines whether the selected month can be changed.
1787 #[doc(alias = "no-month-change")]
1788 fn is_no_month_change(&self) -> bool {
1789 ObjectExt::property(self.as_ref(), "no-month-change")
1790 }
1791
1792 /// Determines whether the selected month can be changed.
1793 #[doc(alias = "no-month-change")]
1794 fn set_no_month_change(&self, no_month_change: bool) {
1795 ObjectExt::set_property(self.as_ref(), "no-month-change", no_month_change)
1796 }
1797
1798 /// Determines whether day names are displayed.
1799 #[doc(alias = "show-day-names")]
1800 fn shows_day_names(&self) -> bool {
1801 ObjectExt::property(self.as_ref(), "show-day-names")
1802 }
1803
1804 /// Determines whether day names are displayed.
1805 #[doc(alias = "show-day-names")]
1806 fn set_show_day_names(&self, show_day_names: bool) {
1807 ObjectExt::set_property(self.as_ref(), "show-day-names", show_day_names)
1808 }
1809
1810 /// Determines whether details are shown directly in the widget, or if they are
1811 /// available only as tooltip. When this property is set days with details are
1812 /// marked.
1813 #[doc(alias = "show-details")]
1814 fn shows_details(&self) -> bool {
1815 ObjectExt::property(self.as_ref(), "show-details")
1816 }
1817
1818 /// Determines whether details are shown directly in the widget, or if they are
1819 /// available only as tooltip. When this property is set days with details are
1820 /// marked.
1821 #[doc(alias = "show-details")]
1822 fn set_show_details(&self, show_details: bool) {
1823 ObjectExt::set_property(self.as_ref(), "show-details", show_details)
1824 }
1825
1826 /// Determines whether a heading is displayed.
1827 #[doc(alias = "show-heading")]
1828 fn shows_heading(&self) -> bool {
1829 ObjectExt::property(self.as_ref(), "show-heading")
1830 }
1831
1832 /// Determines whether a heading is displayed.
1833 #[doc(alias = "show-heading")]
1834 fn set_show_heading(&self, show_heading: bool) {
1835 ObjectExt::set_property(self.as_ref(), "show-heading", show_heading)
1836 }
1837
1838 /// Determines whether week numbers are displayed.
1839 #[doc(alias = "show-week-numbers")]
1840 fn shows_week_numbers(&self) -> bool {
1841 ObjectExt::property(self.as_ref(), "show-week-numbers")
1842 }
1843
1844 /// Determines whether week numbers are displayed.
1845 #[doc(alias = "show-week-numbers")]
1846 fn set_show_week_numbers(&self, show_week_numbers: bool) {
1847 ObjectExt::set_property(self.as_ref(), "show-week-numbers", show_week_numbers)
1848 }
1849
1850 /// The selected year.
1851 /// This property gets initially set to the current year.
1852 fn year(&self) -> i32 {
1853 ObjectExt::property(self.as_ref(), "year")
1854 }
1855
1856 /// The selected year.
1857 /// This property gets initially set to the current year.
1858 fn set_year(&self, year: i32) {
1859 ObjectExt::set_property(self.as_ref(), "year", year)
1860 }
1861
1862 /// Emitted when the user selects a day.
1863 #[doc(alias = "day-selected")]
1864 fn connect_day_selected<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1865 unsafe extern "C" fn day_selected_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
1866 this: *mut ffi::GtkCalendar,
1867 f: glib::ffi::gpointer,
1868 ) {
1869 unsafe {
1870 let f: &F = &*(f as *const F);
1871 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
1872 }
1873 }
1874 unsafe {
1875 let f: Box_<F> = Box_::new(f);
1876 connect_raw(
1877 self.as_ptr() as *mut _,
1878 c"day-selected".as_ptr(),
1879 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1880 day_selected_trampoline::<Self, F> as *const (),
1881 )),
1882 Box_::into_raw(f),
1883 )
1884 }
1885 }
1886
1887 /// Emitted when the user double-clicks a day.
1888 #[doc(alias = "day-selected-double-click")]
1889 fn connect_day_selected_double_click<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1890 unsafe extern "C" fn day_selected_double_click_trampoline<
1891 P: IsA<Calendar>,
1892 F: Fn(&P) + 'static,
1893 >(
1894 this: *mut ffi::GtkCalendar,
1895 f: glib::ffi::gpointer,
1896 ) {
1897 unsafe {
1898 let f: &F = &*(f as *const F);
1899 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
1900 }
1901 }
1902 unsafe {
1903 let f: Box_<F> = Box_::new(f);
1904 connect_raw(
1905 self.as_ptr() as *mut _,
1906 c"day-selected-double-click".as_ptr(),
1907 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1908 day_selected_double_click_trampoline::<Self, F> as *const (),
1909 )),
1910 Box_::into_raw(f),
1911 )
1912 }
1913 }
1914
1915 /// Emitted when the user clicks a button to change the selected month on a
1916 /// calendar.
1917 #[doc(alias = "month-changed")]
1918 fn connect_month_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1919 unsafe extern "C" fn month_changed_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
1920 this: *mut ffi::GtkCalendar,
1921 f: glib::ffi::gpointer,
1922 ) {
1923 unsafe {
1924 let f: &F = &*(f as *const F);
1925 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
1926 }
1927 }
1928 unsafe {
1929 let f: Box_<F> = Box_::new(f);
1930 connect_raw(
1931 self.as_ptr() as *mut _,
1932 c"month-changed".as_ptr(),
1933 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1934 month_changed_trampoline::<Self, F> as *const (),
1935 )),
1936 Box_::into_raw(f),
1937 )
1938 }
1939 }
1940
1941 /// Emitted when the user switched to the next month.
1942 #[doc(alias = "next-month")]
1943 fn connect_next_month<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1944 unsafe extern "C" fn next_month_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
1945 this: *mut ffi::GtkCalendar,
1946 f: glib::ffi::gpointer,
1947 ) {
1948 unsafe {
1949 let f: &F = &*(f as *const F);
1950 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
1951 }
1952 }
1953 unsafe {
1954 let f: Box_<F> = Box_::new(f);
1955 connect_raw(
1956 self.as_ptr() as *mut _,
1957 c"next-month".as_ptr(),
1958 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1959 next_month_trampoline::<Self, F> as *const (),
1960 )),
1961 Box_::into_raw(f),
1962 )
1963 }
1964 }
1965
1966 /// Emitted when user switched to the next year.
1967 #[doc(alias = "next-year")]
1968 fn connect_next_year<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1969 unsafe extern "C" fn next_year_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
1970 this: *mut ffi::GtkCalendar,
1971 f: glib::ffi::gpointer,
1972 ) {
1973 unsafe {
1974 let f: &F = &*(f as *const F);
1975 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
1976 }
1977 }
1978 unsafe {
1979 let f: Box_<F> = Box_::new(f);
1980 connect_raw(
1981 self.as_ptr() as *mut _,
1982 c"next-year".as_ptr(),
1983 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1984 next_year_trampoline::<Self, F> as *const (),
1985 )),
1986 Box_::into_raw(f),
1987 )
1988 }
1989 }
1990
1991 /// Emitted when the user switched to the previous month.
1992 #[doc(alias = "prev-month")]
1993 fn connect_prev_month<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1994 unsafe extern "C" fn prev_month_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
1995 this: *mut ffi::GtkCalendar,
1996 f: glib::ffi::gpointer,
1997 ) {
1998 unsafe {
1999 let f: &F = &*(f as *const F);
2000 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2001 }
2002 }
2003 unsafe {
2004 let f: Box_<F> = Box_::new(f);
2005 connect_raw(
2006 self.as_ptr() as *mut _,
2007 c"prev-month".as_ptr(),
2008 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2009 prev_month_trampoline::<Self, F> as *const (),
2010 )),
2011 Box_::into_raw(f),
2012 )
2013 }
2014 }
2015
2016 /// Emitted when user switched to the previous year.
2017 #[doc(alias = "prev-year")]
2018 fn connect_prev_year<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2019 unsafe extern "C" fn prev_year_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
2020 this: *mut ffi::GtkCalendar,
2021 f: glib::ffi::gpointer,
2022 ) {
2023 unsafe {
2024 let f: &F = &*(f as *const F);
2025 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2026 }
2027 }
2028 unsafe {
2029 let f: Box_<F> = Box_::new(f);
2030 connect_raw(
2031 self.as_ptr() as *mut _,
2032 c"prev-year".as_ptr(),
2033 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2034 prev_year_trampoline::<Self, F> as *const (),
2035 )),
2036 Box_::into_raw(f),
2037 )
2038 }
2039 }
2040
2041 #[doc(alias = "day")]
2042 fn connect_day_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2043 unsafe extern "C" fn notify_day_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
2044 this: *mut ffi::GtkCalendar,
2045 _param_spec: glib::ffi::gpointer,
2046 f: glib::ffi::gpointer,
2047 ) {
2048 unsafe {
2049 let f: &F = &*(f as *const F);
2050 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2051 }
2052 }
2053 unsafe {
2054 let f: Box_<F> = Box_::new(f);
2055 connect_raw(
2056 self.as_ptr() as *mut _,
2057 c"notify::day".as_ptr(),
2058 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2059 notify_day_trampoline::<Self, F> as *const (),
2060 )),
2061 Box_::into_raw(f),
2062 )
2063 }
2064 }
2065
2066 #[doc(alias = "detail-height-rows")]
2067 fn connect_detail_height_rows_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2068 unsafe extern "C" fn notify_detail_height_rows_trampoline<
2069 P: IsA<Calendar>,
2070 F: Fn(&P) + 'static,
2071 >(
2072 this: *mut ffi::GtkCalendar,
2073 _param_spec: glib::ffi::gpointer,
2074 f: glib::ffi::gpointer,
2075 ) {
2076 unsafe {
2077 let f: &F = &*(f as *const F);
2078 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2079 }
2080 }
2081 unsafe {
2082 let f: Box_<F> = Box_::new(f);
2083 connect_raw(
2084 self.as_ptr() as *mut _,
2085 c"notify::detail-height-rows".as_ptr(),
2086 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2087 notify_detail_height_rows_trampoline::<Self, F> as *const (),
2088 )),
2089 Box_::into_raw(f),
2090 )
2091 }
2092 }
2093
2094 #[doc(alias = "detail-width-chars")]
2095 fn connect_detail_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2096 unsafe extern "C" fn notify_detail_width_chars_trampoline<
2097 P: IsA<Calendar>,
2098 F: Fn(&P) + 'static,
2099 >(
2100 this: *mut ffi::GtkCalendar,
2101 _param_spec: glib::ffi::gpointer,
2102 f: glib::ffi::gpointer,
2103 ) {
2104 unsafe {
2105 let f: &F = &*(f as *const F);
2106 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2107 }
2108 }
2109 unsafe {
2110 let f: Box_<F> = Box_::new(f);
2111 connect_raw(
2112 self.as_ptr() as *mut _,
2113 c"notify::detail-width-chars".as_ptr(),
2114 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2115 notify_detail_width_chars_trampoline::<Self, F> as *const (),
2116 )),
2117 Box_::into_raw(f),
2118 )
2119 }
2120 }
2121
2122 #[doc(alias = "month")]
2123 fn connect_month_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2124 unsafe extern "C" fn notify_month_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
2125 this: *mut ffi::GtkCalendar,
2126 _param_spec: glib::ffi::gpointer,
2127 f: glib::ffi::gpointer,
2128 ) {
2129 unsafe {
2130 let f: &F = &*(f as *const F);
2131 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2132 }
2133 }
2134 unsafe {
2135 let f: Box_<F> = Box_::new(f);
2136 connect_raw(
2137 self.as_ptr() as *mut _,
2138 c"notify::month".as_ptr(),
2139 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2140 notify_month_trampoline::<Self, F> as *const (),
2141 )),
2142 Box_::into_raw(f),
2143 )
2144 }
2145 }
2146
2147 #[doc(alias = "no-month-change")]
2148 fn connect_no_month_change_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2149 unsafe extern "C" fn notify_no_month_change_trampoline<
2150 P: IsA<Calendar>,
2151 F: Fn(&P) + 'static,
2152 >(
2153 this: *mut ffi::GtkCalendar,
2154 _param_spec: glib::ffi::gpointer,
2155 f: glib::ffi::gpointer,
2156 ) {
2157 unsafe {
2158 let f: &F = &*(f as *const F);
2159 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2160 }
2161 }
2162 unsafe {
2163 let f: Box_<F> = Box_::new(f);
2164 connect_raw(
2165 self.as_ptr() as *mut _,
2166 c"notify::no-month-change".as_ptr(),
2167 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2168 notify_no_month_change_trampoline::<Self, F> as *const (),
2169 )),
2170 Box_::into_raw(f),
2171 )
2172 }
2173 }
2174
2175 #[doc(alias = "show-day-names")]
2176 fn connect_show_day_names_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2177 unsafe extern "C" fn notify_show_day_names_trampoline<
2178 P: IsA<Calendar>,
2179 F: Fn(&P) + 'static,
2180 >(
2181 this: *mut ffi::GtkCalendar,
2182 _param_spec: glib::ffi::gpointer,
2183 f: glib::ffi::gpointer,
2184 ) {
2185 unsafe {
2186 let f: &F = &*(f as *const F);
2187 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2188 }
2189 }
2190 unsafe {
2191 let f: Box_<F> = Box_::new(f);
2192 connect_raw(
2193 self.as_ptr() as *mut _,
2194 c"notify::show-day-names".as_ptr(),
2195 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2196 notify_show_day_names_trampoline::<Self, F> as *const (),
2197 )),
2198 Box_::into_raw(f),
2199 )
2200 }
2201 }
2202
2203 #[doc(alias = "show-details")]
2204 fn connect_show_details_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2205 unsafe extern "C" fn notify_show_details_trampoline<
2206 P: IsA<Calendar>,
2207 F: Fn(&P) + 'static,
2208 >(
2209 this: *mut ffi::GtkCalendar,
2210 _param_spec: glib::ffi::gpointer,
2211 f: glib::ffi::gpointer,
2212 ) {
2213 unsafe {
2214 let f: &F = &*(f as *const F);
2215 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2216 }
2217 }
2218 unsafe {
2219 let f: Box_<F> = Box_::new(f);
2220 connect_raw(
2221 self.as_ptr() as *mut _,
2222 c"notify::show-details".as_ptr(),
2223 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2224 notify_show_details_trampoline::<Self, F> as *const (),
2225 )),
2226 Box_::into_raw(f),
2227 )
2228 }
2229 }
2230
2231 #[doc(alias = "show-heading")]
2232 fn connect_show_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2233 unsafe extern "C" fn notify_show_heading_trampoline<
2234 P: IsA<Calendar>,
2235 F: Fn(&P) + 'static,
2236 >(
2237 this: *mut ffi::GtkCalendar,
2238 _param_spec: glib::ffi::gpointer,
2239 f: glib::ffi::gpointer,
2240 ) {
2241 unsafe {
2242 let f: &F = &*(f as *const F);
2243 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2244 }
2245 }
2246 unsafe {
2247 let f: Box_<F> = Box_::new(f);
2248 connect_raw(
2249 self.as_ptr() as *mut _,
2250 c"notify::show-heading".as_ptr(),
2251 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2252 notify_show_heading_trampoline::<Self, F> as *const (),
2253 )),
2254 Box_::into_raw(f),
2255 )
2256 }
2257 }
2258
2259 #[doc(alias = "show-week-numbers")]
2260 fn connect_show_week_numbers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2261 unsafe extern "C" fn notify_show_week_numbers_trampoline<
2262 P: IsA<Calendar>,
2263 F: Fn(&P) + 'static,
2264 >(
2265 this: *mut ffi::GtkCalendar,
2266 _param_spec: glib::ffi::gpointer,
2267 f: glib::ffi::gpointer,
2268 ) {
2269 unsafe {
2270 let f: &F = &*(f as *const F);
2271 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2272 }
2273 }
2274 unsafe {
2275 let f: Box_<F> = Box_::new(f);
2276 connect_raw(
2277 self.as_ptr() as *mut _,
2278 c"notify::show-week-numbers".as_ptr(),
2279 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2280 notify_show_week_numbers_trampoline::<Self, F> as *const (),
2281 )),
2282 Box_::into_raw(f),
2283 )
2284 }
2285 }
2286
2287 #[doc(alias = "year")]
2288 fn connect_year_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2289 unsafe extern "C" fn notify_year_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
2290 this: *mut ffi::GtkCalendar,
2291 _param_spec: glib::ffi::gpointer,
2292 f: glib::ffi::gpointer,
2293 ) {
2294 unsafe {
2295 let f: &F = &*(f as *const F);
2296 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2297 }
2298 }
2299 unsafe {
2300 let f: Box_<F> = Box_::new(f);
2301 connect_raw(
2302 self.as_ptr() as *mut _,
2303 c"notify::year".as_ptr(),
2304 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2305 notify_year_trampoline::<Self, F> as *const (),
2306 )),
2307 Box_::into_raw(f),
2308 )
2309 }
2310 }
2311}
2312
2313impl<O: IsA<Calendar>> CalendarExt for O {}