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 /// The ::drag-data-received signal is emitted on the drop site when the
568 /// dragged data has been received. If the data was received in order to
569 /// determine whether the drop will be accepted, the handler is expected
570 /// to call `gdk_drag_status()` and not finish the drag.
571 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
572 /// (and this is the last target to be received), the handler for this
573 /// signal is expected to process the received data and then call
574 /// `gtk_drag_finish()`, setting the `success` parameter depending on
575 /// whether the data was processed successfully.
576 ///
577 /// Applications must create some means to determine why the signal was emitted
578 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
579 ///
580 /// The handler may inspect the selected action with
581 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
582 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
583 /// shown in the following example:
584 ///
585 ///
586 /// **⚠️ The following code is in C ⚠️**
587 ///
588 /// ```C
589 /// void
590 /// drag_data_received (GtkWidget *widget,
591 /// GdkDragContext *context,
592 /// gint x,
593 /// gint y,
594 /// GtkSelectionData *data,
595 /// guint info,
596 /// guint time)
597 /// {
598 /// if ((data->length >= 0) && (data->format == 8))
599 /// {
600 /// GdkDragAction action;
601 ///
602 /// // handle data here
603 ///
604 /// action = gdk_drag_context_get_selected_action (context);
605 /// if (action == GDK_ACTION_ASK)
606 /// {
607 /// GtkWidget *dialog;
608 /// gint response;
609 ///
610 /// dialog = gtk_message_dialog_new (NULL,
611 /// GTK_DIALOG_MODAL |
612 /// GTK_DIALOG_DESTROY_WITH_PARENT,
613 /// GTK_MESSAGE_INFO,
614 /// GTK_BUTTONS_YES_NO,
615 /// "Move the data ?\n");
616 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
617 /// gtk_widget_destroy (dialog);
618 ///
619 /// if (response == GTK_RESPONSE_YES)
620 /// action = GDK_ACTION_MOVE;
621 /// else
622 /// action = GDK_ACTION_COPY;
623 /// }
624 ///
625 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
626 /// }
627 /// else
628 /// gtk_drag_finish (context, FALSE, FALSE, time);
629 /// }
630 /// ```
631 ///
632 ///
633 ///
634 ///
635 /// #### `drag-drop`
636 /// The ::drag-drop signal is emitted on the drop site when the user drops
637 /// the data onto the widget. The signal handler must determine whether
638 /// the cursor position is in a drop zone or not. If it is not in a drop
639 /// zone, it returns [`false`] and no further processing is necessary.
640 /// Otherwise, the handler returns [`true`]. In this case, the handler must
641 /// ensure that `gtk_drag_finish()` is called to let the source know that
642 /// the drop is done. The call to `gtk_drag_finish()` can be done either
643 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
644 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
645 /// or more of the supported targets.
646 ///
647 ///
648 ///
649 ///
650 /// #### `drag-end`
651 /// The ::drag-end signal is emitted on the drag source when a drag is
652 /// finished. A typical reason to connect to this signal is to undo
653 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
654 ///
655 ///
656 ///
657 ///
658 /// #### `drag-failed`
659 /// The ::drag-failed signal is emitted on the drag source when a drag has
660 /// failed. The signal handler may hook custom code to handle a failed DnD
661 /// operation based on the type of error, it returns [`true`] is the failure has
662 /// been already handled (not showing the default "drag operation failed"
663 /// animation), otherwise it returns [`false`].
664 ///
665 ///
666 ///
667 ///
668 /// #### `drag-leave`
669 /// The ::drag-leave signal is emitted on the drop site when the cursor
670 /// leaves the widget. A typical reason to connect to this signal is to
671 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
672 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
673 ///
674 ///
675 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
676 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
677 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
678 ///
679 ///
680 ///
681 ///
682 /// #### `drag-motion`
683 /// The ::drag-motion signal is emitted on the drop site when the user
684 /// moves the cursor over the widget during a drag. The signal handler
685 /// must determine whether the cursor position is in a drop zone or not.
686 /// If it is not in a drop zone, it returns [`false`] and no further processing
687 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
688 /// handler is responsible for providing the necessary information for
689 /// displaying feedback to the user, by calling `gdk_drag_status()`.
690 ///
691 /// If the decision whether the drop will be accepted or rejected can't be
692 /// made based solely on the cursor position and the type of the data, the
693 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
694 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
695 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
696 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
697 /// when using the drag-motion signal that way.
698 ///
699 /// Also note that there is no drag-enter signal. The drag receiver has to
700 /// keep track of whether he has received any drag-motion signals since the
701 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
702 /// an "enter" signal. Upon an "enter", the handler will typically highlight
703 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
704 ///
705 ///
706 /// **⚠️ The following code is in C ⚠️**
707 ///
708 /// ```C
709 /// static void
710 /// drag_motion (GtkWidget *widget,
711 /// GdkDragContext *context,
712 /// gint x,
713 /// gint y,
714 /// guint time)
715 /// {
716 /// GdkAtom target;
717 ///
718 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
719 ///
720 /// if (!private_data->drag_highlight)
721 /// {
722 /// private_data->drag_highlight = 1;
723 /// gtk_drag_highlight (widget);
724 /// }
725 ///
726 /// target = gtk_drag_dest_find_target (widget, context, NULL);
727 /// if (target == GDK_NONE)
728 /// gdk_drag_status (context, 0, time);
729 /// else
730 /// {
731 /// private_data->pending_status
732 /// = gdk_drag_context_get_suggested_action (context);
733 /// gtk_drag_get_data (widget, context, target, time);
734 /// }
735 ///
736 /// return TRUE;
737 /// }
738 ///
739 /// static void
740 /// drag_data_received (GtkWidget *widget,
741 /// GdkDragContext *context,
742 /// gint x,
743 /// gint y,
744 /// GtkSelectionData *selection_data,
745 /// guint info,
746 /// guint time)
747 /// {
748 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
749 ///
750 /// if (private_data->suggested_action)
751 /// {
752 /// private_data->suggested_action = 0;
753 ///
754 /// // We are getting this data due to a request in drag_motion,
755 /// // rather than due to a request in drag_drop, so we are just
756 /// // supposed to call gdk_drag_status(), not actually paste in
757 /// // the data.
758 ///
759 /// str = gtk_selection_data_get_text (selection_data);
760 /// if (!data_is_acceptable (str))
761 /// gdk_drag_status (context, 0, time);
762 /// else
763 /// gdk_drag_status (context,
764 /// private_data->suggested_action,
765 /// time);
766 /// }
767 /// else
768 /// {
769 /// // accept the drop
770 /// }
771 /// }
772 /// ```
773 ///
774 ///
775 ///
776 ///
777 /// #### `draw`
778 /// This signal is emitted when a widget is supposed to render itself.
779 /// The `widget`'s top left corner must be painted at the origin of
780 /// the passed in context and be sized to the values returned by
781 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
782 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
783 ///
784 /// Signal handlers connected to this signal can modify the cairo
785 /// context passed as `cr` in any way they like and don't need to
786 /// restore it. The signal emission takes care of calling `cairo_save()`
787 /// before and `cairo_restore()` after invoking the handler.
788 ///
789 /// The signal handler will get a `cr` with a clip region already set to the
790 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
791 /// widgets that want to avoid redrawing themselves completely can get the full
792 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
793 /// get a finer-grained representation of the dirty region with
794 /// `cairo_copy_clip_rectangle_list()`.
795 ///
796 ///
797 ///
798 ///
799 /// #### `enter-notify-event`
800 /// The ::enter-notify-event will be emitted when the pointer enters
801 /// the `widget`'s window.
802 ///
803 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
804 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
805 ///
806 /// This signal will be sent to the grab widget if there is one.
807 ///
808 ///
809 ///
810 ///
811 /// #### `event`
812 /// The GTK+ main loop will emit three signals for each GDK event delivered
813 /// to a widget: one generic ::event signal, another, more specific,
814 /// signal that matches the type of event delivered (e.g.
815 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
816 /// [`event-after`][struct@crate::Widget#event-after] signal.
817 ///
818 ///
819 ///
820 ///
821 /// #### `event-after`
822 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
823 /// the second more specific signal, ::event-after will be emitted
824 /// regardless of the previous two signals handlers return values.
825 ///
826 ///
827 ///
828 ///
829 /// #### `focus`
830 ///
831 ///
832 ///
833 /// #### `focus-in-event`
834 /// The ::focus-in-event signal will be emitted when the keyboard focus
835 /// enters the `widget`'s window.
836 ///
837 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
838 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
839 ///
840 ///
841 ///
842 ///
843 /// #### `focus-out-event`
844 /// The ::focus-out-event signal will be emitted when the keyboard focus
845 /// leaves the `widget`'s window.
846 ///
847 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
848 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
849 ///
850 ///
851 ///
852 ///
853 /// #### `grab-broken-event`
854 /// Emitted when a pointer or keyboard grab on a window belonging
855 /// to `widget` gets broken.
856 ///
857 /// On X11, this happens when the grab window becomes unviewable
858 /// (i.e. it or one of its ancestors is unmapped), or if the same
859 /// application grabs the pointer or keyboard again.
860 ///
861 ///
862 ///
863 ///
864 /// #### `grab-focus`
865 /// Action
866 ///
867 ///
868 /// #### `grab-notify`
869 /// The ::grab-notify signal is emitted when a widget becomes
870 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
871 /// another widget, or when it becomes unshadowed due to a grab
872 /// being removed.
873 ///
874 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
875 /// grab widget in the grab stack of its window group is not
876 /// its ancestor.
877 ///
878 ///
879 ///
880 ///
881 /// #### `hide`
882 /// The ::hide signal is emitted when `widget` is hidden, for example with
883 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
884 ///
885 ///
886 ///
887 ///
888 /// #### `hierarchy-changed`
889 /// The ::hierarchy-changed signal is emitted when the
890 /// anchored state of a widget changes. A widget is
891 /// “anchored” when its toplevel
892 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
893 /// a widget changes from un-anchored to anchored or vice-versa.
894 ///
895 ///
896 ///
897 ///
898 /// #### `key-press-event`
899 /// The ::key-press-event signal is emitted when a key is pressed. The signal
900 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
901 ///
902 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
903 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
904 ///
905 /// This signal will be sent to the grab widget if there is one.
906 ///
907 ///
908 ///
909 ///
910 /// #### `key-release-event`
911 /// The ::key-release-event signal is emitted when a key is released.
912 ///
913 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
914 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
915 ///
916 /// This signal will be sent to the grab widget if there is one.
917 ///
918 ///
919 ///
920 ///
921 /// #### `keynav-failed`
922 /// Gets emitted if keyboard navigation fails.
923 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
924 ///
925 ///
926 ///
927 ///
928 /// #### `leave-notify-event`
929 /// The ::leave-notify-event will be emitted when the pointer leaves
930 /// the `widget`'s window.
931 ///
932 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
933 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
934 ///
935 /// This signal will be sent to the grab widget if there is one.
936 ///
937 ///
938 ///
939 ///
940 /// #### `map`
941 /// The ::map signal is emitted when `widget` is going to be mapped, that is
942 /// when the widget is visible (which is controlled with
943 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
944 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
945 /// be emitted.
946 ///
947 /// The ::map signal can be used to determine whether a widget will be drawn,
948 /// for instance it can resume an animation that was stopped during the
949 /// emission of [`unmap`][struct@crate::Widget#unmap].
950 ///
951 ///
952 ///
953 ///
954 /// #### `map-event`
955 /// The ::map-event signal will be emitted when the `widget`'s window is
956 /// mapped. A window is mapped when it becomes visible on the screen.
957 ///
958 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
959 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
960 /// automatically for all new windows.
961 ///
962 ///
963 ///
964 ///
965 /// #### `mnemonic-activate`
966 /// The default handler for this signal activates `widget` if `group_cycling`
967 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
968 ///
969 ///
970 ///
971 ///
972 /// #### `motion-notify-event`
973 /// The ::motion-notify-event signal is emitted when the pointer moves
974 /// over the widget's [`gdk::Window`][crate::gdk::Window].
975 ///
976 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
977 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
978 ///
979 /// This signal will be sent to the grab widget if there is one.
980 ///
981 ///
982 ///
983 ///
984 /// #### `move-focus`
985 /// Action
986 ///
987 ///
988 /// #### `parent-set`
989 /// The ::parent-set signal is emitted when a new parent
990 /// has been set on a widget.
991 ///
992 ///
993 ///
994 ///
995 /// #### `popup-menu`
996 /// This signal gets emitted whenever a widget should pop up a context
997 /// menu. This usually happens through the standard key binding mechanism;
998 /// by pressing a certain key while a widget is focused, the user can cause
999 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1000 /// a menu with clipboard commands. See the
1001 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1002 /// for an example of how to use this signal.
1003 ///
1004 /// Action
1005 ///
1006 ///
1007 /// #### `property-notify-event`
1008 /// The ::property-notify-event signal will be emitted when a property on
1009 /// the `widget`'s window has been changed or deleted.
1010 ///
1011 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1012 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1013 ///
1014 ///
1015 ///
1016 ///
1017 /// #### `proximity-in-event`
1018 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1019 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1020 ///
1021 /// This signal will be sent to the grab widget if there is one.
1022 ///
1023 ///
1024 ///
1025 ///
1026 /// #### `proximity-out-event`
1027 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1028 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1029 ///
1030 /// This signal will be sent to the grab widget if there is one.
1031 ///
1032 ///
1033 ///
1034 ///
1035 /// #### `query-tooltip`
1036 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1037 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1038 /// focus in keyboard mode.
1039 ///
1040 /// Using the given coordinates, the signal handler should determine
1041 /// whether a tooltip should be shown for `widget`. If this is the case
1042 /// [`true`] should be returned, [`false`] otherwise. Note that if
1043 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1044 /// should not be used.
1045 ///
1046 /// The signal handler is free to manipulate `tooltip` with the therefore
1047 /// destined function calls.
1048 ///
1049 ///
1050 ///
1051 ///
1052 /// #### `realize`
1053 /// The ::realize signal is emitted when `widget` is associated with a
1054 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1055 /// widget has been mapped (that is, it is going to be drawn).
1056 ///
1057 ///
1058 ///
1059 ///
1060 /// #### `screen-changed`
1061 /// The ::screen-changed signal gets emitted when the
1062 /// screen of a widget has changed.
1063 ///
1064 ///
1065 ///
1066 ///
1067 /// #### `scroll-event`
1068 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1069 /// range is pressed. Wheel mice are usually configured to generate
1070 /// button press events for buttons 4 and 5 when the wheel is turned.
1071 ///
1072 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1073 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1074 ///
1075 /// This signal will be sent to the grab widget if there is one.
1076 ///
1077 ///
1078 ///
1079 ///
1080 /// #### `selection-clear-event`
1081 /// The ::selection-clear-event signal will be emitted when the
1082 /// the `widget`'s window has lost ownership of a selection.
1083 ///
1084 ///
1085 ///
1086 ///
1087 /// #### `selection-get`
1088 ///
1089 ///
1090 ///
1091 /// #### `selection-notify-event`
1092 ///
1093 ///
1094 ///
1095 /// #### `selection-received`
1096 ///
1097 ///
1098 ///
1099 /// #### `selection-request-event`
1100 /// The ::selection-request-event signal will be emitted when
1101 /// another client requests ownership of the selection owned by
1102 /// the `widget`'s window.
1103 ///
1104 ///
1105 ///
1106 ///
1107 /// #### `show`
1108 /// The ::show signal is emitted when `widget` is shown, for example with
1109 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1110 ///
1111 ///
1112 ///
1113 ///
1114 /// #### `show-help`
1115 /// Action
1116 ///
1117 ///
1118 /// #### `size-allocate`
1119 ///
1120 ///
1121 ///
1122 /// #### `state-changed`
1123 /// The ::state-changed signal is emitted when the widget state changes.
1124 /// See `gtk_widget_get_state()`.
1125 ///
1126 ///
1127 ///
1128 ///
1129 /// #### `state-flags-changed`
1130 /// The ::state-flags-changed signal is emitted when the widget state
1131 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1132 ///
1133 ///
1134 ///
1135 ///
1136 /// #### `style-set`
1137 /// The ::style-set signal is emitted when a new style has been set
1138 /// on a widget. Note that style-modifying functions like
1139 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1140 ///
1141 /// Note that this signal is emitted for changes to the deprecated
1142 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1143 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1144 ///
1145 ///
1146 ///
1147 ///
1148 /// #### `style-updated`
1149 /// The ::style-updated signal is a convenience signal that is emitted when the
1150 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1151 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1152 ///
1153 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1154 /// cause this signal to be emitted.
1155 ///
1156 ///
1157 ///
1158 ///
1159 /// #### `touch-event`
1160 ///
1161 ///
1162 ///
1163 /// #### `unmap`
1164 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1165 /// means that either it or any of its parents up to the toplevel widget have
1166 /// been set as hidden.
1167 ///
1168 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1169 /// used to, for example, stop an animation on the widget.
1170 ///
1171 ///
1172 ///
1173 ///
1174 /// #### `unmap-event`
1175 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1176 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1177 ///
1178 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1179 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1180 /// automatically for all new windows.
1181 ///
1182 ///
1183 ///
1184 ///
1185 /// #### `unrealize`
1186 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1187 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1188 /// called or the widget has been unmapped (that is, it is going to be
1189 /// hidden).
1190 ///
1191 ///
1192 ///
1193 ///
1194 /// #### `visibility-notify-event`
1195 /// The ::visibility-notify-event will be emitted when the `widget`'s
1196 /// window is obscured or unobscured.
1197 ///
1198 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1199 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1200 ///
1201 ///
1202 ///
1203 ///
1204 /// #### `window-state-event`
1205 /// The ::window-state-event will be emitted when the state of the
1206 /// toplevel window associated to the `widget` changes.
1207 ///
1208 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1209 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1210 /// this mask automatically for all new windows.
1211 ///
1212 ///
1213 /// </details>
1214 ///
1215 /// # Implements
1216 ///
1217 /// [`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]
1218 #[doc(alias = "GtkCalendar")]
1219 pub struct Calendar(Object<ffi::GtkCalendar, ffi::GtkCalendarClass>) @extends Widget, @implements Buildable;
1220
1221 match fn {
1222 type_ => || ffi::gtk_calendar_get_type(),
1223 }
1224}
1225
1226impl Calendar {
1227 pub const NONE: Option<&'static Calendar> = None;
1228
1229 /// Creates a new calendar, with the current date being selected.
1230 ///
1231 /// # Returns
1232 ///
1233 /// a newly [`Calendar`][crate::Calendar] widget
1234 #[doc(alias = "gtk_calendar_new")]
1235 pub fn new() -> Calendar {
1236 assert_initialized_main_thread!();
1237 unsafe { Widget::from_glib_none(ffi::gtk_calendar_new()).unsafe_cast() }
1238 }
1239
1240 // rustdoc-stripper-ignore-next
1241 /// Creates a new builder-pattern struct instance to construct [`Calendar`] objects.
1242 ///
1243 /// This method returns an instance of [`CalendarBuilder`](crate::builders::CalendarBuilder) which can be used to create [`Calendar`] objects.
1244 pub fn builder() -> CalendarBuilder {
1245 CalendarBuilder::new()
1246 }
1247}
1248
1249impl Default for Calendar {
1250 fn default() -> Self {
1251 Self::new()
1252 }
1253}
1254
1255// rustdoc-stripper-ignore-next
1256/// A [builder-pattern] type to construct [`Calendar`] objects.
1257///
1258/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1259#[must_use = "The builder must be built to be used"]
1260pub struct CalendarBuilder {
1261 builder: glib::object::ObjectBuilder<'static, Calendar>,
1262}
1263
1264impl CalendarBuilder {
1265 fn new() -> Self {
1266 Self {
1267 builder: glib::object::Object::builder(),
1268 }
1269 }
1270
1271 /// The selected day (as a number between 1 and 31, or 0
1272 /// to unselect the currently selected day).
1273 /// This property gets initially set to the current day.
1274 pub fn day(self, day: i32) -> Self {
1275 Self {
1276 builder: self.builder.property("day", day),
1277 }
1278 }
1279
1280 /// Height of a detail cell, in rows.
1281 /// A value of 0 allows any width. See [`CalendarExt::set_detail_func()`][crate::prelude::CalendarExt::set_detail_func()].
1282 pub fn detail_height_rows(self, detail_height_rows: i32) -> Self {
1283 Self {
1284 builder: self
1285 .builder
1286 .property("detail-height-rows", detail_height_rows),
1287 }
1288 }
1289
1290 /// Width of a detail cell, in characters.
1291 /// A value of 0 allows any width. See [`CalendarExt::set_detail_func()`][crate::prelude::CalendarExt::set_detail_func()].
1292 pub fn detail_width_chars(self, detail_width_chars: i32) -> Self {
1293 Self {
1294 builder: self
1295 .builder
1296 .property("detail-width-chars", detail_width_chars),
1297 }
1298 }
1299
1300 /// The selected month (as a number between 0 and 11).
1301 /// This property gets initially set to the current month.
1302 pub fn month(self, month: i32) -> Self {
1303 Self {
1304 builder: self.builder.property("month", month),
1305 }
1306 }
1307
1308 /// Determines whether the selected month can be changed.
1309 pub fn no_month_change(self, no_month_change: bool) -> Self {
1310 Self {
1311 builder: self.builder.property("no-month-change", no_month_change),
1312 }
1313 }
1314
1315 /// Determines whether day names are displayed.
1316 pub fn show_day_names(self, show_day_names: bool) -> Self {
1317 Self {
1318 builder: self.builder.property("show-day-names", show_day_names),
1319 }
1320 }
1321
1322 /// Determines whether details are shown directly in the widget, or if they are
1323 /// available only as tooltip. When this property is set days with details are
1324 /// marked.
1325 pub fn show_details(self, show_details: bool) -> Self {
1326 Self {
1327 builder: self.builder.property("show-details", show_details),
1328 }
1329 }
1330
1331 /// Determines whether a heading is displayed.
1332 pub fn show_heading(self, show_heading: bool) -> Self {
1333 Self {
1334 builder: self.builder.property("show-heading", show_heading),
1335 }
1336 }
1337
1338 /// Determines whether week numbers are displayed.
1339 pub fn show_week_numbers(self, show_week_numbers: bool) -> Self {
1340 Self {
1341 builder: self
1342 .builder
1343 .property("show-week-numbers", show_week_numbers),
1344 }
1345 }
1346
1347 /// The selected year.
1348 /// This property gets initially set to the current year.
1349 pub fn year(self, year: i32) -> Self {
1350 Self {
1351 builder: self.builder.property("year", year),
1352 }
1353 }
1354
1355 pub fn app_paintable(self, app_paintable: bool) -> Self {
1356 Self {
1357 builder: self.builder.property("app-paintable", app_paintable),
1358 }
1359 }
1360
1361 pub fn can_default(self, can_default: bool) -> Self {
1362 Self {
1363 builder: self.builder.property("can-default", can_default),
1364 }
1365 }
1366
1367 pub fn can_focus(self, can_focus: bool) -> Self {
1368 Self {
1369 builder: self.builder.property("can-focus", can_focus),
1370 }
1371 }
1372
1373 pub fn events(self, events: gdk::EventMask) -> Self {
1374 Self {
1375 builder: self.builder.property("events", events),
1376 }
1377 }
1378
1379 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1380 pub fn expand(self, expand: bool) -> Self {
1381 Self {
1382 builder: self.builder.property("expand", expand),
1383 }
1384 }
1385
1386 /// Whether the widget should grab focus when it is clicked with the mouse.
1387 ///
1388 /// This property is only relevant for widgets that can take focus.
1389 ///
1390 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1391 /// GtkComboBox) implemented this property individually.
1392 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1393 Self {
1394 builder: self.builder.property("focus-on-click", focus_on_click),
1395 }
1396 }
1397
1398 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1399 pub fn halign(self, halign: Align) -> Self {
1400 Self {
1401 builder: self.builder.property("halign", halign),
1402 }
1403 }
1404
1405 pub fn has_default(self, has_default: bool) -> Self {
1406 Self {
1407 builder: self.builder.property("has-default", has_default),
1408 }
1409 }
1410
1411 pub fn has_focus(self, has_focus: bool) -> Self {
1412 Self {
1413 builder: self.builder.property("has-focus", has_focus),
1414 }
1415 }
1416
1417 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1418 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1419 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1420 /// whether it will provide a tooltip or not.
1421 ///
1422 /// Note that setting this property to [`true`] for the first time will change
1423 /// the event masks of the GdkWindows of this widget to include leave-notify
1424 /// and motion-notify events. This cannot and will not be undone when the
1425 /// property is set to [`false`] again.
1426 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1427 Self {
1428 builder: self.builder.property("has-tooltip", has_tooltip),
1429 }
1430 }
1431
1432 pub fn height_request(self, height_request: i32) -> Self {
1433 Self {
1434 builder: self.builder.property("height-request", height_request),
1435 }
1436 }
1437
1438 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1439 pub fn hexpand(self, hexpand: bool) -> Self {
1440 Self {
1441 builder: self.builder.property("hexpand", hexpand),
1442 }
1443 }
1444
1445 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1446 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1447 Self {
1448 builder: self.builder.property("hexpand-set", hexpand_set),
1449 }
1450 }
1451
1452 pub fn is_focus(self, is_focus: bool) -> Self {
1453 Self {
1454 builder: self.builder.property("is-focus", is_focus),
1455 }
1456 }
1457
1458 /// Sets all four sides' margin at once. If read, returns max
1459 /// margin on any side.
1460 pub fn margin(self, margin: i32) -> Self {
1461 Self {
1462 builder: self.builder.property("margin", margin),
1463 }
1464 }
1465
1466 /// Margin on bottom side of widget.
1467 ///
1468 /// This property adds margin outside of the widget's normal size
1469 /// request, the margin will be added in addition to the size from
1470 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1471 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1472 Self {
1473 builder: self.builder.property("margin-bottom", margin_bottom),
1474 }
1475 }
1476
1477 /// Margin on end of widget, horizontally. This property supports
1478 /// left-to-right and right-to-left text directions.
1479 ///
1480 /// This property adds margin outside of the widget's normal size
1481 /// request, the margin will be added in addition to the size from
1482 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1483 pub fn margin_end(self, margin_end: i32) -> Self {
1484 Self {
1485 builder: self.builder.property("margin-end", margin_end),
1486 }
1487 }
1488
1489 /// Margin on start of widget, horizontally. This property supports
1490 /// left-to-right and right-to-left text directions.
1491 ///
1492 /// This property adds margin outside of the widget's normal size
1493 /// request, the margin will be added in addition to the size from
1494 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1495 pub fn margin_start(self, margin_start: i32) -> Self {
1496 Self {
1497 builder: self.builder.property("margin-start", margin_start),
1498 }
1499 }
1500
1501 /// Margin on top side of widget.
1502 ///
1503 /// This property adds margin outside of the widget's normal size
1504 /// request, the margin will be added in addition to the size from
1505 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1506 pub fn margin_top(self, margin_top: i32) -> Self {
1507 Self {
1508 builder: self.builder.property("margin-top", margin_top),
1509 }
1510 }
1511
1512 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1513 Self {
1514 builder: self.builder.property("name", name.into()),
1515 }
1516 }
1517
1518 pub fn no_show_all(self, no_show_all: bool) -> Self {
1519 Self {
1520 builder: self.builder.property("no-show-all", no_show_all),
1521 }
1522 }
1523
1524 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1525 /// more details about window opacity.
1526 ///
1527 /// Before 3.8 this was only available in GtkWindow
1528 pub fn opacity(self, opacity: f64) -> Self {
1529 Self {
1530 builder: self.builder.property("opacity", opacity),
1531 }
1532 }
1533
1534 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1535 Self {
1536 builder: self.builder.property("parent", parent.clone().upcast()),
1537 }
1538 }
1539
1540 pub fn receives_default(self, receives_default: bool) -> Self {
1541 Self {
1542 builder: self.builder.property("receives-default", receives_default),
1543 }
1544 }
1545
1546 pub fn sensitive(self, sensitive: bool) -> Self {
1547 Self {
1548 builder: self.builder.property("sensitive", sensitive),
1549 }
1550 }
1551
1552 /// Sets the text of tooltip to be the given string, which is marked up
1553 /// with the [Pango text markup language][PangoMarkupFormat].
1554 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1555 ///
1556 /// This is a convenience property which will take care of getting the
1557 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1558 /// will automatically be set to [`true`] and there will be taken care of
1559 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1560 ///
1561 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1562 /// are set, the last one wins.
1563 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1564 Self {
1565 builder: self
1566 .builder
1567 .property("tooltip-markup", tooltip_markup.into()),
1568 }
1569 }
1570
1571 /// Sets the text of tooltip to be the given string.
1572 ///
1573 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1574 ///
1575 /// This is a convenience property which will take care of getting the
1576 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1577 /// will automatically be set to [`true`] and there will be taken care of
1578 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1579 ///
1580 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1581 /// are set, the last one wins.
1582 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1583 Self {
1584 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1585 }
1586 }
1587
1588 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1589 pub fn valign(self, valign: Align) -> Self {
1590 Self {
1591 builder: self.builder.property("valign", valign),
1592 }
1593 }
1594
1595 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1596 pub fn vexpand(self, vexpand: bool) -> Self {
1597 Self {
1598 builder: self.builder.property("vexpand", vexpand),
1599 }
1600 }
1601
1602 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1603 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1604 Self {
1605 builder: self.builder.property("vexpand-set", vexpand_set),
1606 }
1607 }
1608
1609 pub fn visible(self, visible: bool) -> Self {
1610 Self {
1611 builder: self.builder.property("visible", visible),
1612 }
1613 }
1614
1615 pub fn width_request(self, width_request: i32) -> Self {
1616 Self {
1617 builder: self.builder.property("width-request", width_request),
1618 }
1619 }
1620
1621 // rustdoc-stripper-ignore-next
1622 /// Build the [`Calendar`].
1623 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1624 pub fn build(self) -> Calendar {
1625 assert_initialized_main_thread!();
1626 self.builder.build()
1627 }
1628}
1629
1630/// Trait containing all [`struct@Calendar`] methods.
1631///
1632/// # Implementors
1633///
1634/// [`Calendar`][struct@crate::Calendar]
1635pub trait CalendarExt: IsA<Calendar> + 'static {
1636 /// Remove all visual markers.
1637 #[doc(alias = "gtk_calendar_clear_marks")]
1638 fn clear_marks(&self) {
1639 unsafe {
1640 ffi::gtk_calendar_clear_marks(self.as_ref().to_glib_none().0);
1641 }
1642 }
1643
1644 /// Obtains the selected date from a [`Calendar`][crate::Calendar].
1645 ///
1646 /// # Returns
1647 ///
1648 ///
1649 /// ## `year`
1650 /// location to store the year as a decimal
1651 /// number (e.g. 2011), or [`None`]
1652 ///
1653 /// ## `month`
1654 /// location to store the month number
1655 /// (between 0 and 11), or [`None`]
1656 ///
1657 /// ## `day`
1658 /// location to store the day number (between
1659 /// 1 and 31), or [`None`]
1660 #[doc(alias = "gtk_calendar_get_date")]
1661 #[doc(alias = "get_date")]
1662 fn date(&self) -> (u32, u32, u32) {
1663 unsafe {
1664 let mut year = std::mem::MaybeUninit::uninit();
1665 let mut month = std::mem::MaybeUninit::uninit();
1666 let mut day = std::mem::MaybeUninit::uninit();
1667 ffi::gtk_calendar_get_date(
1668 self.as_ref().to_glib_none().0,
1669 year.as_mut_ptr(),
1670 month.as_mut_ptr(),
1671 day.as_mut_ptr(),
1672 );
1673 (year.assume_init(), month.assume_init(), day.assume_init())
1674 }
1675 }
1676
1677 /// Returns if the `day` of the `self` is already marked.
1678 /// ## `day`
1679 /// the day number between 1 and 31.
1680 ///
1681 /// # Returns
1682 ///
1683 /// whether the day is marked.
1684 #[doc(alias = "gtk_calendar_get_day_is_marked")]
1685 #[doc(alias = "get_day_is_marked")]
1686 fn day_is_marked(&self, day: u32) -> bool {
1687 unsafe {
1688 from_glib(ffi::gtk_calendar_get_day_is_marked(
1689 self.as_ref().to_glib_none().0,
1690 day,
1691 ))
1692 }
1693 }
1694
1695 /// Queries the height of detail cells, in rows.
1696 /// See [`detail-width-chars`][struct@crate::Calendar#detail-width-chars].
1697 ///
1698 /// # Returns
1699 ///
1700 /// The height of detail cells, in rows.
1701 #[doc(alias = "gtk_calendar_get_detail_height_rows")]
1702 #[doc(alias = "get_detail_height_rows")]
1703 #[doc(alias = "detail-height-rows")]
1704 fn detail_height_rows(&self) -> i32 {
1705 unsafe { ffi::gtk_calendar_get_detail_height_rows(self.as_ref().to_glib_none().0) }
1706 }
1707
1708 /// Queries the width of detail cells, in characters.
1709 /// See [`detail-width-chars`][struct@crate::Calendar#detail-width-chars].
1710 ///
1711 /// # Returns
1712 ///
1713 /// The width of detail cells, in characters.
1714 #[doc(alias = "gtk_calendar_get_detail_width_chars")]
1715 #[doc(alias = "get_detail_width_chars")]
1716 #[doc(alias = "detail-width-chars")]
1717 fn detail_width_chars(&self) -> i32 {
1718 unsafe { ffi::gtk_calendar_get_detail_width_chars(self.as_ref().to_glib_none().0) }
1719 }
1720
1721 /// Returns the current display options of `self`.
1722 ///
1723 /// # Returns
1724 ///
1725 /// the display options.
1726 #[doc(alias = "gtk_calendar_get_display_options")]
1727 #[doc(alias = "get_display_options")]
1728 fn display_options(&self) -> CalendarDisplayOptions {
1729 unsafe {
1730 from_glib(ffi::gtk_calendar_get_display_options(
1731 self.as_ref().to_glib_none().0,
1732 ))
1733 }
1734 }
1735
1736 /// Places a visual marker on a particular day.
1737 /// ## `day`
1738 /// the day number to mark between 1 and 31.
1739 #[doc(alias = "gtk_calendar_mark_day")]
1740 fn mark_day(&self, day: u32) {
1741 unsafe {
1742 ffi::gtk_calendar_mark_day(self.as_ref().to_glib_none().0, day);
1743 }
1744 }
1745
1746 /// Selects a day from the current month.
1747 /// ## `day`
1748 /// the day number between 1 and 31, or 0 to unselect
1749 /// the currently selected day.
1750 #[doc(alias = "gtk_calendar_select_day")]
1751 fn select_day(&self, day: u32) {
1752 unsafe {
1753 ffi::gtk_calendar_select_day(self.as_ref().to_glib_none().0, day);
1754 }
1755 }
1756
1757 /// Shifts the calendar to a different month.
1758 /// ## `month`
1759 /// a month number between 0 and 11.
1760 /// ## `year`
1761 /// the year the month is in.
1762 #[doc(alias = "gtk_calendar_select_month")]
1763 fn select_month(&self, month: u32, year: u32) {
1764 unsafe {
1765 ffi::gtk_calendar_select_month(self.as_ref().to_glib_none().0, month, year);
1766 }
1767 }
1768
1769 /// Installs a function which provides Pango markup with detail information
1770 /// for each day. Examples for such details are holidays or appointments. That
1771 /// information is shown below each day when [`show-details`][struct@crate::Calendar#show-details] is set.
1772 /// A tooltip containing with full detail information is provided, if the entire
1773 /// text should not fit into the details area, or if [`show-details`][struct@crate::Calendar#show-details]
1774 /// is not set.
1775 ///
1776 /// The size of the details area can be restricted by setting the
1777 /// [`detail-width-chars`][struct@crate::Calendar#detail-width-chars] and [`detail-height-rows`][struct@crate::Calendar#detail-height-rows]
1778 /// properties.
1779 /// ## `func`
1780 /// a function providing details for each day.
1781 #[doc(alias = "gtk_calendar_set_detail_func")]
1782 fn set_detail_func<P: Fn(&Calendar, u32, u32, u32) -> Option<String> + 'static>(
1783 &self,
1784 func: P,
1785 ) {
1786 let func_data: Box_<P> = Box_::new(func);
1787 unsafe extern "C" fn func_func<
1788 P: Fn(&Calendar, u32, u32, u32) -> Option<String> + 'static,
1789 >(
1790 calendar: *mut ffi::GtkCalendar,
1791 year: std::ffi::c_uint,
1792 month: std::ffi::c_uint,
1793 day: std::ffi::c_uint,
1794 user_data: glib::ffi::gpointer,
1795 ) -> *mut std::ffi::c_char {
1796 unsafe {
1797 let calendar = from_glib_borrow(calendar);
1798 let callback = &*(user_data as *mut P);
1799 (*callback)(&calendar, year, month, day).to_glib_full()
1800 }
1801 }
1802 let func = Some(func_func::<P> as _);
1803 unsafe extern "C" fn destroy_func<
1804 P: Fn(&Calendar, u32, u32, u32) -> Option<String> + 'static,
1805 >(
1806 data: glib::ffi::gpointer,
1807 ) {
1808 unsafe {
1809 let _callback = Box_::from_raw(data as *mut P);
1810 }
1811 }
1812 let destroy_call3 = Some(destroy_func::<P> as _);
1813 let super_callback0: Box_<P> = func_data;
1814 unsafe {
1815 ffi::gtk_calendar_set_detail_func(
1816 self.as_ref().to_glib_none().0,
1817 func,
1818 Box_::into_raw(super_callback0) as *mut _,
1819 destroy_call3,
1820 );
1821 }
1822 }
1823
1824 /// Updates the height of detail cells.
1825 /// See [`detail-height-rows`][struct@crate::Calendar#detail-height-rows].
1826 /// ## `rows`
1827 /// detail height in rows.
1828 #[doc(alias = "gtk_calendar_set_detail_height_rows")]
1829 #[doc(alias = "detail-height-rows")]
1830 fn set_detail_height_rows(&self, rows: i32) {
1831 unsafe {
1832 ffi::gtk_calendar_set_detail_height_rows(self.as_ref().to_glib_none().0, rows);
1833 }
1834 }
1835
1836 /// Updates the width of detail cells.
1837 /// See [`detail-width-chars`][struct@crate::Calendar#detail-width-chars].
1838 /// ## `chars`
1839 /// detail width in characters.
1840 #[doc(alias = "gtk_calendar_set_detail_width_chars")]
1841 #[doc(alias = "detail-width-chars")]
1842 fn set_detail_width_chars(&self, chars: i32) {
1843 unsafe {
1844 ffi::gtk_calendar_set_detail_width_chars(self.as_ref().to_glib_none().0, chars);
1845 }
1846 }
1847
1848 /// Sets display options (whether to display the heading and the month
1849 /// headings).
1850 /// ## `flags`
1851 /// the display options to set
1852 #[doc(alias = "gtk_calendar_set_display_options")]
1853 fn set_display_options(&self, flags: CalendarDisplayOptions) {
1854 unsafe {
1855 ffi::gtk_calendar_set_display_options(
1856 self.as_ref().to_glib_none().0,
1857 flags.into_glib(),
1858 );
1859 }
1860 }
1861
1862 /// Removes the visual marker from a particular day.
1863 /// ## `day`
1864 /// the day number to unmark between 1 and 31.
1865 #[doc(alias = "gtk_calendar_unmark_day")]
1866 fn unmark_day(&self, day: u32) {
1867 unsafe {
1868 ffi::gtk_calendar_unmark_day(self.as_ref().to_glib_none().0, day);
1869 }
1870 }
1871
1872 /// The selected day (as a number between 1 and 31, or 0
1873 /// to unselect the currently selected day).
1874 /// This property gets initially set to the current day.
1875 fn day(&self) -> i32 {
1876 ObjectExt::property(self.as_ref(), "day")
1877 }
1878
1879 /// The selected day (as a number between 1 and 31, or 0
1880 /// to unselect the currently selected day).
1881 /// This property gets initially set to the current day.
1882 fn set_day(&self, day: i32) {
1883 ObjectExt::set_property(self.as_ref(), "day", day)
1884 }
1885
1886 /// The selected month (as a number between 0 and 11).
1887 /// This property gets initially set to the current month.
1888 fn month(&self) -> i32 {
1889 ObjectExt::property(self.as_ref(), "month")
1890 }
1891
1892 /// The selected month (as a number between 0 and 11).
1893 /// This property gets initially set to the current month.
1894 fn set_month(&self, month: i32) {
1895 ObjectExt::set_property(self.as_ref(), "month", month)
1896 }
1897
1898 /// Determines whether the selected month can be changed.
1899 #[doc(alias = "no-month-change")]
1900 fn is_no_month_change(&self) -> bool {
1901 ObjectExt::property(self.as_ref(), "no-month-change")
1902 }
1903
1904 /// Determines whether the selected month can be changed.
1905 #[doc(alias = "no-month-change")]
1906 fn set_no_month_change(&self, no_month_change: bool) {
1907 ObjectExt::set_property(self.as_ref(), "no-month-change", no_month_change)
1908 }
1909
1910 /// Determines whether day names are displayed.
1911 #[doc(alias = "show-day-names")]
1912 fn shows_day_names(&self) -> bool {
1913 ObjectExt::property(self.as_ref(), "show-day-names")
1914 }
1915
1916 /// Determines whether day names are displayed.
1917 #[doc(alias = "show-day-names")]
1918 fn set_show_day_names(&self, show_day_names: bool) {
1919 ObjectExt::set_property(self.as_ref(), "show-day-names", show_day_names)
1920 }
1921
1922 /// Determines whether details are shown directly in the widget, or if they are
1923 /// available only as tooltip. When this property is set days with details are
1924 /// marked.
1925 #[doc(alias = "show-details")]
1926 fn shows_details(&self) -> bool {
1927 ObjectExt::property(self.as_ref(), "show-details")
1928 }
1929
1930 /// Determines whether details are shown directly in the widget, or if they are
1931 /// available only as tooltip. When this property is set days with details are
1932 /// marked.
1933 #[doc(alias = "show-details")]
1934 fn set_show_details(&self, show_details: bool) {
1935 ObjectExt::set_property(self.as_ref(), "show-details", show_details)
1936 }
1937
1938 /// Determines whether a heading is displayed.
1939 #[doc(alias = "show-heading")]
1940 fn shows_heading(&self) -> bool {
1941 ObjectExt::property(self.as_ref(), "show-heading")
1942 }
1943
1944 /// Determines whether a heading is displayed.
1945 #[doc(alias = "show-heading")]
1946 fn set_show_heading(&self, show_heading: bool) {
1947 ObjectExt::set_property(self.as_ref(), "show-heading", show_heading)
1948 }
1949
1950 /// Determines whether week numbers are displayed.
1951 #[doc(alias = "show-week-numbers")]
1952 fn shows_week_numbers(&self) -> bool {
1953 ObjectExt::property(self.as_ref(), "show-week-numbers")
1954 }
1955
1956 /// Determines whether week numbers are displayed.
1957 #[doc(alias = "show-week-numbers")]
1958 fn set_show_week_numbers(&self, show_week_numbers: bool) {
1959 ObjectExt::set_property(self.as_ref(), "show-week-numbers", show_week_numbers)
1960 }
1961
1962 /// The selected year.
1963 /// This property gets initially set to the current year.
1964 fn year(&self) -> i32 {
1965 ObjectExt::property(self.as_ref(), "year")
1966 }
1967
1968 /// The selected year.
1969 /// This property gets initially set to the current year.
1970 fn set_year(&self, year: i32) {
1971 ObjectExt::set_property(self.as_ref(), "year", year)
1972 }
1973
1974 /// Emitted when the user selects a day.
1975 #[doc(alias = "day-selected")]
1976 fn connect_day_selected<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1977 unsafe extern "C" fn day_selected_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
1978 this: *mut ffi::GtkCalendar,
1979 f: glib::ffi::gpointer,
1980 ) {
1981 unsafe {
1982 let f: &F = &*(f as *const F);
1983 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
1984 }
1985 }
1986 unsafe {
1987 let f: Box_<F> = Box_::new(f);
1988 connect_raw(
1989 self.as_ptr() as *mut _,
1990 c"day-selected".as_ptr(),
1991 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1992 day_selected_trampoline::<Self, F> as *const (),
1993 )),
1994 Box_::into_raw(f),
1995 )
1996 }
1997 }
1998
1999 /// Emitted when the user double-clicks a day.
2000 #[doc(alias = "day-selected-double-click")]
2001 fn connect_day_selected_double_click<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2002 unsafe extern "C" fn day_selected_double_click_trampoline<
2003 P: IsA<Calendar>,
2004 F: Fn(&P) + 'static,
2005 >(
2006 this: *mut ffi::GtkCalendar,
2007 f: glib::ffi::gpointer,
2008 ) {
2009 unsafe {
2010 let f: &F = &*(f as *const F);
2011 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2012 }
2013 }
2014 unsafe {
2015 let f: Box_<F> = Box_::new(f);
2016 connect_raw(
2017 self.as_ptr() as *mut _,
2018 c"day-selected-double-click".as_ptr(),
2019 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2020 day_selected_double_click_trampoline::<Self, F> as *const (),
2021 )),
2022 Box_::into_raw(f),
2023 )
2024 }
2025 }
2026
2027 /// Emitted when the user clicks a button to change the selected month on a
2028 /// calendar.
2029 #[doc(alias = "month-changed")]
2030 fn connect_month_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2031 unsafe extern "C" fn month_changed_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
2032 this: *mut ffi::GtkCalendar,
2033 f: glib::ffi::gpointer,
2034 ) {
2035 unsafe {
2036 let f: &F = &*(f as *const F);
2037 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2038 }
2039 }
2040 unsafe {
2041 let f: Box_<F> = Box_::new(f);
2042 connect_raw(
2043 self.as_ptr() as *mut _,
2044 c"month-changed".as_ptr(),
2045 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2046 month_changed_trampoline::<Self, F> as *const (),
2047 )),
2048 Box_::into_raw(f),
2049 )
2050 }
2051 }
2052
2053 /// Emitted when the user switched to the next month.
2054 #[doc(alias = "next-month")]
2055 fn connect_next_month<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2056 unsafe extern "C" fn next_month_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
2057 this: *mut ffi::GtkCalendar,
2058 f: glib::ffi::gpointer,
2059 ) {
2060 unsafe {
2061 let f: &F = &*(f as *const F);
2062 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2063 }
2064 }
2065 unsafe {
2066 let f: Box_<F> = Box_::new(f);
2067 connect_raw(
2068 self.as_ptr() as *mut _,
2069 c"next-month".as_ptr(),
2070 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2071 next_month_trampoline::<Self, F> as *const (),
2072 )),
2073 Box_::into_raw(f),
2074 )
2075 }
2076 }
2077
2078 /// Emitted when user switched to the next year.
2079 #[doc(alias = "next-year")]
2080 fn connect_next_year<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2081 unsafe extern "C" fn next_year_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
2082 this: *mut ffi::GtkCalendar,
2083 f: glib::ffi::gpointer,
2084 ) {
2085 unsafe {
2086 let f: &F = &*(f as *const F);
2087 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2088 }
2089 }
2090 unsafe {
2091 let f: Box_<F> = Box_::new(f);
2092 connect_raw(
2093 self.as_ptr() as *mut _,
2094 c"next-year".as_ptr(),
2095 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2096 next_year_trampoline::<Self, F> as *const (),
2097 )),
2098 Box_::into_raw(f),
2099 )
2100 }
2101 }
2102
2103 /// Emitted when the user switched to the previous month.
2104 #[doc(alias = "prev-month")]
2105 fn connect_prev_month<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2106 unsafe extern "C" fn prev_month_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
2107 this: *mut ffi::GtkCalendar,
2108 f: glib::ffi::gpointer,
2109 ) {
2110 unsafe {
2111 let f: &F = &*(f as *const F);
2112 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2113 }
2114 }
2115 unsafe {
2116 let f: Box_<F> = Box_::new(f);
2117 connect_raw(
2118 self.as_ptr() as *mut _,
2119 c"prev-month".as_ptr(),
2120 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2121 prev_month_trampoline::<Self, F> as *const (),
2122 )),
2123 Box_::into_raw(f),
2124 )
2125 }
2126 }
2127
2128 /// Emitted when user switched to the previous year.
2129 #[doc(alias = "prev-year")]
2130 fn connect_prev_year<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2131 unsafe extern "C" fn prev_year_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
2132 this: *mut ffi::GtkCalendar,
2133 f: glib::ffi::gpointer,
2134 ) {
2135 unsafe {
2136 let f: &F = &*(f as *const F);
2137 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2138 }
2139 }
2140 unsafe {
2141 let f: Box_<F> = Box_::new(f);
2142 connect_raw(
2143 self.as_ptr() as *mut _,
2144 c"prev-year".as_ptr(),
2145 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2146 prev_year_trampoline::<Self, F> as *const (),
2147 )),
2148 Box_::into_raw(f),
2149 )
2150 }
2151 }
2152
2153 #[doc(alias = "day")]
2154 fn connect_day_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2155 unsafe extern "C" fn notify_day_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
2156 this: *mut ffi::GtkCalendar,
2157 _param_spec: glib::ffi::gpointer,
2158 f: glib::ffi::gpointer,
2159 ) {
2160 unsafe {
2161 let f: &F = &*(f as *const F);
2162 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2163 }
2164 }
2165 unsafe {
2166 let f: Box_<F> = Box_::new(f);
2167 connect_raw(
2168 self.as_ptr() as *mut _,
2169 c"notify::day".as_ptr(),
2170 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2171 notify_day_trampoline::<Self, F> as *const (),
2172 )),
2173 Box_::into_raw(f),
2174 )
2175 }
2176 }
2177
2178 #[doc(alias = "detail-height-rows")]
2179 fn connect_detail_height_rows_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2180 unsafe extern "C" fn notify_detail_height_rows_trampoline<
2181 P: IsA<Calendar>,
2182 F: Fn(&P) + 'static,
2183 >(
2184 this: *mut ffi::GtkCalendar,
2185 _param_spec: glib::ffi::gpointer,
2186 f: glib::ffi::gpointer,
2187 ) {
2188 unsafe {
2189 let f: &F = &*(f as *const F);
2190 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2191 }
2192 }
2193 unsafe {
2194 let f: Box_<F> = Box_::new(f);
2195 connect_raw(
2196 self.as_ptr() as *mut _,
2197 c"notify::detail-height-rows".as_ptr(),
2198 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2199 notify_detail_height_rows_trampoline::<Self, F> as *const (),
2200 )),
2201 Box_::into_raw(f),
2202 )
2203 }
2204 }
2205
2206 #[doc(alias = "detail-width-chars")]
2207 fn connect_detail_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2208 unsafe extern "C" fn notify_detail_width_chars_trampoline<
2209 P: IsA<Calendar>,
2210 F: Fn(&P) + 'static,
2211 >(
2212 this: *mut ffi::GtkCalendar,
2213 _param_spec: glib::ffi::gpointer,
2214 f: glib::ffi::gpointer,
2215 ) {
2216 unsafe {
2217 let f: &F = &*(f as *const F);
2218 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2219 }
2220 }
2221 unsafe {
2222 let f: Box_<F> = Box_::new(f);
2223 connect_raw(
2224 self.as_ptr() as *mut _,
2225 c"notify::detail-width-chars".as_ptr(),
2226 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2227 notify_detail_width_chars_trampoline::<Self, F> as *const (),
2228 )),
2229 Box_::into_raw(f),
2230 )
2231 }
2232 }
2233
2234 #[doc(alias = "month")]
2235 fn connect_month_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2236 unsafe extern "C" fn notify_month_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
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::month".as_ptr(),
2251 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2252 notify_month_trampoline::<Self, F> as *const (),
2253 )),
2254 Box_::into_raw(f),
2255 )
2256 }
2257 }
2258
2259 #[doc(alias = "no-month-change")]
2260 fn connect_no_month_change_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2261 unsafe extern "C" fn notify_no_month_change_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::no-month-change".as_ptr(),
2279 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2280 notify_no_month_change_trampoline::<Self, F> as *const (),
2281 )),
2282 Box_::into_raw(f),
2283 )
2284 }
2285 }
2286
2287 #[doc(alias = "show-day-names")]
2288 fn connect_show_day_names_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2289 unsafe extern "C" fn notify_show_day_names_trampoline<
2290 P: IsA<Calendar>,
2291 F: Fn(&P) + 'static,
2292 >(
2293 this: *mut ffi::GtkCalendar,
2294 _param_spec: glib::ffi::gpointer,
2295 f: glib::ffi::gpointer,
2296 ) {
2297 unsafe {
2298 let f: &F = &*(f as *const F);
2299 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2300 }
2301 }
2302 unsafe {
2303 let f: Box_<F> = Box_::new(f);
2304 connect_raw(
2305 self.as_ptr() as *mut _,
2306 c"notify::show-day-names".as_ptr(),
2307 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2308 notify_show_day_names_trampoline::<Self, F> as *const (),
2309 )),
2310 Box_::into_raw(f),
2311 )
2312 }
2313 }
2314
2315 #[doc(alias = "show-details")]
2316 fn connect_show_details_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2317 unsafe extern "C" fn notify_show_details_trampoline<
2318 P: IsA<Calendar>,
2319 F: Fn(&P) + 'static,
2320 >(
2321 this: *mut ffi::GtkCalendar,
2322 _param_spec: glib::ffi::gpointer,
2323 f: glib::ffi::gpointer,
2324 ) {
2325 unsafe {
2326 let f: &F = &*(f as *const F);
2327 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2328 }
2329 }
2330 unsafe {
2331 let f: Box_<F> = Box_::new(f);
2332 connect_raw(
2333 self.as_ptr() as *mut _,
2334 c"notify::show-details".as_ptr(),
2335 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2336 notify_show_details_trampoline::<Self, F> as *const (),
2337 )),
2338 Box_::into_raw(f),
2339 )
2340 }
2341 }
2342
2343 #[doc(alias = "show-heading")]
2344 fn connect_show_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2345 unsafe extern "C" fn notify_show_heading_trampoline<
2346 P: IsA<Calendar>,
2347 F: Fn(&P) + 'static,
2348 >(
2349 this: *mut ffi::GtkCalendar,
2350 _param_spec: glib::ffi::gpointer,
2351 f: glib::ffi::gpointer,
2352 ) {
2353 unsafe {
2354 let f: &F = &*(f as *const F);
2355 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2356 }
2357 }
2358 unsafe {
2359 let f: Box_<F> = Box_::new(f);
2360 connect_raw(
2361 self.as_ptr() as *mut _,
2362 c"notify::show-heading".as_ptr(),
2363 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2364 notify_show_heading_trampoline::<Self, F> as *const (),
2365 )),
2366 Box_::into_raw(f),
2367 )
2368 }
2369 }
2370
2371 #[doc(alias = "show-week-numbers")]
2372 fn connect_show_week_numbers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2373 unsafe extern "C" fn notify_show_week_numbers_trampoline<
2374 P: IsA<Calendar>,
2375 F: Fn(&P) + 'static,
2376 >(
2377 this: *mut ffi::GtkCalendar,
2378 _param_spec: glib::ffi::gpointer,
2379 f: glib::ffi::gpointer,
2380 ) {
2381 unsafe {
2382 let f: &F = &*(f as *const F);
2383 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2384 }
2385 }
2386 unsafe {
2387 let f: Box_<F> = Box_::new(f);
2388 connect_raw(
2389 self.as_ptr() as *mut _,
2390 c"notify::show-week-numbers".as_ptr(),
2391 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2392 notify_show_week_numbers_trampoline::<Self, F> as *const (),
2393 )),
2394 Box_::into_raw(f),
2395 )
2396 }
2397 }
2398
2399 #[doc(alias = "year")]
2400 fn connect_year_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2401 unsafe extern "C" fn notify_year_trampoline<P: IsA<Calendar>, F: Fn(&P) + 'static>(
2402 this: *mut ffi::GtkCalendar,
2403 _param_spec: glib::ffi::gpointer,
2404 f: glib::ffi::gpointer,
2405 ) {
2406 unsafe {
2407 let f: &F = &*(f as *const F);
2408 f(Calendar::from_glib_borrow(this).unsafe_cast_ref())
2409 }
2410 }
2411 unsafe {
2412 let f: Box_<F> = Box_::new(f);
2413 connect_raw(
2414 self.as_ptr() as *mut _,
2415 c"notify::year".as_ptr(),
2416 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2417 notify_year_trampoline::<Self, F> as *const (),
2418 )),
2419 Box_::into_raw(f),
2420 )
2421 }
2422 }
2423}
2424
2425impl<O: IsA<Calendar>> CalendarExt for O {}