| 1 |
#include "calendar_ctrl_wrapper.h" |
| 2 |
#include "allocator_mgr.h" |
| 3 |
#include "wxgui_defs.h" |
| 4 |
#include <wx/calctrl.h> |
| 5 |
|
| 6 |
CalendarCtrlWrapper::CalendarCtrlWrapper() |
| 7 |
: wxcWidget(ID_WXCALEDARCTRL) |
| 8 |
{ |
| 9 |
PREPEND_STYLE_FALSE(wxCAL_SUNDAY_FIRST); |
| 10 |
PREPEND_STYLE_FALSE(wxCAL_MONDAY_FIRST); |
| 11 |
PREPEND_STYLE_TRUE(wxCAL_SHOW_HOLIDAYS); |
| 12 |
PREPEND_STYLE_FALSE(wxCAL_NO_YEAR_CHANGE); |
| 13 |
PREPEND_STYLE_FALSE(wxCAL_NO_MONTH_CHANGE); |
| 14 |
PREPEND_STYLE_FALSE(wxCAL_SHOW_SURROUNDING_WEEKS); |
| 15 |
PREPEND_STYLE_FALSE(wxCAL_SEQUENTIAL_MONTH_SELECTION); |
| 16 |
|
| 17 |
RegisterEvent(wxT("wxEVT_CALENDAR_DOUBLECLICKED"), wxT("wxCalendarEvent"), |
| 18 |
_("A day was double clicked in the calendar.")); |
| 19 |
RegisterEvent(wxT("wxEVT_CALENDAR_DAY_CHANGED"), wxT("wxCalendarEvent"), _("The selected day changed.")); |
| 20 |
RegisterEvent(wxT("wxEVT_CALENDAR_MONTH_CHANGED"), wxT("wxCalendarEvent"), _("The selected month changed.")); |
| 21 |
RegisterEvent(wxT("wxEVT_CALENDAR_SEL_CHANGED"), wxT("wxCalendarEvent"), _("The selected date changed.")); |
| 22 |
RegisterEvent(wxT("wxEVT_CALENDAR_WEEKDAY_CLICKED"), wxT("wxCalendarEvent"), |
| 23 |
_("User clicked on the week day header")); |
| 24 |
RegisterEvent(wxT("wxEVT_CALENDAR_YEAR_CHANGED"), wxT("wxCalendarEvent"), _("The selected year changed.")); |
| 25 |
|
| 26 |
SetPropertyString(_("Common Settings"), "wxCalendarCtrl"); |
| 27 |
m_namePattern = wxT("m_calendar"); |
| 28 |
SetName(GenerateName()); |
| 29 |
} |
| 30 |
|
| 31 |
CalendarCtrlWrapper::~CalendarCtrlWrapper() {} |
| 32 |
|
| 33 |
wxcWidget* CalendarCtrlWrapper::Clone() const { return new CalendarCtrlWrapper(); } |
| 34 |
|
| 35 |
wxString CalendarCtrlWrapper::CppCtorCode() const |
| 36 |
{ |
| 37 |
// wxCalendarCtrl(wxWindow* parent, wxWindowID id, const wxDateTime& date = wxDefaultDateTime, const wxPoint& pos = |
| 38 |
// wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAL_SHOW_HOLIDAYS, const wxString& name = |
| 39 |
// wxCalendarNameStr) |
| 40 |
wxString cpp; |
| 41 |
cpp << GetName() << wxT(" = new ") << GetRealClassName() << wxT("(") << GetWindowParent() << wxT(", ") << WindowID() |
| 42 |
<< wxT(", ") << wxT("wxDefaultDateTime, ") << wxT("wxDefaultPosition, ") << SizeAsString() << wxT(", ") |
| 43 |
<< StyleFlags(wxT("wxCAL_SHOW_HOLIDAYS")) << wxT(");\n"); |
| 44 |
|
| 45 |
cpp << CPPCommonAttributes(); |
| 46 |
return cpp; |
| 47 |
} |
| 48 |
|
| 49 |
void CalendarCtrlWrapper::GetIncludeFile(wxArrayString& headers) const { headers.Add(wxT("#include <wx/calctrl.h>")); } |
| 50 |
|
| 51 |
wxString CalendarCtrlWrapper::GetWxClassName() const { return wxT("wxCalendarCtrl"); } |
| 52 |
|
| 53 |
void CalendarCtrlWrapper::ToXRC(wxString& text, XRC_TYPE type) const |
| 54 |
{ |
| 55 |
text << XRCPrefix() << XRCStyle() << XRCSize() << XRCCommonAttributes() << XRCSuffix(); |
| 56 |
} |