- m_txt=new wxTextCtrl(this, CTRLID_TXT, txt);
- m_txt->Connect(wxID_ANY, wxID_ANY, wxEVT_KEY_DOWN, (wxObjectEventFunction)&wxDatePickerCtrl::OnEditKey, 0, this);
- m_txt->Connect(wxID_ANY, wxID_ANY, wxEVT_KILL_FOCUS, (wxObjectEventFunction)&wxDatePickerCtrl::OnKillFocus, 0, this);
- SetFormat(wxT("%x"));
-
- m_btn = new wxBitmapButton(this, CTRLID_BTN, bmp);
-
- m_dlg = new wxDialog(this, CTRLID_CAL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER);
- m_dlg->SetFont(GetFont());
-
- 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);
+ wxBitmapButton *btn = new wxBitmapButton(this, CTRLID_BTN, bmp);
+ btn->SetMargins(0, 0);
+ m_btn = btn;
+
+ m_popup = new wxPopupWindow(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(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_SEL_CHANGED,
+ (wxObjectEventFunction)
+ (wxEventFunction)
+ (wxCalendarEventFunction)
+ &wxDatePickerCtrlGeneric::OnSelChange,
+ 0, this);
+ m_cal->Connect(wxID_ANY, wxID_ANY, wxEVT_KEY_DOWN,
+ (wxObjectEventFunction)
+ (wxEventFunction)
+ (wxCharEventFunction)
+ &wxDatePickerCtrlGeneric::OnCalKey,
+ 0, this);
+ m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_DOUBLECLICKED,
+ (wxObjectEventFunction)
+ (wxEventFunction)
+ (wxCalendarEventFunction)
+ &wxDatePickerCtrlGeneric::OnSelChange,
+ 0, this);
+ m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_DAY_CHANGED,
+ (wxObjectEventFunction)
+ (wxEventFunction)
+ (wxCalendarEventFunction)
+ &wxDatePickerCtrlGeneric::OnSelChange,
+ 0, this);
+ m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_MONTH_CHANGED,
+ (wxObjectEventFunction)
+ (wxEventFunction)
+ (wxCalendarEventFunction)
+ &wxDatePickerCtrlGeneric::OnSelChange,
+ 0, this);
+ m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_YEAR_CHANGED,
+ (wxObjectEventFunction)
+ (wxEventFunction)
+ (wxCalendarEventFunction)
+ &wxDatePickerCtrlGeneric::OnSelChange,
+ 0, this);