wxEllipsizeMode mode, int maxWidth,
int replacementWidth, int marginWidth);
- // this field contains the label in wx format, i.e. with '&' mnemonics
+ // this field contains the label in wx format, i.e. with '&' mnemonics,
+ // as it was passed to the last SetLabel() call
wxString m_labelOrig;
wxDECLARE_NO_COPY_CLASS(wxControlBase);
// These functions are platform-specific and must be overridden in ports
// which do not natively support ellipsization and they must be implemented
- // in a way so that the m_label member of wxControl is not touched:
+ // in a way so that the m_labelOrig member of wxControl is not touched:
// returns the real label currently displayed inside the control.
virtual wxString DoGetLabel() const { return wxEmptyString; }
// sets the real label currently displayed inside the control,
- // _without_ invalidating the size. The text passed is always markup-free.
+ // _without_ invalidating the size. The text passed is always markup-free
+ // but may contain the mnemonic characters.
virtual void DoSetLabel(const wxString& WXUNUSED(str)) { }
private:
// adjust the label size to the new label unless disabled
if ( !HasFlag(wxST_NO_AUTORESIZE) &&
- !IsEllipsized() ) // if ellipsize is ON, then we don't want to get resized!
+ !IsEllipsized() ) // if ellipsization is ON, then we don't want to get resized!
SetSize( GetBestSize() );
}
}
void wxStaticText::DoSetSize(int x, int y,
- int width, int height,
- int sizeFlags )
+ int width, int height,
+ int sizeFlags )
{
wxStaticTextBase::DoSetSize(x, y, width, height, sizeFlags);
void wxStaticText::DoSetLabel(const wxString& str)
{
- GTKSetLabelForLabel(GTK_LABEL(m_widget), str);
+ // this function looks like GTKSetLabelForLabel() but here we just want to modify
+ // the GTK control without altering any internal wxStaticText variable
+
+ const wxString labelGTK = GTKConvertMnemonics(str);
+ gtk_label_set_text_with_mnemonic(GTK_LABEL(m_widget), wxGTK_CONV(labelGTK));
}
// static