Calendar


Object Hierarchy:

Gtk.Calendar Gtk.Calendar Gtk.Calendar Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.Calendar GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Gtk.Accessible Gtk.Accessible Gtk.Accessible->Gtk.Calendar Gtk.Accessible->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.Calendar Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget Gtk.ConstraintTarget Gtk.ConstraintTarget->Gtk.Calendar Gtk.ConstraintTarget->Gtk.Widget

Description:

[ CCode ( type_id = "gtk_calendar_get_type ()" ) ]
public sealed class Calendar : Widget, Accessible, Buildable, ConstraintTarget

`GtkCalendar` is a widget that displays a Gregorian calendar, one month at a time.

![An example GtkCalendar](calendar.png)

A `GtkCalendar` can be created with [ctor@Gtk.Calendar.new].

The date that is currently displayed can be altered with [method@Gtk.Calendar.select_day].

To place a visual marker on a particular day, use [method@Gtk.Calendar.mark_day] and to remove the marker, [method@Gtk.Calendar.unmark_day]. Alternative, all marks can be cleared with [method@Gtk.Calendar.clear_marks].

The selected date can be retrieved from a `GtkCalendar` using [method@Gtk.Calendar.get_date].

Users should be aware that, although the Gregorian calendar is the legal calendar in most countries, it was adopted progressively between 1582 and 1929. Display before these dates is likely to be historically incorrect.

CSS nodes

``` calendar.view ├── header │ ├── button │ ├── stack.month │ ├── button │ ├── button │ ├── label.year │ ╰── button ╰── grid ╰── label.day-name.day-number[.today] ```

`GtkCalendar` has a main node with name calendar. It contains a subnode called header containing the widgets for switching between years and months.

The grid subnode contains all day labels, including week numbers on the left (marked with the .week-number css class) and day names on top ( marked with the .day-name css class).

Day labels that belong to the previous or next month get the .other-month style class. The label of the current day get the .today style class.

Marked day labels get the GtkCalendar:selected state assigned.


Namespace: Gtk
Package: gtk4

Content:

Properties:

Creation methods:

Methods:

Signals:

Inherited Members:

All known members inherited from class Gtk.Widget