- //Format mnemonics properly for GTK2. This can be called from GTK1.x, but
- //it's not very useful because mnemonics don't exist prior to GTK2.
- wxString label2;
- for (size_t i = 0; i < label.Len(); i++)
+ // keep the original string internally to be able to return it later (for
+ // consistency with the other ports)
+ m_label = label;
+
+ InvalidateBestSize();
+}
+
+wxString wxControl::GetLabel() const
+{
+ return m_label;
+}
+
+void wxControl::GTKSetLabelForLabel(GtkLabel *w, const wxString& label)
+{
+ // don't call the virtual function which might call this one back again
+ wxControl::SetLabel(label);
+
+ const wxString labelGTK = GTKRemoveMnemonics(label);
+
+ gtk_label_set(w, wxGTK_CONV(labelGTK));
+}
+
+void wxControl::GTKSetLabelForFrame(GtkFrame *w, const wxString& label)
+{
+ wxControl::SetLabel(label);
+
+ const wxString labelGTK = GTKRemoveMnemonics(label);
+
+ gtk_frame_set_label(w, labelGTK.empty() ? (char *)NULL
+ : wxGTK_CONV(labelGTK));
+}
+
+/* static */
+wxString wxControl::GTKRemoveMnemonics(const wxString& label)
+{
+ const size_t len = label.length();
+ wxString labelGTK;
+ labelGTK.reserve(len);
+ for ( size_t i = 0; i < len; i++ )