X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1a87edf286921de9b182f3d19adb6bb63ba85ebd..d1f024a8de8872ae314b30e0d1b8c8a1b8518c3d:/src/palmos/radiobox.cpp?ds=inline diff --git a/src/palmos/radiobox.cpp b/src/palmos/radiobox.cpp index 80ec1b6103..71a7ab9775 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" @@ -177,6 +173,8 @@ bool wxRadioBox::Create(wxWindow *parent, if(m_pos.y==wxDefaultCoord) m_pos.y=0; + m_label = title; + if(!wxControl::Create(parent, id, m_pos, m_size, style, val, name)) return false; @@ -231,7 +229,7 @@ wxRadioBox::~wxRadioBox() { } -wxRadioButton *wxRadioBox::GetRadioButton(int i) +wxRadioButton *wxRadioBox::GetRadioButton(int i) const { return (wxRadioButton *)m_radios.Get(i); } @@ -250,6 +248,10 @@ 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; @@ -273,21 +275,29 @@ void wxRadioBox::DoMoveWindow(int x, int y, int width, int height) end.y = (use_cols ? ((j+1)*m_size.y)/minor : ((k+1)*m_size.y)/m_majorDim); wxRadioButton* rb = GetRadioButton(i); if(rb) - rb->SetSize(end.x-start.x-1,end.y-start.y-1); + { + rb->SetSize(start.x,start.y,end.x-start.x-1,end.y-start.y-1); + } i++; } } } + + // refresh old and new area + GetParent()->RefreshRect(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) @@ -303,9 +313,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; } // ---------------------------------------------------------------------------- @@ -331,9 +342,12 @@ void wxRadioBox::SetFocus() { } -bool wxRadioBox::Show(bool show) +// Enable all subcontrols +bool wxRadioBox::Enable(bool enable) { - return false; + for(int i=0; i<GetCount(); i++) + Enable(i, enable); + return true; } // Enable a specific button @@ -345,17 +359,47 @@ bool wxRadioBox::Enable(int item, bool enable) return false; } -// Enable all subcontrols -bool wxRadioBox::Enable(bool enable) +bool wxRadioBox::Show(bool show) { for(int i=0; i<GetCount(); i++) - Enable(i, enable); + Show(i, show); return true; } // Show a specific button -void wxRadioBox::Show(int item, bool show) +bool wxRadioBox::Show(int item, bool show) +{ + wxRadioButton *btn = GetRadioButton(item); + if(btn) + { + bool ret = btn->Show(show); + RefreshRect(btn->GetRect()); + return ret; + } + return false; +} + +wxString wxRadioBox::GetLabel() { + return m_label; +} + +void wxRadioBox::SetLabel(const wxString& label) +{ + m_label = label; +} + +void wxRadioBox::Refresh(bool eraseBack, const wxRect *rect) +{ + wxRect area = GetRect(); + + if(rect) + { + area.Offset(rect->GetPosition()); + area.SetSize(rect->GetSize()); + } + + GetParent()->RefreshRect(area); } void wxRadioBox::Command(wxCommandEvent & event)