Package: gtk

Class gtk:calendar

Superclasses

Documented Subclasses

None

Direct Slots

day
The day property of type :int (Read / Write)
The selected day as a number between 1 and 31, or 0 to unselect the currently selected day. This property gets initially set to the current day.
Allowed values: [0, 31]
Default value: 0
month
The month property of type :int (Read / Write)
The selected month as a number between 0 and 11. This property gets initially set to the current month.
Allowed values: [0, 11]
Default value: 0
show-day-names
The show-day-names property of type :boolean (Read / Write)
Determines whether day names are displayed.
Default value: true
show-heading
The show-heading property of type :boolean (Read / Write)
Determines whether a heading is displayed.
Default value: true
show-week-numbers
The show-week-numbers property of type :boolean (Read / Write)
Determines whether week numbers are displayed.
Default value: false
year
The year property of type :int (Read / Write)
The selected year. This property gets initially set to the current year.
Allowed values: [0, 4194303]
Default value: 0

Details

The gtk:calendar widget displays a Gregorian calendar, one month at a time. It can be created with the gtk:calendar-new function.

Figure: GtkCalendar

The date that is currently displayed can be altered with the gtk:calendar-select-day function. The selected date can be retrieved from a gtk:calendar widget using the gtk:calendar-date function.

To place a visual marker on a particular day, use the gtk:calendar-mark-day function and to remove the marker, the gtk:calendar-unmark-day function. Alternative, all marks can be cleared with the gtk:calendar-clear-marks function.

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][.week-number][.day-number][.other-month][.today]    
The gtk:calendar implementation 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 style class, and day names on top, marked with the .day-name style 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 :selected state assigned.

Signal Details

The "day-selected" signal
lambda (calendar)    :run-first      
calendar
The gtk:calendar widget which received the signal.
The signal is emitted when the user selects a day.
The "next-month" signal
lambda (calendar)    :run-first      
calendar
The gtk:calendar widget which received the signal.
The signal is emitted when the user switched to the next month.
The "next-year" signal
lambda (calendar)    :run-first      
calendar
The gtk:calendar widget which received the signal.
The signal is emitted when user switched to the next year.
The "prev-month" signal
lambda (calendar)    :run-first      
calendar
The gtk:calendar widget which received the signal.
The signal is emitted when the user switched to the previous month.
The "prev-year" signal
lambda (calendar)    :run-first      
calendar
The gtk:calendar widget which received the signal.
The signal is emitted when user switched to the previous year.
 

Returned by

Slot Access Functions

Inherited Slot Access Functions

2024-10-31