]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/datavgen.cpp
Use wxPENSTYLE_XXX and wxBRUSHSTYLE_XXX instead of wxXXX constants.
[wxWidgets.git] / src / generic / datavgen.cpp
index eb1b741996128be3c7438bb99690102319363533..cf63855f78d56b55ca2c68923c2a608620ce4362 100644 (file)
@@ -863,12 +863,16 @@ bool wxDataViewToggleRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state
     return true;
 }
 
-bool wxDataViewToggleRenderer::WXOnLeftClick(wxPoint WXUNUSED(cursor),
-                                             wxRect WXUNUSED(cell),
+bool wxDataViewToggleRenderer::WXOnLeftClick(const wxPoint& cursor,
+                                             const wxRect& WXUNUSED(cell),
                                              wxDataViewModel *model,
                                              const wxDataViewItem& item,
                                              unsigned int col)
 {
+    // only react to clicks directly on the checkbox, not elsewhere in the same cell:
+    if (!wxRect(GetSize()).Contains(cursor))
+        return false;
+
     if (model->IsEnabled(item, col))
     {
         model->ChangeValue(!m_toggle, item, col);
@@ -1027,7 +1031,7 @@ wxSize wxDataViewDateRenderer::GetSize() const
     return GetTextExtent(m_date.FormatDate());
 }
 
-bool wxDataViewDateRenderer::WXOnActivate(wxRect WXUNUSED(cell),
+bool wxDataViewDateRenderer::WXOnActivate(const wxRect& WXUNUSED(cell),
                                           wxDataViewModel *model,
                                           const wxDataViewItem& item,
                                           unsigned int col)
@@ -1606,10 +1610,11 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
         wxMin( (int)(  GetLineAt( wxMax(0,update.y+update.height) ) - item_start + 1),
             (int)(GetRowCount( ) - item_start));
     unsigned int item_last = item_start + item_count;
-    // Get the parent of DataViewCtrl
-    wxWindow *parent = GetParent()->GetParent();
+
+    // Send the event to wxDataViewCtrl itself.
+    wxWindow * const parent = GetParent();
     wxDataViewEvent cache_event(wxEVT_COMMAND_DATAVIEW_CACHE_HINT, parent->GetId());
-    cache_event.SetEventObject(GetParent());
+    cache_event.SetEventObject(parent);
     cache_event.SetCache(item_start, item_last - 1);
     parent->ProcessWindowEvent(cache_event);