virtual void ResetAttr(size_t WXUNUSED(day)) { }
+ // holidays support
+ //
+ // currently all functions in this section are implemented in the generic
+ // version of the control only and are simply ignored by native ones
+
+ // equivalent to changing wxCAL_SHOW_HOLIDAYS flag but should be called
+ // instead of just changing it
+ virtual void EnableHolidayDisplay(bool WXUNUSED(display) = true) { }
+
+ // set/get the colours to use for holidays (if they're enabled)
+ virtual void SetHolidayColours(const wxColour& WXUNUSED(colFg),
+ const wxColour& WXUNUSED(colBg)) { }
+
+ virtual const wxColour& GetHolidayColourFg() const { return wxNullColour; }
+ virtual const wxColour& GetHolidayColourBg() const { return wxNullColour; }
+
+ // mark the given day of the current month as being a holiday
+ virtual void SetHoliday(size_t WXUNUSED(day)) { }
+
+
+ // customizing the colours of the controls
+ //
+ // most of the methods in this section are only implemented by the native
+ // version of the control and do nothing in the native ones
+
+ // set/get the colours to use for the display of the week day names at the
+ // top of the controls
+ virtual void SetHeaderColours(const wxColour& WXUNUSED(colFg),
+ const wxColour& WXUNUSED(colBg)) { }
+
+ virtual const wxColour& GetHeaderColourFg() const { return wxNullColour; }
+ virtual const wxColour& GetHeaderColourBg() const { return wxNullColour; }
+
+ // set/get the colours used for the currently selected date
+ virtual void SetHighlightColours(const wxColour& WXUNUSED(colFg),
+ const wxColour& WXUNUSED(colBg)) { }
+
+ virtual const wxColour& GetHighlightColourFg() const { return wxNullColour; }
+ virtual const wxColour& GetHighlightColourBg() const { return wxNullColour; }
+
+
// implementation only from now on
// generate the given calendar event(s)
void EnableYearChange(bool enable = true);
// corresponds to wxCAL_SHOW_HOLIDAYS bit, generic only
- void EnableHolidayDisplay(bool display = true);
+ virtual void EnableHolidayDisplay(bool display = true);
// customization
// all other functions in this section are for generic version only
// header colours are used for painting the weekdays at the top
- void SetHeaderColours(const wxColour& colFg, const wxColour& colBg)
+ virtual void SetHeaderColours(const wxColour& colFg, const wxColour& colBg)
{
m_colHeaderFg = colFg;
m_colHeaderBg = colBg;
}
- const wxColour& GetHeaderColourFg() const { return m_colHeaderFg; }
- const wxColour& GetHeaderColourBg() const { return m_colHeaderBg; }
+ virtual const wxColour& GetHeaderColourFg() const { return m_colHeaderFg; }
+ virtual const wxColour& GetHeaderColourBg() const { return m_colHeaderBg; }
// highlight colour is used for the currently selected date
- void SetHighlightColours(const wxColour& colFg, const wxColour& colBg)
+ virtual void SetHighlightColours(const wxColour& colFg, const wxColour& colBg)
{
m_colHighlightFg = colFg;
m_colHighlightBg = colBg;
}
- const wxColour& GetHighlightColourFg() const { return m_colHighlightFg; }
- const wxColour& GetHighlightColourBg() const { return m_colHighlightBg; }
+ virtual const wxColour& GetHighlightColourFg() const { return m_colHighlightFg; }
+ virtual const wxColour& GetHighlightColourBg() const { return m_colHighlightBg; }
// holiday colour is used for the holidays (if style & wxCAL_SHOW_HOLIDAYS)
- void SetHolidayColours(const wxColour& colFg, const wxColour& colBg)
+ virtual void SetHolidayColours(const wxColour& colFg, const wxColour& colBg)
{
m_colHolidayFg = colFg;
m_colHolidayBg = colBg;
}
- const wxColour& GetHolidayColourFg() const { return m_colHolidayFg; }
- const wxColour& GetHolidayColourBg() const { return m_colHolidayBg; }
+ virtual const wxColour& GetHolidayColourFg() const { return m_colHolidayFg; }
+ virtual const wxColour& GetHolidayColourBg() const { return m_colHolidayBg; }
virtual wxCalendarDateAttr *GetAttr(size_t day) const
{
virtual void ResetAttr(size_t day) { SetAttr(day, NULL); }
- void SetHoliday(size_t day);
+ virtual void SetHoliday(size_t day);
virtual wxCalendarHitTestResult HitTest(const wxPoint& pos,
wxDateTime *date = NULL,
/**
Gets the background colour of the header part of the calendar window.
+ This method is currently only implemented in generic wxCalendarCtrl and
+ always returns @c wxNullColour in the native versions.
+
@see SetHeaderColours()
*/
const wxColour GetHeaderColourBg() const;
/**
Gets the foreground colour of the header part of the calendar window.
- Only in generic wxCalendarCtrl.
+
+ This method is currently only implemented in generic wxCalendarCtrl and
+ always returns @c wxNullColour in the native versions.
@see SetHeaderColours()
*/
/**
Gets the background highlight colour. Only in generic wxCalendarCtrl.
+ This method is currently only implemented in generic wxCalendarCtrl and
+ always returns @c wxNullColour in the native versions.
+
@see SetHighlightColours()
*/
const wxColour GetHighlightColourBg() const;
/**
Gets the foreground highlight colour. Only in generic wxCalendarCtrl.
+ This method is currently only implemented in generic wxCalendarCtrl and
+ always returns @c wxNullColour in the native versions.
+
@see SetHighlightColours()
*/
const wxColour GetHighlightColourFg() const;
/**
Return the background colour currently used for holiday highlighting.
- Only in generic wxCalendarCtrl.
+
+ Only useful with generic wxCalendarCtrl as native versions currently
+ don't support holidays display at all and always return @c wxNullColour.
@see SetHolidayColours()
*/
/**
Return the foreground colour currently used for holiday highlighting.
- Only in generic wxCalendarCtrl.
+
+ Only useful with generic wxCalendarCtrl as native versions currently
+ don't support holidays display at all and always return @c wxNullColour.
@see SetHolidayColours()
*/
/**
Set the colours used for painting the weekdays at the top of the control.
- Only in generic wxCalendarCtrl.
+
+ This method is currently only implemented in generic wxCalendarCtrl and
+ does nothing in the native versions.
*/
void SetHeaderColours(const wxColour& colFg,
const wxColour& colBg);
/**
Set the colours to be used for highlighting the currently selected date.
- Only in generic wxCalendarCtrl.
+
+ This method is currently only implemented in generic wxCalendarCtrl and
+ does nothing in the native versions.
*/
void SetHighlightColours(const wxColour& colFg,
const wxColour& colBg);
/**
Marks the specified day as being a holiday in the current month.
+
+ This method is only implemented in the generic version of the control
+ and does nothing in the native ones.
*/
void SetHoliday(size_t day);
/**
- 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.
+ Sets the colours to be used for the holidays highlighting.
+
+ This method is only implemented in the generic version of the control
+ and does nothing in the native ones. It should also only be called if
+ the window style includes @c wxCAL_SHOW_HOLIDAYS flag or
+ EnableHolidayDisplay() had been called.
+
*/
void SetHolidayColours(const wxColour& colFg,
const wxColour& colBg);
void MyFrame::OnCalHolidays(wxCommandEvent& event)
{
- wxCalendarCtrlBase * cal = m_panel->GetCal();
-#ifdef wxHAS_NATIVE_CALENDARCTRL
- wxStaticCast(cal, wxGenericCalendarCtrl)
-#else
- cal
-#endif
- ->EnableHolidayDisplay(event.IsChecked());
+ m_panel->GetCal()->EnableHolidayDisplay(event.IsChecked());
}
void MyFrame::OnCalSpecial(wxCommandEvent& event)