Allow to check if wxMarkupText has changed when setting it

This can/will be used for avoidiing to do anything if the markup hasn't
really changed.
This commit is contained in:
Vadim Zeitlin
2024-12-12 20:38:05 +01:00
parent 1ab3bacfc1
commit 6df975fdb2
+10 -2
View File
@@ -27,8 +27,16 @@ class WXDLLIMPEXP_CORE wxMarkupTextBase
public:
virtual ~wxMarkupTextBase() = default;
// Update the markup string.
void SetMarkup(const wxString& markup) { m_markup = markup; }
// Update the markup string, return false if it didn't change.
bool SetMarkup(const wxString& markup)
{
if ( markup == m_markup )
return false;
m_markup = markup;
return true;
}
// Return the width and height required by the given string and optionally
// the height of the visible part above the baseline (i.e. ascent minus