Add wxDataViewValueAdjuster

Add wxDataViewRenderer:: SetValueAdjuster() and a
wxDataViewValueAdjuster class. This can be used to customize rendering
of values depending on whether they are highlighted (selection) or not,
without having to implement an entire new custom renderer.
This commit is contained in:
Václav Slavík
2016-11-21 18:07:32 +01:00
committed by Václav Slavík
parent 13862ad8e6
commit ff1dba498e
9 changed files with 152 additions and 6 deletions

View File

@@ -969,6 +969,7 @@ wxDataViewRenderer::wxDataViewRenderer( const wxString &varianttype,
m_mode = mode;
m_ellipsizeMode = wxELLIPSIZE_MIDDLE;
m_dc = NULL;
m_state = 0;
}
wxDataViewRenderer::~wxDataViewRenderer()
@@ -2264,10 +2265,16 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
cell_rect.y = GetLineStart( item );
cell_rect.height = GetLineHeight( item );
bool selected = m_selection.IsSelected(item);
int state = 0;
if (m_hasFocus && selected)
state |= wxDATAVIEW_CELL_SELECTED;
cell->SetState(state);
cell->PrepareForItem(model, dataitem, col->GetModelColumn());
// draw the background
bool selected = m_selection.IsSelected(item);
if ( !selected )
DrawCellBackground( cell, dc, cell_rect );
@@ -2323,10 +2330,6 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
if ( item_rect.width <= 0 )
continue;
int state = 0;
if (m_hasFocus && selected)
state |= wxDATAVIEW_CELL_SELECTED;
// TODO: it would be much more efficient to create a clipping
// region for the entire column being rendered (in the OnPaint
// of wxDataViewMainWindow) instead of a single clip region for