Struct gtk4::Calendar [−][src]
pub struct Calendar(_);
Expand description
Calendar
is a widget that displays a Gregorian calendar, one month
at a time.
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 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 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.
Switches to date
’s year and month and select its day.
date
a GDateTime
representing the day to select
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
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.
pub fn connect_show_week_numbers_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
Trait Implementations
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
Returns the type identifier of Self
.
Auto Trait Implementations
impl RefUnwindSafe for Calendar
impl UnwindSafe for Calendar
Blanket Implementations
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
Returns true
if the object is an instance of (can be cast to) T
.
pub fn set_property<'a, N, V>(
&self,
property_name: N,
value: V
) -> Result<(), BoolError> where
N: Into<&'a str>,
V: ToValue,
pub fn set_property_from_value<'a, N>(
&self,
property_name: N,
value: &Value
) -> Result<(), BoolError> where
N: Into<&'a str>,
pub fn set_properties_from_value(
&self,
property_values: &[(&str, Value)]
) -> Result<(), BoolError>
pub fn has_property<'a, N>(&self, property_name: N, type_: Option<Type>) -> bool where
N: Into<&'a str>,
pub fn find_property<'a, N>(&self, property_name: N) -> Option<ParamSpec> where
N: Into<&'a str>,
Safety Read more
Safety Read more
Safety Read more
Safety Read more
pub fn connect<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
Same as connect
but takes a SignalId
instead of a signal name.
pub fn connect_local<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: 'static + Fn(&[Value]) -> Option<Value>,
Same as connect_local
but takes a SignalId
instead of a signal name.
pub unsafe fn connect_unsafe<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: Fn(&[Value]) -> Option<Value>,
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.
pub fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec) + Send + Sync,
pub fn connect_notify_local<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec),
pub unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: Fn(&T, &ParamSpec),
pub fn bind_property<'a, O, N, M>(
&'a self,
source_property: N,
target: &'a O,
target_property: M
) -> BindingBuilder<'a> where
O: ObjectType,
N: Into<&'a str>,
M: Into<&'a str>,
Returns a SendValue
clone of self
.