// 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"
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;
{
}
-wxRadioButton *wxRadioBox::GetRadioButton(int i)
+wxRadioButton *wxRadioBox::GetRadioButton(int i) const
{
return (wxRadioButton *)m_radios.Get(i);
}
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;
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)
// 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;
}
// ----------------------------------------------------------------------------
{
}
-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
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)