1. moved m_majorDim duplicated in many ports to wxRadioBoxBase

2. also implement Getcolumn/RowCount() in it now and document them
3. removed various remains of old (pre-wxRadioBoxBase) cruft

sorry in advance for any compilation breakage on the platforms I can't test on


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36307 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-11-30 16:28:15 +00:00
parent 344d0d8821
commit 21e0a4d5f1
19 changed files with 111 additions and 318 deletions

View File

@@ -131,7 +131,6 @@ void wxRadioBox::Init()
{
m_selectedButton = wxNOT_FOUND;
m_radioButtons = NULL;
m_majorDim = 0;
m_radioWidth = NULL;
m_radioHeight = NULL;
}
@@ -149,7 +148,7 @@ bool wxRadioBox::Create(wxWindow *parent,
const wxString& name)
{
// initialize members
m_majorDim = majorDim == 0 ? n : majorDim;
SetMajorDim(majorDim == 0 ? n : majorDim, style);
// common initialization
if ( !wxStaticBox::Create(parent, id, title, pos, size, style, name) )
@@ -331,32 +330,6 @@ int wxRadioBox::GetCount() const
return m_radioButtons->GetCount();
}
// returns the number of rows
int wxRadioBox::GetNumVer() const
{
if ( m_windowStyle & wxRA_SPECIFY_ROWS )
{
return m_majorDim;
}
else
{
return (GetCount() + m_majorDim - 1)/m_majorDim;
}
}
// returns the number of columns
int wxRadioBox::GetNumHor() const
{
if ( m_windowStyle & wxRA_SPECIFY_ROWS )
{
return (GetCount() + m_majorDim - 1)/m_majorDim;
}
else
{
return m_majorDim;
}
}
void wxRadioBox::SetString(int item, const wxString& label)
{
wxCHECK_RET( IsValid(item), wxT("invalid radiobox index") );
@@ -498,8 +471,8 @@ wxSize wxRadioBox::GetTotalButtonSize(const wxSize& sizeBtn) const
int extraHeight = cy1;
int height = GetNumVer() * sizeBtn.y + cy1/2 + extraHeight;
int width = GetNumHor() * (sizeBtn.x + cx1) + cx1;
int height = GetRowCount() * sizeBtn.y + cy1/2 + extraHeight;
int width = GetColumnCount() * (sizeBtn.x + cx1) + cx1;
// Add extra space under the label, if it exists.
if (!wxControl::GetLabel().empty())
@@ -580,9 +553,9 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
// to the right border of radiobox and thus can be wider than this.
// Also, remember that wxRA_SPECIFY_COLS means that we arrange buttons in
// left to right order and m_majorDim is the number of columns while
// left to right order and GetMajorDim() is the number of columns while
// wxRA_SPECIFY_ROWS means that the buttons are arranged top to bottom and
// m_majorDim is the number of rows.
// GetMajorDim() is the number of rows.
x_offset += cx1;
y_offset += cy1;
@@ -606,16 +579,16 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
// item is the last in its row if it is a multiple of the number of
// columns or if it is just the last item
int n = i + 1;
isLastInTheRow = ((n % m_majorDim) == 0) || (n == count);
isLastInTheRow = ((n % GetMajorDim()) == 0) || (n == count);
}
else // wxRA_SPECIFY_ROWS
{
// item is the last in the row if it is in the last columns
isLastInTheRow = i >= (count/m_majorDim)*m_majorDim;
isLastInTheRow = i >= (count/GetMajorDim())*GetMajorDim();
}
// is this the start of new row/column?
if ( i && (i % m_majorDim == 0) )
if ( i && (i % GetMajorDim() == 0) )
{
if ( m_windowStyle & wxRA_SPECIFY_ROWS )
{