![]() |
![]() |
![]() |
GTK+ 3 Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#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
); void gtk_calendar_select_month (GtkCalendar *calendar
,guint month
,guint year
); void gtk_calendar_select_day (GtkCalendar *calendar
,guint day
); void gtk_calendar_mark_day (GtkCalendar *calendar
,guint day
); void gtk_calendar_unmark_day (GtkCalendar *calendar
,guint day
); gboolean gtk_calendar_get_day_is_marked (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
);
GtkCalendar is a widget that displays a Gregorian 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_set_display_options()
.
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.
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 NULL
when no information is available.
|
a GtkCalendar. |
|
the year for which details are needed. |
|
the month for which details are needed. |
|
the day of month for which details are needed.
|
|
the data passed with gtk_calendar_set_detail_func() .
|
Returns : |
Newly allocated string with Pango markup with details
for the specified day, or NULL .
|
Since 2.14
typedef 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_SHOW_DETAILS = 1 << 5 } GtkCalendarDisplayOptions;
These options can be used to influence the display and behaviour of a GtkCalendar.
Specifies that the month and year should be displayed. | |
Specifies that three letter day descriptions should be present. | |
Prevents the user from switching months with the calendar. | |
Displays each week numbers of the current year, down the left side of the calendar. | |
Just show an indicator, not the full details
text when details are provided. See gtk_calendar_set_detail_func() .
|
GtkWidget* gtk_calendar_new (void
);
Creates a new calendar, with the current date being selected.
Returns : |
a newly GtkCalendar widget |
void gtk_calendar_select_month (GtkCalendar *calendar
,guint month
,guint year
);
Shifts the calendar to a different month.
|
a GtkCalendar |
|
a month number between 0 and 11. |
|
the year the month is in. |
void gtk_calendar_select_day (GtkCalendar *calendar
,guint day
);
Selects a day from the current month.
|
a GtkCalendar. |
|
the day number between 1 and 31, or 0 to unselect the currently selected day. |
void gtk_calendar_mark_day (GtkCalendar *calendar
,guint day
);
Places a visual marker on a particular day.
|
a GtkCalendar |
|
the day number to mark between 1 and 31. |
void gtk_calendar_unmark_day (GtkCalendar *calendar
,guint day
);
Removes the visual marker from a particular day.
|
a GtkCalendar. |
|
the day number to unmark between 1 and 31. |
gboolean gtk_calendar_get_day_is_marked (GtkCalendar *calendar
,guint day
);
Returns if the day
of the calendar
is already marked.
|
a GtkCalendar |
|
the day number between 1 and 31. |
Returns : |
whether the day is marked. |
Since 3.0
void gtk_calendar_clear_marks (GtkCalendar *calendar
);
Remove all visual markers.
|
a GtkCalendar |
GtkCalendarDisplayOptions gtk_calendar_get_display_options
(GtkCalendar *calendar
);
Returns the current display options of calendar
.
|
a GtkCalendar |
Returns : |
the display options. |
Since 2.4
void gtk_calendar_set_display_options (GtkCalendar *calendar
,GtkCalendarDisplayOptions flags
);
Sets display options (whether to display the heading and the month headings).
|
a GtkCalendar |
|
the display options to set |
Since 2.4
void gtk_calendar_get_date (GtkCalendar *calendar
,guint *year
,guint *month
,guint *day
);
Obtains the selected date from a GtkCalendar.
|
a GtkCalendar |
|
location to store the year as a decimal
number (e.g. 2011), or NULL . [out][allow-none]
|
|
location to store the month number
(between 0 and 11), or NULL . [out][allow-none]
|
|
location to store the day number (between
1 and 31), or NULL . [out][allow-none]
|
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.
|
a GtkCalendar. |
|
a function providing details for each day. |
|
data to pass to func invokations.
|
|
a function for releasing data .
|
Since 2.14
gint gtk_calendar_get_detail_width_chars (GtkCalendar *calendar
);
Queries the width of detail cells, in characters. See "detail-width-chars".
|
a GtkCalendar. |
Returns : |
The width of detail cells, in characters. |
Since 2.14
void gtk_calendar_set_detail_width_chars (GtkCalendar *calendar
,gint chars
);
Updates the width of detail cells. See "detail-width-chars".
|
a GtkCalendar. |
|
detail width in characters. |
Since 2.14
gint gtk_calendar_get_detail_height_rows (GtkCalendar *calendar
);
Queries the height of detail cells, in rows. See "detail-width-chars".
|
a GtkCalendar. |
Returns : |
The height of detail cells, in rows. |
Since 2.14
void gtk_calendar_set_detail_height_rows (GtkCalendar *calendar
,gint rows
);
Updates the height of detail cells. See "detail-height-rows".
|
a GtkCalendar. |
|
detail height in rows. |
Since 2.14