1. wxDir works for MSW and documented
[wxWidgets.git] / src / msw / radiobox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: radiobox.cpp
3 // Purpose: wxRadioBox
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ===========================================================================
13 // declarations
14 // ===========================================================================
15
16 // ---------------------------------------------------------------------------
17 // headers
18 // ---------------------------------------------------------------------------
19
20 #ifdef __GNUG__
21 #pragma implementation "radiobox.h"
22 #endif
23
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
26
27 #ifdef __BORLANDC__
28 #pragma hdrstop
29 #endif
30
31 #ifndef WX_PRECOMP
32 #include "wx/bitmap.h"
33 #include "wx/brush.h"
34 #include "wx/radiobox.h"
35 #include "wx/log.h"
36 #endif
37
38 #include "wx/msw/private.h"
39
40 #if wxUSE_TOOLTIPS
41 #include <commctrl.h>
42
43 #include "wx/tooltip.h"
44 #endif // wxUSE_TOOLTIPS
45
46 #if !USE_SHARED_LIBRARY
47 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
48 #endif
49
50 // VZ: the new behaviour is to create the radio buttons as children of the
51 // radiobox instead of creating them as children of the radiobox' parent.
52 //
53 // This seems more logical, more consistent with what other frameworks do
54 // and allows tooltips to work with radioboxes, so there should be no
55 // reason to revert to the backward compatible behaviour - but I still
56 // leave this possibility just in case.
57 #define RADIOBTN_PARENT_IS_RADIOBOX 1
58
59 // ---------------------------------------------------------------------------
60 // private functions
61 // ---------------------------------------------------------------------------
62
63 // wnd proc for radio buttons
64 #ifdef __WIN32__
65 LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hWnd,
66 UINT message,
67 WPARAM wParam,
68 LPARAM lParam);
69
70 // ---------------------------------------------------------------------------
71 // global vars
72 // ---------------------------------------------------------------------------
73
74 // the pointer to standard radio button wnd proc
75 static WXFARPROC s_wndprocRadioBtn = (WXFARPROC)NULL;
76
77 #endif // __WIN32__
78
79 // ===========================================================================
80 // implementation
81 // ===========================================================================
82
83 // ---------------------------------------------------------------------------
84 // wxRadioBox
85 // ---------------------------------------------------------------------------
86
87 int wxRadioBox::GetNumVer() const
88 {
89 if ( m_windowStyle & wxRA_SPECIFY_ROWS )
90 {
91 return m_majorDim;
92 }
93 else
94 {
95 return (m_noItems + m_majorDim - 1)/m_majorDim;
96 }
97 }
98
99 int wxRadioBox::GetNumHor() const
100 {
101 if ( m_windowStyle & wxRA_SPECIFY_ROWS )
102 {
103 return (m_noItems + m_majorDim - 1)/m_majorDim;
104 }
105 else
106 {
107 return m_majorDim;
108 }
109 }
110
111 bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id)
112 {
113 if ( cmd == BN_CLICKED )
114 {
115 int selectedButton = -1;
116
117 for ( int i = 0; i < m_noItems; i++ )
118 {
119 if ( id == wxGetWindowId(m_radioButtons[i]) )
120 {
121 selectedButton = i;
122
123 break;
124 }
125 }
126
127 wxASSERT_MSG( selectedButton != -1, wxT("click from alien button?") );
128
129 if ( selectedButton != m_selectedButton )
130 {
131 m_selectedButton = selectedButton;
132
133 SendNotificationEvent();
134 }
135 //else: don't generate events when the selection doesn't change
136
137 return TRUE;
138 }
139 else
140 return FALSE;
141 }
142
143 #if WXWIN_COMPATIBILITY
144 wxRadioBox::wxRadioBox(wxWindow *parent, wxFunction func, const char *title,
145 int x, int y, int width, int height,
146 int n, char **choices,
147 int majorDim, long style, const char *name)
148 {
149 wxString *choices2 = new wxString[n];
150 for ( int i = 0; i < n; i ++) choices2[i] = choices[i];
151 Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), n, choices2, majorDim, style,
152 wxDefaultValidator, name);
153 Callback(func);
154 delete choices2;
155 }
156
157 #endif
158
159 // Radio box item
160 wxRadioBox::wxRadioBox()
161 {
162 m_selectedButton = -1;
163 m_noItems = 0;
164 m_noRowsOrCols = 0;
165 m_radioButtons = NULL;
166 m_majorDim = 0;
167 m_radioWidth = NULL;
168 m_radioHeight = NULL;
169 }
170
171 bool wxRadioBox::Create(wxWindow *parent,
172 wxWindowID id,
173 const wxString& title,
174 const wxPoint& pos,
175 const wxSize& size,
176 int n,
177 const wxString choices[],
178 int majorDim,
179 long style,
180 const wxValidator& val,
181 const wxString& name)
182 {
183 // initialize members
184 m_selectedButton = -1;
185 m_noItems = 0;
186
187 m_majorDim = majorDim == 0 ? n : majorDim;
188 m_noRowsOrCols = majorDim;
189
190 // common initialization
191 if ( !CreateControl(parent, id, pos, size, style, val, name) )
192 return FALSE;
193
194 // create the static box
195 if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX, pos, size, title, 0) )
196 return FALSE;
197
198 // and now create the buttons
199 m_noItems = n;
200 #if RADIOBTN_PARENT_IS_RADIOBOX
201 HWND hwndParent = GetHwnd();
202 #else
203 HWND hwndParent = GetHwndOf(parent);
204 #endif
205
206 // Some radio boxes test consecutive id.
207 (void)NewControlId();
208 m_radioButtons = new WXHWND[n];
209 m_radioWidth = new int[n];
210 m_radioHeight = new int[n];
211
212 WXHFONT hfont = 0;
213 wxFont& font = GetFont();
214 if ( font.Ok() )
215 {
216 hfont = font.GetResourceHandle();
217 }
218
219 for ( int i = 0; i < n; i++ )
220 {
221 m_radioWidth[i] =
222 m_radioHeight[i] = -1;
223 long styleBtn = BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE;
224 if ( i == 0 && style == 0 )
225 styleBtn |= WS_GROUP;
226
227 long newId = NewControlId();
228
229 HWND hwndBtn = ::CreateWindow(_T("BUTTON"),
230 choices[i],
231 styleBtn,
232 0, 0, 0, 0, // will be set in SetSize()
233 hwndParent,
234 (HMENU)newId,
235 wxGetInstance(),
236 NULL);
237
238 if ( !hwndBtn )
239 {
240 wxLogLastError("CreateWindow(radio btn)");
241
242 return FALSE;
243 }
244
245 m_radioButtons[i] = (WXHWND)hwndBtn;
246
247 SubclassRadioButton((WXHWND)hwndBtn);
248
249 if ( hfont )
250 {
251 ::SendMessage(hwndBtn, WM_SETFONT, (WPARAM)hfont, 0L);
252 }
253
254 m_subControls.Add(newId);
255 }
256
257 // Create a dummy radio control to end the group.
258 (void)::CreateWindow(_T("BUTTON"),
259 _T(""),
260 WS_GROUP | BS_AUTORADIOBUTTON | WS_CHILD,
261 0, 0, 0, 0, hwndParent,
262 (HMENU)NewControlId(), wxGetInstance(), NULL);
263
264 SetSelection(0);
265
266 SetSize(pos.x, pos.y, size.x, size.y);
267
268 return TRUE;
269 }
270
271 wxRadioBox::~wxRadioBox()
272 {
273 m_isBeingDeleted = TRUE;
274
275 if (m_radioButtons)
276 {
277 int i;
278 for (i = 0; i < m_noItems; i++)
279 ::DestroyWindow((HWND)m_radioButtons[i]);
280 delete[] m_radioButtons;
281 }
282
283 if (m_radioWidth)
284 delete[] m_radioWidth;
285 if (m_radioHeight)
286 delete[] m_radioHeight;
287
288 }
289
290 wxString wxRadioBox::GetLabel(int item) const
291 {
292 wxCHECK_MSG( item >= 0 && item < m_noItems, wxT(""), wxT("invalid radiobox index") );
293
294 return wxGetWindowText(m_radioButtons[item]);
295 }
296
297 void wxRadioBox::SetLabel(int item, const wxString& label)
298 {
299 wxCHECK_RET( item >= 0 && item < m_noItems, wxT("invalid radiobox index") );
300
301 m_radioWidth[item] = m_radioHeight[item] = -1;
302 SetWindowText((HWND)m_radioButtons[item], label.c_str());
303 }
304
305 void wxRadioBox::SetLabel(int item, wxBitmap *bitmap)
306 {
307 /*
308 m_radioWidth[item] = bitmap->GetWidth() + FB_MARGIN;
309 m_radioHeight[item] = bitmap->GetHeight() + FB_MARGIN;
310 */
311 wxFAIL_MSG(wxT("not implemented"));
312 }
313
314 int wxRadioBox::FindString(const wxString& s) const
315 {
316 for (int i = 0; i < m_noItems; i++)
317 {
318 if ( s == wxGetWindowText(m_radioButtons[i]) )
319 return i;
320 }
321
322 return wxNOT_FOUND;
323 }
324
325 void wxRadioBox::SetSelection(int N)
326 {
327 wxCHECK_RET( (N >= 0) && (N < m_noItems), wxT("invalid radiobox index") );
328
329 // Following necessary for Win32s, because Win32s translate BM_SETCHECK
330 if (m_selectedButton >= 0 && m_selectedButton < m_noItems)
331 ::SendMessage((HWND) m_radioButtons[m_selectedButton], BM_SETCHECK, 0, 0L);
332
333 ::SendMessage((HWND)m_radioButtons[N], BM_SETCHECK, 1, 0L);
334 ::SetFocus((HWND)m_radioButtons[N]);
335
336 m_selectedButton = N;
337 }
338
339 // Get single selection, for single choice list items
340 int wxRadioBox::GetSelection() const
341 {
342 return m_selectedButton;
343 }
344
345 // Find string for position
346 wxString wxRadioBox::GetString(int N) const
347 {
348 return wxGetWindowText(m_radioButtons[N]);
349 }
350
351 // Restored old code.
352 void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
353 {
354 int currentX, currentY;
355 GetPosition(&currentX, &currentY);
356 int widthOld, heightOld;
357 GetSize(&widthOld, &heightOld);
358
359 int xx = x;
360 int yy = y;
361
362 if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
363 xx = currentX;
364 if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
365 yy = currentY;
366
367 #if RADIOBTN_PARENT_IS_RADIOBOX
368 int y_offset = 0;
369 int x_offset = 0;
370 #else
371 int y_offset = yy;
372 int x_offset = xx;
373 #endif
374
375 int current_width, cyf;
376
377 int cx1,cy1;
378 wxGetCharSize(m_hWnd, &cx1, &cy1, & GetFont());
379
380 // Attempt to have a look coherent with other platforms: We compute the
381 // biggest toggle dim, then we align all items according this value.
382 int maxWidth = -1;
383 int maxHeight = -1;
384
385 int i;
386 for (i = 0 ; i < m_noItems; i++)
387 {
388 int eachWidth;
389 int eachHeight;
390 if (m_radioWidth[i]<0)
391 {
392 // It's a labelled toggle
393 GetTextExtent(wxGetWindowText(m_radioButtons[i]),
394 &current_width, &cyf);
395 eachWidth = (int)(current_width + RADIO_SIZE);
396 eachHeight = (int)((3*cyf)/2);
397 }
398 else
399 {
400 eachWidth = m_radioWidth[i];
401 eachHeight = m_radioHeight[i];
402 }
403
404 if (maxWidth<eachWidth)
405 maxWidth = eachWidth;
406 if (maxHeight<eachHeight)
407 maxHeight = eachHeight;
408 }
409
410 if (m_hWnd)
411 {
412 int totWidth;
413 int totHeight;
414
415 int nbHor = GetNumHor(),
416 nbVer = GetNumVer();
417
418 // this formula works, but I don't know why.
419 // Please, be sure what you do if you modify it!!
420 if (m_radioWidth[0]<0)
421 totHeight = (nbVer * maxHeight) + cy1/2;
422 else
423 totHeight = nbVer * (maxHeight+cy1/2);
424 totWidth = nbHor * (maxWidth+cx1);
425
426 int extraHeight = cy1;
427
428 #if defined(CTL3D) && !CTL3D
429 // Requires a bigger group box in plain Windows
430 extraHeight *= 3;
431 extraHeight /= 2;
432 #endif
433
434 // only change our width/height if asked for
435 if ( width == -1 )
436 {
437 if ( sizeFlags & wxSIZE_AUTO_WIDTH )
438 width = totWidth + cx1;
439 else
440 width = widthOld;
441 }
442
443 if ( height == -1 )
444 {
445 if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
446 height = totHeight + extraHeight;
447 else
448 height = heightOld;
449 }
450
451 ::MoveWindow(GetHwnd(), xx, yy, width, height, TRUE);
452
453 x_offset += cx1;
454 y_offset += cy1;
455 }
456
457 #if defined(CTL3D) && (!CTL3D)
458 y_offset += (int)(cy1/2); // Fudge factor since buttons overlapped label
459 // JACS 2/12/93. CTL3D draws group label quite high.
460 #endif
461 int startX = x_offset;
462 int startY = y_offset;
463
464 for ( i = 0 ; i < m_noItems; i++)
465 {
466 // Bidimensional radio adjustment
467 if (i&&((i%m_majorDim)==0)) // Why is this omitted for i = 0?
468 {
469 if (m_windowStyle & wxRA_VERTICAL)
470 {
471 y_offset = startY;
472 x_offset += maxWidth + cx1;
473 }
474 else
475 {
476 x_offset = startX;
477 y_offset += maxHeight;
478 if (m_radioWidth[0]>0)
479 y_offset += cy1/2;
480 }
481 }
482 int eachWidth;
483 int eachHeight;
484 if (m_radioWidth[i]<0)
485 {
486 // It's a labeled item
487 GetTextExtent(wxGetWindowText(m_radioButtons[i]),
488 &current_width, &cyf);
489
490 // How do we find out radio button bitmap size!!
491 // By adjusting them carefully, manually :-)
492 eachWidth = (int)(current_width + RADIO_SIZE);
493 eachHeight = (int)((3*cyf)/2);
494 }
495 else
496 {
497 eachWidth = m_radioWidth[i];
498 eachHeight = m_radioHeight[i];
499 }
500
501 // VZ: make all buttons of the same, maximal size - like this they
502 // cover the radiobox entirely and the radiobox tooltips are always
503 // shown (otherwise they are not when the mouse pointer is in the
504 // radiobox part not belonging to any radiobutton)
505 ::MoveWindow((HWND)m_radioButtons[i],
506 x_offset, y_offset, maxWidth, maxHeight,
507 TRUE);
508
509 if (m_windowStyle & wxRA_SPECIFY_ROWS)
510 {
511 y_offset += maxHeight;
512 if (m_radioWidth[0]>0)
513 y_offset += cy1/2;
514 }
515 else
516 x_offset += maxWidth + cx1;
517 }
518 }
519
520 void wxRadioBox::GetSize(int *width, int *height) const
521 {
522 RECT rect;
523 rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
524
525 if (m_hWnd)
526 wxFindMaxSize(m_hWnd, &rect);
527
528 int i;
529 for (i = 0; i < m_noItems; i++)
530 wxFindMaxSize(m_radioButtons[i], &rect);
531
532 *width = rect.right - rect.left;
533 *height = rect.bottom - rect.top;
534 }
535
536 void wxRadioBox::GetPosition(int *x, int *y) const
537 {
538 wxWindow *parent = GetParent();
539 RECT rect = { -1, -1, -1, -1 };
540
541 int i;
542 for (i = 0; i < m_noItems; i++)
543 wxFindMaxSize(m_radioButtons[i], &rect);
544
545 if (m_hWnd)
546 wxFindMaxSize(m_hWnd, &rect);
547
548 // Since we now have the absolute screen coords, if there's a parent we
549 // must subtract its top left corner
550 POINT point;
551 point.x = rect.left;
552 point.y = rect.top;
553 if (parent)
554 {
555 ::ScreenToClient((HWND) parent->GetHWND(), &point);
556 }
557
558 // We may be faking the client origin. So a window that's really at (0, 30)
559 // may appear (to wxWin apps) to be at (0, 0).
560 if (GetParent())
561 {
562 wxPoint pt(GetParent()->GetClientAreaOrigin());
563 point.x -= pt.x;
564 point.y -= pt.y;
565 }
566
567 *x = point.x;
568 *y = point.y;
569 }
570
571 void wxRadioBox::SetFocus()
572 {
573 if (m_noItems > 0)
574 {
575 if (m_selectedButton == -1)
576 ::SetFocus((HWND) m_radioButtons[0]);
577 else
578 ::SetFocus((HWND) m_radioButtons[m_selectedButton]);
579 }
580
581 }
582
583 bool wxRadioBox::Show(bool show)
584 {
585 if ( !wxControl::Show(show) )
586 return FALSE;
587
588 int nCmdShow = show ? SW_SHOW : SW_HIDE;
589 for ( int i = 0; i < m_noItems; i++ )
590 {
591 ::ShowWindow((HWND)m_radioButtons[i], nCmdShow);
592 }
593
594 return TRUE;
595 }
596
597 // Enable a specific button
598 void wxRadioBox::Enable(int item, bool enable)
599 {
600 wxCHECK_RET( item >= 0 && item < m_noItems,
601 wxT("invalid item in wxRadioBox::Enable()") );
602
603 ::EnableWindow((HWND) m_radioButtons[item], enable);
604 }
605
606 // Enable all controls
607 bool wxRadioBox::Enable(bool enable)
608 {
609 if ( !wxControl::Enable(enable) )
610 return FALSE;
611
612 for (int i = 0; i < m_noItems; i++)
613 ::EnableWindow((HWND) m_radioButtons[i], enable);
614
615 return TRUE;
616 }
617
618 // Show a specific button
619 void wxRadioBox::Show(int item, bool show)
620 {
621 wxCHECK_RET( item >= 0 && item < m_noItems,
622 wxT("invalid item in wxRadioBox::Show()") );
623
624 ::ShowWindow((HWND)m_radioButtons[item], show ? SW_SHOW : SW_HIDE);
625 }
626
627 // For single selection items only
628 wxString wxRadioBox::GetStringSelection() const
629 {
630 wxString result;
631 int sel = GetSelection();
632 if (sel > -1)
633 result = GetString(sel);
634
635 return result;
636 }
637
638 bool wxRadioBox::SetStringSelection(const wxString& s)
639 {
640 int sel = FindString (s);
641 if (sel > -1)
642 {
643 SetSelection (sel);
644 return TRUE;
645 }
646 else
647 return FALSE;
648 }
649
650 bool wxRadioBox::ContainsHWND(WXHWND hWnd) const
651 {
652 int i;
653 for (i = 0; i < Number(); i++)
654 {
655 if (GetRadioButtons()[i] == hWnd)
656 return TRUE;
657 }
658
659 return FALSE;
660 }
661
662 void wxRadioBox::Command(wxCommandEvent & event)
663 {
664 SetSelection (event.m_commandInt);
665 ProcessCommand (event);
666 }
667
668 void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn)
669 {
670 #ifdef __WIN32__
671 HWND hwndBtn = (HWND)hWndBtn;
672
673 if ( !s_wndprocRadioBtn )
674 s_wndprocRadioBtn = (WXFARPROC)::GetWindowLong(hwndBtn, GWL_WNDPROC);
675
676 // No GWL_USERDATA in Win16, so omit this subclassing.
677 ::SetWindowLong(hwndBtn, GWL_WNDPROC, (long)wxRadioBtnWndProc);
678 ::SetWindowLong(hwndBtn, GWL_USERDATA, (long)this);
679 #endif // __WIN32__
680 }
681
682 void wxRadioBox::SendNotificationEvent()
683 {
684 wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId);
685 event.SetInt( m_selectedButton );
686 event.SetString( GetString(m_selectedButton) );
687 event.SetEventObject( this );
688 ProcessCommand(event);
689 }
690
691 bool wxRadioBox::SetFont(const wxFont& font)
692 {
693 if ( !wxControl::SetFont(font) )
694 {
695 // nothing to do
696 return FALSE;
697 }
698
699 // also set the font of our radio buttons
700 WXHFONT hfont = wxFont(font).GetResourceHandle();
701 for ( int n = 0; n < m_noItems; n++ )
702 {
703 ::SendMessage((HWND)m_radioButtons[n], WM_SETFONT, (WPARAM)hfont, 0L);
704 }
705
706 return TRUE;
707 }
708
709 long wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
710 {
711 // This is required for the radiobox to be sensitive to mouse input,
712 // e.g. for Dialog Editor.
713 if (nMsg == WM_NCHITTEST)
714 {
715 int xPos = LOWORD(lParam); // horizontal position of cursor
716 int yPos = HIWORD(lParam); // vertical position of cursor
717
718 ScreenToClient(&xPos, &yPos);
719
720 // Make sure you can drag by the top of the groupbox, but let
721 // other (enclosed) controls get mouse events also
722 if (yPos < 10)
723 return (long)HTCLIENT;
724 }
725
726 return wxControl::MSWWindowProc(nMsg, wParam, lParam);
727 }
728
729 // ---------------------------------------------------------------------------
730 // window proc for radio buttons
731 // ---------------------------------------------------------------------------
732
733 #ifdef __WIN32__
734
735 LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
736 UINT msg,
737 WPARAM wParam,
738 LPARAM lParam)
739 {
740 bool processed = FALSE;
741 if ( msg == WM_KEYDOWN
742 #if wxUSE_TOOLTIPS
743 || msg == WM_NOTIFY
744 #endif // wxUSE_TOOLTIPS
745 )
746 {
747 wxRadioBox *radiobox = (wxRadioBox *)::GetWindowLong(hwnd, GWL_USERDATA);
748
749 wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
750
751 #if wxUSE_TOOLTIPS
752 if ( msg == WM_NOTIFY )
753 {
754 NMHDR* hdr = (NMHDR *)lParam;
755 if ( (int)hdr->code == TTN_NEEDTEXT )
756 {
757 wxToolTip *tt = radiobox->GetToolTip();
758 if ( tt )
759 {
760 TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam;
761 ttt->lpszText = (wxChar *)tt->GetTip().c_str();
762
763 processed = TRUE;
764 }
765 }
766 }
767 else // msg == WM_KEYDOWN
768 #endif // wxUSE_TOOLTIPS
769 {
770 processed = TRUE;
771
772 int sel = radiobox->GetSelection();
773
774 switch ( wParam )
775 {
776 case VK_UP:
777 sel--;
778 break;
779
780 case VK_LEFT:
781 sel -= radiobox->GetNumVer();
782 break;
783
784 case VK_DOWN:
785 sel++;
786 break;
787
788 case VK_RIGHT:
789 sel += radiobox->GetNumVer();
790 break;
791
792 case VK_TAB:
793 {
794 wxNavigationKeyEvent event;
795 event.SetDirection(!(::GetKeyState(VK_SHIFT) & 0x100));
796 event.SetWindowChange(FALSE);
797 event.SetEventObject(radiobox);
798
799 if ( radiobox->GetEventHandler()->ProcessEvent(event) )
800 return 0;
801 }
802 // fall through
803
804 default:
805 processed = FALSE;
806 }
807
808 if ( processed )
809 {
810 if ( sel >= 0 && sel < radiobox->Number() )
811 {
812 radiobox->SetSelection(sel);
813
814 // emulate the button click
815 radiobox->SendNotificationEvent();
816 }
817 }
818 }
819 }
820
821 if ( processed )
822 return 0;
823
824 return ::CallWindowProc(CASTWNDPROC s_wndprocRadioBtn, hwnd, msg, wParam, lParam);
825 }
826
827 #endif // __WIN32__
828