| 15 | using wxDataViewCustomRenderer::wxDataViewCustomRenderer; |
| 16 | |
| 17 | bool ActivateCell(const wxRect& cell, |
| 18 | wxDataViewModel* model, |
| 19 | const wxDataViewItem& item, |
| 20 | unsigned col, |
| 21 | const wxMouseEvent* mouseEvent) final |
| 22 | { |
| 23 | if(mouseEvent == nullptr) |
| 24 | { |
| 25 | wxCHECK(GetView(), false); |
| 26 | |
| 27 | wxVariant value; |
| 28 | model->GetValue(value, item, PluginDataModel::ColumnState); |
| 29 | value = !value.GetBool(); |
| 30 | |
| 31 | wxDataViewItemArray sel; |
| 32 | GetView()->GetSelections(sel); |
| 33 | if(!sel.empty()) |
| 34 | { |
| 35 | for(const auto& other : sel) |
| 36 | model->ChangeValue(value, other, PluginDataModel::ColumnState); |
| 37 | } |
| 38 | else |
| 39 | model->ChangeValue(value, item, PluginDataModel::ColumnState); |
| 40 | |
| 41 | #if wxUSE_ACCESSIBILITY |
| 42 | if(const auto ctrl = dynamic_cast<PluginDataViewCtrl*>(GetView())) |
| 43 | { |
| 44 | wxAccessible::NotifyEvent( |
| 45 | wxACC_EVENT_OBJECT_NAMECHANGE, |
| 46 | ctrl, |
| 47 | wxOBJID_CLIENT, |
| 48 | ctrl->GetRowByItem(item) + 1); |
| 49 | } |
| 50 | #endif |
| 51 | return true; |
| 52 | } |
| 53 | return OnCellClicked(cell, model, item, col, mouseEvent); |
| 54 | } |
| 55 | |
| 56 | protected: |
| 57 | virtual bool OnCellClicked(const wxRect& cell, |
nothing calls this directly
no test coverage detected