]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/datectrl.cpp
wxDatePicker and wxDateTime for PalmOS. Remove conflict with internal maxDays in...
[wxWidgets.git] / src / palmos / datectrl.cpp
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
26 #ifndef WX_PRECOMP
27 #endif
28
29 #if wxUSE_DATEPICKCTRL
30
31 #include "wx/datectrl.h"
32 #include "wx/app.h"
33 #include "wx/intl.h"
34 #include "wx/dynlib.h"
35
36 #define _WX_DEFINE_DATE_EVENTS_
37 #include "wx/dateevt.h"
38
39 // ============================================================================
40 // implementation
41 // ============================================================================
42
43 // ----------------------------------------------------------------------------
44 // wxDatePickerCtrl creation
45 // ----------------------------------------------------------------------------
46
47 bool wxDatePickerCtrl::Create(wxWindow *parent,
48 wxWindowID id,
49 const wxDateTime& dt,
50 const wxPoint& pos,
51 const wxSize& size,
52 long style,
53 const wxValidator& validator,
54 const wxString& name)
55 {
56 if(!wxControl::Create(parent, id, pos, size, style, validator, name))
57 return false;
58
59 wxString label;
60
61 if ( dt.IsValid() )
62 label = dt.FormatDate();
63
64 if(!wxControl::PalmCreateControl(selectorTriggerCtl, label, pos, size))
65 return false;
66
67 return true;
68 }
69
70 // ----------------------------------------------------------------------------
71 // wxDatePickerCtrl geometry
72 // ----------------------------------------------------------------------------
73
74 wxSize wxDatePickerCtrl::DoGetBestSize() const
75 {
76 return wxSize(16,16);
77 }
78
79 // ----------------------------------------------------------------------------
80 // wxDatePickerCtrl operations
81 // ----------------------------------------------------------------------------
82
83 void wxDatePickerCtrl::SetValue(const wxDateTime& dt)
84 {
85 if ( dt.IsValid() )
86 SetLabel(dt.FormatDate());
87 else
88 SetLabel(wxEmptyString);
89 }
90
91 wxDateTime wxDatePickerCtrl::GetValue() const
92 {
93 wxDateTime dt;
94 // TODO
95 return dt;
96 }
97
98 void wxDatePickerCtrl::SetRange(const wxDateTime& dt1, const wxDateTime& dt2)
99 {
100 // TODO
101 }
102
103 bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) const
104 {
105 // TODO
106 return false;
107 }
108
109 // ----------------------------------------------------------------------------
110 // helpers
111 // ----------------------------------------------------------------------------
112
113 bool wxDatePickerCtrl::SendClickEvent()
114 {
115 wxDateTime dt(wxDateTime::Today());
116 int16_t month = dt.GetMonth();
117 int16_t day = dt.GetDay();
118 int16_t year = dt.GetYear();
119
120 if(SelectDay(selectDayByMonth,&month,&day,&year,_T("Pick date")));
121 }
122
123 #endif // wxUSE_DATEPICKCTRL
124