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