#include <stdio.h>
#include "wx/setup.h"
#include "wx/radiobut.h"
+#include "wx/settings.h"
#include "wx/brush.h"
#endif
#include "wx/msw/private.h"
-#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
// IMPLEMENT_DYNAMIC_CLASS(wxBitmapRadioButton, wxRadioButton)
-#endif
bool wxRadioButton::MSWCommand(WXUINT param, WXWORD id)
{
{
wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId);
event.SetEventObject( this );
+ event.SetInt( GetValue() );
ProcessCommand(event);
return TRUE;
}
const wxString& name)
{
SetName(name);
+#if wxUSE_VALIDATORS
SetValidator(validator);
+#endif // wxUSE_VALIDATORS
if (parent) parent->AddChild(this);
groupStyle = WS_GROUP;
// long msStyle = groupStyle | RADIO_FLAGS;
- long msStyle = groupStyle | BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE ;
+ long msStyle = groupStyle | BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE /* | WS_CLIPSIBLINGS */;
bool want3D;
WXDWORD exStyle = Determine3DEffects(0, &want3D) ;
return (SendMessage((HWND) GetHWND(), BM_GETCHECK, 0, 0L) != 0);
}
+void wxRadioButton::Command (wxCommandEvent & event)
+{
+ SetValue ( (event.m_commandInt != 0) );
+ ProcessCommand (event);
+}
+
WXHBRUSH wxRadioButton::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
- WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
+ WXUINT message,
+ WXWPARAM wParam,
+ WXLPARAM lParam)
{
#if wxUSE_CTL3D
- if ( m_useCtl3D )
- {
- HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
- return (WXHBRUSH) hbrush;
- }
-#endif
+ if ( m_useCtl3D )
+ {
+ HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
+ return (WXHBRUSH) hbrush;
+ }
+#endif // wxUSE_CTL3D
- if (GetParent()->GetTransparentBackground())
- SetBkMode((HDC) pDC, TRANSPARENT);
- else
- SetBkMode((HDC) pDC, OPAQUE);
+ HDC hdc = (HDC)pDC;
+ if (GetParent()->GetTransparentBackground())
+ SetBkMode(hdc, TRANSPARENT);
+ else
+ SetBkMode(hdc, OPAQUE);
- ::SetBkColor((HDC) pDC, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
- ::SetTextColor((HDC) pDC, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
+ wxColour colBack = GetBackgroundColour();
- wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID);
+ if (!IsEnabled())
+ colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
- // Note that this will be cleaned up in wxApp::OnIdle, if backgroundBrush
- // has a zero usage count.
-// backgroundBrush->RealizeResource();
- return (WXHBRUSH) backgroundBrush->GetResourceHandle();
-}
+ ::SetBkColor(hdc, wxColourToRGB(colBack));
+ ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
-void wxRadioButton::Command (wxCommandEvent & event)
-{
- SetValue ( (event.m_commandInt != 0) );
- ProcessCommand (event);
-}
+ wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID);
+ return (WXHBRUSH)brush->GetResourceHandle();
+}
// Not implemented
#if 0