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:
committed by
Václav Slavík
parent
13862ad8e6
commit
ff1dba498e
@@ -658,12 +658,14 @@ wxDataViewRendererBase::wxDataViewRendererBase( const wxString &varianttype,
|
||||
{
|
||||
m_variantType = varianttype;
|
||||
m_owner = NULL;
|
||||
m_valueAdjuster = NULL;
|
||||
}
|
||||
|
||||
wxDataViewRendererBase::~wxDataViewRendererBase()
|
||||
{
|
||||
if ( m_editorCtrl )
|
||||
DestroyEditControl();
|
||||
delete m_valueAdjuster;
|
||||
}
|
||||
|
||||
wxDataViewCtrl* wxDataViewRendererBase::GetView() const
|
||||
@@ -830,7 +832,14 @@ wxDataViewRendererBase::PrepareForItem(const wxDataViewModel *model,
|
||||
// Now check if we have a value and remember it for rendering it later.
|
||||
// Notice that we do it even if it's null, as the cell should be empty then
|
||||
// and not show the last used value.
|
||||
const wxVariant& value = CheckedGetValue(model, item, column);
|
||||
wxVariant value = CheckedGetValue(model, item, column);
|
||||
|
||||
if ( m_valueAdjuster )
|
||||
{
|
||||
if ( IsHighlighted() )
|
||||
value = m_valueAdjuster->MakeHighlighted(value);
|
||||
}
|
||||
|
||||
SetValue(value);
|
||||
|
||||
if ( !value.IsNull() )
|
||||
|
||||
Reference in New Issue
Block a user