1 /////////////////////////////////////////////////////////////////////////////
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
18 #include "wx/wxchar.h"
19 #include "wx/string.h"
20 #include "wx/bitmap.h"
22 #include "wx/radiobox.h"
25 #include "wx/os2/private.h"
27 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox
, wxControl
)
29 // ---------------------------------------------------------------------------
31 // ---------------------------------------------------------------------------
33 // wnd proc for radio buttons
34 MRESULT EXPENTRY
wxRadioBtnWndProc( HWND hWnd
39 MRESULT EXPENTRY
wxRadioBoxWndProc( HWND hWnd
45 // ---------------------------------------------------------------------------
47 // ---------------------------------------------------------------------------
49 // the pointer to standard radio button wnd proc
50 extern void wxAssociateWinWithHandle( HWND hWnd
53 static WXFARPROC fnWndProcRadioBtn
= NULL
;
54 static WXFARPROC fnWndProcRadioBox
= NULL
;
56 // ===========================================================================
58 // ===========================================================================
60 // ---------------------------------------------------------------------------
62 // ---------------------------------------------------------------------------
65 wxRadioBox::wxRadioBox()
67 m_nSelectedButton
= -1;
70 m_ahRadioButtons
= NULL
;
72 m_pnRadioWidth
= NULL
;
73 m_pnRadioHeight
= NULL
;
74 } // end of wxRadioBox::wxRadioBox
76 wxRadioBox::~wxRadioBox()
78 m_isBeingDeleted
= true;
83 for (i
= 0; i
< m_nNoItems
; i
++)
84 ::WinDestroyWindow((HWND
)m_ahRadioButtons
[i
]);
85 delete[] m_ahRadioButtons
;
88 delete[] m_pnRadioWidth
;
90 delete[] m_pnRadioHeight
;
91 } // end of wxRadioBox::~wxRadioBox
93 void wxRadioBox::AdjustButtons( int nX
,
97 int WXUNUSED(nSizeFlags
) )
101 int nYOffset
= nY
+ nHeight
;
108 wxFont vFont
= GetFont();
110 wxGetCharSize( m_hWnd
115 vMaxSize
= GetMaxButtonSize();
116 nMaxWidth
= vMaxSize
.x
;
117 nMaxHeight
= vMaxSize
.y
;
120 nYOffset
-= (nMaxHeight
+ ((3*nCy1
)/2));
125 for (int i
= 0; i
< m_nNoItems
; i
++)
128 // The last button in the row may be wider than the other ones as the
129 // radiobox may be wider than the sum of the button widths (as it
130 // happens, for example, when the radiobox label is very long)
132 bool bIsLastInTheRow
;
134 if (m_windowStyle
& wxRA_SPECIFY_COLS
)
137 // Item is the last in its row if it is a multiple of the number of
138 // columns or if it is just the last item
142 bIsLastInTheRow
= ((n
% m_nMajorDim
) == 0) || (n
== m_nNoItems
);
144 else // winRA_SPECIFY_ROWS
147 // Item is the last in the row if it is in the last columns
149 bIsLastInTheRow
= i
>= (m_nNoItems
/m_nMajorDim
) * m_nMajorDim
;
153 // Is this the start of new row/column?
155 if (i
&& (i
% m_nMajorDim
== 0))
157 if (m_windowStyle
& wxRA_SPECIFY_ROWS
)
161 // Start of new column
164 nXOffset
+= nMaxWidth
+ nCx1
;
166 else // start of new row
169 nYOffset
-= nMaxHeight
;
170 if (m_pnRadioWidth
[0] > 0L)
180 // Make the button go to the end of radio box
182 nWidthBtn
= nStartX
+ nWidth
- nXOffset
- (2 * nCx1
);
183 if (nWidthBtn
< nMaxWidth
)
184 nWidthBtn
= nMaxWidth
;
189 // Normal button, always of the same size
191 nWidthBtn
= nMaxWidth
;
195 // Make all buttons of the same, maximal size - like this they
196 // cover the radiobox entirely and the radiobox tooltips are always
197 // shown (otherwise they are not when the mouse pointer is in the
198 // radiobox part not beYInt32ing to any radiobutton)
200 ::WinSetWindowPos( (HWND
)m_ahRadioButtons
[i
]
206 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
209 // Where do we put the next button?
211 if (m_windowStyle
& wxRA_SPECIFY_ROWS
)
216 nYOffset
-= nMaxHeight
;
217 if (m_pnRadioWidth
[0] > 0)
223 // To the right of this one
225 nXOffset
+= nWidthBtn
+ nCx1
;
228 } // end of wxRadioBox::AdjustButtons
230 void wxRadioBox::Command (
231 wxCommandEvent
& rEvent
234 SetSelection (rEvent
.GetInt());
235 ProcessCommand(rEvent
);
236 } // end of wxRadioBox::Command
238 bool wxRadioBox::ContainsHWND(
242 size_t nCount
= GetCount();
245 for (i
= 0; i
< nCount
; i
++)
247 if (GetRadioButtons()[i
] == hWnd
)
251 } // end of wxRadioBox::ContainsHWND
253 bool wxRadioBox::Create(
256 , const wxString
& rsTitle
257 , const wxPoint
& rPos
258 , const wxSize
& rSize
259 , const wxArrayString
& asChoices
262 , const wxValidator
& rVal
263 , const wxString
& rsName
266 wxCArrayString
chs(asChoices
);
268 return Create(pParent
, vId
, rsTitle
, rPos
, rSize
, chs
.GetCount(),
269 chs
.GetStrings(), nMajorDim
, lStyle
, rVal
, rsName
);
272 bool wxRadioBox::Create(
275 , const wxString
& rsTitle
276 , const wxPoint
& rPos
277 , const wxSize
& rSize
279 , const wxString asChoices
[]
282 , const wxValidator
& rVal
283 , const wxString
& rsName
289 vColour
.Set(wxString(wxT("BLACK")));
290 m_backgroundColour
= pParent
->GetBackgroundColour();
291 m_nSelectedButton
= -1;
294 m_nMajorDim
= nMajorDim
== 0 ? nNum
: nMajorDim
;
295 m_nNoRowsOrCols
= nMajorDim
;
298 // Common initialization
300 if (!CreateControl( pParent
309 if (!OS2CreateControl( wxT("STATIC")
317 wxAssociateWinWithHandle(m_hWnd
, this);
320 // Some radio boxes test consecutive id.
323 (void)NewControlId();
324 m_ahRadioButtons
= new WXHWND
[nNum
];
325 m_pnRadioWidth
= new int[nNum
];
326 m_pnRadioHeight
= new int[nNum
];
328 for (int i
= 0; i
< nNum
; i
++)
330 m_pnRadioWidth
[i
] = m_pnRadioHeight
[i
] = -1;
332 long lStyleBtn
= BS_AUTORADIOBUTTON
| WS_TABSTOP
| WS_VISIBLE
;
333 int nNewId
= NewControlId();
335 if (i
== 0 && lStyle
== 0)
336 lStyleBtn
|= WS_GROUP
;
338 HWND hWndBtn
= (WXHWND
)::WinCreateWindow ( GetHwndOf(pParent
)
340 ,(PSZ
)asChoices
[i
].c_str()
349 lColor
= (LONG
)vColour
.GetPixel();
350 ::WinSetPresParam( hWndBtn
355 lColor
= (LONG
)m_backgroundColour
.GetPixel();
357 ::WinSetPresParam( hWndBtn
366 m_ahRadioButtons
[i
] = (WXHWND
)hWndBtn
;
367 SubclassRadioButton((WXHWND
)hWndBtn
);
368 wxAssociateWinWithHandle(hWndBtn
, this);
369 wxOS2SetFont( hWndBtn
372 ::WinSetWindowULong(hWndBtn
, QWL_USER
, (ULONG
)this);
373 m_aSubControls
.Add(nNewId
);
377 // Create a dummy radio control to end the group.
379 (void)::WinCreateWindow ( GetHwndOf(pParent
)
382 ,WS_GROUP
| BS_AUTORADIOBUTTON
386 ,(HMENU
)NewControlId()
390 SetFont(*wxSMALL_FONT
);
391 fnWndProcRadioBox
= (WXFARPROC
)::WinSubclassWindow( GetHwnd()
392 ,(PFNWP
)wxRadioBoxWndProc
394 ::WinSetWindowULong(GetHwnd(), QWL_USER
, (ULONG
)this);
395 lColor
= (LONG
)vColour
.GetPixel();
396 ::WinSetPresParam( m_hWnd
401 ::WinSetPresParam( m_hWnd
406 lColor
= (LONG
)m_backgroundColour
.GetPixel();
408 ::WinSetPresParam( m_hWnd
413 ::WinSetPresParam( m_hWnd
427 } // end of wxRadioBox::Create
429 wxSize
wxRadioBox::DoGetBestSize() const
431 return (GetTotalButtonSize(GetMaxButtonSize()));
432 } // end of WinGuiBase_CRadioBox::DoGetBestSize
434 void wxRadioBox::DoSetSize(
448 #if RADIOBTN_PARENT_IS_RADIOBOX
457 wxSize vMaxSize
= GetMaxButtonSize();
465 wxFont vFont
= GetFont();
467 m_nSizeFlags
= nSizeFlags
;
468 GetPosition( &nCurrentX
475 if (nX
== wxDefaultCoord
&& !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
477 if (nY
== wxDefaultCoord
&& !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
484 wxGetCharSize( m_hWnd
491 // Attempt to have a look coherent with other platforms: We compute the
492 // biggest toggle dim, then we align all items according this value.
494 vMaxSize
= GetMaxButtonSize();
495 nMaxWidth
= vMaxSize
.x
;
496 nMaxHeight
= vMaxSize
.y
;
498 vTotSize
= GetTotalButtonSize(vMaxSize
);
499 nTotWidth
= vTotSize
.x
;
500 nTotHeight
= vTotSize
.y
;
503 // Only change our width/height if asked for
507 if (nSizeFlags
& wxSIZE_AUTO_WIDTH
)
515 if (nSizeFlags
& wxSIZE_AUTO_HEIGHT
)
516 nHeight
= nTotHeight
;
518 nHeight
= nHeightOld
;
521 wxWindowOS2
* pParent
= (wxWindowOS2
*)GetParent();
525 int nOS2Height
= GetOS2ParentHeight(pParent
);
527 nYy
= nOS2Height
- (nYy
+ nHeight
);
528 nYOffset
= nYy
+ nHeight
;
534 ::WinQueryWindowRect(HWND_DESKTOP
, &vRect
);
535 nYy
= vRect
.yTop
- (nYy
+ nHeight
);
537 ::WinSetWindowPos( GetHwnd()
543 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
547 // Now position all the buttons: the current button will be put at
548 // wxPoint(x_offset, y_offset) and the new row/column will start at
549 // startX/startY. The size of all buttons will be the same wxSize(maxWidth,
550 // maxHeight) except for the buttons in the last column which should extend
551 // to the right border of radiobox and thus can be wider than this.
553 // Also, remember that wxRA_SPECIFY_COLS means that we arrange buttons in
554 // left to right order and m_majorDim is the number of columns while
555 // wxRA_SPECIFY_ROWS means that the buttons are arranged top to bottom and
556 // m_majorDim is the number of rows.
559 nYOffset
-= (nMaxHeight
+ ((3*nCy1
)/2));
564 for (int i
= 0; i
< m_nNoItems
; i
++)
567 // The last button in the row may be wider than the other ones as the
568 // radiobox may be wider than the sum of the button widths (as it
569 // happens, for example, when the radiobox label is very long)
571 bool bIsLastInTheRow
;
573 if (m_windowStyle
& wxRA_SPECIFY_COLS
)
576 // Item is the last in its row if it is a multiple of the number of
577 // columns or if it is just the last item
581 bIsLastInTheRow
= ((n
% m_nMajorDim
) == 0) || (n
== m_nNoItems
);
583 else // winRA_SPECIFY_ROWS
586 // Item is the last in the row if it is in the last columns
588 bIsLastInTheRow
= i
>= (m_nNoItems
/m_nMajorDim
) * m_nMajorDim
;
592 // Is this the start of new row/column?
594 if (i
&& (i
% m_nMajorDim
== 0))
596 if (m_windowStyle
& wxRA_SPECIFY_ROWS
)
600 // Start of new column
603 nXOffset
+= nMaxWidth
+ nCx1
;
605 else // start of new row
608 nYOffset
-= nMaxHeight
;
609 if (m_pnRadioWidth
[0] > 0L)
619 // Make the button go to the end of radio box
621 nWidthBtn
= nStartX
+ nWidth
- nXOffset
- (2 * nCx1
);
622 if (nWidthBtn
< nMaxWidth
)
623 nWidthBtn
= nMaxWidth
;
628 // Normal button, always of the same size
630 nWidthBtn
= nMaxWidth
;
634 // Make all buttons of the same, maximal size - like this they
635 // cover the radiobox entirely and the radiobox tooltips are always
636 // shown (otherwise they are not when the mouse pointer is in the
637 // radiobox part not beinting to any radiobutton)
639 ::WinSetWindowPos( (HWND
)m_ahRadioButtons
[i
]
645 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
648 // Where do we put the next button?
650 if (m_windowStyle
& wxRA_SPECIFY_ROWS
)
655 nYOffset
-= nMaxHeight
;
656 if (m_pnRadioWidth
[0] > 0)
662 // To the right of this one
664 nXOffset
+= nWidthBtn
+ nCx1
;
667 } // end of wxRadioBox::DoSetSize
669 bool wxRadioBox::Enable(int nItem
, bool bEnable
)
671 wxCHECK_MSG( IsValid(nItem
), false,
672 wxT("invalid item in wxRadioBox::Enable()") );
674 ::WinEnableWindow((HWND
) m_ahRadioButtons
[nItem
], bEnable
);
676 } // end of wxRadioBox::Enable
678 bool wxRadioBox::Enable(
682 if ( !wxControl::Enable(bEnable
) )
684 for (int i
= 0; i
< m_nNoItems
; i
++)
685 ::WinEnableWindow((HWND
)m_ahRadioButtons
[i
], bEnable
);
687 } // end of wxRadioBox::Enable
689 int wxRadioBox::FindString(
690 const wxString
& rsStr
693 for (int i
= 0; i
< m_nNoItems
; i
++)
695 if (rsStr
== wxGetWindowText(m_ahRadioButtons
[i
]) )
699 } // end of wxRadioBox::FindString
701 int wxRadioBox::GetColumnCount() const
704 } // end of wxRadioBox::GetColumnCount
706 int wxRadioBox::GetCount() const
709 } // end of wxRadioBox::GetCount
711 wxString
wxRadioBox::GetLabel(
715 wxCHECK_MSG( IsValid(nItem
), wxEmptyString
, wxT("invalid radiobox index") );
717 return wxGetWindowText(m_ahRadioButtons
[nItem
]);
718 } // end of wxRadioBox::GetLabel
720 wxSize
wxRadioBox::GetMaxButtonSize() const
725 for (int i
= 0 ; i
< m_nNoItems
; i
++)
730 if (m_pnRadioWidth
[i
] < 0L)
732 GetTextExtent( wxGetWindowText(m_ahRadioButtons
[i
])
738 // Adjust the size to take into account the radio box itself
739 // FIXME this is totally bogus!
741 nWidth
+= RADIO_SIZE
;
747 nWidth
= m_pnRadioWidth
[i
];
748 nHeight
= m_pnRadioHeight
[i
];
750 if (nWidthMax
< nWidth
)
752 if (nHeightMax
< nHeight
)
753 nHeightMax
= nHeight
;
755 wxSize
maxsize( nWidthMax
, nHeightMax
);
757 } // end of wxRadioBox::GetMaxButtonSize
759 int wxRadioBox::GetNumHor() const
761 if ( m_windowStyle
& wxRA_SPECIFY_ROWS
)
763 return (m_nNoItems
+ m_nMajorDim
- 1)/m_nMajorDim
;
769 } // end of wxRadioBox::GetNumHor
771 int wxRadioBox::GetNumVer() const
773 if ( m_windowStyle
& wxRA_SPECIFY_ROWS
)
779 return (m_nNoItems
+ m_nMajorDim
- 1)/m_nMajorDim
;
781 } // end of wxRadioBox::GetNumVer
783 void wxRadioBox::GetPosition( int* pnX
,
784 int* WXUNUSED(pnY
) ) const
786 wxWindowOS2
* pParent
= GetParent();
787 RECT vRect
= { -1, -1, -1, -1 };
791 for (i
= 0; i
< m_nNoItems
; i
++)
792 wxFindMaxSize( m_ahRadioButtons
[i
]
796 wxFindMaxSize( m_hWnd
801 // Since we now have the absolute screen coords, if there's a parent we
802 // must subtract its top left corner
804 vPoint
.x
= vRect
.xLeft
;
805 vPoint
.y
= vRect
.yTop
;
810 ::WinQueryWindowPos((HWND
)pParent
->GetHWND(), &vSwp
);
816 // We may be faking the client origin. So a window that's really at (0, 30)
817 // may appear (to wxWin apps) to be at (0, 0).
821 wxPoint
vPt(GetParent()->GetClientAreaOrigin());
828 } // end of wxRadioBox::GetPosition
830 int wxRadioBox::GetRowCount() const
833 } // end of wxRadioBox::GetRowCount
835 // Get single selection, for single choice list items
836 int wxRadioBox::GetSelection() const
838 return m_nSelectedButton
;
839 } // end of wxRadioBox::GetSelection
841 void wxRadioBox::GetSize(
855 wxFindMaxSize( m_hWnd
859 for (i
= 0; i
< m_nNoItems
; i
++)
860 wxFindMaxSize( m_ahRadioButtons
[i
]
865 *pnWidth
= vRect
.xRight
- vRect
.xLeft
;
867 *pnHeight
= vRect
.yTop
- vRect
.yBottom
;
868 } // end of wxRadioBox::GetSize
870 // Find string for position
871 wxString
wxRadioBox::GetString(
875 return wxGetWindowText(m_ahRadioButtons
[nNum
]);
876 } // end of wxRadioBox::GetString
878 // For single selection items only
879 wxString
wxRadioBox::GetStringSelection() const
882 int nSel
= GetSelection();
885 sResult
= GetString(nSel
);
887 } // end of wxRadioBox::GetStringSelection
889 wxSize
wxRadioBox::GetTotalButtonSize( const wxSize
& rSizeBtn
) const
897 wxFont vFont
= GetFont();
899 wxGetCharSize( m_hWnd
, &nCx1
, &nCy1
, &vFont
);
902 nHeight
= GetNumVer() * rSizeBtn
.y
+ (2 * nCy1
);
903 nWidth
= GetNumHor() * (rSizeBtn
.x
+ nCx1
) + nCx1
;
906 // And also wide enough for its label
908 GetTextExtent( GetTitle()
912 nWidthLabel
+= RADIO_SIZE
;
913 if (nWidthLabel
> nWidth
)
914 nWidth
= nWidthLabel
;
916 wxSize
total( nWidth
, nHeight
);
918 } // end of wxRadioBox::GetTotalButtonSize
920 WXHBRUSH
wxRadioBox::OnCtlColor( WXHDC hwinDC
,
921 WXHWND
WXUNUSED(hWnd
),
922 WXUINT
WXUNUSED(uCtlColor
),
923 WXUINT
WXUNUSED(uMessage
),
924 WXWPARAM
WXUNUSED(wParam
),
925 WXLPARAM
WXUNUSED(lParam
) )
927 HPS hPS
= (HPS
)hwinDC
; // pass in a PS handle in OS/2
929 if (GetParent()->GetTransparentBackground())
930 ::GpiSetBackMix(hPS
, BM_LEAVEALONE
);
932 ::GpiSetBackMix(hPS
, BM_OVERPAINT
);
934 wxColour vColBack
= GetBackgroundColour();
936 ::GpiSetBackColor(hPS
, vColBack
.GetPixel());
937 ::GpiSetColor(hPS
, vColBack
.GetPixel());
939 wxBrush
* pBrush
= wxTheBrushList
->FindOrCreateBrush( vColBack
, wxSOLID
);
940 return ((WXHBRUSH
)pBrush
->GetResourceHandle());
941 } // end of wxRadioBox::OnCtlColor
943 bool wxRadioBox::OS2Command( WXUINT uCmd
,
946 int nSelectedButton
= -1;
948 if (uCmd
== BN_CLICKED
)
954 for (int i
= 0; i
< m_nNoItems
; i
++)
956 if (wId
== wxGetWindowId(m_ahRadioButtons
[i
]))
962 if (nSelectedButton
== -1)
969 if (nSelectedButton
!= m_nSelectedButton
)
971 m_nSelectedButton
= nSelectedButton
;
972 SendNotificationEvent();
978 } // end of wxRadioBox::OS2Command
980 void wxRadioBox::SendNotificationEvent()
982 wxCommandEvent
vEvent( wxEVT_COMMAND_RADIOBOX_SELECTED
986 vEvent
.SetInt( m_nSelectedButton
);
987 vEvent
.SetString( GetString(m_nSelectedButton
) );
988 vEvent
.SetEventObject(this);
989 ProcessCommand(vEvent
);
990 } // end of wxRadioBox::SendNotificationEvent
992 void wxRadioBox::SetFocus()
996 if (m_nSelectedButton
== -1)
997 ::WinSetFocus(HWND_DESKTOP
, (HWND
)m_ahRadioButtons
[0]);
999 ::WinSetFocus(HWND_DESKTOP
, (HWND
)m_ahRadioButtons
[m_nSelectedButton
]);
1001 } // end of wxRadioBox::SetFocus
1003 bool wxRadioBox::SetFont(
1007 if (!wxControl::SetFont(rFont
))
1015 // Also set the font of our radio buttons
1017 for (int n
= 0; n
< (int)m_nNoItems
; n
++)
1019 HWND hWndBtn
= (HWND
)m_ahRadioButtons
[n
];
1021 wxOS2SetFont( hWndBtn
1024 ::WinInvalidateRect(hWndBtn
, NULL
, FALSE
);
1027 } // end of wxRadioBox::SetFont
1029 void wxRadioBox::SetSelection(
1033 wxCHECK_RET( IsValid(nNum
), wxT("invalid radiobox index") );
1035 if ( IsValid(m_nSelectedButton
) )
1036 ::WinSendMsg((HWND
)m_ahRadioButtons
[m_nSelectedButton
], BM_SETCHECK
, (MPARAM
)0, (MPARAM
)0);
1038 ::WinSendMsg((HWND
)m_ahRadioButtons
[nNum
], BM_SETCHECK
, (MPARAM
)1, (MPARAM
)0);
1039 ::WinSetFocus(HWND_DESKTOP
, (HWND
)m_ahRadioButtons
[nNum
]);
1040 m_nSelectedButton
= nNum
;
1041 } // end of wxRadioBox::SetSelection
1043 void wxRadioBox::SetString(
1045 , const wxString
& rsLabel
1048 wxCHECK_RET( IsValid(nItem
), wxT("invalid radiobox index") );
1050 m_pnRadioWidth
[nItem
] = m_pnRadioHeight
[nItem
] = -1;
1051 ::WinSetWindowText((HWND
)m_ahRadioButtons
[nItem
], (PSZ
)rsLabel
.c_str());
1052 } // end of wxRadioBox::SetString
1054 bool wxRadioBox::SetStringSelection(
1055 const wxString
& rsStr
1058 int nSel
= FindString(rsStr
);
1067 } // end of wxRadioBox::SetStringSelection
1069 bool wxRadioBox::Show(
1073 if (!wxControl::Show(bShow
))
1076 for (int i
= 0; i
< m_nNoItems
; i
++)
1078 ::WinShowWindow((HWND
)m_ahRadioButtons
[i
], (BOOL
)bShow
);
1081 } // end of wxRadioBox::Show
1083 // Show a specific button
1084 bool wxRadioBox::Show(
1089 wxCHECK_MSG( IsValid(nItem
), false,
1090 wxT("invalid item in wxRadioBox::Show()") );
1092 ::WinShowWindow((HWND
)m_ahRadioButtons
[nItem
], bShow
);
1095 } // end of wxRadioBox::Show
1097 void wxRadioBox::SubclassRadioButton(
1101 fnWndProcRadioBtn
= (WXFARPROC
)::WinSubclassWindow(hWndBtn
, (PFNWP
)wxRadioBtnWndProc
);
1102 } // end of wxRadioBox::SubclassRadioButton
1104 MRESULT
wxRadioBox::WindowProc(
1110 return (wxControl::OS2WindowProc( uMsg
1114 } // end of wxRadioBox::WindowProc
1116 // ---------------------------------------------------------------------------
1117 // window proc for radio buttons
1118 // ---------------------------------------------------------------------------
1120 MRESULT
wxRadioBtnWndProc(
1131 USHORT uKeyFlags
= SHORT1FROMMP((MPARAM
)wParam
);
1133 if (!(uKeyFlags
& KC_KEYUP
)) // Key Down event
1135 if (uKeyFlags
& KC_VIRTUALKEY
)
1137 wxRadioBox
* pRadiobox
= (wxRadioBox
*)::WinQueryWindowULong( hWnd
1140 USHORT uVk
= SHORT2FROMMP((MPARAM
)lParam
);
1141 bool bProcessed
= true;
1166 // Just to suppress the compiler warning
1173 int nSelOld
= pRadiobox
->GetSelection();
1174 int nSelNew
= pRadiobox
->GetNextItem( nSelOld
1176 ,pRadiobox
->GetWindowStyleFlag()
1179 if (nSelNew
!= nSelOld
)
1181 pRadiobox
->SetSelection(nSelNew
);
1184 // Emulate the button click
1186 pRadiobox
->SendNotificationEvent();
1196 return fnWndProcRadioBtn( hWnd
1201 } // end of wxRadioBtnWndProc
1203 MRESULT EXPENTRY
wxRadioBoxWndProc(
1210 return (fnWndProcRadioBox( hWnd
1216 } // end of wxRadioBoxWndProc