Activate double-click processor only if wxPGComboBox editor is associated with wxBoolProperty.

Special handling of double-clicks (in wxPGDoubleClickProcessor) makes sense only for properties handling Boolean values (wxBoolProperty).
This commit is contained in:
Artur Wieczorek
2015-02-26 19:05:51 +01:00
parent fe7afd273d
commit b5e0a16dfd

View File

@@ -522,6 +522,9 @@ public:
wxPGDoubleClickProcessor( wxOwnerDrawnComboBox* combo, wxPGProperty* property ) wxPGDoubleClickProcessor( wxOwnerDrawnComboBox* combo, wxPGProperty* property )
: wxEvtHandler() : wxEvtHandler()
{ {
wxASSERT_MSG( wxDynamicCast(property, wxBoolProperty),
wxT("Double-click processor should be used only with wxBoolProperty") );
m_timeLastMouseUp = 0; m_timeLastMouseUp = 0;
m_combo = combo; m_combo = combo;
m_property = property; m_property = property;
@@ -536,7 +539,6 @@ protected:
int evtType = event.GetEventType(); int evtType = event.GetEventType();
if ( m_property->HasFlag(wxPG_PROP_USE_DCC) && if ( m_property->HasFlag(wxPG_PROP_USE_DCC) &&
wxDynamicCast(m_property, wxBoolProperty) &&
!m_combo->IsPopupShown() ) !m_combo->IsPopupShown() )
{ {
// Just check that it is in the text area // Just check that it is in the text area
@@ -640,10 +642,14 @@ public:
name ) ) name ) )
return false; return false;
m_dclickProcessor = new // Enabling double-click processor makes sense
wxPGDoubleClickProcessor( this, GetGrid()->GetSelection() ); // only for wxBoolProperty.
wxPGProperty* selProp = GetGrid()->GetSelection();
PushEventHandler(m_dclickProcessor); if (wxDynamicCast(selProp, wxBoolProperty))
{
m_dclickProcessor = new wxPGDoubleClickProcessor(this, selProp);
PushEventHandler(m_dclickProcessor);
}
return true; return true;
} }