1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions for the wxCalendarCtrl
7 // Created: 23-May-2000
9 // Copyright: (c) 2000 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
18 #include <wx/calctrl.h>
21 //----------------------------------------------------------------------
24 %include my_typemaps.i
26 // Import some definitions of other classes, etc.
34 %pragma(python) code = "import wx"
36 //---------------------------------------------------------------------------
43 wxCAL_NO_MONTH_CHANGE,
47 enum wxCalendarHitTestResult
49 wxCAL_HITTEST_NOWHERE, // outside of anything
50 wxCAL_HITTEST_HEADER, // on the header (weekdays)
51 wxCAL_HITTEST_DAY // on a day in the calendar
54 // border types for a date
55 enum wxCalendarDateBorder
57 wxCAL_BORDER_NONE, // no border (default)
58 wxCAL_BORDER_SQUARE, // a rectangular border
59 wxCAL_BORDER_ROUND // a round border
62 //---------------------------------------------------------------------------
65 class wxCalendarDateAttr
69 wxCalendarDateAttr(const wxColour& colText,
70 const wxColour& colBack = wxNullColour,
71 const wxColour& colBorder = wxNullColour,
72 const wxFont& font = wxNullFont,
73 wxCalendarDateBorder border = wxCAL_BORDER_NONE);
75 %name(wxCalendarDateAttrBorder)
76 wxCalendarDateAttr(wxCalendarDateBorder border,
77 const wxColour& colBorder = wxNullColour);
80 void SetTextColour(const wxColour& colText);
81 void SetBackgroundColour(const wxColour& colBack);
82 void SetBorderColour(const wxColour& col);
83 void SetFont(const wxFont& font);
84 void SetBorder(wxCalendarDateBorder border);
85 void SetHoliday(bool holiday);
88 bool HasTextColour() const;
89 bool HasBackgroundColour() const;
90 bool HasBorderColour() const;
92 bool HasBorder() const;
94 bool IsHoliday() const;
96 const wxColour& GetTextColour() const;
97 const wxColour& GetBackgroundColour() const;
98 const wxColour& GetBorderColour() const;
99 const wxFont& GetFont() const;
100 wxCalendarDateBorder GetBorder() const;
103 //---------------------------------------------------------------------------
105 class wxCalendarCtrl;
107 class wxCalendarEvent : public wxCommandEvent
110 wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type);
112 const wxDateTime& GetDate() const;
113 wxDateTime::WeekDay GetWeekDay() const;
118 wxEVT_CALENDAR_DOUBLECLICKED,
119 wxEVT_CALENDAR_SEL_CHANGED,
120 wxEVT_CALENDAR_DAY_CHANGED,
121 wxEVT_CALENDAR_MONTH_CHANGED,
122 wxEVT_CALENDAR_YEAR_CHANGED,
123 wxEVT_CALENDAR_WEEKDAY_CLICKED,
126 %pragma(python) code = "
127 def EVT_CALENDAR(win, id, fn):
128 win.Connect(id, -1, wxEVT_CALENDAR_DOUBLECLICKED, fn)
130 def EVT_CALENDAR_SEL_CHANGED(win, id, fn):
131 win.Connect(id, -1, wxEVT_CALENDAR_SEL_CHANGED, fn)
133 def EVT_CALENDAR_DAY(win, id, fn):
134 win.Connect(id, -1, wxEVT_CALENDAR_DAY_CHANGED, fn)
136 def EVT_CALENDAR_MONTH(win, id, fn):
137 win.Connect(id, -1, wxEVT_CALENDAR_MONTH_CHANGED, fn)
139 def EVT_CALENDAR_YEAR(win, id, fn):
140 win.Connect(id, -1, wxEVT_CALENDAR_YEAR_CHANGED, fn)
142 def EVT_CALENDAR_WEEKDAY_CLICKED(win, id, fn):
143 win.Connect(id, -1, wxEVT_CALENDAR_WEEKDAY_CLICKED, fn)
147 //---------------------------------------------------------------------------
149 class wxCalendarCtrl : public wxControl
153 wxCalendarCtrl(wxWindow *parent,
155 const wxDateTime& date = wxDefaultDateTime,
156 const wxPoint& pos = wxDefaultPosition,
157 const wxSize& size = wxDefaultSize,
158 long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS,
159 const char* name = "calendar");
160 %name(wxPreCalendarCtrl)wxCalendarCtrl();
162 bool Create(wxWindow *parent,
164 const wxDateTime& date = wxDefaultDateTime,
165 const wxPoint& pos = wxDefaultPosition,
166 const wxSize& size = wxDefaultSize,
167 long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS,
168 const char* name = "calendar");
170 // set/get the current date
171 // ------------------------
173 void SetDate(const wxDateTime& date);
174 const wxDateTime& GetDate() const;
179 // some calendar styles can't be changed after the control creation by
180 // just using SetWindowStyle() and Refresh() and the functions below
181 // should be used instead for them
183 // corresponds to wxCAL_NO_YEAR_CHANGE bit
184 void EnableYearChange(bool enable = TRUE);
186 // corresponds to wxCAL_NO_MONTH_CHANGE bit
187 void EnableMonthChange(bool enable = TRUE);
189 // corresponds to wxCAL_SHOW_HOLIDAYS bit
190 void EnableHolidayDisplay(bool display = TRUE);
195 // header colours are used for painting the weekdays at the top
196 void SetHeaderColours(const wxColour& colFg, const wxColour& colBg);
197 const wxColour& GetHeaderColourFg() const;
198 const wxColour& GetHeaderColourBg() const;
200 // highlight colour is used for the currently selected date
201 void SetHighlightColours(const wxColour& colFg, const wxColour& colBg);
202 const wxColour& GetHighlightColourFg() const;
203 const wxColour& GetHighlightColourBg() const;
205 // holiday colour is used for the holidays (if style & wxCAL_SHOW_HOLIDAYS)
206 void SetHolidayColours(const wxColour& colFg, const wxColour& colBg);
207 const wxColour& GetHolidayColourFg() const;
208 const wxColour& GetHolidayColourBg() const;
210 // an item without custom attributes is drawn with the default colours and
211 // font and without border, setting custom attributes allows to modify this
213 // the day parameter should be in 1..31 range, for days 29, 30, 31 the
214 // corresponding attribute is just unused if there is no such day in the
217 wxCalendarDateAttr *GetAttr(size_t day) const;
218 void SetAttr(size_t day, wxCalendarDateAttr *attr);
220 void SetHoliday(size_t day);
222 void ResetAttr(size_t day);
224 // returns one of wxCAL_HITTEST_XXX constants and fills either date or wd
225 // with the corresponding value (none for NOWHERE, the date for DAY and wd
227 wxCalendarHitTestResult HitTest(const wxPoint& pos,
228 wxDateTime *date = NULL,
229 wxDateTime::WeekDay *wd = NULL);
234 //---------------------------------------------------------------------------
237 wxClassInfo::CleanUpClasses();
238 wxClassInfo::InitializeClasses();
241 //---------------------------------------------------------------------------
243 %pragma(python) include="_calextras.py";
245 //---------------------------------------------------------------------------