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