]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/timectrl.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxTimePickerCtrl
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 @class wxTimePickerCtrl
14 This control allows the user to enter time.
16 It is similar to wxDatePickerCtrl but is used for time, and not date,
17 selection. While GetValue() and SetValue() still work with values of type
18 wxDateTime (because wxWidgets doesn't provide a time-only class), their
19 date part is ignored by this control.
21 It is only available if @c wxUSE_TIMEPICKCTRL is set to 1.
23 This control currently doesn't have any specific flags.
25 @beginEventEmissionTable{wxDateEvent}
26 @event{EVT_TIME_CHANGED(id, func)}
27 This event fires when the user changes the current selection in the
33 @appearance{timepickerctrl.png}
35 @see wxDatePickerCtrl, wxDateEvent
39 class wxTimePickerCtrl
: public wxControl
43 Initializes the object and calls Create() with all the parameters.
45 wxTimePickerCtrl(wxWindow
* parent
, wxWindowID id
,
46 const wxDateTime
& dt
= wxDefaultDateTime
,
47 const wxPoint
& pos
= wxDefaultPosition
,
48 const wxSize
& size
= wxDefaultSize
,
49 long style
= wxTP_DEFAULT
,
50 const wxValidator
& validator
= wxDefaultValidator
,
51 const wxString
& name
= "timectrl");
54 Create the control window.
56 This method should only be used for objects created using default
60 Parent window, must not be non-@NULL.
62 The identifier for the control.
64 The initial value of the control, if an invalid date (such as the
65 default value) is used, the control is set to current time.
69 Initial size. If left at default value, the control chooses its own
70 best size by using the height approximately equal to a text control
71 and width large enough to show the time fully.
73 The window style, should be left at 0 as there are no special
74 styles for this control in this version.
76 Validator which can be used for additional checks.
80 @return @true if the control was successfully created or @false if
83 bool Create(wxWindow
* parent
, wxWindowID id
,
84 const wxDateTime
& dt
= wxDefaultDateTime
,
85 const wxPoint
& pos
= wxDefaultPosition
,
86 const wxSize
& size
= wxDefaultSize
,
87 long style
= wxDP_DEFAULT
| wxDP_SHOWCENTURY
,
88 const wxValidator
& validator
= wxDefaultValidator
,
89 const wxString
& name
= "timectrl");
92 Returns the currently entered time.
94 The date part of the returned wxDateTime object is always set to today
95 and should be ignored, only the time part is relevant.
97 virtual wxDateTime
GetValue() const = 0;
100 Changes the current value of the control.
102 The date part of @a dt is ignored, only the time part is displayed in
103 the control. The @a dt object must however be valid.
105 Calling this method does not result in a time change event.
107 virtual void SetValue(const wxDateTime
& dt
) = 0;