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"
34 #include "wx/bitmap.h"
36 #include "wx/radiobox.h"
37 #include "wx/settings.h"
41 #include "wx/msw/private.h"
44 #if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__)
47 #include "wx/tooltip.h"
48 #endif // wxUSE_TOOLTIPS
50 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox
, wxControl
)
52 // there are two possible ways to create the radio buttons: either as children
53 // of the radiobox or as siblings of it - allow playing with both variants for
54 // now, eventually we will choose the best one for our purposes
56 // two main problems are the keyboard navigation inside the radiobox (arrows
57 // should switch between buttons, not pass focus to the next control) and the
58 // tooltips - a tooltip is associated with the radiobox itself, not the
61 // the problems with setting this to 1:
62 // a) Alt-<mnemonic of radiobox> isn't handled properly by IsDialogMessage()
63 // because it sets focus to the next control accepting it which is not a
64 // radio button but a radiobox sibling in this case - the only solution to
65 // this would be to handle Alt-<mnemonic> ourselves
66 // b) the problems with setting radiobox colours under Win98/2K were reported
67 // but I couldn't reproduce it so I have no idea about what causes it
69 // the problems with setting this to 0:
70 // a) the tooltips are not shown for the radiobox - possible solution: make
71 // TTM_WINDOWFROMPOS handling code in msw/tooltip.cpp work (easier said than
72 // done because I don't know why it doesn't work)
73 #define RADIOBTN_PARENT_IS_RADIOBOX 0
75 // ---------------------------------------------------------------------------
77 // ---------------------------------------------------------------------------
79 // wnd proc for radio buttons
81 LRESULT APIENTRY _EXPORT
wxRadioBtnWndProc(HWND hWnd
,
86 // ---------------------------------------------------------------------------
88 // ---------------------------------------------------------------------------
90 // the pointer to standard radio button wnd proc
91 static WXFARPROC s_wndprocRadioBtn
= (WXFARPROC
)NULL
;
95 // ===========================================================================
97 // ===========================================================================
99 // ---------------------------------------------------------------------------
101 // ---------------------------------------------------------------------------
103 int wxRadioBox::GetCount() const
108 int wxRadioBox::GetColumnCount() const
113 int wxRadioBox::GetRowCount() const
118 // returns the number of rows
119 int wxRadioBox::GetNumVer() const
121 if ( m_windowStyle
& wxRA_SPECIFY_ROWS
)
127 return (m_noItems
+ m_majorDim
- 1)/m_majorDim
;
131 // returns the number of columns
132 int wxRadioBox::GetNumHor() const
134 if ( m_windowStyle
& wxRA_SPECIFY_ROWS
)
136 return (m_noItems
+ m_majorDim
- 1)/m_majorDim
;
144 bool wxRadioBox::MSWCommand(WXUINT cmd
, WXWORD id
)
146 if ( cmd
== BN_CLICKED
)
151 int selectedButton
= -1;
153 for ( int i
= 0; i
< m_noItems
; i
++ )
155 if ( id
== wxGetWindowId(m_radioButtons
[i
]) )
163 if ( selectedButton
== -1 )
165 // just ignore it - due to a hack with WM_NCHITTEST handling in our
166 // wnd proc, we can receive dummy click messages when we click near
167 // the radiobox edge (this is ugly but Julian wouldn't let me get
172 if ( selectedButton
!= m_selectedButton
)
174 m_selectedButton
= selectedButton
;
176 SendNotificationEvent();
178 //else: don't generate events when the selection doesn't change
186 #if WXWIN_COMPATIBILITY
187 wxRadioBox::wxRadioBox(wxWindow
*parent
, wxFunction func
, const char *title
,
188 int x
, int y
, int width
, int height
,
189 int n
, char **choices
,
190 int majorDim
, long style
, const char *name
)
192 wxString
*choices2
= new wxString
[n
];
193 for ( int i
= 0; i
< n
; i
++) choices2
[i
] = choices
[i
];
194 Create(parent
, -1, title
, wxPoint(x
, y
), wxSize(width
, height
), n
, choices2
, majorDim
, style
,
195 wxDefaultValidator
, name
);
200 #endif // WXWIN_COMPATIBILITY
203 wxRadioBox::wxRadioBox()
205 m_selectedButton
= -1;
208 m_radioButtons
= NULL
;
211 m_radioHeight
= NULL
;
214 bool wxRadioBox::Create(wxWindow
*parent
,
216 const wxString
& title
,
220 const wxString choices
[],
223 const wxValidator
& val
,
224 const wxString
& name
)
226 // initialize members
227 m_selectedButton
= -1;
230 m_majorDim
= majorDim
== 0 ? n
: majorDim
;
231 m_noRowsOrCols
= majorDim
;
233 // common initialization
234 if ( !CreateControl(parent
, id
, pos
, size
, style
, val
, name
) )
237 // create the static box
238 if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX
| WS_GROUP
,
239 pos
, size
, title
, 0) )
242 // and now create the buttons
244 #if RADIOBTN_PARENT_IS_RADIOBOX
245 HWND hwndParent
= GetHwnd();
247 HWND hwndParent
= GetHwndOf(parent
);
250 // Some radio boxes test consecutive id.
251 (void)NewControlId();
252 m_radioButtons
= new WXHWND
[n
];
253 m_radioWidth
= new int[n
];
254 m_radioHeight
= new int[n
];
257 wxFont
& font
= GetFont();
260 hfont
= font
.GetResourceHandle();
263 for ( int i
= 0; i
< n
; i
++ )
266 m_radioHeight
[i
] = -1;
267 long styleBtn
= BS_AUTORADIOBUTTON
| WS_TABSTOP
| WS_CHILD
| WS_VISIBLE
;
268 if ( i
== 0 && style
== 0 )
269 styleBtn
|= WS_GROUP
;
271 long newId
= NewControlId();
273 HWND hwndBtn
= ::CreateWindow(_T("BUTTON"),
276 0, 0, 0, 0, // will be set in SetSize()
284 wxLogLastError(wxT("CreateWindow(radio btn)"));
289 m_radioButtons
[i
] = (WXHWND
)hwndBtn
;
291 SubclassRadioButton((WXHWND
)hwndBtn
);
295 ::SendMessage(hwndBtn
, WM_SETFONT
, (WPARAM
)hfont
, 0L);
298 m_subControls
.Add(newId
);
301 // Create a dummy radio control to end the group.
302 (void)::CreateWindow(_T("BUTTON"),
304 WS_GROUP
| BS_AUTORADIOBUTTON
| WS_CHILD
,
305 0, 0, 0, 0, hwndParent
,
306 (HMENU
)NewControlId(), wxGetInstance(), NULL
);
310 SetSize(pos
.x
, pos
.y
, size
.x
, size
.y
);
315 wxRadioBox::~wxRadioBox()
317 m_isBeingDeleted
= TRUE
;
322 for (i
= 0; i
< m_noItems
; i
++)
323 ::DestroyWindow((HWND
)m_radioButtons
[i
]);
324 delete[] m_radioButtons
;
328 delete[] m_radioWidth
;
330 delete[] m_radioHeight
;
334 void wxRadioBox::SetString(int item
, const wxString
& label
)
336 wxCHECK_RET( item
>= 0 && item
< m_noItems
, wxT("invalid radiobox index") );
338 m_radioWidth
[item
] = m_radioHeight
[item
] = -1;
339 SetWindowText((HWND
)m_radioButtons
[item
], label
.c_str());
342 void wxRadioBox::SetSelection(int N
)
344 wxCHECK_RET( (N
>= 0) && (N
< m_noItems
), wxT("invalid radiobox index") );
346 // Following necessary for Win32s, because Win32s translate BM_SETCHECK
347 if (m_selectedButton
>= 0 && m_selectedButton
< m_noItems
)
348 ::SendMessage((HWND
) m_radioButtons
[m_selectedButton
], BM_SETCHECK
, 0, 0L);
350 ::SendMessage((HWND
)m_radioButtons
[N
], BM_SETCHECK
, 1, 0L);
351 ::SetFocus((HWND
)m_radioButtons
[N
]);
353 m_selectedButton
= N
;
356 // Get single selection, for single choice list items
357 int wxRadioBox::GetSelection() const
359 return m_selectedButton
;
362 // Find string for position
363 wxString
wxRadioBox::GetString(int item
) const
365 wxCHECK_MSG( item
>= 0 && item
< m_noItems
, wxEmptyString
,
366 wxT("invalid radiobox index") );
368 return wxGetWindowText(m_radioButtons
[item
]);
371 // ----------------------------------------------------------------------------
373 // ----------------------------------------------------------------------------
375 wxSize
wxRadioBox::GetMaxButtonSize() const
377 // calculate the max button size
380 for ( int i
= 0 ; i
< m_noItems
; i
++ )
383 if ( m_radioWidth
[i
] < 0 )
385 GetTextExtent(wxGetWindowText(m_radioButtons
[i
]), &width
, &height
);
387 // adjust the size to take into account the radio box itself
388 // FIXME this is totally bogus!
395 width
= m_radioWidth
[i
];
396 height
= m_radioHeight
[i
];
399 if ( widthMax
< width
)
401 if ( heightMax
< height
)
405 return wxSize(widthMax
, heightMax
);
408 wxSize
wxRadioBox::GetTotalButtonSize(const wxSize
& sizeBtn
) const
410 // the radiobox should be big enough for its buttons
412 wxGetCharSize(m_hWnd
, &cx1
, &cy1
, &GetFont());
414 int extraHeight
= cy1
;
416 #if defined(CTL3D) && !CTL3D
417 // Requires a bigger group box in plain Windows
422 int height
= GetNumVer() * sizeBtn
.y
+ cy1
/2 + extraHeight
;
423 int width
= GetNumHor() * (sizeBtn
.x
+ cx1
) + cx1
;
425 // and also wide enough for its label
427 GetTextExtent(GetTitle(), &widthLabel
, NULL
);
428 widthLabel
+= RADIO_SIZE
; // FIXME this is bogus too
429 if ( widthLabel
> width
)
432 return wxSize(width
, height
);
435 wxSize
wxRadioBox::DoGetBestSize() const
437 return GetTotalButtonSize(GetMaxButtonSize());
440 // Restored old code.
441 void wxRadioBox::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
443 int currentX
, currentY
;
444 GetPosition(¤tX
, ¤tY
);
445 int widthOld
, heightOld
;
446 GetSize(&widthOld
, &heightOld
);
451 if (x
== -1 && !(sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
453 if (y
== -1 && !(sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
456 #if RADIOBTN_PARENT_IS_RADIOBOX
465 wxGetCharSize(m_hWnd
, &cx1
, &cy1
, & GetFont());
467 // Attempt to have a look coherent with other platforms: We compute the
468 // biggest toggle dim, then we align all items according this value.
469 wxSize maxSize
= GetMaxButtonSize();
470 int maxWidth
= maxSize
.x
,
471 maxHeight
= maxSize
.y
;
473 wxSize totSize
= GetTotalButtonSize(maxSize
);
474 int totWidth
= totSize
.x
,
475 totHeight
= totSize
.y
;
477 // only change our width/height if asked for
480 if ( sizeFlags
& wxSIZE_AUTO_WIDTH
)
488 if ( sizeFlags
& wxSIZE_AUTO_HEIGHT
)
494 ::MoveWindow(GetHwnd(), xx
, yy
, width
, height
, TRUE
);
496 // Now position all the buttons: the current button will be put at
497 // wxPoint(x_offset, y_offset) and the new row/column will start at
498 // startX/startY. The size of all buttons will be the same wxSize(maxWidth,
499 // maxHeight) except for the buttons in the last column which should extend
500 // to the right border of radiobox and thus can be wider than this.
502 // Also, remember that wxRA_SPECIFY_COLS means that we arrange buttons in
503 // left to right order and m_majorDim is the number of columns while
504 // wxRA_SPECIFY_ROWS means that the buttons are arranged top to bottom and
505 // m_majorDim is the number of rows.
510 #if defined(CTL3D) && (!CTL3D)
511 y_offset
+= (int)(cy1
/2); // Fudge factor since buttons overlapped label
512 // JACS 2/12/93. CTL3D draws group label quite high.
515 int startX
= x_offset
;
516 int startY
= y_offset
;
518 for ( int i
= 0; i
< m_noItems
; i
++ )
520 // the last button in the row may be wider than the other ones as the
521 // radiobox may be wider than the sum of the button widths (as it
522 // happens, for example, when the radiobox label is very long)
524 if ( m_windowStyle
& wxRA_SPECIFY_COLS
)
526 // item is the last in its row if it is a multiple of the number of
527 // columns or if it is just the last item
529 isLastInTheRow
= ((n
% m_majorDim
) == 0) || (n
== m_noItems
);
531 else // wxRA_SPECIFY_ROWS
533 // item is the last in the row if it is in the last columns
534 isLastInTheRow
= i
>= (m_noItems
/m_majorDim
)*m_majorDim
;
537 // is this the start of new row/column?
538 if ( i
&& (i
% m_majorDim
== 0) )
540 if ( m_windowStyle
& wxRA_SPECIFY_ROWS
)
542 // start of new column
544 x_offset
+= maxWidth
+ cx1
;
546 else // start of new row
549 y_offset
+= maxHeight
;
550 if (m_radioWidth
[0]>0)
556 if ( isLastInTheRow
)
558 // make the button go to the end of radio box
559 widthBtn
= startX
+ width
- x_offset
- 2*cx1
;
560 if ( widthBtn
< maxWidth
)
565 // normal button, always of the same size
569 // VZ: make all buttons of the same, maximal size - like this they
570 // cover the radiobox entirely and the radiobox tooltips are always
571 // shown (otherwise they are not when the mouse pointer is in the
572 // radiobox part not belonging to any radiobutton)
573 ::MoveWindow((HWND
)m_radioButtons
[i
],
574 x_offset
, y_offset
, widthBtn
, maxHeight
,
577 // where do we put the next button?
578 if ( m_windowStyle
& wxRA_SPECIFY_ROWS
)
581 y_offset
+= maxHeight
;
582 if (m_radioWidth
[0]>0)
587 // to the right of this one
588 x_offset
+= widthBtn
+ cx1
;
593 void wxRadioBox::GetSize(int *width
, int *height
) const
596 rect
.left
= -1; rect
.right
= -1; rect
.top
= -1; rect
.bottom
= -1;
599 wxFindMaxSize(m_hWnd
, &rect
);
602 for (i
= 0; i
< m_noItems
; i
++)
603 wxFindMaxSize(m_radioButtons
[i
], &rect
);
605 *width
= rect
.right
- rect
.left
;
606 *height
= rect
.bottom
- rect
.top
;
609 void wxRadioBox::GetPosition(int *x
, int *y
) const
611 wxWindow
*parent
= GetParent();
612 RECT rect
= { -1, -1, -1, -1 };
615 for (i
= 0; i
< m_noItems
; i
++)
616 wxFindMaxSize(m_radioButtons
[i
], &rect
);
619 wxFindMaxSize(m_hWnd
, &rect
);
621 // Since we now have the absolute screen coords, if there's a parent we
622 // must subtract its top left corner
628 ::ScreenToClient((HWND
) parent
->GetHWND(), &point
);
631 // We may be faking the client origin. So a window that's really at (0, 30)
632 // may appear (to wxWin apps) to be at (0, 0).
635 wxPoint
pt(GetParent()->GetClientAreaOrigin());
644 void wxRadioBox::SetFocus()
648 if (m_selectedButton
== -1)
649 ::SetFocus((HWND
) m_radioButtons
[0]);
651 ::SetFocus((HWND
) m_radioButtons
[m_selectedButton
]);
656 bool wxRadioBox::Show(bool show
)
658 if ( !wxControl::Show(show
) )
661 int nCmdShow
= show
? SW_SHOW
: SW_HIDE
;
662 for ( int i
= 0; i
< m_noItems
; i
++ )
664 ::ShowWindow((HWND
)m_radioButtons
[i
], nCmdShow
);
670 // Enable a specific button
671 void wxRadioBox::Enable(int item
, bool enable
)
673 wxCHECK_RET( item
>= 0 && item
< m_noItems
,
674 wxT("invalid item in wxRadioBox::Enable()") );
676 ::EnableWindow((HWND
) m_radioButtons
[item
], enable
);
679 // Enable all controls
680 bool wxRadioBox::Enable(bool enable
)
682 if ( !wxControl::Enable(enable
) )
685 for (int i
= 0; i
< m_noItems
; i
++)
686 ::EnableWindow((HWND
) m_radioButtons
[i
], enable
);
691 // Show a specific button
692 void wxRadioBox::Show(int item
, bool show
)
694 wxCHECK_RET( item
>= 0 && item
< m_noItems
,
695 wxT("invalid item in wxRadioBox::Show()") );
697 ::ShowWindow((HWND
)m_radioButtons
[item
], show
? SW_SHOW
: SW_HIDE
);
700 bool wxRadioBox::ContainsHWND(WXHWND hWnd
) const
702 size_t count
= GetCount();
703 for ( size_t i
= 0; i
< count
; i
++ )
705 if ( GetRadioButtons()[i
] == hWnd
)
712 void wxRadioBox::Command(wxCommandEvent
& event
)
714 SetSelection (event
.m_commandInt
);
715 ProcessCommand (event
);
718 // NB: if this code is changed, wxGetWindowForHWND() which relies on having the
719 // radiobox pointer in GWL_USERDATA for radio buttons must be updated too!
720 void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn
)
722 // No GWL_USERDATA in Win16, so omit this subclassing.
724 HWND hwndBtn
= (HWND
)hWndBtn
;
726 if ( !s_wndprocRadioBtn
)
727 s_wndprocRadioBtn
= (WXFARPROC
)::GetWindowLong(hwndBtn
, GWL_WNDPROC
);
729 ::SetWindowLong(hwndBtn
, GWL_WNDPROC
, (long)wxRadioBtnWndProc
);
730 ::SetWindowLong(hwndBtn
, GWL_USERDATA
, (long)this);
734 void wxRadioBox::SendNotificationEvent()
736 wxCommandEvent
event(wxEVT_COMMAND_RADIOBOX_SELECTED
, m_windowId
);
737 event
.SetInt( m_selectedButton
);
738 event
.SetString( GetString(m_selectedButton
) );
739 event
.SetEventObject( this );
740 ProcessCommand(event
);
743 bool wxRadioBox::SetFont(const wxFont
& font
)
745 if ( !wxControl::SetFont(font
) )
751 // also set the font of our radio buttons
752 WXHFONT hfont
= wxFont(font
).GetResourceHandle();
753 for ( int n
= 0; n
< m_noItems
; n
++ )
755 HWND hwndBtn
= (HWND
)m_radioButtons
[n
];
756 ::SendMessage(hwndBtn
, WM_SETFONT
, (WPARAM
)hfont
, 0L);
758 // otherwise the buttons are not redrawn correctly
759 ::InvalidateRect(hwndBtn
, NULL
, FALSE
/* don't erase bg */);
765 // ----------------------------------------------------------------------------
767 // ----------------------------------------------------------------------------
769 long wxRadioBox::MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
774 case WM_CTLCOLORSTATIC
:
775 // set the colour of the radio buttons to be the same as ours
777 HDC hdc
= (HDC
)wParam
;
779 const wxColour
& colBack
= GetBackgroundColour();
780 ::SetBkColor(hdc
, wxColourToRGB(colBack
));
781 ::SetTextColor(hdc
, wxColourToRGB(GetForegroundColour()));
783 wxBrush
*brush
= wxTheBrushList
->FindOrCreateBrush(colBack
, wxSOLID
);
785 return (WXHBRUSH
)brush
->GetResourceHandle();
789 // This is required for the radiobox to be sensitive to mouse input,
790 // e.g. for Dialog Editor.
793 int xPos
= LOWORD(lParam
); // horizontal position of cursor
794 int yPos
= HIWORD(lParam
); // vertical position of cursor
796 ScreenToClient(&xPos
, &yPos
);
798 // Make sure you can drag by the top of the groupbox, but let
799 // other (enclosed) controls get mouse events also
801 return (long)HTCLIENT
;
806 return wxControl::MSWWindowProc(nMsg
, wParam
, lParam
);
809 WXHBRUSH
wxRadioBox::OnCtlColor(WXHDC pDC
, WXHWND
WXUNUSED(pWnd
), WXUINT
WXUNUSED(nCtlColor
),
815 WXUINT
WXUNUSED(message
),
816 WXWPARAM
WXUNUSED(wParam
),
817 WXLPARAM
WXUNUSED(lParam
)
824 HBRUSH hbrush
= Ctl3dCtlColorEx(message
, wParam
, lParam
);
825 return (WXHBRUSH
) hbrush
;
827 #endif // wxUSE_CTL3D
830 if (GetParent()->GetTransparentBackground())
831 SetBkMode(hdc
, TRANSPARENT
);
833 SetBkMode(hdc
, OPAQUE
);
835 wxColour colBack
= GetBackgroundColour();
838 colBack
= wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE
);
840 ::SetBkColor(hdc
, wxColourToRGB(colBack
));
841 ::SetTextColor(hdc
, wxColourToRGB(GetForegroundColour()));
843 wxBrush
*brush
= wxTheBrushList
->FindOrCreateBrush(colBack
, wxSOLID
);
845 return (WXHBRUSH
)brush
->GetResourceHandle();
849 // ---------------------------------------------------------------------------
850 // window proc for radio buttons
851 // ---------------------------------------------------------------------------
855 LRESULT APIENTRY _EXPORT
wxRadioBtnWndProc(HWND hwnd
,
863 // we must tell IsDialogMessage()/our kbd processing code that we
864 // want to process arrows ourselves because neither of them is
865 // smart enough to handle arrows properly for us
867 long lDlgCode
= ::CallWindowProc(CASTWNDPROC s_wndprocRadioBtn
, hwnd
,
868 message
, wParam
, lParam
);
870 return lDlgCode
| DLGC_WANTARROWS
;
876 NMHDR
* hdr
= (NMHDR
*)lParam
;
877 if ( (int)hdr
->code
== TTN_NEEDTEXT
)
879 wxRadioBox
*radiobox
= (wxRadioBox
*)
880 ::GetWindowLong(hwnd
, GWL_USERDATA
);
882 wxCHECK_MSG( radiobox
, 0,
883 wxT("radio button without radio box?") );
885 wxToolTip
*tooltip
= radiobox
->GetToolTip();
888 TOOLTIPTEXT
*ttt
= (TOOLTIPTEXT
*)lParam
;
889 ttt
->lpszText
= (wxChar
*)tooltip
->GetTip().c_str();
897 #endif // wxUSE_TOOLTIPS
901 wxRadioBox
*radiobox
= (wxRadioBox
*)
902 ::GetWindowLong(hwnd
, GWL_USERDATA
);
904 wxCHECK_MSG( radiobox
, 0, wxT("radio button without radio box?") );
906 bool processed
= TRUE
;
908 bool horz
= (radiobox
->GetWindowStyle() & wxRA_SPECIFY_COLS
) != 0;
909 int num
= radiobox
->Number(),
910 rows
= radiobox
->GetNumVer(),
911 cols
= radiobox
->GetNumHor();
913 int selOld
= radiobox
->GetSelection();
937 // just to suppress the compiler warning
943 int selOld
= radiobox
->GetSelection();
944 int selNew
= radiobox
->GetNextItem
948 radiobox
->GetWindowStyle()
951 int dim
= horz
? cols
: rows
;
952 if ( selNew
% dim
== 0 )
962 if ( selNew
!= selOld
)
964 radiobox
->SetSelection(selNew
);
966 // emulate the button click
967 radiobox
->SendNotificationEvent();
978 wxRadioBox
*radiobox
= (wxRadioBox
*)
979 ::GetWindowLong(hwnd
, GWL_USERDATA
);
981 wxCHECK_MSG( radiobox
, 0, wxT("radio button without radio box?") );
983 bool processed
= TRUE
;
985 HELPINFO
* info
= (HELPINFO
*) lParam
;
986 // Don't yet process menu help events, just windows
987 if (info
->iContextType
== HELPINFO_WINDOW
)
989 wxWindow
* subjectOfHelp
= radiobox
;
990 bool eventProcessed
= FALSE
;
991 while (subjectOfHelp
&& !eventProcessed
)
993 wxHelpEvent
helpEvent(wxEVT_HELP
, subjectOfHelp
->GetId(), wxPoint(info
->MousePos
.x
, info
->MousePos
.y
) ) ; // info->iCtrlId);
994 helpEvent
.SetEventObject(radiobox
);
995 eventProcessed
= radiobox
->GetEventHandler()->ProcessEvent(helpEvent
);
997 // Go up the window hierarchy until the event is handled (or not)
998 subjectOfHelp
= subjectOfHelp
->GetParent();
1000 processed
= eventProcessed
;
1002 else if (info
->iContextType
== HELPINFO_MENUITEM
)
1004 wxHelpEvent
helpEvent(wxEVT_HELP
, info
->iCtrlId
) ;
1005 helpEvent
.SetEventObject(radiobox
);
1006 processed
= radiobox
->GetEventHandler()->ProcessEvent(helpEvent
);
1008 else processed
= FALSE
;
1018 return ::CallWindowProc(CASTWNDPROC s_wndprocRadioBtn
, hwnd
, message
, wParam
, lParam
);
1023 #endif // wxUSE_RADIOBOX