]>
Commit | Line | Data |
---|---|---|
fceac6bb VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: src/osx/timectrl_osx.cpp | |
3 | // Purpose: Implementation of wxTimePickerCtrl for OS X. | |
4 | // Author: Vadim Zeitlin | |
5 | // Created: 2011-12-18 | |
6 | // RCS-ID: $Id: wxhead.cpp,v 1.11 2010-04-22 12:44:51 zeitlin Exp $ | |
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_TIMEPICKCTRL && wxOSX_USE_COCOA | |
27 | ||
28 | #include "wx/timectrl.h" | |
29 | #include "wx/dateevt.h" | |
30 | ||
31 | #include "wx/osx/core/private/datetimectrl.h" | |
32 | ||
33 | // ============================================================================ | |
34 | // wxTimePickerCtrl implementation | |
35 | // ============================================================================ | |
36 | ||
37 | wxIMPLEMENT_DYNAMIC_CLASS(wxTimePickerCtrl, wxControl); | |
38 | ||
39 | bool | |
40 | wxTimePickerCtrl::Create(wxWindow *parent, | |
41 | wxWindowID id, | |
42 | const wxDateTime& dt, | |
43 | const wxPoint& pos, | |
44 | const wxSize& size, | |
45 | long style, | |
46 | const wxValidator& validator, | |
47 | const wxString& name) | |
48 | { | |
49 | DontCreatePeer(); | |
50 | ||
51 | if ( !wxTimePickerCtrlBase::Create(parent, id, pos, size, | |
52 | style, validator, name) ) | |
53 | return false; | |
54 | ||
55 | wxOSXWidgetImpl* const peer = wxDateTimeWidgetImpl::CreateDateTimePicker | |
56 | ( | |
57 | this, | |
58 | dt, | |
59 | pos, | |
60 | size, | |
61 | style, | |
62 | wxDateTimeWidget_HourMinuteSecond | |
63 | ); | |
64 | if ( !peer ) | |
65 | return false; | |
66 | ||
67 | SetPeer(peer); | |
68 | ||
69 | MacPostControlCreate(pos, size); | |
70 | ||
71 | return true; | |
72 | } | |
73 | ||
74 | void wxTimePickerCtrl::OSXGenerateEvent(const wxDateTime& dt) | |
75 | { | |
76 | wxDateEvent event(this, dt, wxEVT_TIME_CHANGED); | |
77 | HandleWindowEvent(event); | |
78 | } | |
79 | ||
80 | #endif // wxUSE_TIMEPICKCTRL && wxOSX_USE_COCOA |