| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: src/osx/carbon/scrolbar.cpp |
| 3 | // Purpose: wxScrollBar |
| 4 | // Author: Stefan Csomor |
| 5 | // Modified by: |
| 6 | // Created: 1998-01-01 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) Stefan Csomor |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #include "wx/wxprec.h" |
| 13 | |
| 14 | #include "wx/scrolbar.h" |
| 15 | |
| 16 | #ifndef WX_PRECOMP |
| 17 | #include "wx/intl.h" |
| 18 | #include "wx/log.h" |
| 19 | #include "wx/settings.h" |
| 20 | #endif |
| 21 | |
| 22 | #include "wx/osx/private.h" |
| 23 | |
| 24 | class wxOSXScrollBarCarbonImpl : public wxMacControl |
| 25 | { |
| 26 | public : |
| 27 | wxOSXScrollBarCarbonImpl( wxWindowMac* peer) : wxMacControl( peer ) |
| 28 | { |
| 29 | } |
| 30 | |
| 31 | void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) |
| 32 | { |
| 33 | SetValue( value ); |
| 34 | SetControlViewSize(m_controlRef , thumbSize ); |
| 35 | } |
| 36 | protected: |
| 37 | }; |
| 38 | |
| 39 | wxWidgetImplType* wxWidgetImpl::CreateScrollBar( wxWindowMac* wxpeer, |
| 40 | wxWindowMac* parent, |
| 41 | wxWindowID WXUNUSED(id), |
| 42 | const wxPoint& pos, |
| 43 | const wxSize& size, |
| 44 | long WXUNUSED(style), |
| 45 | long WXUNUSED(extraStyle)) |
| 46 | { |
| 47 | Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); |
| 48 | |
| 49 | wxMacControl* peer = new wxOSXScrollBarCarbonImpl( wxpeer ); |
| 50 | OSStatus err = CreateScrollBarControl( |
| 51 | MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, |
| 52 | 0, 0, 100, 1, true /* liveTracking */, |
| 53 | GetwxMacLiveScrollbarActionProc(), |
| 54 | peer->GetControlRefAddr() ); |
| 55 | verify_noerr( err ); |
| 56 | return peer; |
| 57 | } |