]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/datectrl.h
don't place NULL pointers in the GDK window array in GTKGetWindow()
[wxWidgets.git] / interface / wx / datectrl.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: datectrl.h
e54c96f1 3// Purpose: interface of wxDatePickerCtrl
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxDatePickerCtrl
7c913512 11
b9da294f
BP
12 This control allows the user to select a date. Unlike wxCalendarCtrl, which
13 is a relatively big control, wxDatePickerCtrl is implemented as a small
14 window showing the currently selected date. The control can be edited using
15 the keyboard, and can also display a popup window for more user-friendly
16 date selection, depending on the styles used and the platform, except
17 PalmOS where date is selected using native dialog.
7c913512 18
23324ae1 19 It is only available if @c wxUSE_DATEPICKCTRL is set to 1.
7c913512 20
23324ae1 21 @beginStyleTable
8c6791e4 22 @style{wxDP_SPIN}
23324ae1
FM
23 Creates a control without a month calendar drop down but with
24 spin-control-like arrows to change individual date components. This
25 style is not supported by the generic version.
8c6791e4 26 @style{wxDP_DROPDOWN}
23324ae1
FM
27 Creates a control with a month calendar drop-down part from which
28 the user can select a date.
8c6791e4 29 @style{wxDP_DEFAULT}
23324ae1
FM
30 Creates a control with the style that is best supported for the
31 current platform (currently wxDP_SPIN under Windows and
32 wxDP_DROPDOWN elsewhere).
8c6791e4 33 @style{wxDP_ALLOWNONE}
23324ae1
FM
34 With this style, the control allows the user to not enter any valid
35 date at all. Without it - the default - the control always has some
36 valid date.
8c6791e4 37 @style{wxDP_SHOWCENTURY}
23324ae1
FM
38 Forces display of the century in the default date format. Without
39 this style the century could be displayed, or not, depending on the
40 default date representation in the system.
41 @endStyleTable
7c913512 42
3051a44a 43 @beginEventEmissionTable{wxDateEvent}
8c6791e4 44 @event{EVT_DATE_CHANGED(id, func)}
b9da294f
BP
45 This event fires when the user changes the current selection in the
46 control.
23324ae1 47 @endEventTable
7c913512 48
23324ae1 49 @library{wxadv}
d18d9f60 50 @category{pickers}
7e59b885 51 @appearance{datepickerctrl.png}
7c913512 52
e54c96f1 53 @see wxCalendarCtrl, wxDateEvent
23324ae1
FM
54*/
55class wxDatePickerCtrl : public wxControl
56{
57public:
58 /**
b9da294f 59 Initializes the object and calls Create() with all the parameters.
23324ae1 60 */
4cc4bfaf 61 wxDatePickerCtrl(wxWindow* parent, wxWindowID id,
23324ae1
FM
62 const wxDateTime& dt = wxDefaultDateTime,
63 const wxPoint& pos = wxDefaultPosition,
64 const wxSize& size = wxDefaultSize,
65 long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = "datectrl");
68
69 /**
7c913512 70 @param parent
4cc4bfaf 71 Parent window, must not be non-@NULL.
7c913512 72 @param id
4cc4bfaf 73 The identifier for the control.
7c913512 74 @param dt
4cc4bfaf
FM
75 The initial value of the control, if an invalid date (such as the
76 default value) is used, the control is set to today.
7c913512 77 @param pos
4cc4bfaf 78 Initial position.
7c913512 79 @param size
b9da294f
BP
80 Initial size. If left at default value, the control chooses its own
81 best size by using the height approximately equal to a text control
82 and width large enough to show the date string fully.
7c913512 83 @param style
b9da294f
BP
84 The window style, should be left at 0 as there are no special
85 styles for this control in this version.
7c913512 86 @param validator
4cc4bfaf 87 Validator which can be used for additional date checks.
7c913512 88 @param name
4cc4bfaf 89 Control name.
3c4f71cc 90
d29a9a8a 91 @return @true if the control was successfully created or @false if
4cc4bfaf 92 creation failed.
23324ae1 93 */
4cc4bfaf 94 bool Create(wxWindow* parent, wxWindowID id,
23324ae1
FM
95 const wxDateTime& dt = wxDefaultDateTime,
96 const wxPoint& pos = wxDefaultPosition,
97 const wxSize& size = wxDefaultSize,
98 long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
99 const wxValidator& validator = wxDefaultValidator,
100 const wxString& name = "datectrl");
101
102 /**
7c913512 103 If the control had been previously limited to a range of dates using
b9da294f
BP
104 SetRange(), returns the lower and upper bounds of this range. If no
105 range is set (or only one of the bounds is set), @a dt1 and/or @a dt2
106 are set to be invalid.
3c4f71cc 107
7c913512 108 @param dt1
4cc4bfaf
FM
109 Pointer to the object which receives the lower range limit or
110 becomes invalid if it is not set. May be @NULL if the caller is not
b9da294f 111 interested in lower limit.
7c913512 112 @param dt2
b9da294f 113 Same as above but for the upper limit.
3c4f71cc 114
d29a9a8a 115 @return @false if no range limits are currently set, @true if at least
b9da294f 116 one bound is set.
23324ae1 117 */
b91c4601 118 virtual bool GetRange(wxDateTime* dt1, wxDateTime* dt2) const = 0;
23324ae1
FM
119
120 /**
b9da294f
BP
121 Returns the currently selected. If there is no selection or the
122 selection is outside of the current range, an invalid object is
123 returned.
23324ae1 124 */
b91c4601 125 virtual wxDateTime GetValue() const = 0;
23324ae1
FM
126
127 /**
b9da294f
BP
128 Sets the display format for the date in the control. See wxDateTime for
129 the meaning of format strings.
130
131 @note This function is only available in the generic version of this
132 control. The native version always uses the current system locale.
3c4f71cc 133
23324ae1
FM
134 @remarks If the format parameter is invalid, the behaviour is undefined.
135 */
43c48e1e 136 bool SetFormat(const wxString& format);
23324ae1
FM
137
138 /**
b9da294f
BP
139 Sets the valid range for the date selection. If @a dt1 is valid, it
140 becomes the earliest date (inclusive) accepted by the control. If
141 @a dt2 is valid, it becomes the latest possible date.
3c4f71cc 142
b9da294f
BP
143 @remarks If the current value of the control is outside of the newly
144 set range bounds, the behaviour is undefined.
23324ae1 145 */
b91c4601 146 virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0;
23324ae1
FM
147
148 /**
b9da294f
BP
149 Changes the current value of the control. The date should be valid and
150 included in the currently selected range, if any.
151
23324ae1
FM
152 Calling this method does not result in a date change event.
153 */
b91c4601 154 virtual void SetValue(const wxDateTime& dt) = 0;
23324ae1 155};
e54c96f1 156