wxControl::SetLabel no longer strips out codes so do it here
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37237 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -61,12 +61,14 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// notice that we call the base class version which will just remove the
|
// notice that we call the base class version which will
|
||||||
// '&' characters from the string, but not set the label's text to it
|
// not set the label's text to it because the label is no
|
||||||
// because the label is not yet created and because SetLabel() has a side
|
// yet created and because SetLabel() has a side
|
||||||
// effect of changing the control size which might not be desirable
|
// effect of changing the control size which might not be desirable
|
||||||
|
// wxContro::SetLabel no longer strips menu codes, so do it here.
|
||||||
|
wxString label1(wxStripMenuCodes(label));
|
||||||
wxControl::SetLabel(label);
|
wxControl::SetLabel(label);
|
||||||
m_widget = gtk_label_new( wxGTK_CONV( m_label ) );
|
m_widget = gtk_label_new( wxGTK_CONV( label1 ) );
|
||||||
|
|
||||||
GtkJustification justify;
|
GtkJustification justify;
|
||||||
if ( style & wxALIGN_CENTER )
|
if ( style & wxALIGN_CENTER )
|
||||||
@@ -113,6 +115,7 @@ wxString wxStaticText::GetLabel() const
|
|||||||
void wxStaticText::SetLabel( const wxString &label )
|
void wxStaticText::SetLabel( const wxString &label )
|
||||||
{
|
{
|
||||||
wxControl::SetLabel(label);
|
wxControl::SetLabel(label);
|
||||||
|
wxString label1(wxStripMenuCodes(label));
|
||||||
|
|
||||||
// Build the colorized version of the label (markup only allowed
|
// Build the colorized version of the label (markup only allowed
|
||||||
// under GTK2):
|
// under GTK2):
|
||||||
@@ -124,11 +127,11 @@ void wxStaticText::SetLabel( const wxString &label )
|
|||||||
colorlabel.Printf(_T("<span foreground=\"#%02x%02x%02x\">%s</span>"),
|
colorlabel.Printf(_T("<span foreground=\"#%02x%02x%02x\">%s</span>"),
|
||||||
m_foregroundColour.Red(), m_foregroundColour.Green(),
|
m_foregroundColour.Red(), m_foregroundColour.Green(),
|
||||||
m_foregroundColour.Blue(),
|
m_foregroundColour.Blue(),
|
||||||
wxEscapeStringForPangoMarkup(label).c_str());
|
wxEscapeStringForPangoMarkup(label1).c_str());
|
||||||
gtk_label_set_markup( GTK_LABEL(m_widget), wxGTK_CONV( colorlabel ) );
|
gtk_label_set_markup( GTK_LABEL(m_widget), wxGTK_CONV( colorlabel ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( m_label ) );
|
gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( label1 ) );
|
||||||
|
|
||||||
// adjust the label size to the new label unless disabled
|
// adjust the label size to the new label unless disabled
|
||||||
if (!HasFlag(wxST_NO_AUTORESIZE))
|
if (!HasFlag(wxST_NO_AUTORESIZE))
|
||||||
|
@@ -61,12 +61,13 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// notice that we call the base class version which will just remove the
|
// the base class version which
|
||||||
// '&' characters from the string, but not set the label's text to it
|
// will not set the label's text to it
|
||||||
// because the label is not yet created and because SetLabel() has a side
|
// because the label is not yet created and because SetLabel() has a side
|
||||||
// effect of changing the control size which might not be desirable
|
// effect of changing the control size which might not be desirable
|
||||||
|
wxString label1(wxStripMenuCodes(label));
|
||||||
wxControl::SetLabel(label);
|
wxControl::SetLabel(label);
|
||||||
m_widget = gtk_label_new( wxGTK_CONV( m_label ) );
|
m_widget = gtk_label_new( wxGTK_CONV( label1 ) );
|
||||||
|
|
||||||
GtkJustification justify;
|
GtkJustification justify;
|
||||||
if ( style & wxALIGN_CENTER )
|
if ( style & wxALIGN_CENTER )
|
||||||
@@ -101,7 +102,9 @@ void wxStaticText::SetLabel( const wxString &label )
|
|||||||
{
|
{
|
||||||
wxControl::SetLabel(label);
|
wxControl::SetLabel(label);
|
||||||
|
|
||||||
gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( m_label ) );
|
wxString label1(wxStripMenuCodes(label));
|
||||||
|
|
||||||
|
gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( label1 ) );
|
||||||
|
|
||||||
// adjust the label size to the new label unless disabled
|
// adjust the label size to the new label unless disabled
|
||||||
if (!HasFlag(wxST_NO_AUTORESIZE))
|
if (!HasFlag(wxST_NO_AUTORESIZE))
|
||||||
|
Reference in New Issue
Block a user