]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_cald.cpp
XRC spec: relax requirements on some commonly omitted properties.
[wxWidgets.git] / src / xrc / xh_cald.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_cald.cpp
3 // Purpose: XRC resource for wxCalendarCtrl
4 // Author: Brian Gavin
5 // Created: 2000/09/09
6 // Copyright: (c) 2000 Brian Gavin
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #ifdef __BORLANDC__
14 #pragma hdrstop
15 #endif
16
17 #if wxUSE_XRC && wxUSE_CALENDARCTRL
18
19 #include "wx/xrc/xh_cald.h"
20
21 #ifndef WX_PRECOMP
22 #include "wx/event.h"
23 #endif //WX_PRECOMP
24
25 #include "wx/calctrl.h"
26
27 IMPLEMENT_DYNAMIC_CLASS(wxCalendarCtrlXmlHandler, wxXmlResourceHandler)
28
29 wxCalendarCtrlXmlHandler::wxCalendarCtrlXmlHandler()
30 : wxXmlResourceHandler()
31 {
32 XRC_ADD_STYLE(wxCAL_SUNDAY_FIRST);
33 XRC_ADD_STYLE(wxCAL_MONDAY_FIRST);
34 XRC_ADD_STYLE(wxCAL_SHOW_HOLIDAYS);
35 XRC_ADD_STYLE(wxCAL_NO_YEAR_CHANGE);
36 XRC_ADD_STYLE(wxCAL_NO_MONTH_CHANGE);
37 XRC_ADD_STYLE(wxCAL_SEQUENTIAL_MONTH_SELECTION);
38 XRC_ADD_STYLE(wxCAL_SHOW_SURROUNDING_WEEKS);
39
40 AddWindowStyles();
41 }
42
43
44 wxObject *wxCalendarCtrlXmlHandler::DoCreateResource()
45 {
46 XRC_MAKE_INSTANCE(calendar, wxCalendarCtrl);
47
48 calendar->Create(m_parentAsWindow,
49 GetID(),
50 wxDefaultDateTime,
51 /*TODO: take it from resource*/
52 GetPosition(), GetSize(),
53 GetStyle(),
54 GetName());
55
56 SetupWindow(calendar);
57
58 return calendar;
59 }
60
61 bool wxCalendarCtrlXmlHandler::CanHandle(wxXmlNode *node)
62 {
63 return IsOfClass(node, wxT("wxCalendarCtrl"));
64 }
65
66 #endif // wxUSE_XRC && wxUSE_CALENDARCTRL