]>
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"
14 #pragma implementation "spinbuttbase.h"
17 #include "wx/spinbutt.h"
18 #include "wx/mac/uma.h"
20 // ============================================================================
22 // ============================================================================
24 // ----------------------------------------------------------------------------
26 // ----------------------------------------------------------------------------
28 #if !USE_SHARED_LIBRARY
29 IMPLEMENT_DYNAMIC_CLASS(wxSpinButton
, wxControl
)
30 IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent
, wxScrollEvent
);
33 wxSpinButton::wxSpinButton()
38 bool wxSpinButton::Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
,
39 long style
, const wxString
& name
)
50 MacPreControlCreate( parent
, id
, "" , pos
, size
,style
,*( (wxValidator
*) NULL
) , name
, &bounds
, title
) ;
52 m_macControl
= UMANewControl( parent
->GetMacRootWindow() , &bounds
, title
, true , 0 , 0 , 100,
53 kControlLittleArrowsProc
, (long) this ) ;
55 wxASSERT_MSG( m_macControl
!= NULL
, "No valid mac control" ) ;
57 MacPostControlCreate() ;
62 wxSpinButton::~wxSpinButton()
67 ////////////////////////////////////////////////////////////////////////////
69 int wxSpinButton::GetMin() const
74 int wxSpinButton::GetMax() const
79 int wxSpinButton::GetValue() const
84 void wxSpinButton::SetValue(int val
)
87 wxScrollEvent
event(wxEVT_SCROLL_THUMBTRACK
, m_windowId
);
89 event
.SetPosition(m_value
);
90 event
.SetEventObject( this );
91 GetEventHandler()->ProcessEvent(event
);
94 void wxSpinButton::SetRange(int minVal
, int maxVal
)
100 void wxSpinButton::MacHandleControlClick( ControlHandle control
, SInt16 controlpart
)
102 if ( m_macControl
== NULL
)
105 wxEventType scrollEvent
= wxEVT_NULL
;
108 switch( controlpart
)
110 case kControlUpButtonPart
:
112 scrollEvent
= wxEVT_SCROLL_LINEUP
;
114 case kControlDownButtonPart
:
116 scrollEvent
= wxEVT_SCROLL_LINEDOWN
;
120 m_value
= m_value
+ nScrollInc
;
124 if ( m_windowStyle
& wxSP_WRAP
)
132 if ( m_windowStyle
& wxSP_WRAP
)
138 wxScrollEvent
event(scrollEvent
, m_windowId
);
140 event
.SetPosition(m_value
);
141 event
.SetEventObject( this );
142 GetEventHandler()->ProcessEvent(event
);
145 // ----------------------------------------------------------------------------
147 // ----------------------------------------------------------------------------
149 wxSize
wxSpinButton::DoGetBestSize() const
151 if ( (GetWindowStyle() & wxSP_VERTICAL
) != 0 )
159 // horizontal control