]> git.saurik.com Git - wxWidgets.git/commitdiff
Send wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED if WXOnActivate() returned false too.
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 29 Aug 2011 17:25:38 +0000 (17:25 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 29 Aug 2011 17:25:38 +0000 (17:25 +0000)
This is consistent with wxGTK implementation and generally makes sense:
when the renderer cannot handle activation, whole-item activation should
be tried next.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68954 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/datavgen.cpp

index 07415d15f60ef9825d03d236928f3f8e908f7d71..f4f3b1f80bb48fe6e40491382b4d6ec3e9914013 100644 (file)
@@ -3339,6 +3339,8 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event )
                     }
                 }
 
+                bool activated = false;
+
                 if ( activatableCol )
                 {
                     const unsigned colIdx = activatableCol->GetModelColumn();
@@ -3346,9 +3348,10 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event )
 
                     wxDataViewRenderer *cell = activatableCol->GetRenderer();
                     cell->PrepareForItem(GetModel(), item, colIdx);
-                    cell->WXOnActivate(cell_rect, GetModel(), item, colIdx);
+                    activated = cell->WXOnActivate(cell_rect, GetModel(), item, colIdx);
                 }
-                else
+
+                if ( !activated )
                 {
                     wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED,
                                        parent->GetId());
@@ -3642,6 +3645,8 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
         }
         else if ( current == m_lineLastClicked )
         {
+            bool activated = false;
+
             if ((!ignore_other_columns) && (cell->GetMode() == wxDATAVIEW_CELL_ACTIVATABLE))
             {
                 const unsigned colIdx = col->GetModelColumn();
@@ -3650,9 +3655,10 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
 
                 wxRect cell_rect( xpos, GetLineStart( current ),
                                 col->GetWidth(), GetLineHeight( current ) );
-                cell->WXOnActivate( cell_rect, model, item, colIdx );
+                activated = cell->WXOnActivate( cell_rect, model, item, colIdx );
             }
-            else
+
+            if ( !activated )
             {
                 wxWindow *parent = GetParent();
                 wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, parent->GetId());