]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/private/datecontrols.h
[ 1960295 ] wxWeakRef - Reorganization and comments
[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 #include "wx/datetime.h"
15
16 #include "wx/msw/wrapwin.h"
17
18 // namespace for the helper functions related to the date controls
19 namespace wxMSWDateControls
20 {
21
22 // do the one time only initialization of date classes of comctl32.dll, return
23 // true if ok or log an error and return false if we failed (this can only
24 // happen with a very old version of common controls DLL, i.e. before 4.70)
25 extern bool CheckInitialization();
26
27 // convert SYSTEMTIME to wxDateTime
28 inline void FromSystemTime(wxDateTime *dt, const SYSTEMTIME& st)
29 {
30 dt->Set(st.wDay,
31 wx_static_cast(wxDateTime::Month, wxDateTime::Jan + st.wMonth - 1),
32 st.wYear,
33 0, 0, 0);
34 }
35
36 // convert wxDateTime to SYSTEMTIME
37 inline void ToSystemTime(SYSTEMTIME *st, const wxDateTime& dt)
38 {
39 const wxDateTime::Tm tm(dt.GetTm());
40
41 st->wYear = (WXWORD)tm.year;
42 st->wMonth = (WXWORD)(tm.mon - wxDateTime::Jan + 1);
43 st->wDay = tm.mday;
44
45 st->wDayOfWeek =
46 st->wHour =
47 st->wMinute =
48 st->wSecond =
49 st->wMilliseconds = 0;
50 }
51
52 } // namespace wxMSWDateControls
53
54 #endif // _MSW_PRIVATE_DATECONTROLS_H_
55