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