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