X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fa50c0e3bfe333bf527177ada29fe24fbc6f6353..7ea1c917764fb2588fe1aadc75c49ba300f8cb2f:/src/palmos/radiobox.cpp diff --git a/src/palmos/radiobox.cpp b/src/palmos/radiobox.cpp index 91febb5485..5fea32f9bd 100644 --- a/src/palmos/radiobox.cpp +++ b/src/palmos/radiobox.cpp @@ -17,10 +17,6 @@ // headers // --------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "radiobox.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -121,28 +117,6 @@ int wxRadioBox::GetCount() const return m_radios.GetCount(); } -int wxRadioBox::GetColumnCount() const -{ - return 0; -} - -int wxRadioBox::GetRowCount() const -{ - return 0; -} - -// returns the number of rows -int wxRadioBox::GetNumVer() const -{ - return 0; -} - -// returns the number of columns -int wxRadioBox::GetNumHor() const -{ - return 0; -} - bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, @@ -156,8 +130,10 @@ bool wxRadioBox::Create(wxWindow *parent, const wxString& name) { // initialize members - m_majorDim = majorDim == 0 ? n : wxMin(majorDim, n); - if(m_majorDim==0 || n==0) return false; + SetMajorDim(majorDim == 0 ? n : majorDim, style); + + if ( GetMajorDim() == 0 || n == 0 ) + return false; // subtype of the native palmOS radio: checkbox or push button? const bool use_checkbox = style & wxRA_USE_CHECKBOX; @@ -166,12 +142,13 @@ bool wxRadioBox::Create(wxWindow *parent, // get default size and position for the initial placement m_size = size; m_pos = pos; - int minor = n / m_majorDim; - if(n % m_majorDim > 0) minor++; + int minor = n / GetMajorDim(); + if(n % GetMajorDim() > 0) + minor++; if(m_size.x==wxDefaultCoord) - m_size.x=36*(use_cols?m_majorDim:minor); + m_size.x=36*(use_cols?GetMajorDim():minor); if(m_size.y==wxDefaultCoord) - m_size.y=12*(use_cols?minor:m_majorDim); + m_size.y=12*(use_cols?minor:GetMajorDim()); if(m_pos.x==wxDefaultCoord) m_pos.x=0; if(m_pos.y==wxDefaultCoord) @@ -185,15 +162,15 @@ bool wxRadioBox::Create(wxWindow *parent, int i = 0; for ( int j = 0; j < minor; j++ ) { - for ( int k = 0; k < m_majorDim; k++ ) + for ( int k = 0; k < GetMajorDim(); k++ ) { if(iSetGroup( id ); rb->Create( @@ -233,7 +210,7 @@ wxRadioBox::~wxRadioBox() { } -wxRadioButton *wxRadioBox::GetRadioButton(int i) +wxRadioButton *wxRadioBox::GetRadioButton(int i) const { return (wxRadioButton *)m_radios.Get(i); } @@ -252,27 +229,32 @@ void wxRadioBox::DoGetSize( int *width, int *height ) const void wxRadioBox::DoMoveWindow(int x, int y, int width, int height) { + wxRect oldRect = GetRect(); + + m_pos.x = x; + m_pos.y = y; m_size.x = width; m_size.y = height; const bool use_cols = HasFlag(wxRA_SPECIFY_COLS); const int n = GetCount(); - int minor = n / m_majorDim; - if(n % m_majorDim > 0) minor++; + int minor = n / GetMajorDim(); + if(n % GetMajorDim() > 0) + minor++; int i = 0; for ( int j = 0; j < minor; j++ ) { - for ( int k = 0; k < m_majorDim; k++ ) + for ( int k = 0; k < GetMajorDim(); k++ ) { if(iRefreshRect(oldRect.Union(GetRect())); } // get the origin of the client area in the client coordinates wxPoint wxRadioBox::GetClientAreaOrigin() const { - return GetParent()->GetClientAreaOrigin() + GetPosition(); + return GetPosition(); } void wxRadioBox::SetString(int item, const wxString& label) { + wxRadioButton *btn = GetRadioButton(item); + if(btn) + btn->SetLabel(label); } void wxRadioBox::SetSelection(int N) @@ -307,9 +295,10 @@ int wxRadioBox::GetSelection() const // Find string for position wxString wxRadioBox::GetString(int item) const { - wxString ret; - - return ret; + wxRadioButton *btn = GetRadioButton(item); + if(btn) + return btn->GetLabel(); + return wxEmptyString; } // ---------------------------------------------------------------------------- @@ -354,14 +343,21 @@ bool wxRadioBox::Enable(int item, bool enable) bool wxRadioBox::Show(bool show) { - // TODO - return false; + for(int i=0; iShow(show); + RefreshRect(btn->GetRect()); + return ret; + } return false; } @@ -385,7 +381,7 @@ void wxRadioBox::Refresh(bool eraseBack, const wxRect *rect) area.SetSize(rect->GetSize()); } - GetParent()->Refresh( eraseBack , &area ); + GetParent()->RefreshRect(area); } void wxRadioBox::Command(wxCommandEvent & event)