Handle wxELLIPSIZE_NONE gracefully in wxControl::Ellipsize()
Since 44bcc3a723
wxRendererGeneric::DrawItemText()
could call Ellipsize() with wxELLIPSIZE_NONE mode, resulting in an assert.
Fix this by just not doing anything in this case.
Closes #125.
This commit is contained in:
committed by
Vadim Zeitlin
parent
1bb714b9df
commit
4e49638a6c
@@ -383,7 +383,8 @@ public: // static functions
|
|||||||
wxDC::GetPartialTextExtents() function.
|
wxDC::GetPartialTextExtents() function.
|
||||||
@param mode
|
@param mode
|
||||||
The ellipsization mode. This is the setting which determines
|
The ellipsization mode. This is the setting which determines
|
||||||
which part of the string should be replaced by the ellipsis.
|
which part of the string should be replaced by the ellipsis
|
||||||
|
(unless it is ::wxELLIPSIZE_NONE in which case nothing is done).
|
||||||
See ::wxEllipsizeMode enumeration values for more info.
|
See ::wxEllipsizeMode enumeration values for more info.
|
||||||
@param maxWidth
|
@param maxWidth
|
||||||
The maximum width of the returned string in pixels.
|
The maximum width of the returned string in pixels.
|
||||||
|
@@ -520,6 +520,9 @@ wxString wxControlBase::Ellipsize(const wxString& label, const wxDC& dc,
|
|||||||
wxEllipsizeMode mode, int maxFinalWidth,
|
wxEllipsizeMode mode, int maxFinalWidth,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
|
if (mode == wxELLIPSIZE_NONE)
|
||||||
|
return label;
|
||||||
|
|
||||||
wxString ret;
|
wxString ret;
|
||||||
|
|
||||||
// these cannot be cached between different Ellipsize() calls as they can
|
// these cannot be cached between different Ellipsize() calls as they can
|
||||||
|
Reference in New Issue
Block a user