]>
Commit | Line | Data |
---|---|---|
1bd55598 | 1 | # This file was created automatically by SWIG 1.3.29. |
d14a1e28 RD |
2 | # Don't modify this file, modify the SWIG interface instead. |
3 | ||
a5ee0656 RD |
4 | """ |
5 | Classes for an interactive Calendar control. | |
6 | """ | |
7 | ||
d14a1e28 | 8 | import _calendar |
1bd55598 RD |
9 | import new |
10 | new_instancemethod = new.instancemethod | |
36ed4f51 | 11 | def _swig_setattr_nondynamic(self,class_type,name,value,static=1): |
1bd55598 | 12 | if (name == "thisown"): return self.this.own(value) |
36ed4f51 | 13 | if (name == "this"): |
1bd55598 RD |
14 | if type(value).__name__ == 'PySwigObject': |
15 | self.__dict__[name] = value | |
36ed4f51 RD |
16 | return |
17 | method = class_type.__swig_setmethods__.get(name,None) | |
18 | if method: return method(self,value) | |
1bd55598 | 19 | if (not static) or hasattr(self,name): |
36ed4f51 RD |
20 | self.__dict__[name] = value |
21 | else: | |
22 | raise AttributeError("You cannot add attributes to %s" % self) | |
23 | ||
24 | def _swig_setattr(self,class_type,name,value): | |
25 | return _swig_setattr_nondynamic(self,class_type,name,value,0) | |
26 | ||
27 | def _swig_getattr(self,class_type,name): | |
1bd55598 | 28 | if (name == "thisown"): return self.this.own() |
36ed4f51 RD |
29 | method = class_type.__swig_getmethods__.get(name,None) |
30 | if method: return method(self) | |
31 | raise AttributeError,name | |
32 | ||
1bd55598 RD |
33 | def _swig_repr(self): |
34 | try: strthis = "proxy of " + self.this.__repr__() | |
35 | except: strthis = "" | |
36 | return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) | |
37 | ||
36ed4f51 RD |
38 | import types |
39 | try: | |
40 | _object = types.ObjectType | |
41 | _newclass = 1 | |
42 | except AttributeError: | |
43 | class _object : pass | |
44 | _newclass = 0 | |
45 | del types | |
46 | ||
47 | ||
48 | def _swig_setattr_nondynamic_method(set): | |
49 | def set_attr(self,name,value): | |
1bd55598 RD |
50 | if (name == "thisown"): return self.this.own(value) |
51 | if hasattr(self,name) or (name == "this"): | |
36ed4f51 RD |
52 | set(self,name,value) |
53 | else: | |
54 | raise AttributeError("You cannot add attributes to %s" % self) | |
55 | return set_attr | |
56 | ||
57 | ||
d55e5bfc RD |
58 | import _misc |
59 | import _core | |
60 | wx = _core | |
d6c14a4c | 61 | __docfilter__ = wx.__DocFilter(globals()) |
d14a1e28 RD |
62 | CAL_SUNDAY_FIRST = _calendar.CAL_SUNDAY_FIRST |
63 | CAL_MONDAY_FIRST = _calendar.CAL_MONDAY_FIRST | |
64 | CAL_SHOW_HOLIDAYS = _calendar.CAL_SHOW_HOLIDAYS | |
65 | CAL_NO_YEAR_CHANGE = _calendar.CAL_NO_YEAR_CHANGE | |
66 | CAL_NO_MONTH_CHANGE = _calendar.CAL_NO_MONTH_CHANGE | |
67 | CAL_SEQUENTIAL_MONTH_SELECTION = _calendar.CAL_SEQUENTIAL_MONTH_SELECTION | |
68 | CAL_SHOW_SURROUNDING_WEEKS = _calendar.CAL_SHOW_SURROUNDING_WEEKS | |
69 | CAL_HITTEST_NOWHERE = _calendar.CAL_HITTEST_NOWHERE | |
70 | CAL_HITTEST_HEADER = _calendar.CAL_HITTEST_HEADER | |
71 | CAL_HITTEST_DAY = _calendar.CAL_HITTEST_DAY | |
72 | CAL_HITTEST_INCMONTH = _calendar.CAL_HITTEST_INCMONTH | |
73 | CAL_HITTEST_DECMONTH = _calendar.CAL_HITTEST_DECMONTH | |
74 | CAL_HITTEST_SURROUNDING_WEEK = _calendar.CAL_HITTEST_SURROUNDING_WEEK | |
75 | CAL_BORDER_NONE = _calendar.CAL_BORDER_NONE | |
76 | CAL_BORDER_SQUARE = _calendar.CAL_BORDER_SQUARE | |
77 | CAL_BORDER_ROUND = _calendar.CAL_BORDER_ROUND | |
78 | class CalendarDateAttr(object): | |
98e665d3 | 79 | """ |
d6c14a4c RD |
80 | A set of customization attributes for a calendar date, which can be |
81 | used to control the look of the Calendar object. | |
98e665d3 | 82 | """ |
1bd55598 RD |
83 | thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') |
84 | __repr__ = _swig_repr | |
85 | def __init__(self, *args, **kwargs): | |
41f1cec7 | 86 | """ |
a95a7133 | 87 | __init__(self, Colour colText=wxNullColour, Colour colBack=wxNullColour, |
98e665d3 | 88 | Colour colBorder=wxNullColour, Font font=wxNullFont, |
cbd72d4f | 89 | int border=CAL_BORDER_NONE) -> CalendarDateAttr |
98e665d3 RD |
90 | |
91 | Create a CalendarDateAttr. | |
41f1cec7 | 92 | """ |
1bd55598 | 93 | _calendar.CalendarDateAttr_swiginit(self,_calendar.new_CalendarDateAttr(*args, **kwargs)) |
423f194a | 94 | def SetTextColour(*args, **kwargs): |
a95a7133 | 95 | """SetTextColour(self, Colour colText)""" |
423f194a RD |
96 | return _calendar.CalendarDateAttr_SetTextColour(*args, **kwargs) |
97 | ||
98 | def SetBackgroundColour(*args, **kwargs): | |
a95a7133 | 99 | """SetBackgroundColour(self, Colour colBack)""" |
423f194a RD |
100 | return _calendar.CalendarDateAttr_SetBackgroundColour(*args, **kwargs) |
101 | ||
102 | def SetBorderColour(*args, **kwargs): | |
a95a7133 | 103 | """SetBorderColour(self, Colour col)""" |
423f194a RD |
104 | return _calendar.CalendarDateAttr_SetBorderColour(*args, **kwargs) |
105 | ||
106 | def SetFont(*args, **kwargs): | |
a95a7133 | 107 | """SetFont(self, Font font)""" |
423f194a RD |
108 | return _calendar.CalendarDateAttr_SetFont(*args, **kwargs) |
109 | ||
110 | def SetBorder(*args, **kwargs): | |
a95a7133 | 111 | """SetBorder(self, int border)""" |
423f194a RD |
112 | return _calendar.CalendarDateAttr_SetBorder(*args, **kwargs) |
113 | ||
114 | def SetHoliday(*args, **kwargs): | |
a95a7133 | 115 | """SetHoliday(self, bool holiday)""" |
423f194a RD |
116 | return _calendar.CalendarDateAttr_SetHoliday(*args, **kwargs) |
117 | ||
118 | def HasTextColour(*args, **kwargs): | |
a95a7133 | 119 | """HasTextColour(self) -> bool""" |
423f194a RD |
120 | return _calendar.CalendarDateAttr_HasTextColour(*args, **kwargs) |
121 | ||
122 | def HasBackgroundColour(*args, **kwargs): | |
a95a7133 | 123 | """HasBackgroundColour(self) -> bool""" |
423f194a RD |
124 | return _calendar.CalendarDateAttr_HasBackgroundColour(*args, **kwargs) |
125 | ||
126 | def HasBorderColour(*args, **kwargs): | |
a95a7133 | 127 | """HasBorderColour(self) -> bool""" |
423f194a RD |
128 | return _calendar.CalendarDateAttr_HasBorderColour(*args, **kwargs) |
129 | ||
130 | def HasFont(*args, **kwargs): | |
a95a7133 | 131 | """HasFont(self) -> bool""" |
423f194a RD |
132 | return _calendar.CalendarDateAttr_HasFont(*args, **kwargs) |
133 | ||
134 | def HasBorder(*args, **kwargs): | |
a95a7133 | 135 | """HasBorder(self) -> bool""" |
423f194a RD |
136 | return _calendar.CalendarDateAttr_HasBorder(*args, **kwargs) |
137 | ||
138 | def IsHoliday(*args, **kwargs): | |
a95a7133 | 139 | """IsHoliday(self) -> bool""" |
423f194a RD |
140 | return _calendar.CalendarDateAttr_IsHoliday(*args, **kwargs) |
141 | ||
142 | def GetTextColour(*args, **kwargs): | |
a95a7133 | 143 | """GetTextColour(self) -> Colour""" |
423f194a RD |
144 | return _calendar.CalendarDateAttr_GetTextColour(*args, **kwargs) |
145 | ||
146 | def GetBackgroundColour(*args, **kwargs): | |
a95a7133 | 147 | """GetBackgroundColour(self) -> Colour""" |
423f194a RD |
148 | return _calendar.CalendarDateAttr_GetBackgroundColour(*args, **kwargs) |
149 | ||
150 | def GetBorderColour(*args, **kwargs): | |
a95a7133 | 151 | """GetBorderColour(self) -> Colour""" |
423f194a RD |
152 | return _calendar.CalendarDateAttr_GetBorderColour(*args, **kwargs) |
153 | ||
154 | def GetFont(*args, **kwargs): | |
a95a7133 | 155 | """GetFont(self) -> Font""" |
423f194a RD |
156 | return _calendar.CalendarDateAttr_GetFont(*args, **kwargs) |
157 | ||
158 | def GetBorder(*args, **kwargs): | |
a95a7133 | 159 | """GetBorder(self) -> int""" |
423f194a RD |
160 | return _calendar.CalendarDateAttr_GetBorder(*args, **kwargs) |
161 | ||
1bd55598 RD |
162 | CalendarDateAttr_swigregister = _calendar.CalendarDateAttr_swigregister |
163 | CalendarDateAttr_swigregister(CalendarDateAttr) | |
e6056257 | 164 | |
53aa7709 | 165 | class CalendarEvent(_core.DateEvent): |
36ed4f51 | 166 | """Proxy of C++ CalendarEvent class""" |
1bd55598 RD |
167 | thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') |
168 | __repr__ = _swig_repr | |
169 | def __init__(self, *args, **kwargs): | |
a95a7133 | 170 | """__init__(self, CalendarCtrl cal, wxEventType type) -> CalendarEvent""" |
1bd55598 | 171 | _calendar.CalendarEvent_swiginit(self,_calendar.new_CalendarEvent(*args, **kwargs)) |
9fd4be55 | 172 | def SetWeekDay(*args, **kwargs): |
a95a7133 | 173 | """SetWeekDay(self, int wd)""" |
9fd4be55 RD |
174 | return _calendar.CalendarEvent_SetWeekDay(*args, **kwargs) |
175 | ||
423f194a | 176 | def GetWeekDay(*args, **kwargs): |
a95a7133 | 177 | """GetWeekDay(self) -> int""" |
423f194a RD |
178 | return _calendar.CalendarEvent_GetWeekDay(*args, **kwargs) |
179 | ||
44bf767a RD |
180 | def PySetDate(self, date): |
181 | """takes datetime.datetime or datetime.date object""" | |
629e65c2 | 182 | self.SetDate(_pydate2wxdate(date)) |
44bf767a RD |
183 | |
184 | def PyGetDate(self): | |
185 | """returns datetime.date object""" | |
629e65c2 | 186 | return _wxdate2pydate(self.GetDate()) |
44bf767a | 187 | |
1bd55598 RD |
188 | CalendarEvent_swigregister = _calendar.CalendarEvent_swigregister |
189 | CalendarEvent_swigregister(CalendarEvent) | |
d14a1e28 RD |
190 | |
191 | wxEVT_CALENDAR_DOUBLECLICKED = _calendar.wxEVT_CALENDAR_DOUBLECLICKED | |
192 | wxEVT_CALENDAR_SEL_CHANGED = _calendar.wxEVT_CALENDAR_SEL_CHANGED | |
193 | wxEVT_CALENDAR_DAY_CHANGED = _calendar.wxEVT_CALENDAR_DAY_CHANGED | |
194 | wxEVT_CALENDAR_MONTH_CHANGED = _calendar.wxEVT_CALENDAR_MONTH_CHANGED | |
195 | wxEVT_CALENDAR_YEAR_CHANGED = _calendar.wxEVT_CALENDAR_YEAR_CHANGED | |
196 | wxEVT_CALENDAR_WEEKDAY_CLICKED = _calendar.wxEVT_CALENDAR_WEEKDAY_CLICKED | |
197 | EVT_CALENDAR = wx.PyEventBinder( wxEVT_CALENDAR_DOUBLECLICKED, 1) | |
198 | EVT_CALENDAR_SEL_CHANGED = wx.PyEventBinder( wxEVT_CALENDAR_SEL_CHANGED, 1) | |
199 | EVT_CALENDAR_DAY = wx.PyEventBinder( wxEVT_CALENDAR_DAY_CHANGED, 1) | |
200 | EVT_CALENDAR_MONTH = wx.PyEventBinder( wxEVT_CALENDAR_MONTH_CHANGED, 1) | |
201 | EVT_CALENDAR_YEAR = wx.PyEventBinder( wxEVT_CALENDAR_YEAR_CHANGED, 1) | |
202 | EVT_CALENDAR_WEEKDAY_CLICKED = wx.PyEventBinder( wxEVT_CALENDAR_WEEKDAY_CLICKED, 1) | |
203 | ||
d55e5bfc | 204 | class CalendarCtrl(_core.Control): |
d6c14a4c RD |
205 | """ |
206 | The calendar control allows the user to pick a date interactively. | |
207 | ||
208 | The CalendarCtrl displays a window containing several parts: the | |
209 | control to pick the month and the year at the top (either or both of | |
210 | them may be disabled) and a month area below them which shows all the | |
211 | days in the month. The user can move the current selection using the | |
212 | keyboard and select the date (generating EVT_CALENDAR event) by | |
213 | pressing <Return> or double clicking it. | |
214 | ||
215 | It has advanced possibilities for the customization of its | |
216 | display. All global settings (such as colours and fonts used) can, of | |
217 | course, be changed. But also, the display style for each day in the | |
218 | month can be set independently using CalendarDateAttr class. | |
219 | ||
220 | An item without custom attributes is drawn with the default colours | |
221 | and font and without border, but setting custom attributes with | |
222 | SetAttr allows to modify its appearance. Just create a custom | |
223 | attribute object and set it for the day you want to be displayed | |
224 | specially A day may be marked as being a holiday, (even if it is not | |
53aa7709 | 225 | recognized as one by `wx.DateTime`) by using the SetHoliday method. |
d6c14a4c RD |
226 | |
227 | As the attributes are specified for each day, they may change when the | |
228 | month is changed, so you will often want to update them in an | |
229 | EVT_CALENDAR_MONTH event handler. | |
d6c14a4c | 230 | """ |
1bd55598 RD |
231 | thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') |
232 | __repr__ = _swig_repr | |
233 | def __init__(self, *args, **kwargs): | |
41f1cec7 | 234 | """ |
a95a7133 | 235 | __init__(self, Window parent, int id=-1, DateTime date=DefaultDateTime, |
41f1cec7 RD |
236 | Point pos=DefaultPosition, Size size=DefaultSize, |
237 | long style=wxCAL_SHOW_HOLIDAYS|wxWANTS_CHARS, | |
cbd72d4f | 238 | String name=CalendarNameStr) -> CalendarCtrl |
98e665d3 RD |
239 | |
240 | Create and show a calendar control. | |
41f1cec7 | 241 | """ |
1bd55598 | 242 | _calendar.CalendarCtrl_swiginit(self,_calendar.new_CalendarCtrl(*args, **kwargs)) |
e6056257 | 243 | self._setOORInfo(self) |
423f194a RD |
244 | |
245 | def Create(*args, **kwargs): | |
41f1cec7 | 246 | """ |
a95a7133 | 247 | Create(self, Window parent, int id, DateTime date=DefaultDateTime, |
41f1cec7 RD |
248 | Point pos=DefaultPosition, Size size=DefaultSize, |
249 | long style=wxCAL_SHOW_HOLIDAYS|wxWANTS_CHARS, | |
cbd72d4f | 250 | String name=CalendarNameStr) -> bool |
98e665d3 | 251 | |
d6c14a4c RD |
252 | Acutally create the GUI portion of the CalendarCtrl for 2-phase |
253 | creation. | |
41f1cec7 | 254 | """ |
423f194a RD |
255 | return _calendar.CalendarCtrl_Create(*args, **kwargs) |
256 | ||
257 | def SetDate(*args, **kwargs): | |
98e665d3 | 258 | """ |
a95a7133 | 259 | SetDate(self, DateTime date) |
98e665d3 RD |
260 | |
261 | Sets the current date. | |
262 | """ | |
423f194a RD |
263 | return _calendar.CalendarCtrl_SetDate(*args, **kwargs) |
264 | ||
265 | def GetDate(*args, **kwargs): | |
98e665d3 | 266 | """ |
a95a7133 | 267 | GetDate(self) -> DateTime |
98e665d3 RD |
268 | |
269 | Gets the currently selected date. | |
270 | """ | |
423f194a RD |
271 | return _calendar.CalendarCtrl_GetDate(*args, **kwargs) |
272 | ||
273 | def SetLowerDateLimit(*args, **kwargs): | |
98e665d3 | 274 | """ |
a95a7133 | 275 | SetLowerDateLimit(self, DateTime date=DefaultDateTime) -> bool |
423f194a | 276 | |
98e665d3 RD |
277 | set the range in which selection can occur |
278 | """ | |
279 | return _calendar.CalendarCtrl_SetLowerDateLimit(*args, **kwargs) | |
423f194a RD |
280 | |
281 | def SetUpperDateLimit(*args, **kwargs): | |
98e665d3 | 282 | """ |
a95a7133 | 283 | SetUpperDateLimit(self, DateTime date=DefaultDateTime) -> bool |
98e665d3 RD |
284 | |
285 | set the range in which selection can occur | |
286 | """ | |
423f194a RD |
287 | return _calendar.CalendarCtrl_SetUpperDateLimit(*args, **kwargs) |
288 | ||
98e665d3 RD |
289 | def GetLowerDateLimit(*args, **kwargs): |
290 | """ | |
a95a7133 | 291 | GetLowerDateLimit(self) -> DateTime |
98e665d3 RD |
292 | |
293 | get the range in which selection can occur | |
294 | """ | |
295 | return _calendar.CalendarCtrl_GetLowerDateLimit(*args, **kwargs) | |
296 | ||
423f194a | 297 | def GetUpperDateLimit(*args, **kwargs): |
98e665d3 | 298 | """ |
a95a7133 | 299 | GetUpperDateLimit(self) -> DateTime |
98e665d3 RD |
300 | |
301 | get the range in which selection can occur | |
302 | """ | |
423f194a RD |
303 | return _calendar.CalendarCtrl_GetUpperDateLimit(*args, **kwargs) |
304 | ||
305 | def SetDateRange(*args, **kwargs): | |
98e665d3 | 306 | """ |
a95a7133 | 307 | SetDateRange(self, DateTime lowerdate=DefaultDateTime, DateTime upperdate=DefaultDateTime) -> bool |
98e665d3 RD |
308 | |
309 | set the range in which selection can occur | |
310 | """ | |
423f194a RD |
311 | return _calendar.CalendarCtrl_SetDateRange(*args, **kwargs) |
312 | ||
313 | def EnableYearChange(*args, **kwargs): | |
98e665d3 | 314 | """ |
a95a7133 | 315 | EnableYearChange(self, bool enable=True) |
98e665d3 RD |
316 | |
317 | This function should be used instead of changing CAL_NO_YEAR_CHANGE | |
318 | style bit directly. It allows or disallows the user to change the year | |
319 | interactively. | |
320 | """ | |
423f194a RD |
321 | return _calendar.CalendarCtrl_EnableYearChange(*args, **kwargs) |
322 | ||
323 | def EnableMonthChange(*args, **kwargs): | |
98e665d3 | 324 | """ |
a95a7133 | 325 | EnableMonthChange(self, bool enable=True) |
98e665d3 | 326 | |
d6c14a4c RD |
327 | This function should be used instead of changing CAL_NO_MONTH_CHANGE |
328 | style bit. It allows or disallows the user to change the month | |
329 | interactively. Note that if the month can not be changed, the year can | |
330 | not be changed either. | |
98e665d3 | 331 | """ |
423f194a RD |
332 | return _calendar.CalendarCtrl_EnableMonthChange(*args, **kwargs) |
333 | ||
334 | def EnableHolidayDisplay(*args, **kwargs): | |
98e665d3 | 335 | """ |
a95a7133 | 336 | EnableHolidayDisplay(self, bool display=True) |
98e665d3 | 337 | |
d6c14a4c RD |
338 | This function should be used instead of changing CAL_SHOW_HOLIDAYS |
339 | style bit directly. It enables or disables the special highlighting of | |
340 | the holidays. | |
98e665d3 | 341 | """ |
423f194a RD |
342 | return _calendar.CalendarCtrl_EnableHolidayDisplay(*args, **kwargs) |
343 | ||
344 | def SetHeaderColours(*args, **kwargs): | |
98e665d3 | 345 | """ |
a95a7133 | 346 | SetHeaderColours(self, Colour colFg, Colour colBg) |
98e665d3 | 347 | |
d6c14a4c | 348 | Header colours are used for painting the weekdays at the top. |
98e665d3 | 349 | """ |
423f194a RD |
350 | return _calendar.CalendarCtrl_SetHeaderColours(*args, **kwargs) |
351 | ||
352 | def GetHeaderColourFg(*args, **kwargs): | |
98e665d3 | 353 | """ |
a95a7133 | 354 | GetHeaderColourFg(self) -> Colour |
98e665d3 | 355 | |
d6c14a4c | 356 | Header colours are used for painting the weekdays at the top. |
98e665d3 | 357 | """ |
423f194a RD |
358 | return _calendar.CalendarCtrl_GetHeaderColourFg(*args, **kwargs) |
359 | ||
360 | def GetHeaderColourBg(*args, **kwargs): | |
98e665d3 | 361 | """ |
a95a7133 | 362 | GetHeaderColourBg(self) -> Colour |
98e665d3 | 363 | |
d6c14a4c | 364 | Header colours are used for painting the weekdays at the top. |
98e665d3 | 365 | """ |
423f194a RD |
366 | return _calendar.CalendarCtrl_GetHeaderColourBg(*args, **kwargs) |
367 | ||
368 | def SetHighlightColours(*args, **kwargs): | |
98e665d3 | 369 | """ |
a95a7133 | 370 | SetHighlightColours(self, Colour colFg, Colour colBg) |
98e665d3 | 371 | |
d6c14a4c | 372 | Highlight colour is used for the currently selected date. |
98e665d3 | 373 | """ |
423f194a RD |
374 | return _calendar.CalendarCtrl_SetHighlightColours(*args, **kwargs) |
375 | ||
376 | def GetHighlightColourFg(*args, **kwargs): | |
98e665d3 | 377 | """ |
a95a7133 | 378 | GetHighlightColourFg(self) -> Colour |
98e665d3 | 379 | |
d6c14a4c | 380 | Highlight colour is used for the currently selected date. |
98e665d3 | 381 | """ |
423f194a RD |
382 | return _calendar.CalendarCtrl_GetHighlightColourFg(*args, **kwargs) |
383 | ||
384 | def GetHighlightColourBg(*args, **kwargs): | |
98e665d3 | 385 | """ |
a95a7133 | 386 | GetHighlightColourBg(self) -> Colour |
98e665d3 | 387 | |
d6c14a4c | 388 | Highlight colour is used for the currently selected date. |
98e665d3 | 389 | """ |
423f194a RD |
390 | return _calendar.CalendarCtrl_GetHighlightColourBg(*args, **kwargs) |
391 | ||
392 | def SetHolidayColours(*args, **kwargs): | |
98e665d3 | 393 | """ |
a95a7133 | 394 | SetHolidayColours(self, Colour colFg, Colour colBg) |
98e665d3 | 395 | |
d6c14a4c RD |
396 | Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is |
397 | used). | |
98e665d3 | 398 | """ |
423f194a RD |
399 | return _calendar.CalendarCtrl_SetHolidayColours(*args, **kwargs) |
400 | ||
401 | def GetHolidayColourFg(*args, **kwargs): | |
98e665d3 | 402 | """ |
a95a7133 | 403 | GetHolidayColourFg(self) -> Colour |
98e665d3 | 404 | |
d6c14a4c RD |
405 | Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is |
406 | used). | |
98e665d3 | 407 | """ |
423f194a RD |
408 | return _calendar.CalendarCtrl_GetHolidayColourFg(*args, **kwargs) |
409 | ||
410 | def GetHolidayColourBg(*args, **kwargs): | |
98e665d3 | 411 | """ |
a95a7133 | 412 | GetHolidayColourBg(self) -> Colour |
98e665d3 | 413 | |
d6c14a4c RD |
414 | Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is |
415 | used). | |
98e665d3 | 416 | """ |
423f194a RD |
417 | return _calendar.CalendarCtrl_GetHolidayColourBg(*args, **kwargs) |
418 | ||
419 | def GetAttr(*args, **kwargs): | |
98e665d3 | 420 | """ |
a95a7133 | 421 | GetAttr(self, size_t day) -> CalendarDateAttr |
98e665d3 | 422 | |
d6c14a4c RD |
423 | Returns the attribute for the given date (should be in the range |
424 | 1...31). The returned value may be None | |
98e665d3 | 425 | """ |
423f194a RD |
426 | return _calendar.CalendarCtrl_GetAttr(*args, **kwargs) |
427 | ||
428 | def SetAttr(*args, **kwargs): | |
98e665d3 | 429 | """ |
a95a7133 | 430 | SetAttr(self, size_t day, CalendarDateAttr attr) |
98e665d3 | 431 | |
d6c14a4c RD |
432 | Associates the attribute with the specified date (in the range |
433 | 1...31). If the attribute passed is None, the items attribute is | |
434 | cleared. | |
98e665d3 | 435 | """ |
423f194a RD |
436 | return _calendar.CalendarCtrl_SetAttr(*args, **kwargs) |
437 | ||
438 | def SetHoliday(*args, **kwargs): | |
98e665d3 | 439 | """ |
a95a7133 | 440 | SetHoliday(self, size_t day) |
98e665d3 RD |
441 | |
442 | Marks the specified day as being a holiday in the current month. | |
443 | """ | |
423f194a RD |
444 | return _calendar.CalendarCtrl_SetHoliday(*args, **kwargs) |
445 | ||
446 | def ResetAttr(*args, **kwargs): | |
98e665d3 | 447 | """ |
a95a7133 | 448 | ResetAttr(self, size_t day) |
98e665d3 | 449 | |
d6c14a4c RD |
450 | Clears any attributes associated with the given day (in the range |
451 | 1...31). | |
98e665d3 | 452 | """ |
423f194a RD |
453 | return _calendar.CalendarCtrl_ResetAttr(*args, **kwargs) |
454 | ||
455 | def HitTest(*args, **kwargs): | |
98e665d3 RD |
456 | """ |
457 | HitTest(Point pos) -> (result, date, weekday) | |
458 | ||
d6c14a4c RD |
459 | Returns 3-tuple with information about the given position on the |
460 | calendar control. The first value of the tuple is a result code and | |
15817c7e | 461 | determines the validity of the remaining two values. |
98e665d3 RD |
462 | """ |
463 | return _calendar.CalendarCtrl_HitTest(*args, **kwargs) | |
423f194a | 464 | |
9fd4be55 | 465 | def GetMonthControl(*args, **kwargs): |
98e665d3 | 466 | """ |
a95a7133 | 467 | GetMonthControl(self) -> Control |
98e665d3 | 468 | |
d6c14a4c | 469 | Get the currently shown control for month. |
98e665d3 | 470 | """ |
9fd4be55 RD |
471 | return _calendar.CalendarCtrl_GetMonthControl(*args, **kwargs) |
472 | ||
473 | def GetYearControl(*args, **kwargs): | |
98e665d3 | 474 | """ |
a95a7133 | 475 | GetYearControl(self) -> Control |
98e665d3 | 476 | |
d6c14a4c | 477 | Get the currently shown control for year. |
98e665d3 | 478 | """ |
9fd4be55 RD |
479 | return _calendar.CalendarCtrl_GetYearControl(*args, **kwargs) |
480 | ||
f20a2e1f RD |
481 | def GetClassDefaultAttributes(*args, **kwargs): |
482 | """ | |
483 | GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes | |
484 | ||
15817c7e RD |
485 | Get the default attributes for this class. This is useful if you want |
486 | to use the same font or colour in your own control as in a standard | |
487 | control -- which is a much better idea than hard coding specific | |
a5ee0656 RD |
488 | colours or fonts which might look completely out of place on the |
489 | user's system, especially if it uses themes. | |
f20a2e1f RD |
490 | |
491 | The variant parameter is only relevant under Mac currently and is | |
15817c7e | 492 | ignore under other platforms. Under Mac, it will change the size of |
a5ee0656 RD |
493 | the returned font. See `wx.Window.SetWindowVariant` for more about |
494 | this. | |
f20a2e1f RD |
495 | """ |
496 | return _calendar.CalendarCtrl_GetClassDefaultAttributes(*args, **kwargs) | |
497 | ||
498 | GetClassDefaultAttributes = staticmethod(GetClassDefaultAttributes) | |
44bf767a RD |
499 | def PySetDate(self, date): |
500 | """takes datetime.datetime or datetime.date object""" | |
629e65c2 | 501 | self.SetDate(_pydate2wxdate(date)) |
44bf767a RD |
502 | |
503 | def PyGetDate(self): | |
504 | """returns datetime.date object""" | |
629e65c2 | 505 | return _wxdate2pydate(self.GetDate()) |
44bf767a RD |
506 | |
507 | def PySetLowerDateLimit(self, date): | |
508 | """takes datetime.datetime or datetime.date object""" | |
629e65c2 | 509 | self.SetLowerDateLimit(_pydate2wxdate(date)) |
44bf767a RD |
510 | |
511 | def PySetUpperDateLimit(self, date): | |
512 | """takes datetime.datetime or datetime.date object""" | |
629e65c2 | 513 | self.SetUpperDateLimit(_pydate2wxdate(date)) |
44bf767a RD |
514 | |
515 | def PySetDateRange(self, lowerdate, upperdate): | |
516 | """takes datetime.datetime or datetime.date objects""" | |
517 | self.PySetLowerDateLimit(lowerdate) | |
518 | self.PySetUpperDateLimit(upperdate) | |
519 | ||
520 | def PyGetLowerDateLimit(self): | |
521 | """returns datetime.date object""" | |
629e65c2 | 522 | return _wxdate2pydate(self.GetLowerDateLimit()) |
44bf767a RD |
523 | |
524 | def PyGetUpperDateLimit(self): | |
525 | """returns datetime.date object""" | |
629e65c2 | 526 | return _wxdate2pydate(self.GetUpperDateLimit()) |
44bf767a | 527 | |
1bd55598 RD |
528 | CalendarCtrl_swigregister = _calendar.CalendarCtrl_swigregister |
529 | CalendarCtrl_swigregister(CalendarCtrl) | |
cbd72d4f RD |
530 | cvar = _calendar.cvar |
531 | CalendarNameStr = cvar.CalendarNameStr | |
e6056257 | 532 | |
d14a1e28 | 533 | def PreCalendarCtrl(*args, **kwargs): |
98e665d3 RD |
534 | """ |
535 | PreCalendarCtrl() -> CalendarCtrl | |
536 | ||
537 | Precreate a CalendarCtrl for 2-phase creation. | |
538 | """ | |
d14a1e28 | 539 | val = _calendar.new_PreCalendarCtrl(*args, **kwargs) |
e6056257 RD |
540 | return val |
541 | ||
f20a2e1f | 542 | def CalendarCtrl_GetClassDefaultAttributes(*args, **kwargs): |
1bd55598 | 543 | """ |
f20a2e1f RD |
544 | CalendarCtrl_GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes |
545 | ||
15817c7e RD |
546 | Get the default attributes for this class. This is useful if you want |
547 | to use the same font or colour in your own control as in a standard | |
548 | control -- which is a much better idea than hard coding specific | |
a5ee0656 RD |
549 | colours or fonts which might look completely out of place on the |
550 | user's system, especially if it uses themes. | |
f20a2e1f RD |
551 | |
552 | The variant parameter is only relevant under Mac currently and is | |
15817c7e | 553 | ignore under other platforms. Under Mac, it will change the size of |
a5ee0656 RD |
554 | the returned font. See `wx.Window.SetWindowVariant` for more about |
555 | this. | |
f20a2e1f | 556 | """ |
1bd55598 | 557 | return _calendar.CalendarCtrl_GetClassDefaultAttributes(*args, **kwargs) |
f20a2e1f | 558 | |
629e65c2 | 559 | def _pydate2wxdate(date): |
44bf767a RD |
560 | import datetime |
561 | assert isinstance(date, (datetime.datetime, datetime.date)) | |
562 | tt = date.timetuple() | |
563 | dmy = (tt[2], tt[1]-1, tt[0]) | |
564 | return wx.DateTimeFromDMY(*dmy) | |
565 | ||
629e65c2 | 566 | def _wxdate2pydate(date): |
44bf767a RD |
567 | import datetime |
568 | assert isinstance(date, wx.DateTime) | |
629e65c2 RD |
569 | if date.IsValid(): |
570 | ymd = map(int, date.FormatISODate().split('-')) | |
571 | return datetime.date(*ymd) | |
572 | else: | |
573 | return None | |
44bf767a | 574 | |
e6056257 | 575 | |
32fe5131 | 576 |