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