]>
Commit | Line | Data |
---|---|---|
fceac6bb VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: src/osx/datetimectrl_osx.cpp | |
3 | // Purpose: Implementation of wxDateTimePickerCtrl for OS X. | |
4 | // Author: Vadim Zeitlin | |
5 | // Created: 2011-12-18 | |
fceac6bb VZ |
6 | // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> |
7 | // Licence: wxWindows licence | |
8 | /////////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | // ============================================================================ | |
11 | // declarations | |
12 | // ============================================================================ | |
13 | ||
14 | // ---------------------------------------------------------------------------- | |
15 | // headers | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
18 | // for compilers that support precompilation, includes "wx.h". | |
19 | #include "wx/wxprec.h" | |
20 | ||
21 | #ifdef __BORLANDC__ | |
22 | #pragma hdrstop | |
23 | #endif | |
24 | ||
25 | #if wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL | |
26 | ||
27 | #ifndef WX_PRECOMP | |
28 | #endif // WX_PRECOMP | |
29 | ||
5a1b9616 | 30 | #include "wx/datectrl.h" |
fceac6bb VZ |
31 | #include "wx/datetimectrl.h" |
32 | ||
33 | #include "wx/osx/core/private/datetimectrl.h" | |
34 | ||
35 | // ============================================================================ | |
36 | // wxDateTimePickerCtrl implementation | |
37 | // ============================================================================ | |
38 | ||
39 | wxDateTimeWidgetImpl* wxDateTimePickerCtrl::GetDateTimePeer() const | |
40 | { | |
41 | return static_cast<wxDateTimeWidgetImpl*>(GetPeer()); | |
42 | } | |
43 | ||
44 | void wxDateTimePickerCtrl::SetValue(const wxDateTime& dt) | |
45 | { | |
5a1b9616 SC |
46 | if ( dt.IsValid() ) |
47 | { | |
48 | GetDateTimePeer()->SetDateTime(dt); | |
49 | } | |
50 | else // invalid date | |
51 | { | |
52 | wxASSERT_MSG( HasFlag(wxDP_ALLOWNONE), | |
53 | wxT("this control must have a valid date") ); | |
54 | ||
55 | // TODO setting to an invalid date is not natively supported | |
56 | // so we must implement a UI for that ourselves | |
57 | GetDateTimePeer()->SetDateTime(dt); | |
58 | } | |
fceac6bb VZ |
59 | } |
60 | ||
61 | wxDateTime wxDateTimePickerCtrl::GetValue() const | |
62 | { | |
63 | return GetDateTimePeer()->GetDateTime(); | |
64 | } | |
65 | ||
66 | ||
67 | #endif // wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL |