/////////////////////////////////////////////////////////////////////////////
-// Name: radiobut.cpp
+// Name: msw/radiobut.cpp
// Purpose: wxRadioButton
// Author: Julian Smart
// Modified by:
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
-#pragma implementation "radiobut.h"
+ #pragma implementation "radiobut.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
+#if wxUSE_RADIOBTN
+
#ifndef WX_PRECOMP
-#include <stdio.h>
-#include "wx/setup.h"
-#include "wx/radiobut.h"
-#include "wx/brush.h"
+ #include "wx/radiobut.h"
+ #include "wx/settings.h"
+ #include "wx/brush.h"
#endif
#include "wx/msw/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
// IMPLEMENT_DYNAMIC_CLASS(wxBitmapRadioButton, wxRadioButton)
-bool wxRadioButton::MSWCommand(WXUINT param, WXWORD id)
+bool wxRadioButton::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
{
if (param == BN_CLICKED)
{
wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId);
event.SetEventObject( this );
+ event.SetInt( GetValue() );
ProcessCommand(event);
return TRUE;
}
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 */;
+
+ if ( m_windowStyle & wxCLIP_SIBLINGS )
+ msStyle |= WS_CLIPSIBLINGS;
+
bool want3D;
WXDWORD exStyle = Determine3DEffects(0, &want3D) ;
SetSize(x, y, width, height);
+ // for compatibility with wxGTK, the first radio button in a group is
+ // always checked (this makes sense anyhow as you need to ensure that at
+ // least one button in the group is checked and this is the simlpest way to
+ // do it)
+ if ( m_windowStyle & wxRB_GROUP )
+ SetValue(TRUE);
+
return TRUE;
}
ProcessCommand (event);
}
+WXHBRUSH wxRadioButton::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
+#if wxUSE_CTL3D
+ WXUINT message,
+ WXWPARAM wParam,
+ WXLPARAM lParam
+#else
+ WXUINT WXUNUSED(message),
+ WXWPARAM WXUNUSED(wParam),
+ WXLPARAM WXUNUSED(lParam)
+#endif
+ )
+{
+#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();
+}
// Not implemented
#if 0
}
#endif
+
+#endif // wxUSE_RADIOBTN