- wxPanel *panel=new wxPanel(m_dlg, CTRLID_PAN, wxPoint(0, 0), wxDefaultSize, wxSUNKEN_BORDER|wxCLIP_CHILDREN);
- m_cal = new wxCalendarCtrl(panel, CTRLID_CAL, wxDefaultDateTime, wxPoint(0,0), wxDefaultSize, wxSUNKEN_BORDER);
- m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_SEL_CHANGED, (wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange, 0, this);
- m_cal->Connect(wxID_ANY, wxID_ANY, wxEVT_KEY_DOWN, (wxObjectEventFunction)&wxDatePickerCtrl::OnCalKey, 0, this);
- m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_DOUBLECLICKED, (wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange, 0, this);
- m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_DAY_CHANGED, (wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange, 0, this);
- m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_MONTH_CHANGED, (wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange, 0, this);
- m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_YEAR_CHANGED, (wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange, 0, this);
+ void ShowAt(int x, int y)
+ {
+ Show();
+ Move(x, y);
+ }
+
+ void Hide()
+ {
+ wxDialog::Hide();
+ }
+};
+
+#endif // wxUSE_POPUPWIN/!wxUSE_POPUPWIN
+
+// ============================================================================
+// wxDatePickerCtrlGeneric implementation
+// ============================================================================
+
+BEGIN_EVENT_TABLE(wxDatePickerCtrlGeneric, wxDatePickerCtrlBase)
+ EVT_BUTTON(CTRLID_BTN, wxDatePickerCtrlGeneric::OnClick)
+ EVT_TEXT(CTRLID_TXT, wxDatePickerCtrlGeneric::OnText)
+ EVT_CHILD_FOCUS(wxDatePickerCtrlGeneric::OnChildSetFocus)
+ EVT_SIZE(wxDatePickerCtrlGeneric::OnSize)
+END_EVENT_TABLE()
+
+#ifndef wxHAS_NATIVE_DATEPICKCTRL
+ IMPLEMENT_DYNAMIC_CLASS(wxDatePickerCtrl, wxControl)
+#endif
+
+// ----------------------------------------------------------------------------
+// creation
+// ----------------------------------------------------------------------------
+
+bool wxDatePickerCtrlGeneric::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxDateTime& date,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
+{
+ wxASSERT_MSG( !(style & wxDP_SPIN),
+ _T("wxDP_SPIN style not supported, use wxDP_DEFAULT") );
+
+ if ( !wxControl::Create(parent, id, pos, size,
+ style | wxCLIP_CHILDREN | wxWANTS_CHARS,
+ validator, name) )
+
+ {
+ return false;
+ }
+
+ InheritAttributes();
+
+ m_txt = new wxTextCtrl(this, CTRLID_TXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, TXTCTRL_FLAGS);
+
+ m_txt->Connect(wxEVT_KEY_DOWN,
+ wxKeyEventHandler(wxDatePickerCtrlGeneric::OnEditKey),
+ NULL, this);
+ m_txt->Connect(wxEVT_KILL_FOCUS,
+ wxFocusEventHandler(wxDatePickerCtrlGeneric::OnKillFocus),
+ NULL, this);
+
+ m_btn = new wxDropdownButton(this, CTRLID_BTN, wxDefaultPosition, wxDefaultSize, wxBU_COMBO);
+
+ m_popup = new wxDatePopupInternal(this);
+ m_popup->SetFont(GetFont());
+
+ wxPanel *panel=new wxPanel(m_popup, CTRLID_PAN,
+ wxPoint(0, 0), wxDefaultSize,
+ wxSUNKEN_BORDER);
+ m_cal = new wxCalendarCtrl(panel, CTRLID_CAL, wxDefaultDateTime,
+ wxPoint(0, 0), wxDefaultSize,
+ wxCAL_SHOW_HOLIDAYS | wxSUNKEN_BORDER);
+ m_cal->Connect(wxEVT_CALENDAR_SEL_CHANGED,
+ wxCalendarEventHandler(wxDatePickerCtrlGeneric::OnSelChange),
+ NULL, this);
+ m_cal->Connect(wxEVT_KEY_DOWN,
+ wxKeyEventHandler(wxDatePickerCtrlGeneric::OnCalKey),
+ NULL, this);
+ m_cal->Connect(wxEVT_CALENDAR_DOUBLECLICKED,
+ wxCalendarEventHandler(wxDatePickerCtrlGeneric::OnSelChange),
+ NULL, this);
+ m_cal->Connect(wxEVT_CALENDAR_DAY_CHANGED,
+ wxCalendarEventHandler(wxDatePickerCtrlGeneric::OnSelChange),
+ NULL, this);
+ m_cal->Connect(wxEVT_CALENDAR_MONTH_CHANGED,
+ wxCalendarEventHandler(wxDatePickerCtrlGeneric::OnSelChange),
+ NULL, this);
+ m_cal->Connect(wxEVT_CALENDAR_YEAR_CHANGED,
+ wxCalendarEventHandler(wxDatePickerCtrlGeneric::OnSelChange),
+ NULL, this);