X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1a87edf286921de9b182f3d19adb6bb63ba85ebd..cb0b7b7d811356f729315fc14c7e0d311f43384d:/src/univ/radiobox.cpp diff --git a/src/univ/radiobox.cpp b/src/univ/radiobox.cpp index a9e5d1a34c..6a23d3d34b 100644 --- a/src/univ/radiobox.cpp +++ b/src/univ/radiobox.cpp @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "univradiobox.h" -#endif - #include "wx/wxprec.h" #ifdef __BORLANDC__ @@ -99,7 +95,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) void wxRadioBox::Init() { m_selection = -1; - m_majorDim = 0; } wxRadioBox::wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, @@ -178,7 +173,7 @@ bool wxRadioBox::Create(wxWindow *parent, Append(n, choices); // majorDim default value is 0 which means make one row/column - SetMajorDim(majorDim == 0 ? n : majorDim); + SetMajorDim(majorDim == 0 ? n : majorDim, style); if ( size == wxDefaultSize ) { @@ -215,26 +210,6 @@ wxRadioBox::~wxRadioBox() // wxRadioBox init // ---------------------------------------------------------------------------- -void wxRadioBox::SetMajorDim(int majorDim) -{ - wxCHECK_RET( majorDim != 0, _T("major radiobox dimension can't be 0") ); - - m_majorDim = majorDim; - - int minorDim = (GetCount() + m_majorDim - 1) / m_majorDim; - - if ( GetWindowStyle() & wxRA_SPECIFY_COLS ) - { - m_numCols = majorDim; - m_numRows = minorDim; - } - else // wxRA_SPECIFY_ROWS - { - m_numCols = minorDim; - m_numRows = majorDim; - } -} - void wxRadioBox::Append(int count, const wxString *choices) { if ( !count ) @@ -329,11 +304,25 @@ bool wxRadioBox::Enable(int n, bool enable) return m_buttons[n]->Enable(enable); } -void wxRadioBox::Show(int n, bool show) +bool wxRadioBox::IsItemEnabled(int n) const +{ + wxCHECK_MSG( IsValid(n), false, _T("invalid index in wxRadioBox::IsItemEnabled") ); + + return m_buttons[n]->IsEnabled(); +} + +bool wxRadioBox::Show(int n, bool show) +{ + wxCHECK_MSG( IsValid(n), false, _T("invalid index in wxRadioBox::Show") ); + + return m_buttons[n]->Show(show); +} + +bool wxRadioBox::IsItemShown(int n) const { - wxCHECK_RET( IsValid(n), _T("invalid index in wxRadioBox::Show") ); + wxCHECK_MSG( IsValid(n), false, _T("invalid index in wxRadioBox::IsItemShown") ); - m_buttons[n]->Show(show); + return m_buttons[n]->IsShown(); } // ---------------------------------------------------------------------------- @@ -403,7 +392,7 @@ void wxRadioBox::DoSetToolTip(wxToolTip *tooltip) wxSize wxRadioBox::GetMaxButtonSize() const { - int widthMax, heightMax, width, height; + int widthMax, heightMax, width = 0, height = 0; widthMax = heightMax = 0; int count = GetCount(); @@ -424,8 +413,8 @@ wxSize wxRadioBox::DoGetBestClientSize() const { wxSize sizeBtn = GetMaxButtonSize(); - sizeBtn.x *= m_numCols; - sizeBtn.y *= m_numRows; + sizeBtn.x *= GetColumnCount(); + sizeBtn.y *= GetRowCount(); // add a border around all buttons sizeBtn.x += 2*BOX_BORDER_X; @@ -461,7 +450,7 @@ void wxRadioBox::DoMoveWindow(int x0, int y0, int width, int height) if ( GetWindowStyle() & wxRA_TOPTOBOTTOM ) { // from top to bottom - if ( (n + 1) % m_numRows ) + if ( (n + 1) % GetRowCount() ) { // continue in this column y += sizeBtn.y; @@ -476,7 +465,7 @@ void wxRadioBox::DoMoveWindow(int x0, int y0, int width, int height) else // wxRA_LEFTTORIGHT: mirror the code above { // from left to right - if ( (n + 1) % m_numCols ) + if ( (n + 1) % GetColumnCount() ) { // continue in this row x += sizeBtn.x;