]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/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 IMPLEMENT_DYNAMIC_CLASS(wxSpinButton
, wxControl
)
28 IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent
, wxScrollEvent
);
30 bool wxSpinButton::Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
,
31 long style
, const wxString
& name
)
42 MacPreControlCreate( parent
, id
, "" , pos
, size
,style
,*( (wxValidator
*) NULL
) , name
, &bounds
, title
) ;
44 m_macControl
= UMANewControl( parent
->GetMacRootWindow() , &bounds
, title
, true , 0 , 0 , 100,
45 kControlLittleArrowsProc
, (long) this ) ;
47 wxASSERT_MSG( m_macControl
!= NULL
, "No valid mac control" ) ;
49 MacPostControlCreate() ;
54 wxSpinButton::~wxSpinButton()
59 ////////////////////////////////////////////////////////////////////////////
61 int wxSpinButton::GetValue() const
66 void wxSpinButton::SetValue(int val
)
69 wxScrollEvent
event(wxEVT_SCROLL_THUMBTRACK
, m_windowId
);
71 event
.SetPosition(m_value
);
72 event
.SetEventObject( this );
73 GetEventHandler()->ProcessEvent(event
);
76 void wxSpinButton::SetRange(int minVal
, int maxVal
)
82 void wxSpinButton::MacHandleControlClick( ControlHandle control
, SInt16 controlpart
)
84 if ( m_macControl
== NULL
)
87 wxEventType scrollEvent
= wxEVT_NULL
;
92 case kControlUpButtonPart
:
94 scrollEvent
= wxEVT_SCROLL_LINEUP
;
96 case kControlDownButtonPart
:
98 scrollEvent
= wxEVT_SCROLL_LINEDOWN
;
102 m_value
= m_value
+ nScrollInc
;
106 if ( m_windowStyle
& wxSP_WRAP
)
114 if ( m_windowStyle
& wxSP_WRAP
)
120 wxScrollEvent
event(scrollEvent
, m_windowId
);
122 event
.SetPosition(m_value
);
123 event
.SetEventObject( this );
124 GetEventHandler()->ProcessEvent(event
);
127 // ----------------------------------------------------------------------------
129 // ----------------------------------------------------------------------------
131 wxSize
wxSpinButton::DoGetBestSize()
133 if ( (GetWindowStyle() & wxSP_VERTICAL
) != 0 )
141 // horizontal control