use GetLabelText() instead of wxStripMenuCodes() to avoid stripping the part of the string after TAB
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40331 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -48,7 +48,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID winid,
|
||||
[m_cocoaNSView release];
|
||||
|
||||
[GetNSButton() setBezelStyle:NSRoundedBezelStyle];
|
||||
[GetNSButton() setTitle:wxNSStringWithWxString(wxStripMenuCodes(label))];
|
||||
[GetNSButton() setTitle:wxNSStringWithWxString(GetLabelText(label))];
|
||||
[GetNSControl() sizeToFit];
|
||||
|
||||
if(m_parent)
|
||||
@@ -78,7 +78,7 @@ wxString wxButton::GetLabel() const
|
||||
|
||||
void wxButton::SetLabel(const wxString& label)
|
||||
{
|
||||
[GetNSButton() setTitle:wxNSStringWithWxString(wxStripMenuCodes(label))];
|
||||
[GetNSButton() setTitle:wxNSStringWithWxString(GetLabelText(label))];
|
||||
}
|
||||
|
||||
wxSize wxButton::DoGetBestSize() const
|
||||
|
@@ -47,7 +47,7 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID winid,
|
||||
[m_cocoaNSView release];
|
||||
[GetNSButton() setButtonType: NSSwitchButton];
|
||||
[GetNSButton() setAllowsMixedState: Is3State()];
|
||||
[GetNSButton() setTitle:wxNSStringWithWxString(wxStripMenuCodes(label))];
|
||||
[GetNSButton() setTitle:wxNSStringWithWxString(GetLabelText(label))];
|
||||
[GetNSControl() sizeToFit];
|
||||
|
||||
if(m_parent)
|
||||
|
@@ -37,7 +37,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID winid,
|
||||
return false;
|
||||
m_cocoaNSView = NULL;
|
||||
SetNSBox([[NSBox alloc] initWithFrame:MakeDefaultNSRect(size)]);
|
||||
[GetNSBox() setTitle:wxNSStringWithWxString(wxStripMenuCodes(title))];
|
||||
[GetNSBox() setTitle:wxNSStringWithWxString(GetLabelText(title))];
|
||||
if(m_parent)
|
||||
m_parent->CocoaAddChild(this);
|
||||
SetInitialFrameRect(pos,size);
|
||||
|
@@ -128,7 +128,7 @@ bool wxRadioBox::Create( wxWindow *parent,
|
||||
wxRadioButton *radBtn = new wxRadioButton(
|
||||
this,
|
||||
wxID_ANY,
|
||||
wxStripMenuCodes(choices[i]),
|
||||
GetLabelText(choices[i]),
|
||||
wxPoint( 5, 20 * i + 10 ),
|
||||
wxDefaultSize,
|
||||
i == 0 ? wxRB_GROUP : 0 );
|
||||
|
@@ -43,7 +43,7 @@ bool wxStaticText::Create( wxWindow *parent,
|
||||
{
|
||||
m_macIsUserPane = false;
|
||||
|
||||
m_label = wxStripMenuCodes( label );
|
||||
m_label = GetLabelText( label );
|
||||
|
||||
if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
|
||||
return false;
|
||||
@@ -113,7 +113,7 @@ wxSize wxStaticText::DoGetBestSize() const
|
||||
|
||||
void wxStaticText::SetLabel( const wxString& st )
|
||||
{
|
||||
m_label = wxStripMenuCodes( st );
|
||||
m_label = GetLabelText( st );
|
||||
|
||||
wxMacCFStringHolder str( m_label, m_font.GetEncoding() );
|
||||
CFStringRef ref = str;
|
||||
|
@@ -1136,7 +1136,7 @@ void wxWindowMac::MacPostControlCreate(const wxPoint& pos, const wxSize& size)
|
||||
// adjust font, controlsize etc
|
||||
DoSetWindowVariant( m_windowVariant ) ;
|
||||
|
||||
m_peer->SetLabel( wxStripMenuCodes(m_label) ) ;
|
||||
m_peer->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics) ) ;
|
||||
|
||||
if (!m_macIsUserPane)
|
||||
SetInitialBestSize(size);
|
||||
@@ -2088,7 +2088,7 @@ void wxWindowMac::DoSetClientSize(int clientwidth, int clientheight)
|
||||
|
||||
void wxWindowMac::SetLabel(const wxString& title)
|
||||
{
|
||||
m_label = wxStripMenuCodes(title) ;
|
||||
m_label = wxStripMenuCodes(title, wxStrip_Mnemonics) ;
|
||||
|
||||
if ( m_peer && m_peer->Ok() )
|
||||
m_peer->SetLabel( m_label ) ;
|
||||
|
@@ -207,7 +207,7 @@ wxControl::~wxControl()
|
||||
|
||||
void wxControl::SetLabel(const wxString& title)
|
||||
{
|
||||
m_label = wxStripMenuCodes(title) ;
|
||||
m_label = GetLabelText(title) ;
|
||||
|
||||
if ( m_macControl )
|
||||
{
|
||||
@@ -309,7 +309,7 @@ void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString l
|
||||
((Rect*)outBounds)->bottom = 0;
|
||||
((Rect*)outBounds)->right = 0;
|
||||
|
||||
wxMacStringToPascal( wxStripMenuCodes(label) , maclabel ) ;
|
||||
wxMacStringToPascal( GetLabelText(label) , maclabel ) ;
|
||||
}
|
||||
|
||||
void wxControl::MacPostControlCreate()
|
||||
@@ -398,7 +398,7 @@ void wxControl::MacPostControlCreate()
|
||||
SetSize(pos.x, pos.y, new_size.x, new_size.y);
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
UMASetControlTitle( (ControlHandle) m_macControl , wxStripMenuCodes(m_label) , m_font.GetEncoding() ) ;
|
||||
UMASetControlTitle( (ControlHandle) m_macControl , GetLabelText(m_label) , m_font.GetEncoding() ) ;
|
||||
#endif
|
||||
|
||||
if ( m_macControlIsShown )
|
||||
|
@@ -58,8 +58,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& lbl,
|
||||
if( !CreateControl( parent, id, pos, size, style, validator, name ) )
|
||||
return false;
|
||||
|
||||
wxString label1(wxStripMenuCodes(label));
|
||||
wxXmString text( label1 );
|
||||
wxXmString text( GetLabelText(label) );
|
||||
|
||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||
|
||||
|
@@ -63,8 +63,7 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
||||
name ) )
|
||||
return false;
|
||||
|
||||
wxString label1(wxStripMenuCodes(label));
|
||||
wxXmString text( label1 );
|
||||
wxXmString text( GetLabelText(label) );
|
||||
|
||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||
|
||||
|
@@ -195,7 +195,7 @@ int wxChoice::DoInsert(const wxString& item, unsigned int pos)
|
||||
#ifndef XmNpositionIndex
|
||||
wxCHECK_MSG( pos == GetCount(), -1, wxT("insert not implemented"));
|
||||
#endif
|
||||
Widget w = XtVaCreateManagedWidget (wxStripMenuCodes(item),
|
||||
Widget w = XtVaCreateManagedWidget (GetLabelText(item),
|
||||
#if wxUSE_GADGETS
|
||||
xmPushButtonGadgetClass, (Widget) m_menuWidget,
|
||||
#else
|
||||
|
@@ -85,7 +85,7 @@ void wxControl::SetLabel(const wxString& label)
|
||||
if (!widget)
|
||||
return;
|
||||
|
||||
wxXmString label_str(wxStripMenuCodes(label));
|
||||
wxXmString label_str(GetLabelText(label));
|
||||
|
||||
XtVaSetValues (widget,
|
||||
XmNlabelString, label_str(),
|
||||
|
@@ -76,7 +76,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
XmNresizeWidth, True,
|
||||
NULL);
|
||||
|
||||
wxString label1(wxStripMenuCodes(title));
|
||||
wxString label1(GetLabelText(title));
|
||||
|
||||
if (!label1.empty())
|
||||
{
|
||||
@@ -120,7 +120,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
wxString str(wxStripMenuCodes(choices[i]));
|
||||
wxString str(GetLabelText(choices[i]));
|
||||
m_radioButtonLabels.push_back(str);
|
||||
Widget radioItem = XtVaCreateManagedWidget (
|
||||
wxConstCast(str.c_str(), char),
|
||||
@@ -179,7 +179,7 @@ void wxRadioBox::SetString(unsigned int item, const wxString& label)
|
||||
Widget widget = (Widget)m_radioButtons[item];
|
||||
if (!label.empty())
|
||||
{
|
||||
wxString label1(wxStripMenuCodes(label));
|
||||
wxString label1(GetLabelText(label));
|
||||
wxXmString text( label1 );
|
||||
m_radioButtonLabels[item] = label1;
|
||||
XtVaSetValues (widget,
|
||||
|
@@ -55,7 +55,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||
Display* dpy = XtDisplay(parentWidget);
|
||||
|
||||
wxString label1(wxStripMenuCodes(label));
|
||||
wxString label1(GetLabelText(label));
|
||||
|
||||
wxXmString text( label1 );
|
||||
|
||||
|
@@ -104,7 +104,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
if (!label.empty())
|
||||
{
|
||||
wxString label1(wxStripMenuCodes(label));
|
||||
wxString label1(GetLabelText(label));
|
||||
wxXmString text(label1);
|
||||
Display* dpy = XtDisplay( parentWidget );
|
||||
|
||||
|
@@ -47,7 +47,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
Widget borderWidget =
|
||||
(Widget) wxCreateBorderWidget( (WXWidget)parentWidget, style );
|
||||
wxXmString text( wxStripMenuCodes( label ) );
|
||||
wxXmString text( GetLabelText( label ) );
|
||||
|
||||
m_labelWidget =
|
||||
XtVaCreateManagedWidget (wxConstCast(name.c_str(), char),
|
||||
@@ -73,7 +73,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
void wxStaticText::SetLabel(const wxString& label)
|
||||
{
|
||||
wxXmString label_str(wxStripMenuCodes(label));
|
||||
wxXmString label_str(GetLabelText(label));
|
||||
|
||||
// This variable means we don't need so many casts later.
|
||||
Widget widget = (Widget) m_labelWidget;
|
||||
|
@@ -254,7 +254,7 @@ wxSize wxButton::DoGetBestSize() const
|
||||
|
||||
wxCoord wBtn,
|
||||
hBtn;
|
||||
dc.GetMultiLineTextExtent(wxStripMenuCodes(GetLabel()), &wBtn, &hBtn);
|
||||
dc.GetMultiLineTextExtent(GetLabelText(), &wBtn, &hBtn);
|
||||
|
||||
// add a margin -- the button is wider than just its label
|
||||
wBtn += 3*GetCharWidth();
|
||||
@@ -850,8 +850,8 @@ bool wxButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis)
|
||||
|
||||
COLORREF colFg = wxColourToRGB(GetForegroundColour());
|
||||
DrawButtonText(hdc, &rectBtn,
|
||||
(state & ODS_NOACCEL ? wxStripMenuCodes(GetLabel())
|
||||
: GetLabel()),
|
||||
state & ODS_NOACCEL ? GetLabelText()
|
||||
: GetLabel(),
|
||||
state & ODS_DISABLED ? GetSysColor(COLOR_GRAYTEXT)
|
||||
: colFg);
|
||||
|
||||
|
@@ -215,7 +215,7 @@ wxSize wxCheckBox::DoGetBestSize() const
|
||||
int wCheckbox, hCheckbox;
|
||||
if ( !str.empty() )
|
||||
{
|
||||
GetTextExtent(wxStripMenuCodes(str), &wCheckbox, &hCheckbox);
|
||||
GetTextExtent(GetLabelText(str), &wCheckbox, &hCheckbox);
|
||||
wCheckbox += s_checkSize + GetCharWidth();
|
||||
|
||||
if ( hCheckbox < s_checkSize )
|
||||
|
@@ -495,7 +495,7 @@ wxSize wxRadioBox::GetTotalButtonSize(const wxSize& sizeBtn) const
|
||||
|
||||
// and also wide enough for its label
|
||||
int widthLabel;
|
||||
GetTextExtent(wxStripMenuCodes(GetLabel()), &widthLabel, NULL);
|
||||
GetTextExtent(GetLabelText(), &widthLabel, NULL);
|
||||
widthLabel += RADIO_SIZE; // FIXME this is bogus too
|
||||
if ( widthLabel > width )
|
||||
width = widthLabel;
|
||||
|
@@ -297,7 +297,7 @@ wxSize wxRadioButton::DoGetBestSize() const
|
||||
int wRadio, hRadio;
|
||||
if ( !str.empty() )
|
||||
{
|
||||
GetTextExtent(wxStripMenuCodes(str), &wRadio, &hRadio);
|
||||
GetTextExtent(GetLabelText(str), &wRadio, &hRadio);
|
||||
wRadio += s_radioSize + GetCharWidth();
|
||||
|
||||
if ( hRadio < s_radioSize )
|
||||
|
@@ -160,7 +160,7 @@ wxSize wxStaticBox::DoGetBestSize() const
|
||||
wxGetCharSize(GetHWND(), &cx, &cy, GetFont());
|
||||
|
||||
int wBox;
|
||||
GetTextExtent(wxStripMenuCodes(wxGetWindowText(m_hWnd)), &wBox, &cy);
|
||||
GetTextExtent(GetLabelText(wxGetWindowText(m_hWnd)), &wBox, &cy);
|
||||
|
||||
wBox += 3*cx;
|
||||
int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
|
||||
|
@@ -136,8 +136,7 @@ wxSize wxStaticText::DoGetBestSize() const
|
||||
dc.SetFont(font);
|
||||
|
||||
wxCoord widthTextMax, heightTextTotal;
|
||||
dc.GetMultiLineTextExtent(::wxStripMenuCodes(GetLabel()),
|
||||
&widthTextMax, &heightTextTotal);
|
||||
dc.GetMultiLineTextExtent(GetLabelText(), &widthTextMax, &heightTextTotal);
|
||||
|
||||
#ifdef __WXWINCE__
|
||||
if ( widthTextMax )
|
||||
|
@@ -114,7 +114,7 @@ wxSize wxToggleButton::DoGetBestSize() const
|
||||
{
|
||||
wxString label = wxGetWindowText(GetHWND());
|
||||
int wBtn;
|
||||
GetTextExtent(wxStripMenuCodes(label), &wBtn, NULL);
|
||||
GetTextExtent(GetLabelText(label), &wBtn, NULL);
|
||||
|
||||
int wChar, hChar;
|
||||
wxGetCharSize(GetHWND(), &wChar, &hChar, GetFont());
|
||||
|
Reference in New Issue
Block a user