Add wxDateTimePickerCtrl::SetNullText()
This allows to customize the string shown when there is no valid date under MSW (only, for now) and can be notably used to suppress the unused date completely, which can be useful to lighten up the display when there are many controls. Add UI elements to the widgets sample allowing to test the new function.
This commit is contained in:
@@ -26,6 +26,8 @@ public:
|
||||
virtual void SetValue(const wxDateTime& dt) wxOVERRIDE;
|
||||
virtual wxDateTime GetValue() const wxOVERRIDE;
|
||||
|
||||
virtual void SetNullText(const wxString& text) wxOVERRIDE;
|
||||
|
||||
// returns true if the platform should explicitly apply a theme border
|
||||
virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; }
|
||||
|
||||
@@ -61,6 +63,19 @@ protected:
|
||||
|
||||
// the date currently shown by the control, may be invalid
|
||||
wxDateTime m_date;
|
||||
|
||||
private:
|
||||
// Helper setting the appropriate format depending on the passed in state.
|
||||
void MSWUpdateFormat(bool valid);
|
||||
|
||||
// Same thing, but only doing if the validity differs from the date
|
||||
// validity, i.e. avoiding useless work if nothing needs to be done.
|
||||
void MSWUpdateFormatIfNeeded(bool valid);
|
||||
|
||||
|
||||
// shown when there is no valid value (so only used with wxDP_ALLOWNONE),
|
||||
// always non-empty if SetNullText() was called, see the comments there
|
||||
wxString m_nullText;
|
||||
};
|
||||
|
||||
#endif // _WX_MSW_DATETIMECTRL_H_
|
||||
|
Reference in New Issue
Block a user