1wxCalendarCtrl(3) Erlang Module Definition wxCalendarCtrl(3)
2
3
4
6 wxCalendarCtrl - Functions for wxCalendarCtrl class
7
9 The calendar control allows the user to pick a date. The user can move
10 the current selection using the keyboard and select the date (generat‐
11 ing EVT_CALENDAR event) by pressing <Return> or double clicking it.
12
13 Generic calendar has advanced possibilities for the customization of
14 its display, described below. If you want to use these possibilities on
15 every platform, use wxGenericCalendarCtrl instead of wxCalendarCtrl.
16
17 All global settings (such as colours and fonts used) can, of course, be
18 changed. But also, the display style for each day in the month can be
19 set independently using wxCalendarDateAttr class.
20
21 An item without custom attributes is drawn with the default colours and
22 font and without border, but setting custom attributes with setAttr/3
23 allows modifying its appearance. Just create a custom attribute object
24 and set it for the day you want to be displayed specially (note that
25 the control will take ownership of the pointer, i.e. it will delete it
26 itself). A day may be marked as being a holiday, even if it is not rec‐
27 ognized as one by wx_datetime() using the wxCalendarDateAttr:setHoli‐
28 day/2 method.
29
30 As the attributes are specified for each day, they may change when the
31 month is changed, so you will often want to update them in EVT_CALEN‐
32 DAR_PAGE_CHANGED event handler.
33
34 If neither the wxCAL_SUNDAY_FIRST or wxCAL_MONDAY_FIRST style is given,
35 the first day of the week is determined from operating system's set‐
36 tings, if possible. The native wxGTK calendar chooses the first weekday
37 based on locale, and these styles have no effect on it.
38
39 Styles
40
41 This class supports the following styles:
42
43 Note: Changing the selected date will trigger an EVT_CALENDAR_DAY,
44 MONTH or YEAR event as well as an EVT_CALENDAR_SEL_CHANGED event.
45
46 See: Examples, wxCalendarDateAttr, wxCalendarEvent, wxDatePickerCtrl
47
48 This class is derived (and can use functions) from: wxControl wxWindow
49 wxEvtHandler
50
51 wxWidgets docs: wxCalendarCtrl
52
54 Event types emitted from this class: calendar_sel_changed, calen‐
55 dar_weekday_clicked
56
58 wxCalendarCtrl() = wx:wx_object()
59
61 new() -> wxCalendarCtrl()
62
63 Default constructor.
64
65 new(Parent, Id) -> wxCalendarCtrl()
66
67 Types:
68
69 Parent = wxWindow:wxWindow()
70 Id = integer()
71
72 new(Parent, Id, Options :: [Option]) -> wxCalendarCtrl()
73
74 Types:
75
76 Parent = wxWindow:wxWindow()
77 Id = integer()
78 Option =
79 {date, wx:wx_datetime()} |
80 {pos, {X :: integer(), Y :: integer()}} |
81 {size, {W :: integer(), H :: integer()}} |
82 {style, integer()}
83
84 Does the same as create/4 method.
85
86 create(This, Parent, Id) -> boolean()
87
88 Types:
89
90 This = wxCalendarCtrl()
91 Parent = wxWindow:wxWindow()
92 Id = integer()
93
94 create(This, Parent, Id, Options :: [Option]) -> boolean()
95
96 Types:
97
98 This = wxCalendarCtrl()
99 Parent = wxWindow:wxWindow()
100 Id = integer()
101 Option =
102 {date, wx:wx_datetime()} |
103 {pos, {X :: integer(), Y :: integer()}} |
104 {size, {W :: integer(), H :: integer()}} |
105 {style, integer()}
106
107 Creates the control.
108
109 See wxWindow:new/3 for the meaning of the parameters and the
110 control overview for the possible styles.
111
112 destroy(This :: wxCalendarCtrl()) -> ok
113
114 Destroys the control.
115
116 setDate(This, Date) -> boolean()
117
118 Types:
119
120 This = wxCalendarCtrl()
121 Date = wx:wx_datetime()
122
123 Sets the current date.
124
125 The date parameter must be valid and in the currently valid
126 range as set by SetDateRange() (not implemented in wx), other‐
127 wise the current date is not changed and the function returns
128 false and, additionally, triggers an assertion failure if the
129 date is invalid.
130
131 getDate(This) -> wx:wx_datetime()
132
133 Types:
134
135 This = wxCalendarCtrl()
136
137 Gets the currently selected date.
138
139 enableYearChange(This) -> ok
140
141 Types:
142
143 This = wxCalendarCtrl()
144
145 enableYearChange(This, Options :: [Option]) -> ok
146
147 Types:
148
149 This = wxCalendarCtrl()
150 Option = {enable, boolean()}
151
152 Deprecated:
153
154 This function should be used instead of changing wx‐
155 CAL_NO_YEAR_CHANGE style bit directly. It allows or disallows
156 the user to change the year interactively. Only in generic wx‐
157 CalendarCtrl.
158
159 enableMonthChange(This) -> boolean()
160
161 Types:
162
163 This = wxCalendarCtrl()
164
165 enableMonthChange(This, Options :: [Option]) -> boolean()
166
167 Types:
168
169 This = wxCalendarCtrl()
170 Option = {enable, boolean()}
171
172 This function should be used instead of changing wx‐
173 CAL_NO_MONTH_CHANGE style bit.
174
175 It allows or disallows the user to change the month interac‐
176 tively. Note that if the month cannot be changed, the year can‐
177 not be changed neither.
178
179 Return: true if the value of this option really changed or false
180 if it was already set to the requested value.
181
182 enableHolidayDisplay(This) -> ok
183
184 Types:
185
186 This = wxCalendarCtrl()
187
188 enableHolidayDisplay(This, Options :: [Option]) -> ok
189
190 Types:
191
192 This = wxCalendarCtrl()
193 Option = {display, boolean()}
194
195 This function should be used instead of changing wxCAL_SHOW_HOL‐
196 IDAYS style bit directly.
197
198 It enables or disables the special highlighting of the holidays.
199
200 setHeaderColours(This, ColFg, ColBg) -> ok
201
202 Types:
203
204 This = wxCalendarCtrl()
205 ColFg = ColBg = wx:wx_colour()
206
207 Set the colours used for painting the weekdays at the top of the
208 control.
209
210 This method is currently only implemented in generic wxCalen‐
211 darCtrl and does nothing in the native versions.
212
213 getHeaderColourFg(This) -> wx:wx_colour4()
214
215 Types:
216
217 This = wxCalendarCtrl()
218
219 Gets the foreground colour of the header part of the calendar
220 window.
221
222 This method is currently only implemented in generic wxCalen‐
223 darCtrl and always returns wxNullColour in the native versions.
224
225 See: setHeaderColours/3
226
227 getHeaderColourBg(This) -> wx:wx_colour4()
228
229 Types:
230
231 This = wxCalendarCtrl()
232
233 Gets the background colour of the header part of the calendar
234 window.
235
236 This method is currently only implemented in generic wxCalen‐
237 darCtrl and always returns wxNullColour in the native versions.
238
239 See: setHeaderColours/3
240
241 setHighlightColours(This, ColFg, ColBg) -> ok
242
243 Types:
244
245 This = wxCalendarCtrl()
246 ColFg = ColBg = wx:wx_colour()
247
248 Set the colours to be used for highlighting the currently se‐
249 lected date.
250
251 This method is currently only implemented in generic wxCalen‐
252 darCtrl and does nothing in the native versions.
253
254 getHighlightColourFg(This) -> wx:wx_colour4()
255
256 Types:
257
258 This = wxCalendarCtrl()
259
260 Gets the foreground highlight colour.
261
262 Only in generic wxCalendarCtrl.
263
264 This method is currently only implemented in generic wxCalen‐
265 darCtrl and always returns wxNullColour in the native versions.
266
267 See: setHighlightColours/3
268
269 getHighlightColourBg(This) -> wx:wx_colour4()
270
271 Types:
272
273 This = wxCalendarCtrl()
274
275 Gets the background highlight colour.
276
277 Only in generic wxCalendarCtrl.
278
279 This method is currently only implemented in generic wxCalen‐
280 darCtrl and always returns wxNullColour in the native versions.
281
282 See: setHighlightColours/3
283
284 setHolidayColours(This, ColFg, ColBg) -> ok
285
286 Types:
287
288 This = wxCalendarCtrl()
289 ColFg = ColBg = wx:wx_colour()
290
291 Sets the colours to be used for the holidays highlighting.
292
293 This method is only implemented in the generic version of the
294 control and does nothing in the native ones. It should also only
295 be called if the window style includes wxCAL_SHOW_HOLIDAYS flag
296 or enableHolidayDisplay/2 had been called.
297
298 getHolidayColourFg(This) -> wx:wx_colour4()
299
300 Types:
301
302 This = wxCalendarCtrl()
303
304 Return the foreground colour currently used for holiday high‐
305 lighting.
306
307 Only useful with generic wxCalendarCtrl as native versions cur‐
308 rently don't support holidays display at all and always return
309 wxNullColour.
310
311 See: setHolidayColours/3
312
313 getHolidayColourBg(This) -> wx:wx_colour4()
314
315 Types:
316
317 This = wxCalendarCtrl()
318
319 Return the background colour currently used for holiday high‐
320 lighting.
321
322 Only useful with generic wxCalendarCtrl as native versions cur‐
323 rently don't support holidays display at all and always return
324 wxNullColour.
325
326 See: setHolidayColours/3
327
328 getAttr(This, Day) -> wxCalendarDateAttr:wxCalendarDateAttr()
329
330 Types:
331
332 This = wxCalendarCtrl()
333 Day = integer()
334
335 Returns the attribute for the given date (should be in the range
336 1...31).
337
338 The returned pointer may be NULL. Only in generic wxCalendarC‐
339 trl.
340
341 setAttr(This, Day, Attr) -> ok
342
343 Types:
344
345 This = wxCalendarCtrl()
346 Day = integer()
347 Attr = wxCalendarDateAttr:wxCalendarDateAttr()
348
349 Associates the attribute with the specified date (in the range
350 1...31).
351
352 If the pointer is NULL, the items attribute is cleared. Only in
353 generic wxCalendarCtrl.
354
355 setHoliday(This, Day) -> ok
356
357 Types:
358
359 This = wxCalendarCtrl()
360 Day = integer()
361
362 Marks the specified day as being a holiday in the current month.
363
364 This method is only implemented in the generic version of the
365 control and does nothing in the native ones.
366
367 resetAttr(This, Day) -> ok
368
369 Types:
370
371 This = wxCalendarCtrl()
372 Day = integer()
373
374 Clears any attributes associated with the given day (in the
375 range 1...31).
376
377 Only in generic wxCalendarCtrl.
378
379 hitTest(This, Pos) -> Result
380
381 Types:
382
383 Result =
384 {Res :: wx:wx_enum(),
385 Date :: wx:wx_datetime(),
386 Wd :: wx:wx_enum()}
387 This = wxCalendarCtrl()
388 Pos = {X :: integer(), Y :: integer()}
389
390 Returns one of wxCalendarHitTestResult constants and fills ei‐
391 ther date or wd pointer with the corresponding value depending
392 on the hit test code.
393
394 Not implemented in wxGTK currently.
395
396
397
398wxWidgets team. wx 2.3.1 wxCalendarCtrl(3)