X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2faefb26a40d694676e64813772b0bc132ea9d62..50ef256ed3e52defe91655da5e3f6a9e913c9e2a:/src/msw/radiobut.cpp?ds=sidebyside diff --git a/src/msw/radiobut.cpp b/src/msw/radiobut.cpp index 32cf7fe87e..0117ba49f1 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/brush.h" #endif #include "wx/msw/private.h" @@ -33,6 +34,18 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl) // IMPLEMENT_DYNAMIC_CLASS(wxBitmapRadioButton, wxRadioButton) #endif +bool wxRadioButton::MSWCommand(WXUINT param, WXWORD id) +{ + if (param == BN_CLICKED) + { + wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId); + event.SetEventObject( this ); + ProcessCommand(event); + return TRUE; + } + else return FALSE; +} + bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, @@ -65,7 +78,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, groupStyle = WS_GROUP; // long msStyle = groupStyle | RADIO_FLAGS; - long msStyle = groupStyle | BS_RADIOBUTTON | WS_CHILD | WS_VISIBLE ; + long msStyle = groupStyle | BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE ; bool want3D; WXDWORD exStyle = Determine3DEffects(0, &want3D) ; @@ -83,7 +96,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, wxCHECK_MSG( m_hWnd, FALSE, "Failed to create radiobutton" ); -#if CTL3D +#if wxUSE_CTL3D if (want3D) { Ctl3dSubclassCtl((HWND) m_hWnd); @@ -91,7 +104,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, } #endif - SetFont(* parent->GetFont()); + SetFont(parent->GetFont()); // Subclass again for purposes of dialog editing mode SubclassWin((WXHWND)m_hWnd); @@ -102,7 +115,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, if (label != "") { int label_width, label_height; - GetTextExtent(label, &label_width, &label_height, NULL, NULL, GetFont()); + GetTextExtent(label, &label_width, &label_height, NULL, NULL, & this->GetFont()); if (width < 0) width = (int)(label_width + RADIO_SIZE); if (height<0) @@ -138,16 +151,16 @@ void wxRadioButton::SetValue(bool value) SendMessage((HWND) GetHWND(), BM_SETCHECK, (WPARAM)value, 0L); } -// Get single selection, for single choice list items +// Get single selection bool wxRadioButton::GetValue(void) const { - return (SendMessage((HWND) GetHWND(), BM_SETCHECK, 0, 0L) != 0); + return (SendMessage((HWND) GetHWND(), BM_GETCHECK, 0, 0L) != 0); } WXHBRUSH wxRadioButton::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, WXUINT message, WXWPARAM wParam, WXLPARAM lParam) { -#if CTL3D +#if wxUSE_CTL3D if ( m_useCtl3D ) { HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); @@ -218,7 +231,7 @@ bool wxBitmapRadioButton::Create(wxWindow *parent, wxWindowID id, wxCHECK_MSG( m_hWnd, "Failed to create radio button", FALSE ); -#if CTL3D +#if wxUSE_CTL3D if (!(GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS)) { Ctl3dSubclassCtl((HWND) GetHWND());