-wxRadioBox::wxRadioBox(void)
-{
- m_selectedButton = -1;
- m_noItems = 0;
- m_noRowsOrCols = 0;
- m_radioButtons = NULL;
- m_majorDim = 0 ;
- m_radioWidth = NULL ;
- m_radioHeight = NULL ;
-}
-
-bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
- const wxPoint& pos, const wxSize& size,
- int n, const wxString choices[],
- int majorDim, long style,
- const wxValidator& val, const wxString& name)
-{
- m_selectedButton = -1;
- m_noItems = n;
-
- SetName(name);
- SetValidator(val);
-
- parent->AddChild(this);
- m_backgroundColour = parent->GetDefaultBackgroundColour() ;
- m_foregroundColour = parent->GetDefaultForegroundColour() ;
-
- m_windowStyle = (long&)style;
-
- int x = pos.x;
- int y = pos.y;
- int width = size.x;
- int height = size.y;
-
- if (id == -1)
- m_windowId = NewControlId();
- else
- m_windowId = id;
-
- m_noRowsOrCols = majorDim;
- if (majorDim==0)
- m_majorDim = n ;
- else // Seemed to make sense to put this 'else' here... (RD)
- m_majorDim = majorDim ;
-
- long msStyle = GROUP_FLAGS;
-
- bool want3D;
- WXDWORD exStyle = Determine3DEffects(0, &want3D) ;
- // Even with extended styles, need to combine with WS_BORDER
- // for them to look right.
- if (want3D && ((m_windowStyle & wxSIMPLE_BORDER) || (m_windowStyle & wxRAISED_BORDER) ||
- (m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER)))
- msStyle |= WS_BORDER;
-
-
- m_hWnd = (WXHWND) CreateWindowEx((DWORD) exStyle, GROUP_CLASS, (title == "" ? NULL : (const char *)title),
- msStyle,
- 0,0,0,0,
- (HWND) parent->GetHWND(), (HMENU) m_windowId, wxGetInstance(), NULL) ;
-
- HWND the_handle = (HWND) parent->GetHWND() ;
-
-#if CTL3D
- if (want3D)
- {
- Ctl3dSubclassCtl((HWND) m_hWnd);
- m_useCtl3D = TRUE;
- }
-#endif
-
- SetFont(* parent->GetFont());
-
- SubclassWin((WXHWND)m_hWnd);
-
- // Some radio boxes test consecutive id.
- (void)NewControlId() ;
- m_radioButtons = new WXHWND[n];
- m_radioWidth = new int[n] ;
- m_radioHeight = new int[n] ;
- int i;
- for (i = 0; i < n; i++)
- {
- m_radioWidth[i] = m_radioHeight[i] = -1 ;
- long groupStyle = 0;
- if (i == 0 && style==0)
- groupStyle = WS_GROUP;
- long newId = NewControlId();
- long msStyle = groupStyle | RADIO_FLAGS;
-
- m_radioButtons[i] = (WXHWND) CreateWindowEx(exStyle, RADIO_CLASS, choices[i],
- msStyle,0,0,0,0,
- the_handle, (HMENU)newId, wxGetInstance(), NULL);
-#if CTL3D
- if (want3D)
- {
- Ctl3dSubclassCtl((HWND) m_hWnd);
- m_useCtl3D = TRUE;
- }
-#endif
- if (GetFont())
- {
- SendMessage((HWND)m_radioButtons[i],WM_SETFONT,
- (WPARAM)GetFont()->GetResourceHandle(),0L);
- }
- m_subControls.Append((wxObject *)newId);
- }
-
- // Create a dummy radio control to end the group.
- (void)CreateWindowEx(0, RADIO_CLASS, "", WS_GROUP|RADIO_FLAGS, 0,0,0,0, the_handle, (HMENU)NewControlId(), wxGetInstance(), NULL);
-
- SetSelection(0);
-
- SetSize(x, y, width, height);
-
- return TRUE;