]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/datetimectrl.h
The rounded corners look really dumb at this size.
[wxWidgets.git] / include / wx / msw / datetimectrl.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/datetimectrl.h
3 // Purpose: wxDateTimePickerCtrl for Windows.
4 // Author: Vadim Zeitlin
5 // Created: 2011-09-22 (extracted from wx/msw/datectrl.h).
6 // Copyright: (c) 2005-2011 Vadim Zeitlin <vadim@wxwindows.org>
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_MSW_DATETIMECTRL_H_
11 #define _WX_MSW_DATETIMECTRL_H_
12
13 #include "wx/intl.h"
14
15 // Forward declare a struct from Platform SDK.
16 struct tagNMDATETIMECHANGE;
17
18 // ----------------------------------------------------------------------------
19 // wxDateTimePickerCtrl
20 // ----------------------------------------------------------------------------
21
22 class WXDLLIMPEXP_ADV wxDateTimePickerCtrl : public wxDateTimePickerCtrlBase
23 {
24 public:
25 // set/get the date
26 virtual void SetValue(const wxDateTime& dt);
27 virtual wxDateTime GetValue() const;
28
29 // returns true if the platform should explicitly apply a theme border
30 virtual bool CanApplyThemeBorder() const { return false; }
31
32 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
33
34 protected:
35 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
36 virtual wxSize DoGetBestSize() const;
37
38 // Helper for the derived classes Create(): creates a native control with
39 // the specified attributes.
40 bool MSWCreateDateTimePicker(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 // Notice that the methods below must be overridden in all native MSW
50 // classes inheriting from this one but they can't be pure virtual because
51 // the generic implementations, not needing nor able to implement them, is
52 // also derived from this class currently. The real problem is, of course,
53 // this wrong class structure because the generic classes also inherit the
54 // wrong implementations of Set/GetValue() and DoGetBestSize() but as they
55 // override these methods anyhow, it does work -- but is definitely ugly
56 // and need to be changed (but how?) in the future.
57
58 // Override to return the date/time format used by this control.
59 virtual wxLocaleInfo MSWGetFormat() const /* = 0 */
60 {
61 wxFAIL_MSG( "Unreachable" );
62 return wxLOCALE_TIME_FMT;
63 }
64
65 // Override to indicate whether we can have no date at all.
66 virtual bool MSWAllowsNone() const /* = 0 */
67 {
68 wxFAIL_MSG( "Unreachable" );
69 return false;
70 }
71
72 // Override to update m_date and send the event when the control contents
73 // changes, return true if the event was handled.
74 virtual bool MSWOnDateTimeChange(const tagNMDATETIMECHANGE& dtch) /* = 0 */
75 {
76 wxUnusedVar(dtch);
77 wxFAIL_MSG( "Unreachable" );
78 return false;
79 }
80
81
82 // the date currently shown by the control, may be invalid
83 wxDateTime m_date;
84 };
85
86 #endif // _WX_MSW_DATETIMECTRL_H_