- // If the color has been set, create a markup string to pass to
- // the label setter
- wxString colorlabel;
- colorlabel.Printf(_T("<span foreground=\"#%02x%02x%02x\">%s</span>"),
- m_foregroundColour.Red(), m_foregroundColour.Green(),
- m_foregroundColour.Blue(),
- wxEscapeStringForPangoMarkup(label).c_str());
- gtk_label_set_markup( GTK_LABEL(m_widget), wxGTK_CONV( colorlabel ) );
+ // We need to update the Pango attributes used for the text.
+ if ( isUnderlined || isStrickenThrough )
+ {
+ PangoAttrList* const attrs = pango_attr_list_new();
+ if ( isUnderlined )
+ {
+ PangoAttribute *a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
+ a->start_index = 0;
+ a->end_index = (guint)-1;
+ pango_attr_list_insert(attrs, a);
+ }
+
+ if ( isStrickenThrough )
+ {
+ PangoAttribute *a = pango_attr_strikethrough_new( TRUE );
+ a->start_index = 0;
+ a->end_index = (guint) -1;
+ pango_attr_list_insert(attrs, a);
+ }
+
+ gtk_label_set_attributes(GTK_LABEL(m_widget), attrs);
+ pango_attr_list_unref(attrs);
+ }
+ else // No special attributes any more.
+ {
+ // Just remove any attributes we had set.
+ gtk_label_set_attributes(GTK_LABEL(m_widget), NULL);
+ }
+
+ // The underlines for mnemonics are incompatible with using attributes
+ // so turn them off when setting underlined font.
+ gtk_label_set_use_underline(GTK_LABEL(m_widget), !isUnderlined);