datetimectrl.h 3.3 KB

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