void wxButton::SetLabel(const wxString& label) { if ( IsHelpButtonWithStandardLabel(GetId(), label) ) { // ignore the standard label for the help buttons, it's not used return; } wxAnyButton::SetLabel(label); #if wxOSX_USE_COCOA OSXUpdateAfterLabelChange(label); #endif }
bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& labelOrig, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { DontCreatePeer(); m_marginX = m_marginY = 0; // FIXME: this hack is needed because we're called from // wxBitmapButton::Create() with this style and we currently use a // different wxWidgetImpl method (CreateBitmapButton() rather than // CreateButton()) for creating bitmap buttons, but we really ought // to unify the creation of buttons of all kinds and then remove // this check if ( style & wxBU_NOTEXT ) { return wxControl::Create(parent, id, pos, size, style, validator, name); } wxString label; // Ignore the standard label for help buttons if possible, they use "?" // label under Mac which looks better. if ( !IsHelpButtonWithStandardLabel(id, labelOrig) ) { label = labelOrig.empty() && wxIsStockID(id) ? wxGetStockLabel(id) : labelOrig; } if ( !wxButtonBase::Create(parent, id, pos, size, style, validator, name) ) return false; m_labelOrig = m_label = label ; SetPeer(wxWidgetImpl::CreateButton( this, parent, id, label, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); return true; }
void wxButton::SetLabel(const wxString& label) { if ( IsHelpButtonWithStandardLabel(GetId(), label) ) { // ignore the standard label for the help buttons, it's not used return; } if ( HasFlag(wxBU_NOTEXT) ) { // just store the label internally but don't really use it for the // button m_labelOrig = m_label = label; return; } wxButtonBase::SetLabel(label); }