X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f469584d643a59dab4545bb95020bf6188af1d69..4081eb6fe2de5eed5716459d09c8f4bed8eda92d:/src/msw/radiobut.cpp?ds=sidebyside diff --git a/src/msw/radiobut.cpp b/src/msw/radiobut.cpp index e88d6d7829..134a81dfe2 100644 --- a/src/msw/radiobut.cpp +++ b/src/msw/radiobut.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: msw/radiobut.cpp +// Name: src/msw/radiobut.cpp // Purpose: wxRadioButton // Author: Julian Smart // Modified by: @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "radiobut.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -30,8 +26,9 @@ #if wxUSE_RADIOBTN +#include "wx/radiobut.h" + #ifndef WX_PRECOMP - #include "wx/radiobut.h" #include "wx/settings.h" #include "wx/dcscreen.h" #endif @@ -168,7 +165,7 @@ void wxRadioButton::SetValue(bool value) // buttons in the same group: Windows doesn't do it automatically if ( m_isChecked ) { - // If another radiobutton in the group currently has the focus, we have to + // If another radiobutton in the group currently has the focus, we have to // set it to this radiobutton, else the old readiobutton will be reselected // automatically, if a parent window loses the focus and regains it. bool shouldSetFocus = false; @@ -193,7 +190,7 @@ void wxRadioButton::SetValue(bool value) // A wxRB_SINGLE button isn't part of this group break; } - + if (btn) { if (btn == pFocusWnd) @@ -293,6 +290,13 @@ wxSize wxRadioButton::DoGetBestSize() const dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); s_radioSize = dc.GetCharHeight(); + + // radio button bitmap size under CE is bigger than the font height, + // adding just one pixel seems to work fine for the default font but it + // would be nice to find some better way to find the correct height +#ifdef __WXWINCE__ + s_radioSize++; +#endif // __WXWINCE__ } wxString str = GetLabel(); @@ -300,7 +304,7 @@ wxSize wxRadioButton::DoGetBestSize() const int wRadio, hRadio; if ( !str.empty() ) { - GetTextExtent(str, &wRadio, &hRadio); + GetTextExtent(GetLabelText(str), &wRadio, &hRadio); wRadio += s_radioSize + GetCharWidth(); if ( hRadio < s_radioSize ) @@ -312,8 +316,19 @@ wxSize wxRadioButton::DoGetBestSize() const hRadio = s_radioSize; } - return wxSize(wRadio, hRadio); + wxSize best(wRadio, hRadio); + CacheBestSize(best); + return best; } -#endif // wxUSE_RADIOBTN +WXDWORD wxRadioButton::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + WXDWORD styleMSW = wxControl::MSWGetStyle(style, exstyle); + + if ( style & wxRB_GROUP ) + styleMSW |= WS_GROUP; + return styleMSW; +} + +#endif // wxUSE_RADIOBTN