Top |
Functions
GtkWidget * | gtk_calendar_new () |
void | gtk_calendar_select_day () |
void | gtk_calendar_mark_day () |
void | gtk_calendar_unmark_day () |
gboolean | gtk_calendar_get_day_is_marked () |
void | gtk_calendar_clear_marks () |
gboolean | gtk_calendar_get_show_day_names () |
void | gtk_calendar_set_show_day_names () |
gboolean | gtk_calendar_get_show_heading () |
void | gtk_calendar_set_show_heading () |
gboolean | gtk_calendar_get_show_week_numbers () |
void | gtk_calendar_set_show_week_numbers () |
GDateTime * | gtk_calendar_get_date () |
Properties
int | day | Read / Write |
int | month | Read / Write |
gboolean | show-day-names | Read / Write |
gboolean | show-heading | Read / Write |
gboolean | show-week-numbers | Read / Write |
int | year | Read / Write |
Signals
void | day-selected | Run First |
void | next-month | Run First |
void | next-year | Run First |
void | prev-month | Run First |
void | prev-year | Run First |
Description
GtkCalendar is a widget that displays a Gregorian calendar, one month
at a time. It can be created with gtk_calendar_new()
.
The date that is currently displayed can be altered with
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 selected date can be retrieved from a GtkCalendar using
gtk_calendar_get_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
1 2 3 4 5 6 7 8 9 10 |
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.
Functions
gtk_calendar_new ()
GtkWidget *
gtk_calendar_new (void
);
Creates a new calendar, with the current date being selected.
gtk_calendar_select_day ()
void gtk_calendar_select_day (GtkCalendar *self
,GDateTime *date
);
Will switch to date
's year and month and select its day.
gtk_calendar_mark_day ()
void gtk_calendar_mark_day (GtkCalendar *calendar
,guint day
);
Places a visual marker on a particular day.
gtk_calendar_unmark_day ()
void gtk_calendar_unmark_day (GtkCalendar *calendar
,guint day
);
Removes the visual marker from a particular day.
gtk_calendar_get_day_is_marked ()
gboolean gtk_calendar_get_day_is_marked (GtkCalendar *calendar
,guint day
);
Returns if the day
of the calendar
is already marked.
gtk_calendar_clear_marks ()
void
gtk_calendar_clear_marks (GtkCalendar *calendar
);
Remove all visual markers.
gtk_calendar_get_show_day_names ()
gboolean
gtk_calendar_get_show_day_names (GtkCalendar *self
);
Returns whether self
is currently showing the names
of the week days above the day numbers, i.e. the value
of the “show-day-names” property.
gtk_calendar_set_show_day_names ()
void gtk_calendar_set_show_day_names (GtkCalendar *self
,gboolean value
);
Sets whether the calendar shows day names.
gtk_calendar_get_show_heading ()
gboolean
gtk_calendar_get_show_heading (GtkCalendar *self
);
Returns whether self
is currently showing the heading,
i.e. the value of the “show-heading” property.
Return: Whether the calendar is showing a heading.
gtk_calendar_set_show_heading ()
void gtk_calendar_set_show_heading (GtkCalendar *self
,gboolean value
);
Sets whether the calendar should show a heading containing the current year and month as well as buttons for changing both.
gtk_calendar_get_show_week_numbers ()
gboolean
gtk_calendar_get_show_week_numbers (GtkCalendar *self
);
Returns whether self
is showing week numbers right
now, i.e. the value of the “show-week-numbers”
property.
Return: Whether the calendar is showing week numbers.
gtk_calendar_set_show_week_numbers ()
void gtk_calendar_set_show_week_numbers (GtkCalendar *self
,gboolean value
);
Sets whether week numbers are shown in the calendar.
gtk_calendar_get_date ()
GDateTime *
gtk_calendar_get_date (GtkCalendar *self
);
Returns a GDateTime representing the shown year, month and the selected day, in the local time zone.
Property Details
The “day”
property
“day” int
The selected day (as a number between 1 and 31, or 0 to unselect the currently selected day). This property gets initially set to the current day.
Owner: GtkCalendar
Flags: Read / Write
Allowed values: [0,31]
Default value: 0
The “month”
property
“month” int
The selected month (as a number between 0 and 11). This property gets initially set to the current month.
Owner: GtkCalendar
Flags: Read / Write
Allowed values: [0,11]
Default value: 0
The “show-day-names”
property
“show-day-names” gboolean
Determines whether day names are displayed.
Owner: GtkCalendar
Flags: Read / Write
Default value: TRUE
The “show-heading”
property
“show-heading” gboolean
Determines whether a heading is displayed.
Owner: GtkCalendar
Flags: Read / Write
Default value: TRUE
The “show-week-numbers”
property
“show-week-numbers” gboolean
Determines whether week numbers are displayed.
Owner: GtkCalendar
Flags: Read / Write
Default value: FALSE
Signal Details
The “day-selected”
signal
void user_function (GtkCalendar *calendar, gpointer user_data)
Emitted when the user selects a day.
Parameters
calendar |
the object which received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
The “next-month”
signal
void user_function (GtkCalendar *calendar, gpointer user_data)
Emitted when the user switched to the next month.
Parameters
calendar |
the object which received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
The “next-year”
signal
void user_function (GtkCalendar *calendar, gpointer user_data)
Emitted when user switched to the next year.
Parameters
calendar |
the object which received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
The “prev-month”
signal
void user_function (GtkCalendar *calendar, gpointer user_data)
Emitted when the user switched to the previous month.
Parameters
calendar |
the object which received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
The “prev-year”
signal
void user_function (GtkCalendar *calendar, gpointer user_data)
Emitted when user switched to the previous year.
Parameters
calendar |
the object which received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First