From 9f8130d6b3012265895fd69ce394c443c045b709 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 18 Jan 2006 16:16:36 +0000 Subject: [PATCH] Must strip menu codes from labels before measuring (fixes bug 1400552) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36971 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/button.cpp | 2 +- src/msw/checkbox.cpp | 2 +- src/msw/radiobox.cpp | 2 +- src/msw/radiobut.cpp | 2 +- src/msw/statbox.cpp | 2 +- src/msw/tglbtn.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/msw/button.cpp b/src/msw/button.cpp index e707738396..6b6f67aa65 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -218,7 +218,7 @@ wxSize wxButton::DoGetBestSize() const wxCoord wBtn, hBtn; - dc.GetMultiLineTextExtent(GetLabel(), &wBtn, &hBtn); + dc.GetMultiLineTextExtent(wxStripMenuCodes(GetLabel()), &wBtn, &hBtn); // add a margin -- the button is wider than just its label wBtn += 3*GetCharWidth(); diff --git a/src/msw/checkbox.cpp b/src/msw/checkbox.cpp index cd9dd38df8..32cfc4e50e 100644 --- a/src/msw/checkbox.cpp +++ b/src/msw/checkbox.cpp @@ -214,7 +214,7 @@ wxSize wxCheckBox::DoGetBestSize() const int wCheckbox, hCheckbox; if ( !str.IsEmpty() ) { - GetTextExtent(str, &wCheckbox, &hCheckbox); + GetTextExtent(wxStripMenuCodes(str), &wCheckbox, &hCheckbox); wCheckbox += s_checkSize + GetCharWidth(); if ( hCheckbox < s_checkSize ) diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 0fba4670c0..795df4f865 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -478,7 +478,7 @@ wxSize wxRadioBox::GetTotalButtonSize(const wxSize& sizeBtn) const // and also wide enough for its label int widthLabel; - GetTextExtent(GetLabel(), &widthLabel, NULL); + GetTextExtent(wxStripMenuCodes(GetLabel()), &widthLabel, NULL); widthLabel += RADIO_SIZE; // FIXME this is bogus too if ( widthLabel > width ) width = widthLabel; diff --git a/src/msw/radiobut.cpp b/src/msw/radiobut.cpp index e41f4cc7c0..42bbdc43e5 100644 --- a/src/msw/radiobut.cpp +++ b/src/msw/radiobut.cpp @@ -296,7 +296,7 @@ wxSize wxRadioButton::DoGetBestSize() const int wRadio, hRadio; if ( !str.empty() ) { - GetTextExtent(str, &wRadio, &hRadio); + GetTextExtent(wxStripMenuCodes(str), &wRadio, &hRadio); wRadio += s_radioSize + GetCharWidth(); if ( hRadio < s_radioSize ) diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 829976e363..07b6e67c9f 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -160,7 +160,7 @@ wxSize wxStaticBox::DoGetBestSize() const wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); int wBox; - GetTextExtent(wxGetWindowText(m_hWnd), &wBox, &cy); + GetTextExtent(wxStripMenuCodes(wxGetWindowText(m_hWnd)), &wBox, &cy); wBox += 3*cx; int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); diff --git a/src/msw/tglbtn.cpp b/src/msw/tglbtn.cpp index 55368ab31c..d9c7fd1245 100644 --- a/src/msw/tglbtn.cpp +++ b/src/msw/tglbtn.cpp @@ -114,7 +114,7 @@ wxSize wxToggleButton::DoGetBestSize() const { wxString label = wxGetWindowText(GetHWND()); int wBtn; - GetTextExtent(label, &wBtn, NULL); + GetTextExtent(wxStripMenuCodes(label), &wBtn, NULL); int wChar, hChar; wxGetCharSize(GetHWND(), &wChar, &hChar, GetFont());