Fix drawing expander column without values in generic wxDVC
When an item is marked as not containing any value in the expander column, we must still draw the expander button if it has children, so skip only drawing the item value in this case (and also preparing it for drawing it, as calling PrepareForItem() would trigger an assert failure for the items without value), but still execute the rest of the drawing code for it, including drawing the background and expander button. Closes https://github.com/wxWidgets/wxWidgets/pull/2144
This commit is contained in:
parent
bf6fee0af9
commit
ca9fa09fd8
@ -2790,6 +2790,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
wxDataViewTreeNode *node = NULL;
|
||||
wxDataViewItem dataitem;
|
||||
const int line_height = GetLineHeight(item);
|
||||
bool hasValue = true;
|
||||
|
||||
if (!IsVirtualList())
|
||||
{
|
||||
@ -2802,12 +2803,9 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
|
||||
dataitem = node->GetItem();
|
||||
|
||||
// Skip al columns that do not have values
|
||||
if ( !model->HasValue(dataitem, col->GetModelColumn()) )
|
||||
{
|
||||
cell_rect.y += line_height;
|
||||
continue;
|
||||
}
|
||||
hasValue = false;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2824,7 +2822,8 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
state |= wxDATAVIEW_CELL_SELECTED;
|
||||
|
||||
cell->SetState(state);
|
||||
cell->PrepareForItem(model, dataitem, col->GetModelColumn());
|
||||
if (hasValue)
|
||||
cell->PrepareForItem(model, dataitem, col->GetModelColumn());
|
||||
|
||||
// draw the background
|
||||
if ( !selected )
|
||||
@ -2905,7 +2904,8 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
// make its own renderer and thus we cannot be sure of that.
|
||||
wxDCClipper clip(dc, item_rect);
|
||||
|
||||
cell->WXCallRender(item_rect, &dc, state);
|
||||
if (hasValue)
|
||||
cell->WXCallRender(item_rect, &dc, state);
|
||||
|
||||
cell_rect.y += line_height;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user