+// ---------------------------------------------------------------------------
+// global vars
+// ---------------------------------------------------------------------------
+
+// the pointer to standard radio button wnd proc
+static WXFARPROC s_wndprocRadioBtn = (WXFARPROC)NULL;
+
+#endif // __WIN32__
+
+// ===========================================================================
+// implementation
+// ===========================================================================
+
+// ---------------------------------------------------------------------------
+// wxRadioBox
+// ---------------------------------------------------------------------------
+
+int wxRadioBox::GetCount() const
+{
+ return m_noItems;
+}
+
+int wxRadioBox::GetColumnCount() const
+{
+ return GetNumHor();
+}
+
+int wxRadioBox::GetRowCount() const
+{
+ return GetNumVer();
+}
+
+// returns the number of rows
+int wxRadioBox::GetNumVer() const
+{
+ if ( m_windowStyle & wxRA_SPECIFY_ROWS )
+ {
+ return m_majorDim;
+ }
+ else
+ {
+ return (m_noItems + m_majorDim - 1)/m_majorDim;
+ }
+}
+
+// returns the number of columns
+int wxRadioBox::GetNumHor() const
+{
+ if ( m_windowStyle & wxRA_SPECIFY_ROWS )
+ {
+ return (m_noItems + m_majorDim - 1)/m_majorDim;
+ }
+ else
+ {
+ return m_majorDim;
+ }
+}
+
+bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id)
+{
+ if ( cmd == BN_CLICKED )
+ {
+ if (id == GetId())
+ return TRUE;
+
+ int selectedButton = -1;
+
+ for ( int i = 0; i < m_noItems; i++ )
+ {
+ if ( id == wxGetWindowId(m_radioButtons[i]) )
+ {
+ selectedButton = i;
+
+ break;
+ }
+ }
+
+ if ( selectedButton == -1 )
+ {
+ // just ignore it - due to a hack with WM_NCHITTEST handling in our
+ // wnd proc, we can receive dummy click messages when we click near
+ // the radiobox edge (this is ugly but Julian wouldn't let me get
+ // rid of this...)
+ return FALSE;
+ }
+
+ if ( selectedButton != m_selectedButton )
+ {
+ m_selectedButton = selectedButton;
+
+ SendNotificationEvent();
+ }
+ //else: don't generate events when the selection doesn't change
+
+ return TRUE;
+ }
+ else
+ return FALSE;