Merge branch 'underline-improvements' of https://github.com/MaartenBent/wxWidgets

Add support for different underline types and colour to wxTextCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/1406

Closes #17124.
This commit is contained in:
Vadim Zeitlin
2019-07-19 23:45:38 +02:00
7 changed files with 414 additions and 37 deletions

View File

@@ -219,6 +219,19 @@ enum wxTextAttrLineSpacing
};
/**
Underline types that can be used in wxTextAttr::SetFontUnderline().
@since 3.1.3
*/
enum wxTextAttrUnderlineType
{
wxTEXT_ATTR_UNDERLINE_NONE,
wxTEXT_ATTR_UNDERLINE_SOLID,
wxTEXT_ATTR_UNDERLINE_DOUBLE,
wxTEXT_ATTR_UNDERLINE_SPECIAL
};
/**
Describes the possible return values of wxTextCtrl::HitTest().
@@ -422,6 +435,20 @@ public:
*/
bool GetFontUnderlined() const;
/**
Returns the underline type, which is one of the @wxTextAttrUnderlineType values.
@since 3.1.3
*/
wxTextAttrUnderlineType GetUnderlineType() const;
/**
Returns the underline color used. wxNullColour when the text colour is used.
@since 3.1.3
*/
const wxColour& GetUnderlineColour() const;
/**
Returns the font weight.
*/
@@ -803,10 +830,34 @@ public:
void SetFontStyle(wxFontStyle fontStyle);
/**
Sets the font underlining.
Sets the font underlining (solid line, text colour).
*/
void SetFontUnderlined(bool underlined);
/**
Sets the font underlining.
@param type Type of underline.
@param colour Colour to use for underlining, text colour is used by
default.
@note On wxMSW, wxTEXT_ATTR_UNDERLINE_DOUBLE is shown as
wxTEXT_ATTR_UNDERLINE_SOLID. There is only a limited number of colours
supported, the RGB values are listed
<a href="https://docs.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-geteffectcolor">here</a>.
wxTEXT_ATTR_UNDERLINE_SPECIAL is shown as a waved line.
@note On wxGTK, underline colour is only supported by wxGTK3.
wxTEXT_ATTR_UNDERLINE_SPECIAL is shown as a waved line. GTK might
overrule the colour of wxTEXT_ATTR_UNDERLINE_SPECIAL.
@note On wxOSX, wxTEXT_ATTR_UNDERLINE_SPECIAL is shown as a dotted line.
@since 3.1.3
*/
void SetFontUnderlined(wxTextAttrUnderlineType type, const wxColour& colour = wxNullColour);
/**
Sets the font weight.
*/