gtk.calendar

Module for [Calendar] class

Types 3

gtk.calendar.Calendar is a widget that displays a Gregorian calendar, one month at a time.

!An example GtkCalendar

A gtk.calendar.Calendar can be created with gtk.calendar.Calendar.new_.

The date that is currently displayed can be altered with gtk.calendar.Calendar.selectDay.

To place a visual marker on a particular day, use gtk.calendar.Calendar.markDay and to remove the marker, gtk.calendar.Calendar.unmarkDay. Alternative, all marks can be cleared with gtk.calendar.Calendar.clearMarks.

The selected date can be retrieved from a gtk.calendar.Calendar using gtk.calendar.Calendar.getDate.

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]

gtk.calendar.Calendar 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 :selected state assigned.

Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
Calendar self() nothrowReturns `this`, for use in `with` statements.
CalendarGidBuilder builder() static nothrowGet builder for [gtk.calendar.Calendar] Returns: New builder object
int day() @property nothrowGet `day` property. Returns: The selected day (as a number between 1 and 31).
void day(int propval) @property nothrowSet `day` property. Params: propval = The selected day (as a number between 1 and 31).
int month() @property nothrowGet `month` property. Returns: The selected month (as a number between 0 and 11).
void month(int propval) @property nothrowSet `month` property. Params: propval = The selected month (as a number between 0 and 11).
bool showDayNames() @property nothrowGet `showDayNames` property. Returns: Determines whether day names are displayed.
void showDayNames(bool propval) @property nothrowSet `showDayNames` property. Params: propval = Determines whether day names are displayed.
bool showHeading() @property nothrowGet `showHeading` property. Returns: Determines whether a heading is displayed.
void showHeading(bool propval) @property nothrowSet `showHeading` property. Params: propval = Determines whether a heading is displayed.
bool showWeekNumbers() @property nothrowGet `showWeekNumbers` property. Returns: Determines whether week numbers are displayed.
void showWeekNumbers(bool propval) @property nothrowSet `showWeekNumbers` property. Params: propval = Determines whether week numbers are displayed.
int year() @property nothrowGet `year` property. Returns: The selected year.
void year(int propval) @property nothrowSet `year` property. Params: propval = The selected year.
void clearMarks() nothrowRemove all visual markers.
glib.date_time.DateTime getDate() nothrowReturns a [glib.date_time.DateTime] representing the shown year, month and the selected day.
int getDay() nothrowGets the day of the selected date. Returns: the day of the selected date.
bool getDayIsMarked(uint day) nothrowReturns if the day of the calendar is already marked.
int getMonth() nothrowGets the month of the selected date. Returns: The month of the selected date (as a number between 0 and 11).
bool getShowDayNames() nothrowReturns whether self is currently showing the names of the week days.
bool getShowHeading() nothrowReturns whether self is currently showing the heading.
bool getShowWeekNumbers() nothrowReturns whether self is showing week numbers right now.
int getYear() nothrowGets the year of the selected date. Returns: the year of the selected date.
void markDay(uint day) nothrowPlaces a visual marker on a particular day of the current month.
void selectDay(glib.date_time.DateTime date) nothrowSwitches to date's year and month and select its day.
void setDay(int day) nothrowSets the day for the selected date.
void setMonth(int month) nothrowSets the month for the selected date.
void setShowDayNames(bool value) nothrowSets whether the calendar shows day names.
void setShowHeading(bool value) nothrowSets whether the calendar should show a heading.
void setShowWeekNumbers(bool value) nothrowSets whether week numbers are shown in the calendar.
void setYear(int year) nothrowSets the year for the selected date.
void unmarkDay(uint day) nothrowRemoves the visual marker from a particular day.
gulong connectDaySelected(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.calendar.Calendar))) && Parameters!T.length < 2) nothrowConnect to `DaySelected` signal.
gulong connectNextMonth(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.calendar.Calendar))) && Parameters!T.length < 2) nothrowConnect to `NextMonth` signal.
gulong connectNextYear(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.calendar.Calendar))) && Parameters!T.length < 2) nothrowConnect to `NextYear` signal.
gulong connectPrevMonth(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.calendar.Calendar))) && Parameters!T.length < 2) nothrowConnect to `PrevMonth` signal.
gulong connectPrevYear(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.calendar.Calendar))) && Parameters!T.length < 2) nothrowConnect to `PrevYear` signal.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new calendar, with the current date being selected. Returns: a newly [gtk.calendar.Calendar] widget

Fluent builder implementation template for gtk.calendar.Calendar

Methods
T day(int propval) nothrowSet `day` property. Params: propval = The selected day (as a number between 1 and 31). Returns: Builder instance for fluent chaining
T month(int propval) nothrowSet `month` property. Params: propval = The selected month (as a number between 0 and 11).
T showDayNames(bool propval) nothrowSet `showDayNames` property. Params: propval = Determines whether day names are displayed. Returns: Builder instance for fluent chaining
T showHeading(bool propval) nothrowSet `showHeading` property. Params: propval = Determines whether a heading is displayed. Returns: Builder instance for fluent chaining
T showWeekNumbers(bool propval) nothrowSet `showWeekNumbers` property. Params: propval = Determines whether week numbers are displayed. Returns: Builder instance for fluent chaining
T year(int propval) nothrowSet `year` property. Params: propval = The selected year.

Fluent builder for gtk.calendar.Calendar

Methods
Calendar build() nothrowCreate object from builder. Returns: New object