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;
|
width -= indent;
|
||||||
|
|
||||||
wxDataViewItem item = GetItemByRow( row );
|
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);
|
||||||
|
|
||||||
wxRect item_rect(x, 0, width, height);
|
// dc.SetClippingRegion( item_rect );
|
||||||
item_rect.Deflate(PADDING_RIGHTLEFT, 0);
|
cell->WXCallRender(item_rect, &dc, 0);
|
||||||
|
// dc.DestroyClippingRegion();
|
||||||
// dc.SetClippingRegion( item_rect );
|
}
|
||||||
cell->WXCallRender(item_rect, &dc, 0);
|
|
||||||
// dc.DestroyClippingRegion();
|
|
||||||
|
|
||||||
x += width;
|
x += width;
|
||||||
}
|
}
|
||||||
@@ -2836,7 +2837,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
|
|
||||||
cell->SetState(state);
|
cell->SetState(state);
|
||||||
if (hasValue)
|
if (hasValue)
|
||||||
cell->PrepareForItem(model, dataitem, col->GetModelColumn());
|
hasValue = cell->PrepareForItem(model, dataitem, col->GetModelColumn());
|
||||||
|
|
||||||
// draw the background
|
// draw the background
|
||||||
if ( !selected )
|
if ( !selected )
|
||||||
@@ -3789,9 +3790,8 @@ int wxDataViewMainWindow::QueryAndCacheLineHeight(unsigned int row, wxDataViewIt
|
|||||||
|
|
||||||
wxDataViewRenderer *renderer =
|
wxDataViewRenderer *renderer =
|
||||||
const_cast<wxDataViewRenderer*>(column->GetRenderer());
|
const_cast<wxDataViewRenderer*>(column->GetRenderer());
|
||||||
renderer->PrepareForItem(model, item, column->GetModelColumn());
|
if ( renderer->PrepareForItem(model, item, column->GetModelColumn()) )
|
||||||
|
height = wxMax(height, renderer->GetSize().y);
|
||||||
height = wxMax(height, renderer->GetSize().y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ... and store the height in the cache
|
// ... and store the height in the cache
|
||||||
@@ -5998,8 +5998,8 @@ public:
|
|||||||
|
|
||||||
if ( m_model->HasValue(item, GetColumn()) )
|
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;
|
width += m_renderer->GetSize().x;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateWithWidth(width);
|
UpdateWithWidth(width);
|
||||||
@@ -6747,7 +6747,9 @@ wxAccStatus wxDataViewCtrlAccessible::GetName(int childId, wxString* name)
|
|||||||
continue; // Skip non-textual items
|
continue; // Skip non-textual items
|
||||||
|
|
||||||
wxDataViewRenderer* r = dvCol->GetRenderer();
|
wxDataViewRenderer* r = dvCol->GetRenderer();
|
||||||
r->PrepareForItem(model, item, dvCol->GetModelColumn());
|
if ( !r->PrepareForItem(model, item, dvCol->GetModelColumn()) )
|
||||||
|
continue;
|
||||||
|
|
||||||
wxString vs = r->GetAccessibleDescription();
|
wxString vs = r->GetAccessibleDescription();
|
||||||
if ( !vs.empty() )
|
if ( !vs.empty() )
|
||||||
{
|
{
|
||||||
@@ -6905,7 +6907,9 @@ wxAccStatus wxDataViewCtrlAccessible::GetDescription(int childId, wxString* desc
|
|||||||
model->GetValue(value, item, dvCol->GetModelColumn());
|
model->GetValue(value, item, dvCol->GetModelColumn());
|
||||||
|
|
||||||
wxDataViewRenderer* r = dvCol->GetRenderer();
|
wxDataViewRenderer* r = dvCol->GetRenderer();
|
||||||
r->PrepareForItem(model, item, dvCol->GetModelColumn());
|
if ( !r->PrepareForItem(model, item, dvCol->GetModelColumn()) )
|
||||||
|
continue;
|
||||||
|
|
||||||
wxString valStr = r->GetAccessibleDescription();
|
wxString valStr = r->GetAccessibleDescription();
|
||||||
// Skip first textual item
|
// Skip first textual item
|
||||||
if ( !firstTextSkipped && !value.IsNull() && !value.IsType(wxS("bool")) && !valStr.empty() )
|
if ( !firstTextSkipped && !value.IsNull() && !value.IsType(wxS("bool")) && !valStr.empty() )
|
||||||
|
|||||||
Reference in New Issue
Block a user