]>
git.saurik.com Git - wxWidgets.git/blob - src/common/radiocmn.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/radiocmn.cpp
3 // Purpose: wxRadioBox methods common to all ports
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
30 #include "wx/radiobox.h"
33 // ============================================================================
35 // ============================================================================
37 int wxRadioBoxBase::GetNextItem(int item
, wxDirection dir
, long style
) const
39 int count
= GetCount(),
40 numCols
= GetColumnCount(),
41 numRows
= GetRowCount();
43 bool horz
= (style
& wxRA_SPECIFY_COLS
) != 0;
52 else // vertical layout
65 else // vertical layout
76 else // vertical layout
78 if ( ++item
== count
)
86 if ( ++item
== count
)
89 else // vertical layout
96 wxFAIL_MSG( _T("unexpected wxDirection value") );
100 // ensure that the item is in range [0..count)
103 // first map the item to the one in the same column but in the last row
106 // now there are 2 cases: either it is the first item of the last row
107 // in which case we need to wrap again and get to the last item or we
108 // can just go to the previous item
109 if ( item
% (horz
? numCols
: numRows
) )
114 else if ( item
>= count
)
116 // same logic as above
119 // ... except that we need to check if this is not the last item, not
121 if ( (item
+ 1) % (horz
? numCols
: numRows
) )
127 wxASSERT_MSG( item
< count
&& item
>= 0,
128 _T("logic error in wxRadioBox::GetNextItem()") );
133 #if WXWIN_COMPATIBILITY_2_4
135 // these functions are deprecated and don't do anything
136 int wxRadioBoxBase::GetNumberOfRowsOrCols() const
141 void wxRadioBoxBase::SetNumberOfRowsOrCols(int WXUNUSED(n
))
145 #endif // WXWIN_COMPATIBILITY_2_4
147 #endif // wxUSE_RADIOBOX