diff --git a/include/wx/msw/datectrl.h b/include/wx/msw/datectrl.h index e3f95e880e..7ec52f0349 100644 --- a/include/wx/msw/datectrl.h +++ b/include/wx/msw/datectrl.h @@ -54,7 +54,9 @@ public: virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; protected: +#if wxUSE_INTL virtual wxLocaleInfo MSWGetFormat() const; +#endif // wxUSE_INTL virtual bool MSWAllowsNone() const { return HasFlag(wxDP_ALLOWNONE); } virtual bool MSWOnDateTimeChange(const tagNMDATETIMECHANGE& dtch); diff --git a/include/wx/msw/datetimectrl.h b/include/wx/msw/datetimectrl.h index eb93f26ae1..dcb4d4ee19 100644 --- a/include/wx/msw/datetimectrl.h +++ b/include/wx/msw/datetimectrl.h @@ -55,12 +55,14 @@ protected: // override these methods anyhow, it does work -- but is definitely ugly // and need to be changed (but how?) in the future. +#if wxUSE_INTL // Override to return the date/time format used by this control. virtual wxLocaleInfo MSWGetFormat() const /* = 0 */ { wxFAIL_MSG( "Unreachable" ); return wxLOCALE_TIME_FMT; } +#endif // wxUSE_INTL // Override to indicate whether we can have no date at all. virtual bool MSWAllowsNone() const /* = 0 */ diff --git a/include/wx/msw/timectrl.h b/include/wx/msw/timectrl.h index e39528a4e0..c5bc83aec6 100644 --- a/include/wx/msw/timectrl.h +++ b/include/wx/msw/timectrl.h @@ -50,7 +50,9 @@ public: virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; protected: +#if wxUSE_INTL virtual wxLocaleInfo MSWGetFormat() const; +#endif // wxUSE_INTL virtual bool MSWAllowsNone() const { return false; } virtual bool MSWOnDateTimeChange(const tagNMDATETIMECHANGE& dtch); diff --git a/src/msw/datectrl.cpp b/src/msw/datectrl.cpp index cf85692bb7..987edd1fd8 100644 --- a/src/msw/datectrl.cpp +++ b/src/msw/datectrl.cpp @@ -91,11 +91,15 @@ WXDWORD wxDatePickerCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const // TODO: handle WM_WININICHANGE +#if wxUSE_INTL + wxLocaleInfo wxDatePickerCtrl::MSWGetFormat() const { return wxLOCALE_SHORT_DATE_FMT; } +#endif // wxUSE_INTL + // ---------------------------------------------------------------------------- // wxDatePickerCtrl operations // ---------------------------------------------------------------------------- diff --git a/src/msw/datetimectrl.cpp b/src/msw/datetimectrl.cpp index c9b4449686..408feab3eb 100644 --- a/src/msw/datetimectrl.cpp +++ b/src/msw/datetimectrl.cpp @@ -110,8 +110,12 @@ wxSize wxDateTimePickerCtrl::DoGetBestSize() const { wxClientDC dc(const_cast(this)); - // Use the same native format as this as the underlying native control. + // Use the same native format as the underlying native control. +#if wxUSE_INTL wxString s = wxDateTime::Now().Format(wxLocale::GetInfo(MSWGetFormat())); +#else // !wxUSE_INTL + wxString s("XXX-YYY-ZZZZ"); +#endif // wxUSE_INTL/!wxUSE_INTL // the best size for the control is bigger than just the string // representation of the current value because the control must accommodate diff --git a/src/msw/timectrl.cpp b/src/msw/timectrl.cpp index e87e1e0a6b..1a39cb4cdf 100644 --- a/src/msw/timectrl.cpp +++ b/src/msw/timectrl.cpp @@ -45,11 +45,15 @@ WXDWORD wxTimePickerCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const return styleMSW; } +#if wxUSE_INTL + wxLocaleInfo wxTimePickerCtrl::MSWGetFormat() const { return wxLOCALE_TIME_FMT; } +#endif // wxUSE_INTL + bool wxTimePickerCtrl::MSWOnDateTimeChange(const NMDATETIMECHANGE& dtch) { m_date.SetFromMSWSysTime(dtch.st);