/* Copyright (C) 1998-2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see .
*/
_CONFIGINCLUDE(gtkmmconfig.h)
#include
#include
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/widget_p.h)
namespace Gtk
{
_CC_INCLUDE(gtk/gtk.h)
_WRAP_ENUM(CalendarDisplayOptions, GtkCalendarDisplayOptions, decl_prefix GTKMM_API)
/** Display a calendar and/or allow the user to select a date.
*
* This is a widget that displays a calendar, one month at a time.
*
* The month and year currently displayed can be altered with
* select_month(). The exact day can be selected from the displayed month
* using select_day().
*
* The way in which the calendar itself is displayed can be altered using
* set_display_options().
*
* The selected date can be retrieved from a GtkCalendar using get_date().
*
* If performing many 'mark' operations, the calendar can be frozen to
* prevent flicker, using freeze(), and 'thawed' again using thaw().
*
* The Calendar widget looks like this:
* @image html calendar1.png
*
* @ingroup Widgets
*/
class GTKMM_API Calendar : public Widget
{
_CLASS_GTKOBJECT(Calendar,GtkCalendar,GTK_CALENDAR,Gtk::Widget,GtkWidget,,,GTKMM_API)
public:
_CTOR_DEFAULT
_WRAP_METHOD(void select_month(guint month, guint year), gtk_calendar_select_month)
_WRAP_METHOD(void select_day(guint day), gtk_calendar_select_day)
_WRAP_METHOD(void mark_day(guint day), gtk_calendar_mark_day)
_WRAP_METHOD(void unmark_day(guint day), gtk_calendar_unmark_day)
_WRAP_METHOD(void clear_marks(), gtk_calendar_clear_marks)
_WRAP_METHOD(void set_display_options(CalendarDisplayOptions flags), gtk_calendar_set_display_options)
_WRAP_METHOD(CalendarDisplayOptions get_display_options() const, gtk_calendar_get_display_options)
_WRAP_METHOD(void get_date(guint& year, guint& month, guint& day) const, gtk_calendar_get_date)
// Additional method not in GTK (#350584)
/** Get the date as Glib::Date
*
* @param date Referenz to set the date
*/
void get_date(Glib::Date& date) const;
/** Detail markup handler.
* For instance,
* @code
* Glib::ustring on_calendar_details(guint year, guint month, guint day);
* @endcode
*
* @param year The year for which details are needed.
* @param month The month for which details are needed.
* @param day The day of @a month for which details are needed.
* @result Pango markup with details for the specified day, or an empty string.
*
* This callback function provides Pango markup with detail information for the
* specified day. Examples for such details are holidays or appointments. The
* function should return an empty string when no information is available.
*
* @newin{2,14}
*/
typedef sigc::slot SlotDetails;
/** 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 full detail information is provided if the entire
* text could not fit into the details area, or if the show-details property
* is not set.
*
* The size of the details area can be restricted by setting the
* detail-width-chars and detail-height-rows properties.
*
* @param slot A callback function providing details for each day.
*
* @newin{2,14}
*/
void set_detail_func(const SlotDetails& slot);
_IGNORE(gtk_calendar_set_detail_func)
_WRAP_METHOD(void set_detail_width_chars(int chars), gtk_calendar_set_detail_width_chars)
_WRAP_METHOD(void set_detail_height_rows(int rows), gtk_calendar_set_detail_height_rows)
_WRAP_METHOD(int get_detail_width_chars() const, gtk_calendar_get_detail_width_chars)
_WRAP_METHOD(int get_detail_height_rows() const, gtk_calendar_get_detail_height_rows)
_WRAP_METHOD(bool get_day_is_marked(guint day) const, gtk_calendar_get_day_is_marked)
_WRAP_SIGNAL(void month_changed(), "month_changed")
_WRAP_SIGNAL(void day_selected(), "day_selected")
_WRAP_SIGNAL(void day_selected_double_click(), "day_selected_double_click")
_WRAP_SIGNAL(void prev_month(), "prev_month")
_WRAP_SIGNAL(void next_month(), "next_month")
_WRAP_SIGNAL(void prev_year(), "prev_year")
_WRAP_SIGNAL(void next_year(), "next_year")
_WRAP_PROPERTY("year", int)
_WRAP_PROPERTY("month", int)
_WRAP_PROPERTY("day", int)
_WRAP_PROPERTY("show-heading", bool)
_WRAP_PROPERTY("show-day-names", bool)
_WRAP_PROPERTY("no-month-change", bool)
_WRAP_PROPERTY("show-week-numbers", bool)
_WRAP_PROPERTY("show-details", bool)
_WRAP_PROPERTY("detail-width-chars", int)
_WRAP_PROPERTY("detail-height-rows", int)
};
} // namespace Gtk