void wxControl::GTKSetLabelForFrame(GtkFrame *w, const wxString& label) { wxControl::SetLabel(label); const wxString labelGTK = GTKRemoveMnemonics(label); gtk_frame_set_label(w, labelGTK.empty() ? (const char *)NULL : wxGTK_CONV(labelGTK)); }
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 wxButton::SetLabel( const wxString &lbl ) { wxCHECK_RET( m_widget != NULL, wxT("invalid button") ); wxString label(lbl); if (label.empty() && wxIsStockID(m_windowId)) label = wxGetStockLabel(m_windowId); wxControl::SetLabel(label); const wxString labelGTK = GTKRemoveMnemonics(label); gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV(labelGTK)); }
bool wxStaticText::Create(wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { m_needParent = TRUE; if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { wxFAIL_MSG( wxT("wxStaticText creation failed") ); return FALSE; } m_label = label; m_widget = gtk_label_new( wxGTK_CONV( GTKRemoveMnemonics(label)) ); GtkJustification justify; if ( style & wxALIGN_CENTER ) justify = GTK_JUSTIFY_CENTER; else if ( style & wxALIGN_RIGHT ) justify = GTK_JUSTIFY_RIGHT; else // wxALIGN_LEFT is 0 justify = GTK_JUSTIFY_LEFT; gtk_label_set_justify(GTK_LABEL(m_widget), justify); // GTK_JUSTIFY_LEFT is 0, RIGHT 1 and CENTER 2 static const float labelAlignments[] = { 0.0, 1.0, 0.5 }; gtk_misc_set_alignment(GTK_MISC(m_widget), labelAlignments[justify], 0.0); gtk_label_set_line_wrap( GTK_LABEL(m_widget), TRUE ); m_parent->DoAddChild( this ); PostCreation(size); return TRUE; }