| 1 |
#include "date_picker_ctrl.h" |
| 2 |
#include "allocator_mgr.h" |
| 3 |
#include "wxgui_defs.h" |
| 4 |
#include <wx/datectrl.h> |
| 5 |
|
| 6 |
DatePickerCtrl::DatePickerCtrl() |
| 7 |
: wxcWidget(ID_WXDATEPICKER) |
| 8 |
{ |
| 9 |
PREPEND_STYLE_FALSE(wxDP_SPIN); |
| 10 |
PREPEND_STYLE_FALSE(wxDP_DROPDOWN); |
| 11 |
PREPEND_STYLE_TRUE(wxDP_DEFAULT); |
| 12 |
PREPEND_STYLE_FALSE(wxDP_ALLOWNONE); |
| 13 |
PREPEND_STYLE_FALSE(wxDP_SHOWCENTURY); |
| 14 |
|
| 15 |
RegisterEvent(wxT("wxEVT_DATE_CHANGED"), wxT("wxDateEvent"), |
| 16 |
_("This event fires when the user changes the current selection in the control.")); |
| 17 |
m_namePattern = wxT("m_datePicker"); |
| 18 |
SetName(GenerateName()); |
| 19 |
} |
| 20 |
|
| 21 |
DatePickerCtrl::~DatePickerCtrl() {} |
| 22 |
|
| 23 |
wxcWidget* DatePickerCtrl::Clone() const { return new DatePickerCtrl(); } |
| 24 |
|
| 25 |
wxString DatePickerCtrl::CppCtorCode() const |
| 26 |
{ |
| 27 |
// wxDatePickerCtrl(wxWindow *parent, wxWindowID id, const wxDateTime& dt = wxDefaultDateTime, const wxPoint& pos = |
| 28 |
// wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const |
| 29 |
// wxValidator& validator = wxDefaultValidator, const wxString& name = "datectrl") |
| 30 |
wxString cpp; |
| 31 |
cpp << GetName() << wxT(" = new ") << GetRealClassName() << wxT("(") << GetWindowParent() << wxT(", ") << WindowID() |
| 32 |
<< wxT(", ") << wxT("wxDefaultDateTime, ") << wxT("wxDefaultPosition, ") << SizeAsString() << wxT(", ") |
| 33 |
<< StyleFlags(wxT("wxDP_DEFAULT | wxDP_SHOWCENTURY")) << wxT(");\n"); |
| 34 |
|
| 35 |
cpp << CPPCommonAttributes(); |
| 36 |
return cpp; |
| 37 |
} |
| 38 |
|
| 39 |
void DatePickerCtrl::GetIncludeFile(wxArrayString& headers) const { headers.Add(wxT("#include <wx/datectrl.h>")); } |
| 40 |
|
| 41 |
wxString DatePickerCtrl::GetWxClassName() const { return wxT("wxDatePickerCtrl"); } |
| 42 |
|
| 43 |
void DatePickerCtrl::ToXRC(wxString& text, XRC_TYPE type) const |
| 44 |
{ |
| 45 |
text << XRCPrefix() << XRCStyle() << XRCSize() << XRCCommonAttributes() << XRCSuffix(); |
| 46 |
} |