diff --git a/include/wx/textctrl.h b/include/wx/textctrl.h
index 693529bab4..22792af375 100644
--- a/include/wx/textctrl.h
+++ b/include/wx/textctrl.h
@@ -275,7 +275,7 @@ enum wxTextAttrUnderlineType
wxTEXT_ATTR_UNDERLINE_NONE,
wxTEXT_ATTR_UNDERLINE_SOLID,
wxTEXT_ATTR_UNDERLINE_DOUBLE,
- wxTEXT_ATTR_UNDERLINE_WAVE
+ wxTEXT_ATTR_UNDERLINE_SPECIAL
};
// ----------------------------------------------------------------------------
diff --git a/interface/wx/textctrl.h b/interface/wx/textctrl.h
index c26277e553..1b2d509d70 100644
--- a/interface/wx/textctrl.h
+++ b/interface/wx/textctrl.h
@@ -229,7 +229,7 @@ enum wxTextAttrUnderlineType
wxTEXT_ATTR_UNDERLINE_NONE,
wxTEXT_ATTR_UNDERLINE_SOLID,
wxTEXT_ATTR_UNDERLINE_DOUBLE,
- wxTEXT_ATTR_UNDERLINE_WAVE
+ wxTEXT_ATTR_UNDERLINE_SPECIAL
};
/**
@@ -830,20 +830,29 @@ public:
void SetFontStyle(wxFontStyle fontStyle);
/**
- Sets the font underlining (solid line, using text colour).
+ Sets the font underlining (solid line, text colour).
*/
void SetFontUnderlined(bool underlined);
/**
- Sets the font underlining with a wxTextAttrUnderlineType and wxColour.
- Specifying wxNullColour will use the text colour.
+ Sets the font underlining.
- @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 here.
+ @param type Type of underline.
- @note On wxGTK, underline colour is only supported by wxGTK3. GTK might overrule the colour of wxTEXT_ATTR_UNDERLINE_WAVE.
+ @param colour Colour to use for underlining, text colour is used by
+ default.
- @note On wxOSX, wxTEXT_ATTR_UNDERLINE_WAVE is shown as a dotted line.
+ @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
+ here.
+ 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
*/
diff --git a/samples/text/text.cpp b/samples/text/text.cpp
index f5df4e4045..f4ee6f9038 100644
--- a/samples/text/text.cpp
+++ b/samples/text/text.cpp
@@ -1237,7 +1237,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
attr.SetFontUnderlined(false);
m_textrich->SetDefaultStyle(attr);
m_textrich->AppendText(" is a ");
- attr.SetFontUnderlined(wxTEXT_ATTR_UNDERLINE_WAVE, *wxRED);
+ attr.SetFontUnderlined(wxTEXT_ATTR_UNDERLINE_SPECIAL, *wxRED);
m_textrich->SetDefaultStyle(attr);
m_textrich->AppendText("mispeled");
attr.SetFontUnderlined(false);
diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp
index a61369ec02..149d00f880 100644
--- a/src/gtk/textctrl.cpp
+++ b/src/gtk/textctrl.cpp
@@ -126,21 +126,21 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text,
if ( attr.HasFontUnderlined() )
{
- PangoUnderline pangoUnderlineStyle;
+ PangoUnderline pangoUnderlineStyle = PANGO_UNDERLINE_NONE;
switch ( attr.GetUnderlineType() )
{
- case wxTEXT_ATTR_UNDERLINE_NONE:
- pangoUnderlineStyle = PANGO_UNDERLINE_NONE;
- break;
case wxTEXT_ATTR_UNDERLINE_SOLID:
pangoUnderlineStyle = PANGO_UNDERLINE_SINGLE;
break;
case wxTEXT_ATTR_UNDERLINE_DOUBLE:
pangoUnderlineStyle = PANGO_UNDERLINE_DOUBLE;
break;
- case wxTEXT_ATTR_UNDERLINE_WAVE:
+ case wxTEXT_ATTR_UNDERLINE_SPECIAL:
pangoUnderlineStyle = PANGO_UNDERLINE_ERROR;
break;
+ default:
+ pangoUnderlineStyle = PANGO_UNDERLINE_NONE;
+ break;
}
g_snprintf(buf, sizeof(buf), "WXFONTUNDERLINESTYLE %u",
@@ -1922,7 +1922,10 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
underlineType = wxTEXT_ATTR_UNDERLINE_DOUBLE;
break;
case PANGO_UNDERLINE_ERROR:
- underlineType = wxTEXT_ATTR_UNDERLINE_WAVE;
+ underlineType = wxTEXT_ATTR_UNDERLINE_SPECIAL;
+ break;
+ default:
+ underlineType = wxTEXT_ATTR_UNDERLINE_NONE;
break;
}
diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp
index 8933f7b803..4156aa7bcd 100644
--- a/src/msw/textctrl.cpp
+++ b/src/msw/textctrl.cpp
@@ -2910,21 +2910,23 @@ bool wxTextCtrl::MSWSetCharFormat(const wxTextAttr& style, long start, long end)
if ( style.HasFontUnderlined() )
{
cf.dwMask |= CFM_UNDERLINETYPE;
+ BYTE underlineType = CFU_UNDERLINENONE;
switch ( style.GetUnderlineType() )
{
- case wxTEXT_ATTR_UNDERLINE_NONE:
- cf.bUnderlineType = CFU_UNDERLINENONE;
- break;
case wxTEXT_ATTR_UNDERLINE_SOLID:
- cf.bUnderlineType = CFU_UNDERLINE;
+ underlineType = CFU_UNDERLINE;
break;
case wxTEXT_ATTR_UNDERLINE_DOUBLE:
- cf.bUnderlineType = CFU_UNDERLINEDOUBLE;
+ underlineType = CFU_UNDERLINEDOUBLE;
break;
- case wxTEXT_ATTR_UNDERLINE_WAVE:
- cf.bUnderlineType = CFU_UNDERLINEWAVE;
+ case wxTEXT_ATTR_UNDERLINE_SPECIAL:
+ underlineType = CFU_UNDERLINEWAVE;
+ break;
+ default:
+ underlineType = CFU_UNDERLINENONE;
break;
}
+ cf.bUnderlineType = underlineType;
#if _RICHEDIT_VER >= 0x0800
BYTE colour = 0;
@@ -3266,7 +3268,10 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
underlineType = wxTEXT_ATTR_UNDERLINE_DOUBLE;
break;
case CFU_UNDERLINEWAVE:
- underlineType = wxTEXT_ATTR_UNDERLINE_WAVE;
+ underlineType = wxTEXT_ATTR_UNDERLINE_SPECIAL;
+ break;
+ default:
+ underlineType = wxTEXT_ATTR_UNDERLINE_NONE;
break;
}
diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm
index 344142bd9e..27581dae19 100644
--- a/src/osx/cocoa/textctrl.mm
+++ b/src/osx/cocoa/textctrl.mm
@@ -1086,12 +1086,15 @@ bool wxNSTextViewControl::GetStyle(long position, wxTextAttr& style)
underlineType = wxTEXT_ATTR_UNDERLINE_DOUBLE;
break;
case NSUnderlineStyleSingle | NSUnderlinePatternDot:
- underlineType = wxTEXT_ATTR_UNDERLINE_WAVE;
+ underlineType = wxTEXT_ATTR_UNDERLINE_SPECIAL;
+ break;
+ default:
+ underlineType = wxTEXT_ATTR_UNDERLINE_NONE;
break;
}
}
- wxColour underlineColour = wxNullColour;
+ wxColour underlineColour;
if ( ulcolor )
underlineColour = wxColour(ulcolor);
@@ -1123,24 +1126,23 @@ void wxNSTextViewControl::SetStyle(long start,
[attrs setValue:style.GetTextColour().OSXGetNSColor() forKey:NSForegroundColorAttributeName];
if ( style.HasFontUnderlined() )
{
+ int underlineStyle = NSUnderlineStyleNone;
switch ( style.GetUnderlineType() )
{
- case wxTEXT_ATTR_UNDERLINE_NONE:
- [attrs setObject:[NSNumber numberWithInt:( NSUnderlineStyleNone )] forKey:NSUnderlineStyleAttributeName];
- break;
-
case wxTEXT_ATTR_UNDERLINE_SOLID:
- [attrs setObject:[NSNumber numberWithInt:( NSUnderlineStyleSingle )] forKey:NSUnderlineStyleAttributeName];
+ underlineStyle = NSUnderlineStyleSingle;
break;
-
case wxTEXT_ATTR_UNDERLINE_DOUBLE:
- [attrs setObject:[NSNumber numberWithInt:( NSUnderlineStyleDouble )] forKey:NSUnderlineStyleAttributeName];
+ underlineStyle = NSUnderlineStyleDouble;
break;
-
- case wxTEXT_ATTR_UNDERLINE_WAVE:
- [attrs setObject:[NSNumber numberWithInt:( NSUnderlineStyleSingle | NSUnderlinePatternDot )] forKey:NSUnderlineStyleAttributeName];
+ case wxTEXT_ATTR_UNDERLINE_SPECIAL:
+ underlineStyle = NSUnderlineStyleSingle | NSUnderlinePatternDot;
+ break;
+ default:
+ underlineStyle = NSUnderlineStyleNone;
break;
}
+ [attrs setObject:[NSNumber numberWithInt:( underlineStyle )] forKey:NSUnderlineStyleAttributeName];
wxColour colour = style.GetUnderlineColour();
if ( colour.IsOk() )
{
@@ -1166,24 +1168,23 @@ void wxNSTextViewControl::SetStyle(long start,
if( style.HasFontUnderlined() )
{
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
+ int underlineStyle = NSUnderlineStyleNone;
switch ( style.GetUnderlineType() )
{
- case wxTEXT_ATTR_UNDERLINE_NONE:
- [dict setObject:[NSNumber numberWithInt:( NSUnderlineStyleNone )] forKey:NSUnderlineStyleAttributeName];
- break;
-
case wxTEXT_ATTR_UNDERLINE_SOLID:
- [dict setObject:[NSNumber numberWithInt:( NSUnderlineStyleSingle )] forKey:NSUnderlineStyleAttributeName];
+ underlineStyle = NSUnderlineStyleSingle;
break;
-
case wxTEXT_ATTR_UNDERLINE_DOUBLE:
- [dict setObject:[NSNumber numberWithInt:( NSUnderlineStyleDouble )] forKey:NSUnderlineStyleAttributeName];
+ underlineStyle = NSUnderlineStyleDouble;
break;
-
- case wxTEXT_ATTR_UNDERLINE_WAVE:
- [dict setObject:[NSNumber numberWithInt:( NSUnderlineStyleSingle | NSUnderlinePatternDot )] forKey:NSUnderlineStyleAttributeName];
+ case wxTEXT_ATTR_UNDERLINE_SPECIAL:
+ underlineStyle = NSUnderlineStyleSingle | NSUnderlinePatternDot;
+ break;
+ default:
+ underlineStyle = NSUnderlineStyleNone;
break;
}
+ [dict setObject:[NSNumber numberWithInt:( underlineStyle )] forKey:NSUnderlineStyleAttributeName];
wxColour colour = style.GetUnderlineColour();
if ( colour.IsOk() )
{