X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/82df62ef8e55adf38221afc82439edeed4fe3368..d94de683a60b20153591cc3f8f52a97cf9ce9453:/src/generic/datectlg.cpp diff --git a/src/generic/datectlg.cpp b/src/generic/datectlg.cpp index 9c6bd88b3a..6527a991b6 100644 --- a/src/generic/datectlg.cpp +++ b/src/generic/datectlg.cpp @@ -113,7 +113,7 @@ public: wxPoint yearPosition = yearControl->GetPosition(); - SetFormat(wxT("%x")); + SetFormat("%x"); width = yearPosition.x + yearSize.x+2+CALBORDER/2; if (width < calSize.x-4) @@ -181,7 +181,7 @@ public: if ( !s.empty() ) { - pDt->ParseFormat(s, m_format); + pDt->ParseFormat(s.c_str(), m_format); if ( !pDt->IsValid() ) return false; } @@ -199,10 +199,10 @@ public: cev.SetEventObject(datePicker); cev.SetId(datePicker->GetId()); cev.SetDate(dt); - GetParent()->ProcessEvent(cev); + datePicker->GetEventHandler()->ProcessEvent(cev); wxDateEvent event(datePicker, dt, wxEVT_DATE_CHANGED); - datePicker->GetParent()->ProcessEvent(event); + datePicker->GetEventHandler()->ProcessEvent(event); } private: @@ -259,7 +259,7 @@ private: return m_combo->GetParent()->HasFlag(flag); } - bool SetFormat(const wxChar *fmt) + bool SetFormat(const wxString& fmt) { m_format.clear(); @@ -370,6 +370,7 @@ END_EVENT_TABLE() BEGIN_EVENT_TABLE(wxDatePickerCtrlGeneric, wxDatePickerCtrlBase) EVT_TEXT(wxID_ANY, wxDatePickerCtrlGeneric::OnText) EVT_SIZE(wxDatePickerCtrlGeneric::OnSize) + EVT_SET_FOCUS(wxDatePickerCtrlGeneric::OnFocus) END_EVENT_TABLE() #ifndef wxHAS_NATIVE_DATEPICKCTRL @@ -404,6 +405,8 @@ bool wxDatePickerCtrlGeneric::Create(wxWindow *parent, m_combo = new wxComboCtrl(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize); + m_combo->SetCtrlMainWnd(this); + m_popup = new wxCalendarComboPopup(); #if defined(__WXMSW__) @@ -416,7 +419,7 @@ bool wxDatePickerCtrlGeneric::Create(wxWindow *parent, m_popup->SetDateValue(date.IsValid() ? date : wxDateTime::Today()); - SetBestFittingSize(size); + SetInitialSize(size); return true; } @@ -512,7 +515,7 @@ void wxDatePickerCtrlGeneric::OnText(wxCommandEvent &ev) { ev.SetEventObject(this); ev.SetId(GetId()); - GetParent()->ProcessEvent(ev); + GetParent()->GetEventHandler()->ProcessEvent(ev); // We'll create an additional event if the date is valid. // If the date isn't valid, the user's probably in the middle of typing @@ -524,6 +527,12 @@ void wxDatePickerCtrlGeneric::OnText(wxCommandEvent &ev) } +void wxDatePickerCtrlGeneric::OnFocus(wxFocusEvent& WXUNUSED(event)) +{ + m_combo->SetFocus(); +} + + #endif // wxUSE_DATEPICKCTRL_GENERIC #endif // wxUSE_DATEPICKCTRL