# HG changeset patch # User Claus Gittinger # Date 832956410 -7200 # Node ID 36e76da4bb4e1a45e6176313eec553bfc96097b8 # Parent fe6a036f9cef5f60b97c6e110472b6007fc78091 checkin from browser diff -r fe6a036f9cef -r 36e76da4bb4e ViewScroller.st --- a/ViewScroller.st Fri May 24 01:16:38 1996 +0200 +++ b/ViewScroller.st Fri May 24 18:46:50 1996 +0200 @@ -35,34 +35,36 @@ documentation " - This wrapper view allows scrolling of views (in contrast - to scrolling of contents which can be done by any view). - - Normally, scrolling is done by putting a view into a ScrollableView - (which simply wraps the scrollbars around) and have the scrollbars - send scrollUp:/scrollDown: etc. send to the scrolledView. + This wrapper view allows scrolling of views (in contrast to scrolling + of contents which can be done by any view). - The default implementation of scrolling (in View) modifies the - transformation and does a bit-copy of the contents with redraw - of the exposed area. + Normally, scrolling is done by putting a view into a ScrollableView (which + simply wraps the scrollbars around) and have the scrollbars send scrollUp:/ + scrollDown: etc. send to the scrolledView. + The default implementation of scrolling (in View) modifies the transformation, + and does a bit-copy of the contents with redraw of the exposed area. - However, there are situations, where you want to scroll a view itself. - For example, if you need many buttons in a panel, which do not fit. + However, there are situations, where you want to scroll a view itself. + For example, if you need many buttons in a panel, which do not fit. - This class provides the basic mechanism to implement this. - It is a wrapper, which implements scrolling by modifying the origin - of its single subview when asked to scroll. Thus, it can be put - into a ScrollableView like any other, but will move its subview - when asked to scroll instead (i.e. reimplement all scroll messages - by manipulating its subviews origininstead of its contents' - transformation offset). + This class provides the basic mechanism to implement this. + It is a wrapper, which implements scrolling by modifying the origin of its + single subview when asked to scroll. Thus, it can be put into a ScrollableView + like any other, but will move its subview when asked to scroll instead. + (i.e. reimplement all scroll messages by manipulating its subviews origin + instead of its contents' transformation offset) - The subview should have a constant extent, which will be taken for - the scrollbar position/height computation. - Since the subview is represented directly by the underlying window - systems view implementation, there may be a limit on the maximum size - of that view. For example, in X, dimensions may not be larger - than 32767 pixels. + The subview should have a constant extent, which will be taken for the + scrollbar position/height computation. + Since the subview is represented directly by the underlying window systems view + implementation, there may be a limit on the maximum size of that view. For + example, in X, dimensions may not be larger than 32767 pixels. + + [see also:] + ScrollableView HVScrollableView + + [author:] + Claus Gittinger " ! @@ -88,6 +90,7 @@ top open. [exEnd] + same, horizontally. Also change layout in panel for nicer look and make panel adjust its height: (since the buttons are defined to fill vertically, the vertical @@ -130,11 +133,11 @@ panel horizontalLayout:#leftSpace. textView1 := ScrollableView for:EditTextView in:panel. - textView1 extent:1000 @ 300. + textView1 extent:2000 @ 300. textView1 scrolledView contents:('Makefile' asFilename readStream contents). textView2 := ScrollableView for:EditTextView in:panel. - textView2 extent:1000 @ 300. + textView2 extent:500 @ 300. textView2 scrolledView contents:('Make.proto' asFilename readStream contents). 1 to:100 do:[:i | @@ -166,7 +169,8 @@ !ViewScroller methodsFor:'event handling'! sizeChanged:how - "our size has changed. Make scrolledView visible" + "reposition the scrolledView, if required" + |newOrigin| super sizeChanged:how. @@ -193,33 +197,33 @@ self scrollHorizontalTo: newOrigin. ]. - "Modified: 24.5.1996 / 00:18:25 / stefan" + "Modified: 24.5.1996 / 17:48:44 / cg" ! ! !ViewScroller methodsFor:'queries-contents'! heightOfContents - "return the height of the scrolledView" + "return my contents' height; this is the scrolledViews height" ^ scrolledView height - "Modified: 24.5.1996 / 00:15:13 / stefan" + "Modified: 24.5.1996 / 17:34:48 / cg" ! viewOrigin - "return our origin relative to the scrolled view" + "the viewOrigin (for scrollBars) is based upon the scrolledViews origin" ^ scrolledView origin negated - "Modified: 24.5.1996 / 00:14:43 / stefan" + "Modified: 24.5.1996 / 17:48:13 / cg" ! widthOfContents - "return the width of the scrolledView" + "return my contents' width; this is the scrolledViews width" ^ scrolledView width - "Modified: 24.5.1996 / 00:15:01 / stefan" + "Modified: 24.5.1996 / 17:34:56 / cg" ! ! !ViewScroller methodsFor:'scrolling'! @@ -323,5 +327,5 @@ !ViewScroller class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.8 1996-05-23 23:16:38 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.9 1996-05-24 16:46:50 cg Exp $' ! !