]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/datectrl.cpp
non-PCH build fix (according to Tinderbox).
[wxWidgets.git] / src / palmos / datectrl.cpp
CommitLineData
324eeecb
WS
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/palmos/datectrl.cpp
3// Purpose: wxDatePickerCtrl implementation
4// Author: Wlodzimierz ABX Skiba
5// Modified by:
6// Created: 02/14/05
7// RCS-ID: $Id$
8// Copyright: (c) Wlodzimierz Skiba
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#include "wx/wxprec.h"
21
22#ifdef __BORLANDC__
23 #pragma hdrstop
24#endif
25
324eeecb
WS
26#if wxUSE_DATEPICKCTRL
27
28#include "wx/datectrl.h"
88a7a4e1
WS
29
30#ifndef WX_PRECOMP
31 #include "wx/intl.h"
670f9935 32 #include "wx/app.h"
88a7a4e1
WS
33#endif
34
324eeecb
WS
35#include "wx/dynlib.h"
36
37#define _WX_DEFINE_DATE_EVENTS_
38#include "wx/dateevt.h"
39
20bc5ad8
WS
40#include <Control.h>
41#include <SelDay.h>
42
a69e2a0a
VZ
43IMPLEMENT_DYNAMIC_CLASS(wxDatePickerCtrl, wxControl)
44
324eeecb
WS
45// ============================================================================
46// implementation
47// ============================================================================
48
49// ----------------------------------------------------------------------------
50// wxDatePickerCtrl creation
51// ----------------------------------------------------------------------------
52
53bool wxDatePickerCtrl::Create(wxWindow *parent,
54 wxWindowID id,
55 const wxDateTime& dt,
56 const wxPoint& pos,
57 const wxSize& size,
58 long style,
59 const wxValidator& validator,
60 const wxString& name)
61{
62 if(!wxControl::Create(parent, id, pos, size, style, validator, name))
63 return false;
64
65 wxString label;
66
67 if ( dt.IsValid() )
60582201 68 {
6a27c749 69 label = dt.FormatDate();
60582201
WS
70 m_dt = dt;
71 }
324eeecb 72
6a27c749 73 if(!wxControl::PalmCreateControl(selectorTriggerCtl, label, pos, size))
324eeecb
WS
74 return false;
75
76 return true;
77}
78
79// ----------------------------------------------------------------------------
80// wxDatePickerCtrl geometry
81// ----------------------------------------------------------------------------
82
83wxSize wxDatePickerCtrl::DoGetBestSize() const
84{
6a27c749 85 return wxSize(16,16);
324eeecb
WS
86}
87
88// ----------------------------------------------------------------------------
89// wxDatePickerCtrl operations
90// ----------------------------------------------------------------------------
91
92void wxDatePickerCtrl::SetValue(const wxDateTime& dt)
93{
6a27c749 94 if ( dt.IsValid() )
60582201
WS
95 m_dt = dt;
96
97 SetLabel(m_dt.FormatDate());
324eeecb
WS
98}
99
100wxDateTime wxDatePickerCtrl::GetValue() const
101{
60582201 102 return m_dt;
324eeecb
WS
103}
104
105void wxDatePickerCtrl::SetRange(const wxDateTime& dt1, const wxDateTime& dt2)
106{
107 // TODO
108}
109
110bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) const
111{
112 // TODO
113 return false;
114}
115
6a27c749
WS
116// ----------------------------------------------------------------------------
117// helpers
118// ----------------------------------------------------------------------------
119
120bool wxDatePickerCtrl::SendClickEvent()
121{
df57c15c 122 int16_t month = (int16_t)m_dt.GetMonth() + 1;
60582201
WS
123 int16_t day = m_dt.GetDay();
124 int16_t year = m_dt.GetYear();
6a27c749 125
60582201
WS
126 if(!SelectDay(selectDayByDay,&month,&day,&year,_T("Pick date")))
127 return false;
128 wxDateTime dt(m_dt);
df57c15c
WS
129 dt.Set((wxDateTime::wxDateTime_t)day,
130 (wxDateTime::Month)(month-1),
131 (int)year);
60582201
WS
132 SetValue(dt);
133 return true;
6a27c749
WS
134}
135
324eeecb 136#endif // wxUSE_DATEPICKCTRL