#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 <commctrl.h>
-// #endif
+ #endif
#include "wx/tooltip.h"
#endif // wxUSE_TOOLTIPS
// ---------------------------------------------------------------------------
// the pointer to standard radio button wnd proc
-static WNDPROC s_wndprocRadioBtn = (WNDPROC)NULL;
+static WXFARPROC s_wndprocRadioBtn = (WXFARPROC)NULL;
#endif // __WIN32__
{
if ( cmd == BN_CLICKED )
{
+ if (id == GetId())
+ return TRUE;
+
int selectedButton = -1;
for ( int i = 0; i < m_noItems; i++ )
if ( !hwndBtn )
{
- wxLogLastError("CreateWindow(radio btn)");
+ wxLogLastError(wxT("CreateWindow(radio btn)"));
return FALSE;
}
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);
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;
}
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
// ---------------------------------------------------------------------------
{
long lDlgCode = ::CallWindowProc(CASTWNDPROC s_wndprocRadioBtn, hwnd,
message, wParam, lParam);
- //CallWindowProc(CASTWNDPROC gs_wndprocToolTip, hwndTT, msg, wParam, lParam);
return lDlgCode | DLGC_WANTARROWS;
}
}
return ::CallWindowProc(CASTWNDPROC s_wndprocRadioBtn, hwnd, message, wParam, lParam);
-
-
}
#endif // __WIN32__