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:
Vadim Zeitlin
2006-07-25 18:47:39 +00:00
parent 54076686b9
commit 32cd189dfc
22 changed files with 32 additions and 35 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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);

View File

@@ -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 );

View File

@@ -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;

View File

@@ -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 ) ;

View File

@@ -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 )

View File

@@ -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();

View File

@@ -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();

View File

@@ -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

View File

@@ -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(),

View File

@@ -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,

View File

@@ -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 );

View File

@@ -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 );

View File

@@ -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;

View File

@@ -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);

View File

@@ -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 )

View File

@@ -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;

View File

@@ -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 )

View File

@@ -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);

View File

@@ -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 )

View File

@@ -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());