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