Class: Gtk::Calendar
- Defined in:
- (unknown)
Overview
Displays a Gregorian calendar, one month at a time.
A GtkCalendar can be created with [ctorGtk.Calendar.new].
The selected date can be retrieved from a GtkCalendar using
[methodGtk.Calendar.get_date].
It can be altered with [methodGtk.Calendar.set_date].
To place a visual marker on a particular day, use
[methodGtk.Calendar.mark_day] and to remove the marker,
[methodGtk.Calendar.unmark_day]. Alternative, all
marks can be cleared with [methodGtk.Calendar.clear_marks].
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.
Shortcuts and Gestures
GtkCalendar supports the following gestures:
- Scrolling up or down will switch to the previous or next month.
- Date strings can be dropped for setting the current day.
CSS nodes
calendar.view
├── header
│ ├── button
│ ├── stack.month
│ ├── button
│ ├── button
│ ├── label.year
│ ╰── button
╰── grid
╰── label[.day-name][.week-number][.day-number][.other-month][.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 :selected state assigned.
Instance Method Summary collapse
-
#clear_marks ⇒ nil
Remove all visual markers.
-
#date ⇒ GLib::DateTime
The selected date.
-
#date=(date) ⇒ GLib::DateTime
The selected date.
-
#day ⇒ Integer
The selected day (as a number between 1 and 31).
-
#day=(day) ⇒ Integer
The selected day (as a number between 1 and 31).
-
#get_day_is_marked(day) ⇒ Boolean
Returns if the day of the calendar is already marked.
-
#initialize ⇒ Gtk::Widget
constructor
Creates a new calendar, with the current date being selected.
-
#mark_day(day) ⇒ nil
Places a visual marker on a particular day of the current month.
-
#month ⇒ Integer
The selected month (as a number between 0 and 11).
-
#month=(month) ⇒ Integer
The selected month (as a number between 0 and 11).
-
#select_day(date) ⇒ nil
Switches to date's year and month and select its day.
-
#show_day_names ⇒ Boolean
Returns whether self is currently showing the names of the week days.
-
#show_day_names=(show_day_names) ⇒ Boolean
Determines whether day names are displayed.
-
#show_day_names? ⇒ Boolean
Determines whether day names are displayed.
-
#show_heading ⇒ Boolean
Returns whether self is currently showing the heading.
-
#show_heading=(show_heading) ⇒ Boolean
Determines whether a heading is displayed.
-
#show_heading? ⇒ Boolean
Determines whether a heading is displayed.
-
#show_week_numbers ⇒ Boolean
Returns whether self is showing week numbers right now.
-
#show_week_numbers=(show_week_numbers) ⇒ Boolean
Determines whether week numbers are displayed.
-
#show_week_numbers? ⇒ Boolean
Determines whether week numbers are displayed.
-
#unmark_day(day) ⇒ nil
Removes the visual marker from a particular day.
-
#year ⇒ Integer
The selected year.
-
#year=(year) ⇒ Integer
The selected year.
Methods inherited from Widget
#accessible_role, #accessible_role=, #action_set_enabled, #activate, #activate_action, #activate_action_variant, #activate_default, #activate_signal, #activate_signal=, #activate_signal_from_name=, #add_binding, #add_binding_action, #add_binding_signal, #add_controller, #add_css_class, #add_mnemonic_label, #add_shortcut, #add_tick_callback, #allocate, #allocated_baseline, #allocated_height, #allocated_width, #baseline, #bind_template_callback_full, #bind_template_child_full, #can_focus, #can_focus=, #can_focus?, #can_target, #can_target=, #can_target?, #child_focus, #child_visible, #child_visible=, #clipboard, #compute_bounds, #compute_expand, #compute_point, #compute_transform, #contains, #create_pango_context, #create_pango_layout, #css_classes, #css_classes=, #css_name, #css_name=, #cursor, #cursor=, #cursor_from_name=, default_direction, default_direction=, #direction, #direction=, #display, #dispose_template, #drag_check_threshold, #error_bell, #first_child, #focus_child, #focus_child=, #focus_on_click, #focus_on_click=, #focus_on_click?, #focusable, #focusable=, #focusable?, #font_map, #font_map=, #font_options, #font_options=, #frame_clock, #get_allocation, #get_ancestor, #get_color, #get_preferred_size, #get_size, #get_size_request, #get_template_child, #grab_focus, #halign, #halign=, #has_css_class, #has_default, #has_default=, #has_default?, #has_focus, #has_focus=, #has_focus?, #has_tooltip, #has_tooltip=, #has_tooltip?, #has_visible_focus, #height, #height_request, #height_request=, #hexpand, #hexpand=, #hexpand?, #hexpand_set, #hexpand_set=, #hexpand_set?, #hide, #in_destruction, #init_template, #insert_action_group, #insert_after, #insert_before, #install_action, #install_property_action, #is_ancestor, #is_drawable, #is_focus, #is_sensitive, #is_visible, #keynav_failed, #last_child, #layout_manager, #layout_manager=, #layout_manager_type, #layout_manager_type=, #limit_events, #limit_events=, #limit_events?, #list_mnemonic_labels, #map, #mapped, #margin_bottom, #margin_bottom=, #margin_end, #margin_end=, #margin_start, #margin_start=, #margin_top, #margin_top=, #measure, #mnemonic_activate, #name, #name=, #native, #next_sibling, #observe_children, #observe_controllers, #opacity, #opacity=, #overflow, #overflow=, #pango_context, #parent, #parent=, #pick, #prev_sibling, #primary_clipboard, #query_action, #queue_allocate, #queue_draw, #queue_resize, #realize, #realized, #receives_default, #receives_default=, #receives_default?, #remove_controller, #remove_css_class, #remove_mnemonic_label, #remove_tick_callback, #request_mode, #root, #root=, #scale_factor, #scale_factor=, #sensitive, #sensitive=, #sensitive?, #set_size_request, #set_state_flags, #settings, #should_layout, #show, #size_allocate, #snapshot_child, #state_flags, #style_context, #template=, #template_from_resource=, #template_scope=, #tooltip_markup, #tooltip_markup=, #tooltip_text, #tooltip_text=, #translate_coordinates, #trigger_tooltip_query, #unmap, #unparent, #unrealize, #unset_state_flags, #valign, #valign=, #vexpand, #vexpand=, #vexpand?, #vexpand_set, #vexpand_set=, #vexpand_set?, #visible, #visible=, #visible?, #width, #width_request, #width_request=
Constructor Details
#initialize ⇒ Gtk::Widget
Creates a new calendar, with the current date being selected.
Instance Method Details
#clear_marks ⇒ nil
Remove all visual markers.
#date ⇒ GLib::DateTime
The selected date.
This property gets initially set to the current date.
#date=(date) ⇒ GLib::DateTime
The selected date.
This property gets initially set to the current date.
#day ⇒ Integer
The selected day (as a number between 1 and 31).
#day=(day) ⇒ Integer
The selected day (as a number between 1 and 31).
#get_day_is_marked(day) ⇒ Boolean
Returns if the day of the calendar is already marked.
#mark_day(day) ⇒ nil
Places a visual marker on a particular day of the current month.
#month ⇒ Integer
The selected month (as a number between 0 and 11).
This property gets initially set to the current month.
#month=(month) ⇒ Integer
The selected month (as a number between 0 and 11).
This property gets initially set to the current month.
#select_day(date) ⇒ nil
Switches to date's year and month and select its day.
#show_day_names ⇒ Boolean
Returns whether self is currently showing the names
of the week days.
This is the value of the [propertyGtk.Calendar:show-day-names]
property.
#show_day_names=(show_day_names) ⇒ Boolean
Determines whether day names are displayed.
#show_day_names? ⇒ Boolean
Determines whether day names are displayed.
#show_heading ⇒ Boolean
Returns whether self is currently showing the heading.
This is the value of the [propertyGtk.Calendar:show-heading]
property.
#show_heading=(show_heading) ⇒ Boolean
Determines whether a heading is displayed.
#show_heading? ⇒ Boolean
Determines whether a heading is displayed.
#show_week_numbers ⇒ Boolean
Returns whether self is showing week numbers right
now.
This is the value of the [propertyGtk.Calendar:show-week-numbers]
property.
#show_week_numbers=(show_week_numbers) ⇒ Boolean
Determines whether week numbers are displayed.
#show_week_numbers? ⇒ Boolean
Determines whether week numbers are displayed.
#unmark_day(day) ⇒ nil
Removes the visual marker from a particular day.
#year ⇒ Integer
The selected year.
This property gets initially set to the current year.
#year=(year) ⇒ Integer
The selected year.
This property gets initially set to the current year.