Gtk::Calendar
class Gtk::Calendar
Gtk::Calendar is a widget that displays a calendar, one month at a time. It can be created with Gtk::Calendar.new.
The month and year currently displayed can be altered with Gtk::Calendar#select_month. The exact day can be selected from the displayed month using Gtk::Calendar#select_day.
To place a visual marker on a particular day, use Gtk::Calendar#mark_day and to remove the marker, Gtk::Calendar#unmark_day. Alternative, all marks can be cleared with Gtk::Calendar#clear_marks.
The way in which the calendar itself is displayed can be altered using Gtk::Calendar#display_options.
The selected date can be retrieved from a Gtk::Calendar using Gtk::Calendar#date.
If performing many 'mark' operations, the calendar can be frozen to prevent flicker, using Gtk::Calendar#freeze, and 'thawed' again using Gtk::Calendar#thaw.
Class Methods
Gtk::Calendar.new
-
Creates a new calendar, with the current date being selected.
- Returns: a newly Gtk::Calendar.
Instance Methods
select_month(month, year)
-
Shifts the calendar to a different month.
- month: a month number between 0 and 11.
- year: the year the month is in.
- Returns: self
select_day(day)
-
Selects a day from the current month.
- day: the day number between 1 and 31, or 0 to unselect the currently selected day.
- Returns: self
mark_day(day)
-
Places a visual marker on a particular day.
- day: the day number to mark between 1 and 31.
- Returns: self
unmark_day(day)
-
Removes the visual marker from a particular day.
- day: the day number to unmark between 1 and 31.
- Returns: self
clear_marks
-
Remove all visual markers.
- Returns: self
display_options
-
Returns the current display options of calendar. Since 2.4
- Returns: the display options(Gtk::Calendar#DisplayOptions).
display_options(flags)
-
Sets display options (whether to display the heading and the month headings). Deprecated since 2.4.
Use Gtk::Calendar#display_options= instead
- flags: the display options(Gtk::Calendar#DisplayOptions) to set.
display_options=(flags)
-
Sets display options (whether to display the heading and the month headings).
- flags: the display options(Gtk::Calendar#DisplayOptions) to set
- Returns: flags
set_display_options(flags)
-
Same as Gtk::Calendar#display_options=. Since 2.4
- flags: the display options(Gtk::Calendar#DisplayOptions) to set
- Returns: self
date
-
Obtains the selected date from a Gtk::Calendar.
- Returns: [year, month, day]
- month(between 0 and 11), day(between 1 and 31).
- Returns: [year, month, day]
freeze
-
Locks the display of the calendar until it is thawed with Gtk::Calendar#thaw. Deprecated
- Returns: self
thaw
- Defrosts a calendar; all the changes made since the last Gtk::Calendar#freeze are displayed. Deprecated
show_heading?
-
Gets the value whether day names are displayed or not.
- Returns: true if the day names are displayed, otherwise false.
show_heading=(show_heading)
-
Sets the value whether day names are displayed or not.
- show_heading: true if the day names are displayed, otherwise false.
- Returns: show_heading
set_show_heading(show_heading)
-
Same as Gtk::Calendar#show_heading=.
- show_heading: true if the day names are displayed, otherwise false.
- Returns: self
show_week_numbers?
-
Gets the value whether day names are displayed or not.
- Returns: true if the day names are displayed, otherwise false.
show_week_numbers=(show_week_numbers)
-
Sets the value whether day names are displayed or not.
- show_week_numbers: true if the day names are displayed
- Returns: show_week_numbers
set_show_week_numbers(show_week_numbers)
-
Same as Gtk::Calendar#show_week_numbers=.
- show_week_numbers: true if the day names are displayed
- Returns: self
show_day_names?
-
Gets the value whether day names are displayed or not.
- Returns: true if the day names are displayed, otherwise false.
show_day_names=(show_day_names)
-
Sets the value whether day names are displayed or not.
- show_day_names: true if the day names are displayed, otherwise false.
- Returns: show_day_names
set_show_day_names(show_day_names)
-
Same as Gtk::Calendar#show_day_names=.
- show_day_names: true if the day names are displayed, otherwise false.
- Returns: self
no_month_change?
-
Gets the value whether the selected month cannot be changed or not.
- Returns: true if the selected month cannot be changed, otherwise false.
no_month_change=(no_month_change)
-
Sets the value whether the selected month cannot be changed or not.
- no_month_change: true if the selected month cannot be changed, otherwise false.
- Returns: no_month_change
set_no_month_change(no_month_change)
-
Same as Gtk::Calendar#no_month_change=.
- no_month_change: true if the selected month cannot be changed, otherwise false.
- Returns: self
year
-
Gets the selected year.
- Returns: The selected year
year=(year)
-
Sets the selected year.
- year: The selected year
- Returns: year
set_year(year)
-
Same as Gtk::Calendar#year=.
- year: The selected year
- Returns: self
month
-
Gets the selected month (as a number between 0 and 11).
- Returns: The selected month (as a number between 0 and 11)
month=(month)
-
Sets the selected month (as a number between 0 and 11).
- month: The selected month (as a number between 0 and 11)
- Returns: month
set_month(month)
-
Same as Gtk::Calendar#month=.
- month: The selected month (as a number between 0 and 11)
- Returns: self
day
-
Gets the selected day (as a number between 1 and 31, or 0 to unselect the currently selected day).
- Returns: The selected day (as a number between 1 and 31, or 0 to unselect the currently selected day)
day=(day)
-
Sets the selected day (as a number between 1 and 31, or 0 to unselect the currently selected day).
- day: The selected day (as a number between 1 and 31, or 0 to unselect the currently selected day)
- Returns: day
set_day(day)
-
Same as Gtk::Calendar#day=.
- day: The selected day (as a number between 1 and 31, or 0 to unselect the currently selected day)
- Returns: self
Constants
DisplayOptions
These options can be used to influence the display and behaviour of a Gtk::Calendar.
SHOW_HEADING
- Specifies that the month and year should be displayed.
SHOW_DAY_NAMES
- Specifies that three letter day descriptions should be present.
NO_MONTH_CHANGE
- Prevents the user from switching months with the calendar.
SHOW_WEEK_NUMBERS
- Displays each week numbers of the current year, down the left side of the calendar.
WEEK_START_MONDAY
- Since GTK+ 2.4, this option is deprecated and ignored by GTK+. The information on which day the calendar week starts is derived from the locale.
Properties
day: Integer (Read/Write)
-
The selected day (as a number between 1 and 31, or 0 to unselect the currently selected day).
- Allowed values: [0,31]
- Default value: 0
month: Integer (Read/Write)
-
The selected month (as a number between 0 and 11).
- Allowed values: [0,11]
- Default value: 0
no-month-change: true or false (Read/Write)
-
Determines whether the selected month can be changed. Since 2.4
- Default value: false
show-day-names: true or false (Read/Write)
-
Determines whether day names are displayed. Since 2.4
- Default value: true
show-heading: true or false (Read/Write)
-
Determines whether a heading is displayed. Since 2.4
- Default value: true
show-week-numbers: true or false (Read/Write)
-
Determines whether week numbers are displayed. Since 2.4
- Default value: false
year: Integer (Read/Write)
-
The selected year.
- Allowed values: >= 0
- Default value: 0
Signals
day-selected: self
-
Emitted when the user selects a day.
- self: Gtk::Calendar
day-selected-double-click: self
-
- self: Gtk::Calendar
month-changed: self
-
Emitted when the user clicks a button to change the selected month on a calendar.
- self: Gtk::Calendar
next-month: self
-
- self: Gtk::Calendar
next-year: self
-
- self: Gtk::Calendar
prev-month: self
-
- self: Gtk::Calendar
prev-year: self
-
- self: Gtk::Calendar
Parola chiave:
Referenze:[Gtk::Calendar]