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