`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 [[email protected]].
The date that is currently displayed can be altered with [[email protected]_day].
To place a visual marker on a particular day, use [[email protected]_day] and to remove the marker, [
[email protected]_day]. Alternative, all marks can be cleared with [[email protected]_marks].
The selected date can be retrieved from a `GtkCalendar` using [[email protected]_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.
- public void clear_marks ()
Remove all visual markers.
- public DateTime get_date ()
Returns a `GDateTime` representing the shown year, month and the
selected day.
- public bool get_day_is_marked (uint day)
Returns if the day
of the this
is already marked.
- public bool get_show_day_names ()
Returns whether this is currently
showing the names of the week days.
- public bool get_show_heading ()
Returns whether this is currently
showing the heading.
- public bool get_show_week_numbers ()
Returns whether this is showing week
numbers right now.
- public void mark_day (uint day)
Places a visual marker on a particular day.
- public void select_day (DateTime date)
Switches to date
's year and month and select its day.
- public void set_show_day_names (bool value)
Sets whether the calendar shows day names.
- public void set_show_heading (bool value)
Sets whether the calendar should show a heading.
- public void set_show_week_numbers (bool value)
Sets whether week numbers are shown in the calendar.
- public void unmark_day (uint day)
Removes the visual marker from a particular day.