Synopsis
#include <gtk/gtk.h>
GtkCalendar;
gchar* (*GtkCalendarDetailFunc) (GtkCalendar *calendar,
guint year,
guint month,
guint day,
gpointer user_data);
enum GtkCalendarDisplayOptions;
GtkWidget* gtk_calendar_new (void);
gboolean gtk_calendar_select_month (GtkCalendar *calendar,
guint month,
guint year);
void gtk_calendar_select_day (GtkCalendar *calendar,
guint day);
gboolean gtk_calendar_mark_day (GtkCalendar *calendar,
guint day);
gboolean gtk_calendar_unmark_day (GtkCalendar *calendar,
guint day);
void gtk_calendar_clear_marks (GtkCalendar *calendar);
GtkCalendarDisplayOptions gtk_calendar_get_display_options
(GtkCalendar *calendar);
void gtk_calendar_set_display_options (GtkCalendar *calendar,
GtkCalendarDisplayOptions flags);
void gtk_calendar_get_date (GtkCalendar *calendar,
guint *year,
guint *month,
guint *day);
void gtk_calendar_set_detail_func (GtkCalendar *calendar,
GtkCalendarDetailFunc func,
gpointer data,
GDestroyNotify destroy);
gint gtk_calendar_get_detail_width_chars (GtkCalendar *calendar);
void gtk_calendar_set_detail_width_chars (GtkCalendar *calendar,
gint chars);
gint gtk_calendar_get_detail_height_rows (GtkCalendar *calendar);
void gtk_calendar_set_detail_height_rows (GtkCalendar *calendar,
gint rows);
void gtk_calendar_display_options (GtkCalendar *calendar,
GtkCalendarDisplayOptions flags);
void gtk_calendar_freeze (GtkCalendar *calendar);
void gtk_calendar_thaw (GtkCalendar *calendar);
Properties"day" gint : Read / Write "detail-height-rows" gint : Read / Write "detail-width-chars" gint : Read / Write "month" gint : Read / Write "no-month-change" gboolean : Read / Write "show-day-names" gboolean : Read / Write "show-details" gboolean : Read / Write "show-heading" gboolean : Read / Write "show-week-numbers" gboolean : Read / Write "year" gint : Read / Write Signals"day-selected" : Run First "day-selected-double-click" : Run First "month-changed" : Run First "next-month" : Run First "next-year" : Run First "prev-month" : Run First "prev-year" : Run First Description
GtkCalendar is a widget that displays a calendar, one month at a time.
It can be created with
The month and year currently displayed can be altered with
To place a visual marker on a particular day, use
The way in which the calendar itself is displayed can be altered using
The selected date can be retrieved from a GtkCalendar using
DetailsGtkCalendartypedef struct _GtkCalendar GtkCalendar;
All of these fields should be considered read only, and everything in this struct should only be modified using the functions provided below. Note
Note that GtkCalendarDetailFunc ()gchar* (*GtkCalendarDetailFunc) (GtkCalendar *calendar, guint year, guint month, guint day, gpointer user_data);
This kind of functions provide Pango markup with detail information for the
specified day. Examples for such details are holidays or appointments. The
function returns
Since 2.14 enum GtkCalendarDisplayOptionstypedef enum
{
GTK_CALENDAR_SHOW_HEADING = 1 << 0,
GTK_CALENDAR_SHOW_DAY_NAMES = 1 << 1,
GTK_CALENDAR_NO_MONTH_CHANGE = 1 << 2,
GTK_CALENDAR_SHOW_WEEK_NUMBERS = 1 << 3,
GTK_CALENDAR_WEEK_START_MONDAY = 1 << 4,
GTK_CALENDAR_SHOW_DETAILS = 1 << 5
} GtkCalendarDisplayOptions;
These options can be used to influence the display and behaviour of a GtkCalendar.
gtk_calendar_new ()GtkWidget* gtk_calendar_new (void); Creates a new calendar, with the current date being selected.
gtk_calendar_select_month ()gboolean gtk_calendar_select_month (GtkCalendar *calendar, guint month, guint year); Shifts the calendar to a different month.
gtk_calendar_select_day ()void gtk_calendar_select_day (GtkCalendar *calendar, guint day); Selects a day from the current month.
gtk_calendar_mark_day ()gboolean gtk_calendar_mark_day (GtkCalendar *calendar, guint day); Places a visual marker on a particular day.
gtk_calendar_unmark_day ()gboolean gtk_calendar_unmark_day (GtkCalendar *calendar, guint day); Removes the visual marker from a particular day.
gtk_calendar_clear_marks ()void gtk_calendar_clear_marks (GtkCalendar *calendar); Remove all visual markers.
gtk_calendar_get_display_options ()GtkCalendarDisplayOptions gtk_calendar_get_display_options (GtkCalendar *calendar);
Returns the current display options of
Since 2.4 gtk_calendar_set_display_options ()void gtk_calendar_set_display_options (GtkCalendar *calendar, GtkCalendarDisplayOptions flags); Sets display options (whether to display the heading and the month headings).
Since 2.4 gtk_calendar_get_date ()void gtk_calendar_get_date (GtkCalendar *calendar, guint *year, guint *month, guint *day); Obtains the selected date from a GtkCalendar.
gtk_calendar_set_detail_func ()void gtk_calendar_set_detail_func (GtkCalendar *calendar, GtkCalendarDetailFunc func, gpointer data, GDestroyNotify destroy); Installs a function which provides Pango markup with detail information for each day. Examples for such details are holidays or appointments. That information is shown below each day when "show-details" is set. A tooltip containing with full detail information is provided, if the entire text should not fit into the details area, or if "show-details" is not set. The size of the details area can be restricted by setting the "detail-width-chars" and "detail-height-rows" properties.
Since 2.14 gtk_calendar_get_detail_width_chars ()gint gtk_calendar_get_detail_width_chars (GtkCalendar *calendar); Queries the width of detail cells, in characters. See "detail-width-chars".
Since 2.14 gtk_calendar_set_detail_width_chars ()void gtk_calendar_set_detail_width_chars (GtkCalendar *calendar, gint chars); Updates the width of detail cells. See "detail-width-chars".
Since 2.14 gtk_calendar_get_detail_height_rows ()gint gtk_calendar_get_detail_height_rows (GtkCalendar *calendar); Queries the height of detail cells, in rows. See "detail-width-chars".
Since 2.14 gtk_calendar_set_detail_height_rows ()void gtk_calendar_set_detail_height_rows (GtkCalendar *calendar, gint rows); Updates the height of detail cells. See "detail-height-rows".
Since 2.14 gtk_calendar_display_options ()void gtk_calendar_display_options (GtkCalendar *calendar, GtkCalendarDisplayOptions flags); Warning
Sets display options (whether to display the heading and the month headings).
gtk_calendar_freeze ()void gtk_calendar_freeze (GtkCalendar *calendar); Warning
Does nothing. Previously locked the display of the calendar until
it was thawed with
gtk_calendar_thaw ()void gtk_calendar_thaw (GtkCalendar *calendar); Warning
Does nothing. Previously defrosted a calendar; all the changes made
since the last
Property DetailsThe
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"day-selected-double-click" signalvoid user_function (GtkCalendar *calendar, gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"month-changed" signalvoid user_function (GtkCalendar *calendar, gpointer user_data) : Run First
Emitted when the user clicks a button to change the selected month on a calendar.
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"next-month" signalvoid user_function (GtkCalendar *calendar, gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"next-year" signalvoid user_function (GtkCalendar *calendar, gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"prev-month" signalvoid user_function (GtkCalendar *calendar, gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"prev-year" signalvoid user_function (GtkCalendar *calendar, gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |