static void window_adjust_scrollbars(WindowRef windowRef) { IMAGE *img; Rect portRect; img = (IMAGE*)GetWRefCon(windowRef); GetWindowPortBounds(windowRef,&portRect); /* Move the crollbars to the edges of the window */ HideControl(img->scrollbarVertRef); HideControl(img->scrollbarHorizRef); MoveControl(img->scrollbarVertRef,portRect.right - kScrollBarWidth, portRect.top - 1); MoveControl(img->scrollbarHorizRef,portRect.left - 1, portRect.bottom - kScrollBarWidth); SizeControl(img->scrollbarVertRef,kScrollBarWidth + 1, portRect.bottom - portRect.top - kScrollBarWidth + 1); SizeControl(img->scrollbarHorizRef, portRect.right - portRect.left - kScrollBarWidth + 1, kScrollBarWidth + 1); /* Adjust the scroll position showing */ if (img->pixmapHdl) { PixMap *pixmap = *(img->pixmapHdl); int visibleHeight = portRect.bottom - portRect.top - kScrollBarWidth; int visibleWidth = portRect.right - portRect.left - kScrollBarWidth; if (pixmap->bounds.bottom > visibleHeight) { SetControl32BitMaximum(img->scrollbarVertRef, pixmap->bounds.bottom - visibleHeight); SetControlViewSize(img->scrollbarVertRef,visibleHeight); } else SetControlMaximum(img->scrollbarVertRef, 0); if (pixmap->bounds.right > visibleWidth) { SetControl32BitMaximum(img->scrollbarHorizRef, pixmap->bounds.right - visibleWidth); SetControlViewSize(img->scrollbarHorizRef, visibleWidth); } else SetControlMaximum(img->scrollbarHorizRef, 0); } ShowControl(img->scrollbarVertRef); ShowControl(img->scrollbarHorizRef); }
void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize, bool refresh) { m_pageSize = pageSize; m_viewSize = thumbSize; m_objectSize = range; int range1 = wxMax((m_objectSize - m_viewSize), 0) ; SetControl32BitMaximum( (ControlHandle) m_macControl , range1 ) ; SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ; SetControl32BitValue( (ControlHandle) m_macControl , position ) ; if ( UMAGetAppearanceVersion() >= 0x0110 ) { if ( SetControlViewSize != (void*) kUnresolvedCFragSymbolAddress ) { SetControlViewSize( (ControlHandle) m_macControl , m_viewSize ) ; } } if ( refresh ) MacRedrawControl() ; }
void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) { SetValue( value ); SetControlViewSize(m_controlRef , thumbSize ); }