X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/11b6a93b1e078fea5bf49ed9e6628a19849c11b3..097aeb99031e36e4306926d652e4bcccda8b71cb:/src/msw/radiobut.cpp diff --git a/src/msw/radiobut.cpp b/src/msw/radiobut.cpp index 0f7b1dc92e..261af8c3d3 100644 --- a/src/msw/radiobut.cpp +++ b/src/msw/radiobut.cpp @@ -24,6 +24,7 @@ #include #include "wx/setup.h" #include "wx/radiobut.h" +#include "wx/settings.h" #include "wx/brush.h" #endif @@ -38,6 +39,7 @@ 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; } @@ -78,7 +80,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, 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) ; @@ -136,6 +138,13 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, 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; } @@ -163,6 +172,37 @@ void wxRadioButton::Command (wxCommandEvent & event) ProcessCommand (event); } +WXHBRUSH wxRadioButton::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(); +} // Not implemented #if 0