+
+ // Create a dummy radio control to end the group.
+ m_dummyId = NewControlId();
+
+ m_dummyHwnd = (WXHWND)::CreateWindow(wxT("BUTTON"),
+ wxEmptyString,
+ WS_GROUP | BS_AUTORADIOBUTTON | WS_CHILD,
+ 0, 0, 0, 0, GetHwndOf(parent),
+ (HMENU)wxUIntToPtr(m_dummyId.GetValue()),
+ wxGetInstance(), NULL);
+
+
+ m_radioButtons->SetFont(GetFont());
+
+#ifdef __WXWINCE__
+ // Set the z-order correctly
+ SetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+#endif
+
+ SetMajorDim(majorDim == 0 ? n : majorDim, style);
+ SetSelection(0);
+ SetSize(pos.x, pos.y, size.x, size.y);
+
+ // Now that we have items determine what is the best size and set it.
+ SetInitialSize(size);
+
+ return true;
+}
+
+bool wxRadioBox::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ int majorDim,
+ long style,
+ const wxValidator& val,
+ const wxString& name)
+{
+ wxCArrayString chs(choices);
+ return Create(parent, id, title, pos, size, chs.GetCount(),
+ chs.GetStrings(), majorDim, style, val, name);
+}
+
+wxRadioBox::~wxRadioBox()
+{
+ SendDestroyEvent();
+
+ delete m_radioButtons;
+ if ( m_dummyHwnd )
+ DestroyWindow((HWND)m_dummyHwnd);
+ delete[] m_radioWidth;
+ delete[] m_radioHeight;
+}
+
+// NB: if this code is changed, wxGetWindowForHWND() which relies on having the
+// radiobox pointer in GWL_USERDATA for radio buttons must be updated too!
+void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn)
+{
+ HWND hwndBtn = (HWND)hWndBtn;
+
+ if ( !s_wndprocRadioBtn )
+ s_wndprocRadioBtn = (WXFARPROC)wxGetWindowProc(hwndBtn);
+
+ wxSetWindowProc(hwndBtn, wxRadioBtnWndProc);
+ wxSetWindowUserData(hwndBtn, this);