]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/calctrl.h
first raw revision
[wxWidgets.git] / interface / calctrl.h
index ad461f089907a9fc0d2a8aa52098ebac1697c05b..ceb3e131ec4cadf909048a952bf724d5df001f43 100644 (file)
@@ -29,8 +29,8 @@ public:
     wxDateTime::WeekDay GetWeekDay() const;
 
     /**
-        Sets the week day carried by the event, normally only used by the library
-        internally.
+        Sets the week day carried by the event,
+        normally only used by the library internally.
     */
     void SetWeekDay(wxDateTime::WeekDay day);
 };
@@ -152,6 +152,17 @@ public:
         Sets the text (foreground) colour to use.
     */
     void SetTextColour(const wxColour& colText);
+
+    /**
+        Used (internally) by generic wxCalendarCtrl::Mark()
+    */
+    static const wxCalendarDateAttr& GetMark();
+
+    /**
+       Set the attribute that will be used to Mark() days
+       on generic wxCalendarCtrl
+    */
+    static void SetMark(wxCalendarDateAttr const& m);
 };
 
 
@@ -160,56 +171,69 @@ public:
     @class wxCalendarCtrl
     @wxheader{calctrl.h}
 
-    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
+    The calendar control allows the user to pick a date.  The user can move the
     current selection using the keyboard and select the date (generating
     @c EVT_CALENDAR event) by pressing @c Return 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.
+    Generic calendar has advanced possibilities for the customization of its
+    display, described below. If you want to use these possibilities on
+    every platform, use wxGenericCalendarCtrl instead of wxCalendarCtrl.
+
+    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
     wxCalendarCtrl::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
-    wxCalendarDateAttr::SetHoliday method.
+    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 wxCalendarDateAttr::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
-    @c EVT_CALENDAR_MONTH event handler.
+    @c EVT_CALENDAR_PAGE_CHANGED event handler.
 
     @beginStyleTable
     @style{wxCAL_SUNDAY_FIRST}:
-           Show Sunday as the first day in the week
+           Show Sunday as the first day in the week (only generic)
     @style{wxCAL_MONDAY_FIRST}:
-           Show Monday as the first day in the week
+           Show Monday as the first day in the week (only generic)
     @style{wxCAL_SHOW_HOLIDAYS}:
-           Highlight holidays in the calendar
+           Highlight holidays in the calendar (only generic)
     @style{wxCAL_NO_YEAR_CHANGE}:
-           Disable the year changing
+           Disable the year changing (deprecated, only generic)
     @style{wxCAL_NO_MONTH_CHANGE}:
            Disable the month (and, implicitly, the year) changing
     @style{wxCAL_SHOW_SURROUNDING_WEEKS}:
            Show the neighbouring weeks in the previous and next months
+           (only generic)
     @style{wxCAL_SEQUENTIAL_MONTH_SELECTION}:
            Use alternative, more compact, style for the month and year
-           selection controls.
+           selection controls. (only generic)
     @endStyleTable
 
+    @beginEventTable{wxCalendarEvent}
+    @event{EVT_CALENDAR(id, func)}:
+           A day was double clicked in the calendar.
+    @event{EVT_CALENDAR_SEL_CHANGED(id, func)}:
+           The selected date changed.
+    @event{EVT_CALENDAR_PAGE_CHANGED(id, func)}:
+           The selected month (and/or year) changed.
+    @event{EVT_CALENDAR_WEEKDAY_CLICKED(id, func)}:
+           User clicked on the week day header (only generic).
+    @endEventTable
+
     @library{wxadv}
     @category{ctrl}
     @appearance{calendarctrl.png}
 
