bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item );
bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item );
bool ItemChanged( const wxDataViewItem &item );
- bool ValueChanged( const wxDataViewItem &item, unsigned int col );
+ bool ValueChanged( const wxDataViewItem &item, unsigned int model_column );
bool Cleared();
void Resort()
{
int flags = 0;
if (m_toggle)
flags |= wxCONTROL_CHECKED;
- if (GetMode() != wxDATAVIEW_CELL_ACTIVATABLE)
+ if (GetMode() != wxDATAVIEW_CELL_ACTIVATABLE ||
+ GetEnabled() == false)
flags |= wxCONTROL_DISABLED;
// check boxes we draw must always have the same, standard size (if it's
const wxDataViewItem & item,
unsigned int col)
{
- model->ChangeValue(!valueOld.GetBool(), item, col);
+ if (model->IsEnabled(item, col))
+ {
+ model->ChangeValue(!valueOld.GetBool(), item, col);
+ }
}
wxSize wxDataViewToggleRenderer::GetSize() const
return true;
}
-bool wxDataViewMainWindow::ValueChanged( const wxDataViewItem & item, unsigned int col )
+bool wxDataViewMainWindow::ValueChanged( const wxDataViewItem & item, unsigned int model_column )
{
- GetOwner()->InvalidateColBestWidth(col);
+ int view_column = -1;
+ unsigned int n_col = m_owner->GetColumnCount();
+ for (unsigned i = 0; i < n_col; i++)
+ {
+ wxDataViewColumn *column = m_owner->GetColumn( i );
+ if (column->GetModelColumn() == model_column)
+ {
+ view_column = (int) i;
+ break;
+ }
+ }
+ if (view_column == -1)
+ return false;
+
+ GetOwner()->InvalidateColBestWidth(view_column);
// NOTE: to be valid, we cannot use e.g. INT_MAX - 1
/*#define MAX_VIRTUAL_WIDTH 100000
le.SetEventObject(parent);
le.SetModel(GetOwner()->GetModel());
le.SetItem(item);
- le.SetColumn(col);
- le.SetDataViewColumn(GetOwner()->GetColumn(col));
+ le.SetColumn(view_column);
+ le.SetDataViewColumn(GetOwner()->GetColumn(view_column));
parent->GetEventHandler()->ProcessEvent(le);
return true;
void wxDataViewMainWindow::ScrollWindow( int dx, int dy, const wxRect *rect )
{
+ m_underMouse = NULL;
+
wxWindow::ScrollWindow( dx, dy, rect );
if (GetOwner()->m_headerArea)
void wxDataViewMainWindow::ScrollTo( int rows, int column )
{
+ m_underMouse = NULL;
+
int x, y;
m_owner->GetScrollPixelsPerUnit( &x, &y );
int sy = GetLineStart( rows )/y;
xpos += c->GetWidth();
}
if (!col)
+ {
+ event.Skip();
return;
+ }
wxDataViewRenderer *cell = col->GetRenderer();
unsigned int current = GetLineAt( y );
if ((current >= GetRowCount()) || (x > GetEndOfLastCol()))
{
// Unselect all if below the last row ?
+ event.Skip();
return;
}
wxRect itemRect = GetItemRect(item, col);
wxDataViewRenderer* renderer = col->GetRenderer();
- renderer->StartEditing(item, itemRect);
+ if (renderer->GetMode() == wxDATAVIEW_CELL_EDITABLE)
+ renderer->StartEditing(item, itemRect);
}
#endif // !wxUSE_GENERICDATAVIEWCTRL