]>
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "radioboxbase.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
34 #include "wx/radiobox.h"
37 // ============================================================================
39 // ============================================================================
41 int wxRadioBoxBase::GetNextItem(int item
, wxDirection dir
, long style
) const
43 int count
= GetCount(),
44 numCols
= GetColumnCount(),
45 numRows
= GetRowCount();
47 bool horz
= (style
& wxRA_SPECIFY_COLS
) != 0;
56 else // vertical layout
69 else // vertical layout
80 else // vertical layout
82 if ( ++item
== count
)
90 if ( ++item
== count
)
93 else // vertical layout
100 wxFAIL_MSG( _T("unexpected wxDirection value") );
104 // ensure that the item is in range [0..count)
107 // first map the item to the one in the same column but in the last row
110 // now there are 2 cases: either it is the first item of the last row
111 // in which case we need to wrap again and get to the last item or we
112 // can just go to the previous item
113 if ( item
% (horz
? numCols
: numRows
) )
118 else if ( item
>= count
)
120 // same logic as above
123 // ... except that we need to check if this is not the last item, not
125 if ( (item
+ 1) % (horz
? numCols
: numRows
) )
131 wxASSERT_MSG( item
< count
&& item
>= 0,
132 _T("logic error in wxRadioBox::GetNextItem()") );
137 #if WXWIN_COMPATIBILITY_2_4
139 // these functions are deprecated and don't do anything
140 int wxRadioBoxBase::GetNumberOfRowsOrCols() const
145 void wxRadioBoxBase::SetNumberOfRowsOrCols(int WXUNUSED(n
))
149 #endif // WXWIN_COMPATIBILITY_2_4
151 #endif // wxUSE_RADIOBOX