Add ellipsizeMode parameter to wxRenderNative::DrawItemText()

Instead of the default end ellipsize mode used in the native and generic
implementation, allow specifying the mode with an additional parameter.

Closes https://github.com/wxWidgets/wxWidgets/pull/97
This commit is contained in:
Tobias Taschner
2015-09-20 16:59:37 +02:00
committed by Vadim Zeitlin
parent 60a3d76045
commit 44bcc3a723
5 changed files with 48 additions and 28 deletions

View File

@@ -981,20 +981,6 @@ wxDataViewCustomRendererBase::RenderText(const wxString& text,
rectText.x += xoffset;
rectText.width -= xoffset;
// check if we want to ellipsize the text if it doesn't fit
wxString ellipsizedText;
if ( GetEllipsizeMode() != wxELLIPSIZE_NONE )
{
ellipsizedText = wxControl::Ellipsize
(
text,
*dc,
GetEllipsizeMode(),
rectText.width,
wxELLIPSIZE_FLAGS_NONE
);
}
int flags = 0;
if ( state & wxDATAVIEW_CELL_SELECTED )
flags |= wxCONTROL_SELECTED | wxCONTROL_FOCUSED;
@@ -1005,10 +991,11 @@ wxDataViewCustomRendererBase::RenderText(const wxString& text,
wxRendererNative::Get().DrawItemText(
GetOwner()->GetOwner(),
*dc,
ellipsizedText.empty() ? text : ellipsizedText,
text,
rectText,
GetEffectiveAlignment(),
flags);
flags,
GetEllipsizeMode());
}
void wxDataViewCustomRendererBase::SetEnabled(bool enabled)