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