Merge improvements to wxGenericCalendarCtrl mouse handling
Closes https://github.com/wxWidgets/wxWidgets/pull/143
This commit is contained in:
@@ -1325,13 +1325,26 @@ bool wxGenericCalendarCtrl::GetDateCoord(const wxDateTime& date, int *day, int *
|
|||||||
|
|
||||||
void wxGenericCalendarCtrl::OnDClick(wxMouseEvent& event)
|
void wxGenericCalendarCtrl::OnDClick(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
if ( HitTest(event.GetPosition()) != wxCAL_HITTEST_DAY )
|
wxDateTime date;
|
||||||
|
switch ( HitTest(event.GetPosition(), &date) )
|
||||||
{
|
{
|
||||||
event.Skip();
|
case wxCAL_HITTEST_DAY:
|
||||||
}
|
GenerateEvent(wxEVT_CALENDAR_DOUBLECLICKED);
|
||||||
else
|
break;
|
||||||
{
|
|
||||||
GenerateEvent(wxEVT_CALENDAR_DOUBLECLICKED);
|
case wxCAL_HITTEST_DECMONTH:
|
||||||
|
case wxCAL_HITTEST_INCMONTH:
|
||||||
|
// Consecutive simple clicks result in a series of simple and
|
||||||
|
// double click events, so handle them in the same way.
|
||||||
|
SetDateAndNotify(date);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wxCAL_HITTEST_WEEK:
|
||||||
|
case wxCAL_HITTEST_HEADER:
|
||||||
|
case wxCAL_HITTEST_SURROUNDING_WEEK:
|
||||||
|
case wxCAL_HITTEST_NOWHERE:
|
||||||
|
event.Skip();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1353,14 +1366,14 @@ void wxGenericCalendarCtrl::OnClick(wxMouseEvent& event)
|
|||||||
// GenerateAllChangeEvents() here, we know which event to send
|
// GenerateAllChangeEvents() here, we know which event to send
|
||||||
GenerateEvent(wxEVT_CALENDAR_DAY_CHANGED);
|
GenerateEvent(wxEVT_CALENDAR_DAY_CHANGED);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxCAL_HITTEST_WEEK:
|
case wxCAL_HITTEST_WEEK:
|
||||||
{
|
{
|
||||||
wxCalendarEvent send( this, date, wxEVT_CALENDAR_WEEK_CLICKED );
|
wxCalendarEvent send( this, date, wxEVT_CALENDAR_WEEK_CLICKED );
|
||||||
HandleWindowEvent( send );
|
HandleWindowEvent( send );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxCAL_HITTEST_HEADER:
|
case wxCAL_HITTEST_HEADER:
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user