]>
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::FindString(const wxString
& s
) const
43 int count
= GetCount();
44 for ( int n
= 0; n
< count
; n
++ )
46 if ( GetString(n
) == s
)
53 int wxRadioBoxBase::GetNextItem(int item
, wxDirection dir
, long style
) const
55 int count
= GetCount(),
56 numCols
= GetColumnCount(),
57 numRows
= GetRowCount();
59 bool horz
= (style
& wxRA_SPECIFY_COLS
) != 0;
68 else // vertical layout
81 else // vertical layout
92 else // vertical layout
94 if ( ++item
== count
)
102 if ( ++item
== count
)
105 else // vertical layout
112 wxFAIL_MSG( _T("unexpected wxDirection value") );
116 // ensure that the item is in range [0..count)
119 // first map the item to the one in the same column but in the last row
122 // now there are 2 cases: either it is the first item of the last row
123 // in which case we need to wrap again and get to the last item or we
124 // can just go to the previous item
125 if ( item
% (horz
? numCols
: numRows
) )
130 else if ( item
>= count
)
132 // same logic as above
135 // ... except that we need to check if this is not the last item, not
137 if ( (item
+ 1) % (horz
? numCols
: numRows
) )
143 wxASSERT_MSG( item
< count
&& item
>= 0,
144 _T("logic error in wxRadioBox::GetNextItem()") );
149 #if WXWIN_COMPATIBILITY_2_4
151 // these functions are deprecated and don't do anything
152 int wxRadioBoxBase::GetNumberOfRowsOrCols() const
157 void wxRadioBoxBase::SetNumberOfRowsOrCols(int WXUNUSED(n
))
161 #endif // WXWIN_COMPATIBILITY_2_4
163 #if WXWIN_COMPATIBILITY_2_2
165 int wxRadioBoxBase::Number() const
170 wxString
wxRadioBoxBase::GetLabel(int n
) const
175 void wxRadioBoxBase::SetLabel(int n
, const wxString
& label
)
180 #endif // WXWIN_COMPATIBILITY_2_2
182 #endif // wxUSE_RADIOBOX