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,
44 wxCAL_SEQUENTIAL_MONTH_SELECTION,
45 wxCAL_SHOW_SURROUNDING_WEEKS,
49 enum wxCalendarHitTestResult
51 wxCAL_HITTEST_NOWHERE, // outside of anything
52 wxCAL_HITTEST_HEADER, // on the header (weekdays)
53 wxCAL_HITTEST_DAY, // on a day in the calendar
54 wxCAL_HITTEST_INCMONTH,
55 wxCAL_HITTEST_DECMONTH,
56 wxCAL_HITTEST_SURROUNDING_WEEK
59 // border types for a date
60 enum wxCalendarDateBorder
62 wxCAL_BORDER_NONE, // no border (default)
63 wxCAL_BORDER_SQUARE, // a rectangular border
64 wxCAL_BORDER_ROUND // a round border
67 //---------------------------------------------------------------------------
70 class wxCalendarDateAttr
74 wxCalendarDateAttr(const wxColour& colText,
75 const wxColour& colBack = wxNullColour,
76 const wxColour& colBorder = wxNullColour,
77 const wxFont& font = wxNullFont,
78 wxCalendarDateBorder border = wxCAL_BORDER_NONE);
80 %name(wxCalendarDateAttrBorder)
81 wxCalendarDateAttr(wxCalendarDateBorder border,
82 const wxColour& colBorder = wxNullColour);
85 void SetTextColour(const wxColour& colText);
86 void SetBackgroundColour(const wxColour& colBack);
87 void SetBorderColour(const wxColour& col);
88 void SetFont(const wxFont& font);
89 void SetBorder(wxCalendarDateBorder border);
90 void SetHoliday(bool holiday);
93 bool HasTextColour() const;
94 bool HasBackgroundColour() const;
95 bool HasBorderColour() const;
97 bool HasBorder() const;
99 bool IsHoliday() const;
101 wxColour GetTextColour() const;
102 wxColour GetBackgroundColour() const;
103 wxColour GetBorderColour() const;
104 wxFont GetFont() const;
105 wxCalendarDateBorder GetBorder() const;
108 //---------------------------------------------------------------------------
110 class wxCalendarCtrl;
112 class wxCalendarEvent : public wxCommandEvent
115 wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type);
117 const wxDateTime& GetDate() const;
118 wxDateTime::WeekDay GetWeekDay() const;
123 wxEVT_CALENDAR_DOUBLECLICKED,
124 wxEVT_CALENDAR_SEL_CHANGED,
125 wxEVT_CALENDAR_DAY_CHANGED,
126 wxEVT_CALENDAR_MONTH_CHANGED,
127 wxEVT_CALENDAR_YEAR_CHANGED,
128 wxEVT_CALENDAR_WEEKDAY_CLICKED,
131 %pragma(python) code = "
132 def EVT_CALENDAR(win, id, fn):
133 win.Connect(id, -1, wxEVT_CALENDAR_DOUBLECLICKED, fn)
135 def EVT_CALENDAR_SEL_CHANGED(win, id, fn):
136 win.Connect(id, -1, wxEVT_CALENDAR_SEL_CHANGED, fn)
138 def EVT_CALENDAR_DAY(win, id, fn):
139 win.Connect(id, -1, wxEVT_CALENDAR_DAY_CHANGED, fn)
141 def EVT_CALENDAR_MONTH(win, id, fn):
142 win.Connect(id, -1, wxEVT_CALENDAR_MONTH_CHANGED, fn)
144 def EVT_CALENDAR_YEAR(win, id, fn):
145 win.Connect(id, -1, wxEVT_CALENDAR_YEAR_CHANGED, fn)
147 def EVT_CALENDAR_WEEKDAY_CLICKED(win, id, fn):
148 win.Connect(id, -1, wxEVT_CALENDAR_WEEKDAY_CLICKED, fn)
152 //---------------------------------------------------------------------------
155 // Put some wx default wxChar* values into wxStrings.
156 DECLARE_DEF_STRING(CalendarNameStr);
159 class wxCalendarCtrl : public wxControl
163 wxCalendarCtrl(wxWindow *parent,
165 const wxDateTime& date = wxDefaultDateTime,
166 const wxPoint& pos = wxDefaultPosition,
167 const wxSize& size = wxDefaultSize,
168 long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS,
169 const wxString& name = wxPyCalendarNameStr);
170 %name(wxPreCalendarCtrl)wxCalendarCtrl();
172 bool Create(wxWindow *parent,
174 const wxDateTime& date = wxDefaultDateTime,
175 const wxPoint& pos = wxDefaultPosition,
176 const wxSize& size = wxDefaultSize,
177 long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS,
178 const wxString& name = wxPyCalendarNameStr);
180 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
181 %pragma(python) addtomethod = "wxPreCalendarCtrl:val._setOORInfo(val)"
183 // set/get the current date
184 // ------------------------
186 void SetDate(const wxDateTime& date);
187 const wxDateTime& GetDate() const;
189 // set/get the range in which selection can occur
190 // ---------------------------------------------
192 bool SetLowerDateLimit(const wxDateTime& date = wxDefaultDateTime);
193 const wxDateTime& GetLowerDateLimit() const;
194 bool SetUpperDateLimit(const wxDateTime& date = wxDefaultDateTime);
195 const wxDateTime& GetUpperDateLimit() const;
197 bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime,
198 const wxDateTime& upperdate = wxDefaultDateTime);
204 // some calendar styles can't be changed after the control creation by
205 // just using SetWindowStyle() and Refresh() and the functions below
206 // should be used instead for them
208 // corresponds to wxCAL_NO_YEAR_CHANGE bit
209 void EnableYearChange(bool enable = TRUE);
211 // corresponds to wxCAL_NO_MONTH_CHANGE bit
212 void EnableMonthChange(bool enable = TRUE);
214 // corresponds to wxCAL_SHOW_HOLIDAYS bit
215 void EnableHolidayDisplay(bool display = TRUE);
220 // header colours are used for painting the weekdays at the top
221 void SetHeaderColours(const wxColour& colFg, const wxColour& colBg);
222 wxColour GetHeaderColourFg() const;
223 wxColour GetHeaderColourBg() const;
225 // highlight colour is used for the currently selected date
226 void SetHighlightColours(const wxColour& colFg, const wxColour& colBg);
227 wxColour GetHighlightColourFg() const;
228 wxColour GetHighlightColourBg() const;
230 // holiday colour is used for the holidays (if style & wxCAL_SHOW_HOLIDAYS)
231 void SetHolidayColours(const wxColour& colFg, const wxColour& colBg);
232 wxColour GetHolidayColourFg() const;
233 wxColour GetHolidayColourBg() const;
235 // an item without custom attributes is drawn with the default colours and
236 // font and without border, setting custom attributes allows to modify this
238 // the day parameter should be in 1..31 range, for days 29, 30, 31 the
239 // corresponding attribute is just unused if there is no such day in the
242 wxCalendarDateAttr *GetAttr(size_t day) const;
243 void SetAttr(size_t day, wxCalendarDateAttr *attr);
245 void SetHoliday(size_t day);
247 void ResetAttr(size_t day);
249 // returns one of wxCAL_HITTEST_XXX constants and fills either date or wd
250 // with the corresponding value (none for NOWHERE, the date for DAY and wd
252 wxCalendarHitTestResult HitTest(const wxPoint& pos,
253 wxDateTime *date = NULL,
254 wxDateTime::WeekDay *wd = NULL);
257 bool Enable(bool enable = TRUE);
258 bool Show(bool show = TRUE);
263 //---------------------------------------------------------------------------
266 wxClassInfo::CleanUpClasses();
267 wxClassInfo::InitializeClasses();
270 //---------------------------------------------------------------------------
272 %pragma(python) include="_calextras.py";
274 //---------------------------------------------------------------------------