]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/spinbutt.cpp
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 // ============================================================================
21 // ============================================================================
23 // ----------------------------------------------------------------------------
25 // ----------------------------------------------------------------------------
27 #if !USE_SHARED_LIBRARY
28 IMPLEMENT_DYNAMIC_CLASS(wxSpinButton
, wxControl
)
29 IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent
, wxScrollEvent
);
32 bool wxSpinButton::Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
,
33 long style
, const wxString
& name
)
44 MacPreControlCreate( parent
, id
, "" , pos
, size
,style
,*( (wxValidator
*) NULL
) , name
, &bounds
, title
) ;
46 m_macControl
= UMANewControl( parent
->GetMacRootWindow() , &bounds
, title
, true , 0 , 0 , 100,
47 kControlLittleArrowsProc
, (long) this ) ;
49 wxASSERT_MSG( m_macControl
!= NULL
, "No valid mac control" ) ;
51 MacPostControlCreate() ;
56 wxSpinButton::~wxSpinButton()
61 ////////////////////////////////////////////////////////////////////////////
63 int wxSpinButton::GetValue() const
68 void wxSpinButton::SetValue(int val
)
71 wxScrollEvent
event(wxEVT_SCROLL_THUMBTRACK
, m_windowId
);
73 event
.SetPosition(m_value
);
74 event
.SetEventObject( this );
75 GetEventHandler()->ProcessEvent(event
);
78 void wxSpinButton::SetRange(int minVal
, int maxVal
)
84 void wxSpinButton::MacHandleControlClick( ControlHandle control
, SInt16 controlpart
)
86 if ( m_macControl
== NULL
)
89 wxEventType scrollEvent
= wxEVT_NULL
;
94 case kControlUpButtonPart
:
96 scrollEvent
= wxEVT_SCROLL_LINEUP
;
98 case kControlDownButtonPart
:
100 scrollEvent
= wxEVT_SCROLL_LINEDOWN
;
104 m_value
= m_value
+ nScrollInc
;
108 if ( m_windowStyle
& wxSP_WRAP
)
116 if ( m_windowStyle
& wxSP_WRAP
)
122 wxScrollEvent
event(scrollEvent
, m_windowId
);
124 event
.SetPosition(m_value
);
125 event
.SetEventObject( this );
126 GetEventHandler()->ProcessEvent(event
);
129 // ----------------------------------------------------------------------------
131 // ----------------------------------------------------------------------------
133 wxSize
wxSpinButton::DoGetBestSize()
135 if ( (GetWindowStyle() & wxSP_VERTICAL
) != 0 )
143 // horizontal control