-void wxRadioBox::GetSize(int *width, int *height) const
-{
- RECT rect;
- rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
-
- if (m_hWnd)
- wxFindMaxSize(m_hWnd, &rect);
-
- int i;
- for (i = 0; i < m_noItems; i++)
- wxFindMaxSize(m_radioButtons[i], &rect);
-
- *width = rect.right - rect.left;
- *height = rect.bottom - rect.top;
-}
-
-void wxRadioBox::GetPosition(int *x, int *y) const
-{
- wxWindow *parent = GetParent();
- RECT rect = { -1, -1, -1, -1 };
-
- int i;
- for (i = 0; i < m_noItems; i++)
- wxFindMaxSize(m_radioButtons[i], &rect);
-
- if (m_hWnd)
- wxFindMaxSize(m_hWnd, &rect);
-
- // Since we now have the absolute screen coords, if there's a parent we
- // must subtract its top left corner
- POINT point;
- point.x = rect.left;
- point.y = rect.top;
- if (parent)
- {
- ::ScreenToClient((HWND) parent->GetHWND(), &point);
- }
-
- // We may be faking the client origin. So a window that's really at (0, 30)
- // may appear (to wxWin apps) to be at (0, 0).
- if (GetParent())
- {
- wxPoint pt(GetParent()->GetClientAreaOrigin());
- point.x -= pt.x;
- point.y -= pt.y;
- }
-
- *x = point.x;
- *y = point.y;
-}
-
-void wxRadioBox::SetFocus()
-{
- if (m_noItems > 0)
- {
- if (m_selectedButton == -1)
- ::SetFocus((HWND) m_radioButtons[0]);
- else
- ::SetFocus((HWND) m_radioButtons[m_selectedButton]);
- }
-
-}
-
-bool wxRadioBox::Show(bool show)
-{
- if ( !wxControl::Show(show) )
- return FALSE;
-
- int nCmdShow = show ? SW_SHOW : SW_HIDE;
- for ( int i = 0; i < m_noItems; i++ )
- {
- ::ShowWindow((HWND)m_radioButtons[i], nCmdShow);
- }
-
- return TRUE;
-}
-
-// Enable a specific button
-void wxRadioBox::Enable(int item, bool enable)
-{
- wxCHECK_RET( item >= 0 && item < m_noItems,
- wxT("invalid item in wxRadioBox::Enable()") );
-
- ::EnableWindow((HWND) m_radioButtons[item], enable);
-}
-
-// Enable all controls
-bool wxRadioBox::Enable(bool enable)
-{
- if ( !wxControl::Enable(enable) )
- return FALSE;
-
- for (int i = 0; i < m_noItems; i++)
- ::EnableWindow((HWND) m_radioButtons[i], enable);
-
- return TRUE;
-}
-
-// Show a specific button
-void wxRadioBox::Show(int item, bool show)
-{
- wxCHECK_RET( item >= 0 && item < m_noItems,
- wxT("invalid item in wxRadioBox::Show()") );
-
- ::ShowWindow((HWND)m_radioButtons[item], show ? SW_SHOW : SW_HIDE);
-}
-
-bool wxRadioBox::ContainsHWND(WXHWND hWnd) const
-{
- size_t count = GetCount();
- for ( size_t i = 0; i < count; i++ )
- {
- if ( GetRadioButtons()[i] == hWnd )
- return TRUE;
- }
-
- return FALSE;
-}
-
-void wxRadioBox::Command(wxCommandEvent & event)
-{
- SetSelection (event.m_commandInt);
- ProcessCommand (event);
-}
-
-// 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)
-{
- // No GWL_USERDATA in Win16, so omit this subclassing.
-#ifdef __WIN32__
- HWND hwndBtn = (HWND)hWndBtn;
-
- if ( !s_wndprocRadioBtn )
- s_wndprocRadioBtn = (WXFARPROC)::GetWindowLong(hwndBtn, GWL_WNDPROC);
-
- ::SetWindowLong(hwndBtn, GWL_WNDPROC, (long)wxRadioBtnWndProc);
- ::SetWindowLong(hwndBtn, GWL_USERDATA, (long)this);
-#endif // __WIN32__
-}
-
-void wxRadioBox::SendNotificationEvent()
-{
- wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId);
- event.SetInt( m_selectedButton );
- event.SetString( GetString(m_selectedButton) );
- event.SetEventObject( this );
- ProcessCommand(event);
-}
-
-bool wxRadioBox::SetFont(const wxFont& font)