]>
git.saurik.com Git - wxWidgets.git/blob - src/osx/spinbutt_osx.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSpinButton
4 // Author: Stefan Csomor
7 // RCS-ID: $Id: spinbutt.cpp 54129 2008-06-11 19:30:52Z SC $
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
16 #include "wx/spinbutt.h"
17 #include "wx/osx/private.h"
20 IMPLEMENT_DYNAMIC_CLASS(wxSpinButton
, wxControl
)
21 IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent
, wxScrollEvent
)
24 wxSpinButton::wxSpinButton()
29 bool wxSpinButton::Create( wxWindow
*parent
,
30 wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
,
31 long style
, const wxString
& name
)
33 m_macIsUserPane
= false;
35 if ( !wxSpinButtonBase::Create( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
) )
44 m_peer
= wxWidgetImpl::CreateSpinButton( this , parent
, id
, 0, m_min
, m_max
, pos
, size
,
45 style
, GetExtraStyle() );
47 MacPostControlCreate( pos
, size
);
52 wxSpinButton::~wxSpinButton()
56 void wxSpinButton::SetValue( int val
)
58 m_peer
->SetValue( val
);
61 int wxSpinButton::GetValue() const
63 return m_peer
->GetValue();
66 void wxSpinButton::SetRange(int minVal
, int maxVal
)
70 m_peer
->SetMaximum( maxVal
);
71 m_peer
->SetMinimum( minVal
);
74 void wxSpinButton::SendThumbTrackEvent()
76 wxSpinEvent
event( wxEVT_SCROLL_THUMBTRACK
, GetId() );
77 event
.SetPosition( GetValue() );
78 event
.SetEventObject( this );
79 HandleWindowEvent( event
);
82 bool wxSpinButton::HandleClicked( double timestampsec
)
85 // these have been handled by the live action proc already
87 SendThumbTrackEvent() ;
93 wxSize
wxSpinButton::DoGetBestSize() const
95 return wxSize( 16, 24 );
98 #endif // wxUSE_SPINBTN