Struct gtk4::Calendar[][src]

pub struct Calendar(_);
Expand description

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

An example GtkCalendar

A Calendar can be created with new().

The date that is currently displayed can be altered with select_day().

To place a visual marker on a particular day, use mark_day() and to remove the marker, unmark_day(). Alternative, all marks can be cleared with clear_marks().

The selected date can be retrieved from a Calendar using 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][.week-number][.day-number][.other-month][.today]

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.

Implements

WidgetExt, glib::ObjectExt, AccessibleExt, BuildableExt, ConstraintTargetExt, WidgetExtManual, AccessibleExtManual

Implementations

Creates a new calendar, with the current date being selected.

Returns

a newly Calendar widget

Creates a new builder-pattern struct instance to construct Calendar objects.

This method returns an instance of CalendarBuilder which can be used to create Calendar objects.

Remove all visual markers.

Returns a GDateTime representing the shown year, month and the selected day.

The returned date is in the local time zone.

Returns

the GDate representing the shown date

Returns if the day of the self is already marked.

day

the day number between 1 and 31.

Returns

whether the day is marked.

Returns whether self is currently showing the names of the week days.

This is the value of the property::Calendar::show-day-names property.

Returns

Whether the calendar shows day names.

Returns whether self is currently showing the heading.

This is the value of the property::Calendar::show-heading property.

Returns

Whether the calendar is showing a heading.

Returns whether self is showing week numbers right now.

This is the value of the property::Calendar::show-week-numbers property.

Returns

Whether the calendar is showing week numbers.

Places a visual marker on a particular day.

day

the day number to mark between 1 and 31.

Switches to date’s year and month and select its day.

date

a GDateTime representing the day to select

Sets whether the calendar shows day names.

value

Whether to show day names above the day numbers

Sets whether the calendar should show a heading.

The heading contains the current year and month as well as buttons for changing both.

value

Whether to show the heading in the calendar

Sets whether week numbers are shown in the calendar.

value

whether to show week numbers on the left of the days

Removes the visual marker from a particular day.

day

the day number to unmark between 1 and 31.

The selected day (as a number between 1 and 31).

The selected day (as a number between 1 and 31).

The selected month (as a number between 0 and 11).

This property gets initially set to the current month.

The selected month (as a number between 0 and 11).

This property gets initially set to the current month.

The selected year.

This property gets initially set to the current year.

The selected year.

This property gets initially set to the current year.

Emitted when the user selects a day.

Emitted when the user switched to the next month.

Emitted when user switched to the next year.

Emitted when the user switched to the previous month.

Emitted when user switched to the previous year.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Upcasts an object to a superclass or interface T. Read more

Upcasts an object to a reference of its superclass or interface T. Read more

Tries to downcast to a subclass or interface implementor T. Read more

Tries to downcast to a reference of its subclass or interface implementor T. Read more

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Casts to T unconditionally. Read more

Casts to &T unconditionally. Read more

Performs the conversion.

Performs the conversion.

Returns true if the object is an instance of (can be cast to) T.

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Same as connect but takes a SignalId instead of a signal name.

Same as connect_local but takes a SignalId instead of a signal name.

Same as connect_unsafe but takes a SignalId instead of a signal name.

Emit signal by signal id.

Same as emit but takes Value for the arguments.

Emit signal by its name.

Same as emit_by_name but takes Value for the arguments.

Emit signal with details by signal id.

Same as emit_with_details but takes Value for the arguments.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Returns a SendValue clone of self.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.