Don't use items without values in generic wxDVC
In particular, don't draw them, as this would reuse the value of the previously drawn item, which would be wrong -- just leave them blank if PrepareForItem() returned false, which happens if GetValue() returned a null value or a value of a wrong type.
This commit is contained in:
@@ -2463,14 +2463,15 @@ wxBitmap wxDataViewMainWindow::CreateItemBitmap( unsigned int row, int &indent )
|
||||
width -= indent;
|
||||
|
||||
wxDataViewItem item = GetItemByRow( row );
|
||||
cell->PrepareForItem(model, item, column->GetModelColumn());
|
||||
|
||||
if ( cell->PrepareForItem(model, item, column->GetModelColumn()) )
|
||||
{
|
||||
wxRect item_rect(x, 0, width, height);
|
||||
item_rect.Deflate(PADDING_RIGHTLEFT, 0);
|
||||
|
||||
// dc.SetClippingRegion( item_rect );
|
||||
cell->WXCallRender(item_rect, &dc, 0);
|
||||
// dc.DestroyClippingRegion();
|
||||
}
|
||||
|
||||
x += width;
|
||||
}
|
||||
@@ -2836,7 +2837,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
|
||||
cell->SetState(state);
|
||||
if (hasValue)
|
||||
cell->PrepareForItem(model, dataitem, col->GetModelColumn());
|
||||
hasValue = cell->PrepareForItem(model, dataitem, col->GetModelColumn());
|
||||
|
||||
// draw the background
|
||||
if ( !selected )
|
||||
@@ -3789,8 +3790,7 @@ int wxDataViewMainWindow::QueryAndCacheLineHeight(unsigned int row, wxDataViewIt
|
||||
|
||||
wxDataViewRenderer *renderer =
|
||||
const_cast<wxDataViewRenderer*>(column->GetRenderer());
|
||||
renderer->PrepareForItem(model, item, column->GetModelColumn());
|
||||
|
||||
if ( renderer->PrepareForItem(model, item, column->GetModelColumn()) )
|
||||
height = wxMax(height, renderer->GetSize().y);
|
||||
}
|
||||
|
||||
@@ -5998,7 +5998,7 @@ public:
|
||||
|
||||
if ( m_model->HasValue(item, GetColumn()) )
|
||||
{
|
||||
m_renderer->PrepareForItem(m_model, item, GetColumn());
|
||||
if ( m_renderer->PrepareForItem(m_model, item, GetColumn()) )
|
||||
width += m_renderer->GetSize().x;
|
||||
}
|
||||
|
||||
@@ -6747,7 +6747,9 @@ wxAccStatus wxDataViewCtrlAccessible::GetName(int childId, wxString* name)
|
||||
continue; // Skip non-textual items
|
||||
|
||||
wxDataViewRenderer* r = dvCol->GetRenderer();
|
||||
r->PrepareForItem(model, item, dvCol->GetModelColumn());
|
||||
if ( !r->PrepareForItem(model, item, dvCol->GetModelColumn()) )
|
||||
continue;
|
||||
|
||||
wxString vs = r->GetAccessibleDescription();
|
||||
if ( !vs.empty() )
|
||||
{
|
||||
@@ -6905,7 +6907,9 @@ wxAccStatus wxDataViewCtrlAccessible::GetDescription(int childId, wxString* desc
|
||||
model->GetValue(value, item, dvCol->GetModelColumn());
|
||||
|
||||
wxDataViewRenderer* r = dvCol->GetRenderer();
|
||||
r->PrepareForItem(model, item, dvCol->GetModelColumn());
|
||||
if ( !r->PrepareForItem(model, item, dvCol->GetModelColumn()) )
|
||||
continue;
|
||||
|
||||
wxString valStr = r->GetAccessibleDescription();
|
||||
// Skip first textual item
|
||||
if ( !firstTextSkipped && !value.IsNull() && !value.IsType(wxS("bool")) && !valStr.empty() )
|
||||
|
||||
Reference in New Issue
Block a user