From 2cfbeac8141db28d9a022cdf92c12f82631a3c82 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 20 Jan 2005 16:22:48 +0000 Subject: [PATCH] added and implemented for MSW wxDP_SHOWCENTURY flag git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31517 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/datectrl.tex | 7 +++++-- include/wx/datectrl.h | 8 ++++++-- include/wx/generic/datectrl.h | 14 +++++++------- include/wx/msw/datectrl.h | 4 ++-- src/msw/datectrl.cpp | 7 ++++++- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/docs/latex/wx/datectrl.tex b/docs/latex/wx/datectrl.tex index cda0fa3138..637a661b3e 100644 --- a/docs/latex/wx/datectrl.tex +++ b/docs/latex/wx/datectrl.tex @@ -42,6 +42,9 @@ calendar drop down part from which the user can select a date.} \twocolitem{\windowstyle{wxDP\_DEFAULT}}{Creates a control with default style which is the best supported for the current platform (currently wxDP\_SPIN under Windows and wxDP\_DROPDOWN elsewhere).} +\twocolitem{\windowstyle{wxDP\_SHOWCENTURY}}{Forces display of the century in +the default date format. Without this flas the century could be displayed or +not depending on the default date representation in the system.} \end{twocollist} \wxheading{Event handling} @@ -67,7 +70,7 @@ changes the current selection in the control.} \param{const wxDateTime\& }{dt = wxDefaultDateTime},\rtfsp \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp \param{const wxSize\& }{size = wxDefaultSize},\rtfsp -\param{long}{ style = wxDP\_DEFAULT},\rtfsp +\param{long}{ style = wxDP\_DEFAULT | wxDP\_SHOWCENTURY},\rtfsp \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``datectrl"}} @@ -82,7 +85,7 @@ all the parameters. \param{const wxDateTime\& }{dt = wxDefaultDateTime},\rtfsp \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp \param{const wxSize\& }{size = wxDefaultSize},\rtfsp -\param{long}{ style = wxDP\_DEFAULT},\rtfsp +\param{long}{ style = wxDP\_DEFAULT | wxDP\_SHOWCENTURY},\rtfsp \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``datectrl"}} diff --git a/include/wx/datectrl.h b/include/wx/datectrl.h index 1cf93fa1d2..cffc29e086 100644 --- a/include/wx/datectrl.h +++ b/include/wx/datectrl.h @@ -27,7 +27,11 @@ enum wxDP_SPIN = 1, // a combobox-like date picker (not supported in mac version) - wxDP_DROPDOWN = 2 + wxDP_DROPDOWN = 2, + + // always show century in the default date display (otherwise it depends on + // the system date format which may include the century or not) + wxDP_SHOWCENTURY = 4 }; // ---------------------------------------------------------------------------- @@ -46,7 +50,7 @@ public: const wxDateTime& dt = wxDefaultDateTime, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDP_DEFAULT, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxDatePickerCtrlNameStr); */ diff --git a/include/wx/generic/datectrl.h b/include/wx/generic/datectrl.h index b0d27c63de..8fa4b2c590 100644 --- a/include/wx/generic/datectrl.h +++ b/include/wx/generic/datectrl.h @@ -26,16 +26,16 @@ public: const wxDateTime& date = wxDefaultDateTime, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxString& name = wxDatePickerCtrlNameStr); bool Create(wxWindow *parent, - wxWindowID id, - const wxDateTime& date, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name=wxDatePickerCtrlNameStr); + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, + const wxString& name = wxDatePickerCtrlNameStr); // wxDatePickerCtrl methods void SetValue(const wxDateTime& date); diff --git a/include/wx/msw/datectrl.h b/include/wx/msw/datectrl.h index 2faab5ac34..4e891c5b71 100644 --- a/include/wx/msw/datectrl.h +++ b/include/wx/msw/datectrl.h @@ -27,7 +27,7 @@ public: const wxDateTime& dt = wxDefaultDateTime, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxDatePickerCtrlNameStr) { @@ -39,7 +39,7 @@ public: const wxDateTime& dt = wxDefaultDateTime, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxDatePickerCtrlNameStr); diff --git a/src/msw/datectrl.cpp b/src/msw/datectrl.cpp index 3be0445eeb..e5b0f87a6e 100644 --- a/src/msw/datectrl.cpp +++ b/src/msw/datectrl.cpp @@ -146,7 +146,12 @@ WXDWORD wxDatePickerCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const styleMSW |= DTS_UPDOWN; //else: drop down by default - styleMSW |= DTS_SHORTDATEFORMAT; +#ifdef DTS_SHORTDATECENTURYFORMAT + if ( style & wxDP_SHOWCENTURY ) + styleMSW |= DTS_SHORTDATECENTURYFORMAT; + else +#endif // DTS_SHORTDATECENTURYFORMAT + styleMSW |= DTS_SHORTDATEFORMAT; return styleMSW; } -- 2.45.2