X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8ad6ad991c39081d513f7d277bd3509fbbaa42fc..0767cb6f445806aaddd49014dca21d39cb4b3688:/src/msw/radiobox.cpp diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index f91948a2db..08a5e32134 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -32,15 +32,16 @@ #include "wx/bitmap.h" #include "wx/brush.h" #include "wx/radiobox.h" + #include "wx/settings.h" #include "wx/log.h" #endif #include "wx/msw/private.h" #if wxUSE_TOOLTIPS -// #ifndef __GNUWIN32__ + #ifndef __GNUWIN32_OLD__ #include -// #endif + #endif #include "wx/tooltip.h" #endif // wxUSE_TOOLTIPS @@ -85,7 +86,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hWnd, // --------------------------------------------------------------------------- // the pointer to standard radio button wnd proc -static WNDPROC s_wndprocRadioBtn = (WNDPROC)NULL; +static WXFARPROC s_wndprocRadioBtn = (WXFARPROC)NULL; #endif // __WIN32__ @@ -125,6 +126,9 @@ bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id) { if ( cmd == BN_CLICKED ) { + if (id == GetId()) + return TRUE; + int selectedButton = -1; for ( int i = 0; i < m_noItems; i++ ) @@ -251,7 +255,7 @@ bool wxRadioBox::Create(wxWindow *parent, if ( !hwndBtn ) { - wxLogLastError("CreateWindow(radio btn)"); + wxLogLastError(wxT("CreateWindow(radio btn)")); return FALSE; } @@ -688,7 +692,7 @@ void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn) HWND hwndBtn = (HWND)hWndBtn; if ( !s_wndprocRadioBtn ) - s_wndprocRadioBtn = (WNDPROC)::GetWindowLong(hwndBtn, GWL_WNDPROC); + s_wndprocRadioBtn = (WXFARPROC)::GetWindowLong(hwndBtn, GWL_WNDPROC); ::SetWindowLong(hwndBtn, GWL_WNDPROC, (long)wxRadioBtnWndProc); ::SetWindowLong(hwndBtn, GWL_USERDATA, (long)this); @@ -716,11 +720,12 @@ bool wxRadioBox::SetFont(const wxFont& font) WXHFONT hfont = wxFont(font).GetResourceHandle(); for ( int n = 0; n < m_noItems; n++ ) { - ::SendMessage((HWND)m_radioButtons[n], WM_SETFONT, (WPARAM)hfont, 0L); - } + HWND hwndBtn = (HWND)m_radioButtons[n]; + ::SendMessage(hwndBtn, WM_SETFONT, (WPARAM)hfont, 0L); - // this is needed because otherwise the buttons are not redrawn correctly - Refresh(); + // otherwise the buttons are not redrawn correctly + ::InvalidateRect(hwndBtn, NULL, FALSE /* don't erase bg */); + } return TRUE; } @@ -769,6 +774,39 @@ long wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) return wxControl::MSWWindowProc(nMsg, wParam, lParam); } +WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) +{ +#if wxUSE_CTL3D + if ( m_useCtl3D ) + { + HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); + return (WXHBRUSH) hbrush; + } +#endif // wxUSE_CTL3D + + HDC hdc = (HDC)pDC; + if (GetParent()->GetTransparentBackground()) + SetBkMode(hdc, TRANSPARENT); + else + SetBkMode(hdc, OPAQUE); + + wxColour colBack = GetBackgroundColour(); + + if (!IsEnabled()) + colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); + + ::SetBkColor(hdc, wxColourToRGB(colBack)); + ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); + + wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); + + return (WXHBRUSH)brush->GetResourceHandle(); +} + + // --------------------------------------------------------------------------- // window proc for radio buttons // --------------------------------------------------------------------------- @@ -789,7 +827,6 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd, { long lDlgCode = ::CallWindowProc(CASTWNDPROC s_wndprocRadioBtn, hwnd, message, wParam, lParam); - //CallWindowProc(CASTWNDPROC gs_wndprocToolTip, hwndTT, msg, wParam, lParam); return lDlgCode | DLGC_WANTARROWS; } @@ -875,8 +912,6 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd, } return ::CallWindowProc(CASTWNDPROC s_wndprocRadioBtn, hwnd, message, wParam, lParam); - - } #endif // __WIN32__