X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dbc3aec19a3af16ad50453f325b9d83d8cf9d9c0..54580df4e2faf875a73b59913b618731cb582b67:/src/generic/datavgen.cpp diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index ef97bb925d..b2b2c6374d 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -732,7 +732,7 @@ bool wxDataViewTextRenderer::HasEditorCtrl() const return true; } -wxControl* wxDataViewTextRenderer::CreateEditorCtrl( wxWindow *parent, +wxWindow* wxDataViewTextRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) { wxTextCtrl* ctrl = new wxTextCtrl( parent, wxID_ANY, value, @@ -746,7 +746,7 @@ wxControl* wxDataViewTextRenderer::CreateEditorCtrl( wxWindow *parent, return ctrl; } -bool wxDataViewTextRenderer::GetValueFromEditorCtrl( wxControl *editor, wxVariant &value ) +bool wxDataViewTextRenderer::GetValueFromEditorCtrl( wxWindow *editor, wxVariant &value ) { wxTextCtrl *text = (wxTextCtrl*) editor; value = text->GetValue(); @@ -863,11 +863,16 @@ bool wxDataViewToggleRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state return true; } -bool wxDataViewToggleRenderer::WXOnActivate(wxRect WXUNUSED(cell), - wxDataViewModel *model, - const wxDataViewItem& item, - unsigned int col) +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); @@ -1026,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) @@ -1101,7 +1106,7 @@ wxSize wxDataViewIconTextRenderer::GetSize() const return wxSize(80,20); } -wxControl* wxDataViewIconTextRenderer::CreateEditorCtrl(wxWindow *parent, wxRect labelRect, const wxVariant& value) +wxWindow* wxDataViewIconTextRenderer::CreateEditorCtrl(wxWindow *parent, wxRect labelRect, const wxVariant& value) { wxDataViewIconText iconText; iconText << value; @@ -1127,7 +1132,7 @@ wxControl* wxDataViewIconTextRenderer::CreateEditorCtrl(wxWindow *parent, wxRect return ctrl; } -bool wxDataViewIconTextRenderer::GetValueFromEditorCtrl( wxControl *editor, wxVariant& value ) +bool wxDataViewIconTextRenderer::GetValueFromEditorCtrl( wxWindow *editor, wxVariant& value ) { wxTextCtrl *text = (wxTextCtrl*) editor; @@ -1605,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);