.\" This is a wxWidgets manpage page generated from the XML docs .TH wxCalendarCtrl 3wx 2005-02-15 "wxWidgets" "wxWidgets class documentation" .SH NAME wxCalendarCtrl \- Control showing an entire calendar month .SH DESCRIPTION The calendar control allows the user to pick a date. For this, it displays a window containing several parts: a control at the top to pick the month and the year (either or both of them may be disabled), and a month area below them which shows all the days in the month. The user can move the current selection using the keyboard and select the date (generating EVT_CALENDAR event) by pressing or double clicking it. It has advanced possibilities for the customization of its display. All global settings (such as colours and fonts used) can, of course, be changed. But also, the display style for each day in the month can be set independently using wxCalendarDateAttr class. An item without custom attributes is drawn with the default colours and font and without border, but setting custom attributes with SetAttr allows to modify its appearance. Just create a custom attribute object and set it for the day you want to be displayed specially (note that the control will take ownership of the pointer, i.e. it will delete it itself). A day may be marked as being a holiday, even if it is not recognized as one by wxDateTime using SetHoliday method. As the attributes are specified for each day, they may change when the month is changed, so you will often want to update them in EVT_CALENDAR_MONTH event handler. .SH "PARENTS" wxControl wxWindow wxEvtHandler wxObject .SH "INCLUDE FILES" wx/calctrl.h .SH MEMBERS .SS wxCalendarCtrl () Default constructor, use Create after it. .SS wxCalendarCtrl (wxWindow* parentwxWindowID idconst wxDateTime& date = wxDefaultDateTimeconst wxPoint& pos = wxDefaultPositionconst wxSize& size = wxDefaultSizelong style = wxCAL_SHOW_HOLIDAYSconst wxString& name = wxCalendarNameStr) Does the same as Create method. .SS bool Create (wxWindow* parentwxWindowID idconst wxDateTime& date = wxDefaultDateTimeconst wxPoint& pos = wxDefaultPositionconst wxSize& size = wxDefaultSizelong style = wxCAL_SHOW_HOLIDAYSconst wxString& name = wxCalendarNameStr) Creates the control. See wxWindow for the meaning of the parameters and the control overview for the possible styles. .SS ~wxCalendarCtrl () Destroys the control. .SS void SetDate (const wxDateTime& date) Sets the current date. .SS const wxDateTime& GetDate () Gets the currently selected date. .SS void EnableYearChange (bool enable = true) This function should be used instead of changing wxCAL_NO_YEAR_CHANGE style bit directly. It allows or disallows the user to change the year interactively. .SS void EnableMonthChange (bool enable = true) This function should be used instead of changing wxCAL_NO_MONTH_CHANGE style bit. It allows or disallows the user to change the month interactively. Note that if the month can not be changed, the year can not be changed neither. .SS void EnableHolidayDisplay (bool display = true) This function should be used instead of changing wxCAL_SHOW_HOLIDAYS style bit directly. It enables or disables the special highlighting of the holidays. .SS void SetHeaderColours (const wxColour& colFgconst wxColour& colBg) Set the colours used for painting the weekdays at the top of the control. .SS const wxColour& GetHeaderColourFg () Gets the foreground colour of the header part of the calendar window. .SS const wxColour& GetHeaderColourBg () Gets the background colour of the header part of the calendar window. .SS void SetHighlightColours (const wxColour& colFgconst wxColour& colBg) Set the colours to be used for highlighting the currently selected date. .SS const wxColour& GetHighlightColourFg () Gets the foreground highlight colour. .SS const wxColour& GetHighlightColourBg () Gets the background highlight colour. .SS void SetHolidayColours (const wxColour& colFgconst wxColour& colBg) Sets the colours to be used for the holidays highlighting (only used if the window style includes wxCAL_SHOW_HOLIDAYS flag). .SS const wxColour& GetHolidayColourFg () Return the foreground colour currently used for holiday highlighting. .SS const wxColour& GetHolidayColourBg () Return the background colour currently used for holiday highlighting. .SS wxCalendarDateAttr * GetAttr (size_t day) Returns the attribute for the given date (should be in the range 1\ldots31). The returned pointer may be NULL . .SS void SetAttr (size_t daywxCalendarDateAttr* attr) Associates the attribute with the specified date (in the range 1\ldots31). If the pointer is NULL , the items attribute is cleared. .SS void SetHoliday (size_t day) Marks the specified day as being a holiday in the current month. .SS void ResetAttr (size_t day) Clears any attributes associated with the given day (in the range 1\ldots31). .SS wxCalendarHitTestResult HitTest (const wxPoint& poswxDateTime* date = NULLwxDateTime::WeekDay* wd = NULL) Returns one of wxCAL_HITTEST_XXX constants and fills either date or wd pointer with the corresponding value depending on the hit test code. .SH "WINDOW STYLES" .SS wxCAL_SUNDAY_FIRST Show Sunday as the first day in the week .SS wxCAL_MONDAY_FIRST Show Monday as the first day in the week .SS wxCAL_SHOW_HOLIDAYS Highlight holidays in the calendar .SS wxCAL_NO_YEAR_CHANGE Disable the year changing .SS wxCAL_NO_MONTH_CHANGE Disable the month (and, implicitly, the year) changing .SS wxCAL_SHOW_SURROUNDING_WEEKS Show the neighbouring weeks in the previous and next months .SS wxCAL_SEQUENTIAL_MONTH_SELECTION Use alternative, more compact, style for the month and year selection controls. .SH EVENTS .SS EVT_CALENDAR(id, func) A day was double clicked in the calendar. .SS EVT_CALENDAR_SEL_CHANGED(id, func) The selected date changed. .SS EVT_CALENDAR_DAY(id, func) The selected day changed. .SS EVT_CALENDAR_MONTH(id, func) The selected month changed. .SS EVT_CALENDAR_YEAR(id, func) The selected year changed. .SS EVT_CALENDAR_WEEKDAY_CLICKED(id, func) User clicked on the week day header .SH "SEE ALSO" wxControl wxWindow wxEvtHandler wxObject Calendar sample wxCalendarDateAttr wxCalendarEvent .SH "AUTHORS" Documentation content by Julian Smart, Robert Roebling, Vadim Zeitlin, Robin Dunn, et al Conversion to manpage format by Arnout Engelen (http://bzzt.net), bugreports welcome.