]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/spinbutt.cpp
8f3e1533b86bad4403aad5c260b58ccd170d233c
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSpinButton
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "spinbutt.h"
16 #include "wx/spinbutt.h"
17 #include "wx/mac/uma.h"
19 #if !USE_SHARED_LIBRARY
20 IMPLEMENT_DYNAMIC_CLASS(wxSpinButton
, wxControl
)
23 wxSpinButton::wxSpinButton()
29 bool wxSpinButton::Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
,
30 long style
, const wxString
& name
)
41 MacPreControlCreate( parent
, id
, "" , pos
, size
,style
,*( (wxValidator
*) NULL
) , name
, &bounds
, title
) ;
43 m_macControl
= UMANewControl( parent
->GetMacRootWindow() , &bounds
, title
, true , 0 , 0 , 100,
44 kControlLittleArrowsProc
, (long) this ) ;
46 wxASSERT_MSG( m_macControl
!= NULL
, "No valid mac control" ) ;
48 MacPostControlCreate() ;
53 wxSpinButton::~wxSpinButton()
58 ////////////////////////////////////////////////////////////////////////////
60 int wxSpinButton::GetValue() const
65 void wxSpinButton::SetValue(int val
)
68 wxScrollEvent
event(wxEVT_SCROLL_THUMBTRACK
, m_windowId
);
70 event
.SetPosition(m_value
);
71 event
.SetEventObject( this );
72 GetEventHandler()->ProcessEvent(event
);
75 void wxSpinButton::SetRange(int minVal
, int maxVal
)
82 IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent
, wxScrollEvent
)
84 wxSpinEvent::wxSpinEvent(wxEventType commandType
, int id
):
85 wxScrollEvent(commandType
, id
)
89 void wxSpinButton::MacHandleControlClick( ControlHandle control
, SInt16 controlpart
)
91 if ( m_macControl
== NULL
)
94 wxEventType scrollEvent
= wxEVT_NULL
;
99 case kControlUpButtonPart
:
101 scrollEvent
= wxEVT_SCROLL_LINEUP
;
103 case kControlDownButtonPart
:
105 scrollEvent
= wxEVT_SCROLL_LINEDOWN
;
109 m_value
= m_value
+ nScrollInc
;
113 if ( m_windowStyle
& wxSP_WRAP
)
121 if ( m_windowStyle
& wxSP_WRAP
)
127 wxScrollEvent
event(scrollEvent
, m_windowId
);
129 event
.SetPosition(m_value
);
130 event
.SetEventObject( this );
131 GetEventHandler()->ProcessEvent(event
);