/////////////////////////////////////////////////////////////////////////////
-// Name: src/osx/carbon/spinbutt.cpp
+// Name: src/osx/spinctrl_osx.cpp
// Purpose: wxSpinCtrl
// Author: Robert
// Modified by: Mark Newsam (Based on GTK file)
EVT_SPIN(wxID_ANY, wxSpinCtrlButton::OnSpinButton)
END_EVENT_TABLE()
-IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
-
BEGIN_EVENT_TABLE(wxSpinCtrl, wxControl)
WX_EVENT_TABLE_CONTROL_CONTAINER(wxSpinCtrl)
END_EVENT_TABLE()
int initial,
const wxString& name)
{
- m_macIsUserPane = true;
if ( !wxControl::Create(parent, id, pos, size, style,
wxDefaultValidator, name) )
{
// delete the controls now, don't leave them alive even though they would
// still be eventually deleted by our parent - but it will be too late, the
// user code expects them to be gone now
- delete m_text;
- m_text = NULL ;
- delete m_btn;
- m_btn = NULL ;
+ wxDELETE(m_text);
+ wxDELETE(m_btn);
}
// ----------------------------------------------------------------------------
void wxSpinCtrl::SetTextValue(int val)
{
- wxCHECK_RET( m_text, _T("invalid call to wxSpinCtrl::SetTextValue") );
+ wxCHECK_RET( m_text, wxT("invalid call to wxSpinCtrl::SetTextValue") );
- m_text->SetValue(wxString::Format(_T("%d"), val));
+ m_text->SetValue(wxString::Format(wxT("%d"), val));
// select all text
m_text->SetSelection(0, -1);
+ m_text->SetInsertionPointEnd();
+
// and give focus to the control!
// m_text->SetFocus(); Why???? TODO.
}
void wxSpinCtrl::SetValue(int val)
{
- wxCHECK_RET( m_btn, _T("invalid call to wxSpinCtrl::SetValue") );
+ wxCHECK_RET( m_btn, wxT("invalid call to wxSpinCtrl::SetValue") );
SetTextValue(val);
void wxSpinCtrl::SetValue(const wxString& text)
{
- wxCHECK_RET( m_text, _T("invalid call to wxSpinCtrl::SetValue") );
+ wxCHECK_RET( m_text, wxT("invalid call to wxSpinCtrl::SetValue") );
long val;
if ( text.ToLong(&val) && ((val > INT_MIN) && (val < INT_MAX)) )
void wxSpinCtrl::SetRange(int min, int max)
{
- wxCHECK_RET( m_btn, _T("invalid call to wxSpinCtrl::SetRange") );
+ wxCHECK_RET( m_btn, wxT("invalid call to wxSpinCtrl::SetRange") );
m_btn->SetRange(min, max);
}