]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/private/datecontrols.h
initial native implementation of wxCalendarCtrl for MSW
[wxWidgets.git] / include / wx / msw / private / datecontrols.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/private/datecontrols.h
3 // Purpose: implementation helpers for wxDatePickerCtrl and wxCalendarCtrl
4 // Author: Vadim Zeitlin
5 // Created: 2008-04-04
6 // RCS-ID: $Id$
7 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _MSW_PRIVATE_DATECONTROLS_H_
12 #define _MSW_PRIVATE_DATECONTROLS_H_
13
14 // namespace for the helper functions related to the date controls
15 namespace wxMSWDateControls
16 {
17
18 // do the one time only initialization of date classes of comctl32.dll, return
19 // true if ok or log an error and return false if we failed (this can only
20 // happen with a very old version of common controls DLL, i.e. before 4.70)
21 extern bool CheckInitialization();
22
23 // convert SYSTEMTIME to wxDateTime
24 inline void FromSystemTime(wxDateTime *dt, const SYSTEMTIME& st)
25 {
26 dt->Set(st.wDay,
27 wx_static_cast(wxDateTime::Month, wxDateTime::Jan + st.wMonth - 1),
28 st.wYear,
29 0, 0, 0);
30 }
31
32 // convert wxDateTime to SYSTEMTIME
33 inline void ToSystemTime(SYSTEMTIME *st, const wxDateTime& dt)
34 {
35 const wxDateTime::Tm tm(dt.GetTm());
36
37 st->wYear = (WXWORD)tm.year;
38 st->wMonth = (WXWORD)(tm.mon - wxDateTime::Jan + 1);
39 st->wDay = tm.mday;
40
41 st->wDayOfWeek =
42 st->wHour =
43 st->wMinute =
44 st->wSecond =
45 st->wMilliseconds = 0;
46 }
47
48 } // namespace wxMSWDateControls
49
50 #endif // _MSW_PRIVATE_DATECONTROLS_H_
51