1 /////////////////////////////////////////////////////////////////////////////
2 // Name: msw/radiobox.cpp
3 // Purpose: wxRadioBox implementation
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ===========================================================================
14 // ===========================================================================
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
21 #pragma implementation "radiobox.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
32 #include "wx/bitmap.h"
34 #include "wx/radiobox.h"
35 #include "wx/settings.h"
39 #include "wx/msw/private.h"
42 #ifndef __GNUWIN32_OLD__
45 #include "wx/tooltip.h"
46 #endif // wxUSE_TOOLTIPS
48 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox
, wxControl
)
50 // there are two possible ways to create the radio buttons: either as children
51 // of the radiobox or as siblings of it - allow playing with both variants for
52 // now, eventually we will choose the best one for our purposes
54 // two main problems are the keyboard navigation inside the radiobox (arrows
55 // should switch between buttons, not pass focus to the next control) and the
56 // tooltips - a tooltip is associated with the radiobox itself, not the
59 // the problems with setting this to 1:
60 // a) Alt-<mnemonic of radiobox> isn't handled properly by IsDialogMessage()
61 // because it sets focus to the next control accepting it which is not a
62 // radio button but a radiobox sibling in this case - the only solution to
63 // this would be to handle Alt-<mnemonic> ourselves
64 // b) the problems with setting radiobox colours under Win98/2K were reported
65 // but I couldn't reproduce it so I have no idea about what causes it
67 // the problems with setting this to 0:
68 // a) the tooltips are not shown for the radiobox - possible solution: make
69 // TTM_WINDOWFROMPOS handling code in msw/tooltip.cpp work (easier said than
70 // done because I don't know why it doesn't work)
71 #define RADIOBTN_PARENT_IS_RADIOBOX 0
73 // ---------------------------------------------------------------------------
75 // ---------------------------------------------------------------------------
77 // wnd proc for radio buttons
79 LRESULT APIENTRY _EXPORT
wxRadioBtnWndProc(HWND hWnd
,
84 // ---------------------------------------------------------------------------
86 // ---------------------------------------------------------------------------
88 // the pointer to standard radio button wnd proc
89 static WXFARPROC s_wndprocRadioBtn
= (WXFARPROC
)NULL
;
93 // ===========================================================================
95 // ===========================================================================
97 // ---------------------------------------------------------------------------
99 // ---------------------------------------------------------------------------
101 // returns the number of rows
102 int wxRadioBox::GetNumVer() const
104 if ( m_windowStyle
& wxRA_SPECIFY_ROWS
)
110 return (m_noItems
+ m_majorDim
- 1)/m_majorDim
;
114 // returns the number of columns
115 int wxRadioBox::GetNumHor() const
117 if ( m_windowStyle
& wxRA_SPECIFY_ROWS
)
119 return (m_noItems
+ m_majorDim
- 1)/m_majorDim
;
127 bool wxRadioBox::MSWCommand(WXUINT cmd
, WXWORD id
)
129 if ( cmd
== BN_CLICKED
)
134 int selectedButton
= -1;
136 for ( int i
= 0; i
< m_noItems
; i
++ )
138 if ( id
== wxGetWindowId(m_radioButtons
[i
]) )
146 if ( selectedButton
== -1 )
148 // just ignore it - due to a hack with WM_NCHITTEST handling in our
149 // wnd proc, we can receive dummy click messages when we click near
150 // the radiobox edge (this is ugly but Julian wouldn't let me get
155 if ( selectedButton
!= m_selectedButton
)
157 m_selectedButton
= selectedButton
;
159 SendNotificationEvent();
161 //else: don't generate events when the selection doesn't change
169 #if WXWIN_COMPATIBILITY
170 wxRadioBox::wxRadioBox(wxWindow
*parent
, wxFunction func
, const char *title
,
171 int x
, int y
, int width
, int height
,
172 int n
, char **choices
,
173 int majorDim
, long style
, const char *name
)
175 wxString
*choices2
= new wxString
[n
];
176 for ( int i
= 0; i
< n
; i
++) choices2
[i
] = choices
[i
];
177 Create(parent
, -1, title
, wxPoint(x
, y
), wxSize(width
, height
), n
, choices2
, majorDim
, style
,
178 wxDefaultValidator
, name
);
183 #endif // WXWIN_COMPATIBILITY
186 wxRadioBox::wxRadioBox()
188 m_selectedButton
= -1;
191 m_radioButtons
= NULL
;
194 m_radioHeight
= NULL
;
197 bool wxRadioBox::Create(wxWindow
*parent
,
199 const wxString
& title
,
203 const wxString choices
[],
206 const wxValidator
& val
,
207 const wxString
& name
)
209 // initialize members
210 m_selectedButton
= -1;
213 m_majorDim
= majorDim
== 0 ? n
: majorDim
;
214 m_noRowsOrCols
= majorDim
;
216 // common initialization
217 if ( !CreateControl(parent
, id
, pos
, size
, style
, val
, name
) )
220 // create the static box
221 if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX
| WS_GROUP
,
222 pos
, size
, title
, 0) )
225 // and now create the buttons
227 #if RADIOBTN_PARENT_IS_RADIOBOX
228 HWND hwndParent
= GetHwnd();
230 HWND hwndParent
= GetHwndOf(parent
);
233 // Some radio boxes test consecutive id.
234 (void)NewControlId();
235 m_radioButtons
= new WXHWND
[n
];
236 m_radioWidth
= new int[n
];
237 m_radioHeight
= new int[n
];
240 wxFont
& font
= GetFont();
243 hfont
= font
.GetResourceHandle();
246 for ( int i
= 0; i
< n
; i
++ )
249 m_radioHeight
[i
] = -1;
250 long styleBtn
= BS_AUTORADIOBUTTON
| WS_TABSTOP
| WS_CHILD
| WS_VISIBLE
;
251 if ( i
== 0 && style
== 0 )
252 styleBtn
|= WS_GROUP
;
254 long newId
= NewControlId();
256 HWND hwndBtn
= ::CreateWindow(_T("BUTTON"),
259 0, 0, 0, 0, // will be set in SetSize()
267 wxLogLastError(wxT("CreateWindow(radio btn)"));
272 m_radioButtons
[i
] = (WXHWND
)hwndBtn
;
274 SubclassRadioButton((WXHWND
)hwndBtn
);
278 ::SendMessage(hwndBtn
, WM_SETFONT
, (WPARAM
)hfont
, 0L);
281 m_subControls
.Add(newId
);
284 // Create a dummy radio control to end the group.
285 (void)::CreateWindow(_T("BUTTON"),
287 WS_GROUP
| BS_AUTORADIOBUTTON
| WS_CHILD
,
288 0, 0, 0, 0, hwndParent
,
289 (HMENU
)NewControlId(), wxGetInstance(), NULL
);
293 SetSize(pos
.x
, pos
.y
, size
.x
, size
.y
);
298 wxRadioBox::~wxRadioBox()
300 m_isBeingDeleted
= TRUE
;
305 for (i
= 0; i
< m_noItems
; i
++)
306 ::DestroyWindow((HWND
)m_radioButtons
[i
]);
307 delete[] m_radioButtons
;
311 delete[] m_radioWidth
;
313 delete[] m_radioHeight
;
317 wxString
wxRadioBox::GetLabel(int item
) const
319 wxCHECK_MSG( item
>= 0 && item
< m_noItems
, wxT(""), wxT("invalid radiobox index") );
321 return wxGetWindowText(m_radioButtons
[item
]);
324 void wxRadioBox::SetLabel(int item
, const wxString
& label
)
326 wxCHECK_RET( item
>= 0 && item
< m_noItems
, wxT("invalid radiobox index") );
328 m_radioWidth
[item
] = m_radioHeight
[item
] = -1;
329 SetWindowText((HWND
)m_radioButtons
[item
], label
.c_str());
332 void wxRadioBox::SetLabel(int item
, wxBitmap
*bitmap
)
335 m_radioWidth[item] = bitmap->GetWidth() + FB_MARGIN;
336 m_radioHeight[item] = bitmap->GetHeight() + FB_MARGIN;
338 wxFAIL_MSG(wxT("not implemented"));
341 int wxRadioBox::FindString(const wxString
& s
) const
343 for (int i
= 0; i
< m_noItems
; i
++)
345 if ( s
== wxGetWindowText(m_radioButtons
[i
]) )
352 void wxRadioBox::SetSelection(int N
)
354 wxCHECK_RET( (N
>= 0) && (N
< m_noItems
), wxT("invalid radiobox index") );
356 // Following necessary for Win32s, because Win32s translate BM_SETCHECK
357 if (m_selectedButton
>= 0 && m_selectedButton
< m_noItems
)
358 ::SendMessage((HWND
) m_radioButtons
[m_selectedButton
], BM_SETCHECK
, 0, 0L);
360 ::SendMessage((HWND
)m_radioButtons
[N
], BM_SETCHECK
, 1, 0L);
361 ::SetFocus((HWND
)m_radioButtons
[N
]);
363 m_selectedButton
= N
;
366 // Get single selection, for single choice list items
367 int wxRadioBox::GetSelection() const
369 return m_selectedButton
;
372 // Find string for position
373 wxString
wxRadioBox::GetString(int N
) const
375 return wxGetWindowText(m_radioButtons
[N
]);
378 // ----------------------------------------------------------------------------
380 // ----------------------------------------------------------------------------
382 wxSize
wxRadioBox::GetMaxButtonSize() const
384 // calculate the max button size
387 for ( int i
= 0 ; i
< m_noItems
; i
++ )
390 if ( m_radioWidth
[i
] < 0 )
392 GetTextExtent(wxGetWindowText(m_radioButtons
[i
]), &width
, &height
);
394 // adjust the size to take into account the radio box itself
395 // FIXME this is totally bogus!
402 width
= m_radioWidth
[i
];
403 height
= m_radioHeight
[i
];
406 if ( widthMax
< width
)
408 if ( heightMax
< height
)
412 return wxSize(widthMax
, heightMax
);
415 wxSize
wxRadioBox::GetTotalButtonSize(const wxSize
& sizeBtn
) const
417 // the radiobox should be big enough for its buttons
419 wxGetCharSize(m_hWnd
, &cx1
, &cy1
, &GetFont());
421 int extraHeight
= cy1
;
423 #if defined(CTL3D) && !CTL3D
424 // Requires a bigger group box in plain Windows
429 int height
= GetNumVer() * sizeBtn
.y
+ cy1
/2 + extraHeight
;
430 int width
= GetNumHor() * (sizeBtn
.x
+ cx1
) + cx1
;
432 // and also wide enough for its label
434 GetTextExtent(GetTitle(), &widthLabel
, NULL
);
435 widthLabel
+= RADIO_SIZE
; // FIXME this is bogus too
436 if ( widthLabel
> width
)
439 return wxSize(width
, height
);
442 wxSize
wxRadioBox::DoGetBestSize() const
444 return GetTotalButtonSize(GetMaxButtonSize());
447 // Restored old code.
448 void wxRadioBox::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
450 int currentX
, currentY
;
451 GetPosition(¤tX
, ¤tY
);
452 int widthOld
, heightOld
;
453 GetSize(&widthOld
, &heightOld
);
458 if (x
== -1 && !(sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
460 if (y
== -1 && !(sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
463 #if RADIOBTN_PARENT_IS_RADIOBOX
472 wxGetCharSize(m_hWnd
, &cx1
, &cy1
, & GetFont());
474 // Attempt to have a look coherent with other platforms: We compute the
475 // biggest toggle dim, then we align all items according this value.
476 wxSize maxSize
= GetMaxButtonSize();
477 int maxWidth
= maxSize
.x
,
478 maxHeight
= maxSize
.y
;
480 wxSize totSize
= GetTotalButtonSize(maxSize
);
481 int totWidth
= totSize
.x
,
482 totHeight
= totSize
.y
;
484 // only change our width/height if asked for
487 if ( sizeFlags
& wxSIZE_AUTO_WIDTH
)
495 if ( sizeFlags
& wxSIZE_AUTO_HEIGHT
)
501 ::MoveWindow(GetHwnd(), xx
, yy
, width
, height
, TRUE
);
503 // Now position all the buttons: the current button will be put at
504 // wxPoint(x_offset, y_offset) and the new row/column will start at
505 // startX/startY. The size of all buttons will be the same wxSize(maxWidth,
506 // maxHeight) except for the buttons in the last column which should extend
507 // to the right border of radiobox and thus can be wider than this.
509 // Also, remember that wxRA_SPECIFY_COLS means that we arrange buttons in
510 // left to right order and m_majorDim is the number of columns while
511 // wxRA_SPECIFY_ROWS means that the buttons are arranged top to bottom and
512 // m_majorDim is the number of rows.
517 #if defined(CTL3D) && (!CTL3D)
518 y_offset
+= (int)(cy1
/2); // Fudge factor since buttons overlapped label
519 // JACS 2/12/93. CTL3D draws group label quite high.
522 int startX
= x_offset
;
523 int startY
= y_offset
;
525 for ( int i
= 0; i
< m_noItems
; i
++ )
527 // the last button in the row may be wider than the other ones as the
528 // radiobox may be wider than the sum of the button widths (as it
529 // happens, for example, when the radiobox label is very long)
531 if ( m_windowStyle
& wxRA_SPECIFY_COLS
)
533 // item is the last in its row if it is a multiple of the number of
534 // columns or if it is just the last item
536 isLastInTheRow
= ((n
% m_majorDim
) == 0) || (n
== m_noItems
);
538 else // wxRA_SPECIFY_ROWS
540 // item is the last in the row if it is in the last columns
541 isLastInTheRow
= i
>= (m_noItems
/m_majorDim
)*m_majorDim
;
544 // is this the start of new row/column?
545 if ( i
&& (i
% m_majorDim
== 0) )
547 if ( m_windowStyle
& wxRA_SPECIFY_ROWS
)
549 // start of new column
551 x_offset
+= maxWidth
+ cx1
;
553 else // start of new row
556 y_offset
+= maxHeight
;
557 if (m_radioWidth
[0]>0)
563 if ( isLastInTheRow
)
565 // make the button go to the end of radio box
566 widthBtn
= startX
+ width
- x_offset
- 2*cx1
;
567 if ( widthBtn
< maxWidth
)
572 // normal button, always of the same size
576 // VZ: make all buttons of the same, maximal size - like this they
577 // cover the radiobox entirely and the radiobox tooltips are always
578 // shown (otherwise they are not when the mouse pointer is in the
579 // radiobox part not belonging to any radiobutton)
580 ::MoveWindow((HWND
)m_radioButtons
[i
],
581 x_offset
, y_offset
, widthBtn
, maxHeight
,
584 // where do we put the next button?
585 if ( m_windowStyle
& wxRA_SPECIFY_ROWS
)
588 y_offset
+= maxHeight
;
589 if (m_radioWidth
[0]>0)
594 // to the right of this one
595 x_offset
+= widthBtn
+ cx1
;
600 void wxRadioBox::GetSize(int *width
, int *height
) const
603 rect
.left
= -1; rect
.right
= -1; rect
.top
= -1; rect
.bottom
= -1;
606 wxFindMaxSize(m_hWnd
, &rect
);
609 for (i
= 0; i
< m_noItems
; i
++)
610 wxFindMaxSize(m_radioButtons
[i
], &rect
);
612 *width
= rect
.right
- rect
.left
;
613 *height
= rect
.bottom
- rect
.top
;
616 void wxRadioBox::GetPosition(int *x
, int *y
) const
618 wxWindow
*parent
= GetParent();
619 RECT rect
= { -1, -1, -1, -1 };
622 for (i
= 0; i
< m_noItems
; i
++)
623 wxFindMaxSize(m_radioButtons
[i
], &rect
);
626 wxFindMaxSize(m_hWnd
, &rect
);
628 // Since we now have the absolute screen coords, if there's a parent we
629 // must subtract its top left corner
635 ::ScreenToClient((HWND
) parent
->GetHWND(), &point
);
638 // We may be faking the client origin. So a window that's really at (0, 30)
639 // may appear (to wxWin apps) to be at (0, 0).
642 wxPoint
pt(GetParent()->GetClientAreaOrigin());
651 void wxRadioBox::SetFocus()
655 if (m_selectedButton
== -1)
656 ::SetFocus((HWND
) m_radioButtons
[0]);
658 ::SetFocus((HWND
) m_radioButtons
[m_selectedButton
]);
663 bool wxRadioBox::Show(bool show
)
665 if ( !wxControl::Show(show
) )
668 int nCmdShow
= show
? SW_SHOW
: SW_HIDE
;
669 for ( int i
= 0; i
< m_noItems
; i
++ )
671 ::ShowWindow((HWND
)m_radioButtons
[i
], nCmdShow
);
677 // Enable a specific button
678 void wxRadioBox::Enable(int item
, bool enable
)
680 wxCHECK_RET( item
>= 0 && item
< m_noItems
,
681 wxT("invalid item in wxRadioBox::Enable()") );
683 ::EnableWindow((HWND
) m_radioButtons
[item
], enable
);
686 // Enable all controls
687 bool wxRadioBox::Enable(bool enable
)
689 if ( !wxControl::Enable(enable
) )
692 for (int i
= 0; i
< m_noItems
; i
++)
693 ::EnableWindow((HWND
) m_radioButtons
[i
], enable
);
698 // Show a specific button
699 void wxRadioBox::Show(int item
, bool show
)
701 wxCHECK_RET( item
>= 0 && item
< m_noItems
,
702 wxT("invalid item in wxRadioBox::Show()") );
704 ::ShowWindow((HWND
)m_radioButtons
[item
], show
? SW_SHOW
: SW_HIDE
);
707 // For single selection items only
708 wxString
wxRadioBox::GetStringSelection() const
711 int sel
= GetSelection();
713 result
= GetString(sel
);
718 bool wxRadioBox::SetStringSelection(const wxString
& s
)
720 int sel
= FindString (s
);
730 bool wxRadioBox::ContainsHWND(WXHWND hWnd
) const
733 for (i
= 0; i
< Number(); i
++)
735 if (GetRadioButtons()[i
] == hWnd
)
742 void wxRadioBox::Command(wxCommandEvent
& event
)
744 SetSelection (event
.m_commandInt
);
745 ProcessCommand (event
);
748 // NB: if this code is changed, wxGetWindowForHWND() which relies on having the
749 // radiobox pointer in GWL_USERDATA for radio buttons must be updated too!
750 void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn
)
752 // No GWL_USERDATA in Win16, so omit this subclassing.
754 HWND hwndBtn
= (HWND
)hWndBtn
;
756 if ( !s_wndprocRadioBtn
)
757 s_wndprocRadioBtn
= (WXFARPROC
)::GetWindowLong(hwndBtn
, GWL_WNDPROC
);
759 ::SetWindowLong(hwndBtn
, GWL_WNDPROC
, (long)wxRadioBtnWndProc
);
760 ::SetWindowLong(hwndBtn
, GWL_USERDATA
, (long)this);
764 void wxRadioBox::SendNotificationEvent()
766 wxCommandEvent
event(wxEVT_COMMAND_RADIOBOX_SELECTED
, m_windowId
);
767 event
.SetInt( m_selectedButton
);
768 event
.SetString( GetString(m_selectedButton
) );
769 event
.SetEventObject( this );
770 ProcessCommand(event
);
773 bool wxRadioBox::SetFont(const wxFont
& font
)
775 if ( !wxControl::SetFont(font
) )
781 // also set the font of our radio buttons
782 WXHFONT hfont
= wxFont(font
).GetResourceHandle();
783 for ( int n
= 0; n
< m_noItems
; n
++ )
785 HWND hwndBtn
= (HWND
)m_radioButtons
[n
];
786 ::SendMessage(hwndBtn
, WM_SETFONT
, (WPARAM
)hfont
, 0L);
788 // otherwise the buttons are not redrawn correctly
789 ::InvalidateRect(hwndBtn
, NULL
, FALSE
/* don't erase bg */);
795 // ----------------------------------------------------------------------------
797 // ----------------------------------------------------------------------------
799 long wxRadioBox::MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
804 case WM_CTLCOLORSTATIC
:
805 // set the colour of the radio buttons to be the same as ours
807 HDC hdc
= (HDC
)wParam
;
809 const wxColour
& colBack
= GetBackgroundColour();
810 ::SetBkColor(hdc
, wxColourToRGB(colBack
));
811 ::SetTextColor(hdc
, wxColourToRGB(GetForegroundColour()));
813 wxBrush
*brush
= wxTheBrushList
->FindOrCreateBrush(colBack
, wxSOLID
);
815 return (WXHBRUSH
)brush
->GetResourceHandle();
819 // This is required for the radiobox to be sensitive to mouse input,
820 // e.g. for Dialog Editor.
823 int xPos
= LOWORD(lParam
); // horizontal position of cursor
824 int yPos
= HIWORD(lParam
); // vertical position of cursor
826 ScreenToClient(&xPos
, &yPos
);
828 // Make sure you can drag by the top of the groupbox, but let
829 // other (enclosed) controls get mouse events also
831 return (long)HTCLIENT
;
836 return wxControl::MSWWindowProc(nMsg
, wParam
, lParam
);
839 WXHBRUSH
wxRadioBox::OnCtlColor(WXHDC pDC
, WXHWND pWnd
, WXUINT nCtlColor
,
847 HBRUSH hbrush
= Ctl3dCtlColorEx(message
, wParam
, lParam
);
848 return (WXHBRUSH
) hbrush
;
850 #endif // wxUSE_CTL3D
853 if (GetParent()->GetTransparentBackground())
854 SetBkMode(hdc
, TRANSPARENT
);
856 SetBkMode(hdc
, OPAQUE
);
858 wxColour colBack
= GetBackgroundColour();
861 colBack
= wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE
);
863 ::SetBkColor(hdc
, wxColourToRGB(colBack
));
864 ::SetTextColor(hdc
, wxColourToRGB(GetForegroundColour()));
866 wxBrush
*brush
= wxTheBrushList
->FindOrCreateBrush(colBack
, wxSOLID
);
868 return (WXHBRUSH
)brush
->GetResourceHandle();
872 // ---------------------------------------------------------------------------
873 // window proc for radio buttons
874 // ---------------------------------------------------------------------------
878 LRESULT APIENTRY _EXPORT
wxRadioBtnWndProc(HWND hwnd
,
886 // we must tell IsDialogMessage()/our kbd processing code that we
887 // want to process arrows ourselves because neither of them is
888 // smart enough to handle arrows properly for us
890 long lDlgCode
= ::CallWindowProc(CASTWNDPROC s_wndprocRadioBtn
, hwnd
,
891 message
, wParam
, lParam
);
893 return lDlgCode
| DLGC_WANTARROWS
;
899 NMHDR
* hdr
= (NMHDR
*)lParam
;
900 if ( (int)hdr
->code
== TTN_NEEDTEXT
)
902 wxRadioBox
*radiobox
= (wxRadioBox
*)
903 ::GetWindowLong(hwnd
, GWL_USERDATA
);
905 wxCHECK_MSG( radiobox
, 0,
906 wxT("radio button without radio box?") );
908 wxToolTip
*tooltip
= radiobox
->GetToolTip();
911 TOOLTIPTEXT
*ttt
= (TOOLTIPTEXT
*)lParam
;
912 ttt
->lpszText
= (wxChar
*)tooltip
->GetTip().c_str();
920 #endif // wxUSE_TOOLTIPS
924 wxRadioBox
*radiobox
= (wxRadioBox
*)
925 ::GetWindowLong(hwnd
, GWL_USERDATA
);
927 wxCHECK_MSG( radiobox
, 0, wxT("radio button without radio box?") );
929 bool processed
= TRUE
;
931 bool horz
= (radiobox
->GetWindowStyle() & wxRA_SPECIFY_COLS
) != 0;
932 int num
= radiobox
->Number(),
933 rows
= radiobox
->GetNumVer(),
934 cols
= radiobox
->GetNumHor();
936 int selOld
= radiobox
->GetSelection();
939 // wrapping will be handled below for the cases when we
940 // add/substract more than 1 but here otherwise as it's simpler
972 if ( ++selNew
== num
)
980 if ( ++selNew
== num
)
993 // ensure that selNew is in range [0..num)
998 int dim
= horz
? cols
: rows
;
1002 else if ( selNew
< 0 )
1006 int dim
= horz
? cols
: rows
;
1007 if ( selNew
% dim
== 0 )
1017 if ( selNew
!= selOld
)
1019 radiobox
->SetSelection(selNew
);
1021 // emulate the button click
1022 radiobox
->SendNotificationEvent();
1030 return ::CallWindowProc(CASTWNDPROC s_wndprocRadioBtn
, hwnd
, message
, wParam
, lParam
);