-    @see @ref overview_samplecalendar "Calendar sample", wxCalendarDateAttr,
-    wxCalendarEvent
+    @nativeimpl{wxgtk}
+
+    @see @ref page_samples_calendar, wxCalendarDateAttr, wxCalendarEvent,
+         wxDatePickerCtrl
 */
 class wxCalendarCtrl : public wxControl
 {
@@ -253,21 +277,26 @@ public:
     /**
         This function should be used instead of changing
         @c 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.
+        change the month interactively. Note that if the month can not
+        be changed, the year can not be changed neither.
+
+        @return @true if the value of this option really changed or @false
+                if it was already set to the requested value.
     */
-    void EnableMonthChange(bool enable = true);
+    bool EnableMonthChange(bool enable = true);
 
     /**
+        @deprecated
+
         This function should be used instead of changing @c wxCAL_NO_YEAR_CHANGE
         style bit directly. It allows or disallows the user to change the year
-        interactively.
+        interactively. Only in generic wxCalendarCtrl.
     */
     void EnableYearChange(bool enable = true);
 
     /**
         Returns the attribute for the given date (should be in the range 1...31).
-        The returned pointer may be @NULL.
+        The returned pointer may be @NULL. Only in generic wxCalendarCtrl.
     */
     wxCalendarDateAttr* GetAttr(size_t day) const;
 
@@ -278,50 +307,54 @@ public:
 
     /**
         Gets the background colour of the header part of the calendar window.
-        
+
         @see SetHeaderColours()
     */
     const wxColour GetHeaderColourBg() const;
 
     /**
         Gets the foreground colour of the header part of the calendar window.
-        
+        Only in generic wxCalendarCtrl.
+
         @see SetHeaderColours()
     */
     const wxColour GetHeaderColourFg() const;
 
     /**
-        Gets the background highlight colour.
-        
+        Gets the background highlight colour. Only in generic wxCalendarCtrl.
+
         @see SetHighlightColours()
     */
     const wxColour GetHighlightColourBg() const;
 
     /**
-        Gets the foreground highlight colour.
-        
+        Gets the foreground highlight colour. Only in generic wxCalendarCtrl.
+
         @see SetHighlightColours()
     */
     const wxColour GetHighlightColourFg() const;
 
     /**
         Return the background colour currently used for holiday highlighting.
-        
+        Only in generic wxCalendarCtrl.
+
         @see SetHolidayColours()
     */
     const wxColour GetHolidayColourBg() const;
 
     /**
         Return the foreground colour currently used for holiday highlighting.
-        
+        Only in generic wxCalendarCtrl.
+
         @see SetHolidayColours()
     */
     const wxColour GetHolidayColourFg() const;
 
     /**
         Returns one of @c wxCAL_HITTEST_XXX
-        constants() and fills either @a date or
-        @a wd pointer with the corresponding value depending on the hit test code.
+        constants() and fills either @a date or @a wd pointer with
+        the corresponding value depending on the hit test code.
+        Only in generic wxCalendarCtrl.
     */
     wxCalendarHitTestResult HitTest(const wxPoint& pos,
                                     wxDateTime* date = NULL,
@@ -330,12 +363,14 @@ public:
     /**
         Clears any attributes associated with the given day (in the range
         1...31).
+        Only in generic wxCalendarCtrl.
     */
     void ResetAttr(size_t day);
 
     /**
         Associates the attribute with the specified date (in the range 1...31).
         If the pointer is @NULL, the items attribute is cleared.
+        Only in generic wxCalendarCtrl.
     */
     void SetAttr(size_t day, wxCalendarDateAttr* attr);
 
@@ -346,12 +381,14 @@ public:
 
     /**
         Set the colours used for painting the weekdays at the top of the control.
+        Only in generic wxCalendarCtrl.
     */
     void SetHeaderColours(const wxColour& colFg,
                           const wxColour& colBg);
 
     /**
         Set the colours to be used for highlighting the currently selected date.
+        Only in generic wxCalendarCtrl.
     */
     void SetHighlightColours(const wxColour& colFg,
                              const wxColour& colBg);
@@ -364,8 +401,16 @@ public:
     /**
         Sets the colours to be used for the holidays highlighting (only used if the
         window style includes @c wxCAL_SHOW_HOLIDAYS flag).
+        Only in generic wxCalendarCtrl.
     */
     void SetHolidayColours(const wxColour& colFg,
                            const wxColour& colBg);
+
+    /**
+        Mark or unmark the day.
+        This day of month will be marked in every month.
+        In generic wxCalendarCtrl,
+    */
+    void Mark(size_t day, bool mark);
 };