Version: 2.9.4
Public Member Functions
wxTimePickerCtrl Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/timectrl.h>

Inheritance diagram for wxTimePickerCtrl:

Detailed Description

This control allows the user to enter time.

It is similar to wxDatePickerCtrl but is used for time, and not date, selection. While GetValue() and SetValue() still work with values of type wxDateTime (because wxWidgets doesn't provide a time-only class), their date part is ignored by this control.

It is only available if wxUSE_TIMEPICKCTRL is set to 1.

This control currently doesn't have any specific flags.

Events emitted by this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxDateEvent& event)

Event macros for events emitted by this class:

Library:  wxAdvanced
Category:  Picker Controls

Appearance:
wxMSW appearancewxGTK appearancewxMac appearance
wxMSW appearancewxGTK appearancewxMac appearance
参照:
wxDatePickerCtrl, wxDateEvent
Since:
2.9.3

Public Member Functions

 wxTimePickerCtrl ()
 Default constructor.
 wxTimePickerCtrl (wxWindow *parent, wxWindowID id, const wxDateTime &dt=wxDefaultDateTime, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTP_DEFAULT, const wxValidator &validator=wxDefaultValidator, const wxString &name="timectrl")
 Initializes the object and calls Create() with all the parameters.
bool Create (wxWindow *parent, wxWindowID id, const wxDateTime &dt=wxDefaultDateTime, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDP_DEFAULT|wxDP_SHOWCENTURY, const wxValidator &validator=wxDefaultValidator, const wxString &name="timectrl")
 Create the control window.
bool GetTime (int *hour, int *min, int *sec) const
 Returns the currently entered time as hours, minutes and seconds.
virtual wxDateTime GetValue () const
 Returns the currently entered time.
bool SetTime (int hour, int min, int sec)
 Changes the current time of the control.
virtual void SetValue (const wxDateTime &dt)
 Changes the current value of the control.

List of all members.


Constructor & Destructor Documentation

wxTimePickerCtrl::wxTimePickerCtrl ( )

Default constructor.

wxTimePickerCtrl::wxTimePickerCtrl ( wxWindow parent,
wxWindowID  id,
const wxDateTime dt = wxDefaultDateTime,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = wxTP_DEFAULT,
const wxValidator validator = wxDefaultValidator,
const wxString name = "timectrl" 
)

Initializes the object and calls Create() with all the parameters.


Member Function Documentation

bool wxTimePickerCtrl::Create ( wxWindow parent,
wxWindowID  id,
const wxDateTime dt = wxDefaultDateTime,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = wxDP_DEFAULT|wxDP_SHOWCENTURY,
const wxValidator validator = wxDefaultValidator,
const wxString name = "timectrl" 
)

Create the control window.

This method should only be used for objects created using default constructor.

Parameters:
parentParent window, must not be non-NULL.
idThe identifier for the control.
dtThe initial value of the control, if an invalid date (such as the default value) is used, the control is set to current time.
posInitial position.
sizeInitial size. If left at default value, the control chooses its own best size by using the height approximately equal to a text control and width large enough to show the time fully.
styleThe window style, should be left at 0 as there are no special styles for this control in this version.
validatorValidator which can be used for additional checks.
nameControl name.
Returns:
true if the control was successfully created or false if creation failed.
bool wxTimePickerCtrl::GetTime ( int *  hour,
int *  min,
int *  sec 
) const

Returns the currently entered time as hours, minutes and seconds.

All the arguments must be non-NULL, false is returned otherwise and none of them is modified.

参照:
SetTime()
Since:
2.9.4
virtual wxDateTime wxTimePickerCtrl::GetValue ( ) const [virtual]

Returns the currently entered time.

The date part of the returned wxDateTime object is always set to today and should be ignored, only the time part is relevant.

bool wxTimePickerCtrl::SetTime ( int  hour,
int  min,
int  sec 
)

Changes the current time of the control.

Calling this method does not result in a time change event.

Parameters:
hourThe new hour value in 0..23 interval.
minThe new minute value in 0..59 interval.
secThe new second value in 0..59 interval.
Returns:
true if the time was changed or false on failure, e.g. if the time components were invalid.
参照:
GetTime()
Since:
2.9.4
virtual void wxTimePickerCtrl::SetValue ( const wxDateTime dt) [virtual]

Changes the current value of the control.

The date part of dt is ignored, only the time part is displayed in the control. The dt object must however be valid.

In particular notice that it is a bad idea to use default wxDateTime constructor from hour, minute and second values as it uses the today date for the date part which means that some times can be invalid if today happens to be the day of DST change. For example, when switching to summer time the time 2:00 typically doesn't exist as the clocks jump directly to 3:00. To avoid this problem, use a fixed date on which DST is known not to change (e.g. Jan 1, 2012) for the date part of the argument or use SetTime().

Calling this method does not result in a time change event.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines