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
This commit is contained in:
parent
90c4e038d0
commit
9f8130d6b3
@ -218,7 +218,7 @@ wxSize wxButton::DoGetBestSize() const
|
|||||||
|
|
||||||
wxCoord wBtn,
|
wxCoord wBtn,
|
||||||
hBtn;
|
hBtn;
|
||||||
dc.GetMultiLineTextExtent(GetLabel(), &wBtn, &hBtn);
|
dc.GetMultiLineTextExtent(wxStripMenuCodes(GetLabel()), &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();
|
||||||
|
@ -214,7 +214,7 @@ wxSize wxCheckBox::DoGetBestSize() const
|
|||||||
int wCheckbox, hCheckbox;
|
int wCheckbox, hCheckbox;
|
||||||
if ( !str.IsEmpty() )
|
if ( !str.IsEmpty() )
|
||||||
{
|
{
|
||||||
GetTextExtent(str, &wCheckbox, &hCheckbox);
|
GetTextExtent(wxStripMenuCodes(str), &wCheckbox, &hCheckbox);
|
||||||
wCheckbox += s_checkSize + GetCharWidth();
|
wCheckbox += s_checkSize + GetCharWidth();
|
||||||
|
|
||||||
if ( hCheckbox < s_checkSize )
|
if ( hCheckbox < s_checkSize )
|
||||||
|
@ -478,7 +478,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(GetLabel(), &widthLabel, NULL);
|
GetTextExtent(wxStripMenuCodes(GetLabel()), &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;
|
||||||
|
@ -296,7 +296,7 @@ wxSize wxRadioButton::DoGetBestSize() const
|
|||||||
int wRadio, hRadio;
|
int wRadio, hRadio;
|
||||||
if ( !str.empty() )
|
if ( !str.empty() )
|
||||||
{
|
{
|
||||||
GetTextExtent(str, &wRadio, &hRadio);
|
GetTextExtent(wxStripMenuCodes(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(wxGetWindowText(m_hWnd), &wBox, &cy);
|
GetTextExtent(wxStripMenuCodes(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);
|
||||||
|
@ -114,7 +114,7 @@ wxSize wxToggleButton::DoGetBestSize() const
|
|||||||
{
|
{
|
||||||
wxString label = wxGetWindowText(GetHWND());
|
wxString label = wxGetWindowText(GetHWND());
|
||||||
int wBtn;
|
int wBtn;
|
||||||
GetTextExtent(label, &wBtn, NULL);
|
GetTextExtent(wxStripMenuCodes(label), &wBtn, NULL);
|
||||||
|
|
||||||
int wChar, hChar;
|
int wChar, hChar;
|
||||||
wxGetCharSize(GetHWND(), &wChar, &hChar, GetFont());
|
wxGetCharSize(GetHWND(), &wChar, &hChar, GetFont());
|
||||||
|
Loading…
Reference in New Issue
Block a user