comments added;
authorClaus Gittinger <cg@exept.de>
Wed, 19 Mar 1997 17:23:20 +0100
changeset 1138 b05fec461045
parent 1137 5ec9db9453f1
child 1139 8114f5fafdf5
comments added; added #pageLeft & #pageRight
ScrView.st
ScrollableView.st
--- a/ScrView.st	Wed Mar 19 17:12:21 1997 +0100
+++ b/ScrView.st	Wed Mar 19 17:23:20 1997 +0100
@@ -13,7 +13,8 @@
 SimpleView subclass:#ScrollableView
 	instanceVariableNames:'scrolledView vScrollBar hScrollBar scrollBarPosition lockUpdates
 		hideScrollBars hasHorizontalScrollBar hasVerticalScrollBar
-		horizontalMini verticalMini vScrollBarHidden hScrollBarHidden'
+		horizontalMini verticalMini vScrollBarHidden hScrollBarHidden
+		vScrollBarVisible hScrollBarVisible'
 	classVariableNames:'DefaultScrolledViewLevel DefaultScrolledViewMargin
 		DefaultScrollBarSpacing DefaultScrolledViewBorderWidth
 		DefaultLevel DefaultScrollBarLevel MyDefaultViewBackgroundColor'
@@ -116,14 +117,14 @@
 
 examples
 "
-    example1 (simple scrolled text):
+  simple scrolled text:
                                                                         [exBegin]
         |top scr txt|
 
         top := StandardSystemView label:'scroll example1'.
         top extent:200@100.
 
-        scr := NewScrollableView for:EditTextView in:top.
+        scr := ScrollableView for:EditTextView in:top.
         scr origin:0.0@0.0 corner:1.0@1.0.
         txt := scr scrolledView.
 
@@ -141,7 +142,7 @@
                                                                         [exEnd]
 
 
-    example2 (changing the scrolledView later):
+  changing the scrolledView later:
                                                                         [exBegin]
         |top scr txtView1 txtView2 browserView|
 
@@ -184,7 +185,7 @@
 
 
 
-    example3 (using a miniscroller):
+  using a miniscroller:
                                                                         [exBegin]
         |top scr txt|
 
@@ -210,7 +211,10 @@
 
 
 
-    example4 (scrolling in both directions):
+  scrolling in both directions:
+    Notice: HVScrollableView remains existent for backward compatibility;
+            scrollability can now be controlled in both directions at any
+            time (see examples below).
                                                                         [exBegin]
         |top scr txt|
 
@@ -236,7 +240,10 @@
 
 
 
-    example5 (using a full scroller vertically, miniscroller horizontally):
+  using a full scroller vertically, miniscroller horizontally:
+    Notice: HVScrollableView remains existent for backward compatibility;
+            scrollability can now be controlled in both directions at any
+            time (see examples below).
                                                                         [exBegin]
         |top scr txt|
 
@@ -262,7 +269,10 @@
 
 
 
-    example6 (using miniscrollers for both directions ):
+  using miniscrollers for both directions:
+    Notice: HVScrollableView remains existent for backward compatibility;
+            scrollability can now be controlled in both directions at any
+            time (see examples below).
                                                                         [exBegin]
         |top scr txt|
 
@@ -285,6 +295,58 @@
                   ).
         top open
                                                                         [exEnd]
+  controlling scrollability:
+                                                                        [exBegin]
+        |top scr txt|
+
+        top := StandardSystemView label:'scroll example6'.
+        top extent:200@100.
+
+        txt := EditTextView new.
+        
+        scr := ScrollableView forView:txt in:top.
+        scr origin:0.0@0.0 corner:1.0@1.0.
+        scr horizontalScrollable:true.
+        scr verticalScrollable:false.
+
+        txt list:#('line1'
+                   'line2'
+                   'line3'
+                   'line4'
+                   'line5'
+                   'line7'
+                   'line8'
+                   'line9'
+                   'line10'
+                  ).
+        top open
+                                                                        [exEnd]
+  controlling scrollability and miniScroller:
+                                                                        [exBegin]
+        |top scr txt|
+
+        top := StandardSystemView label:'scroll example6'.
+        top extent:200@100.
+
+        txt := EditTextView new.
+
+        scr := ScrollableView forView:txt in:top.
+        scr origin:0.0@0.0 corner:1.0@1.0.
+        scr horizontalScrollable:true; horizontalMini:true.
+        scr verticalScrollable:false.
+
+        txt list:#('line1'
+                   'line2'
+                   'line3'
+                   'line4'
+                   'line5'
+                   'line7'
+                   'line8'
+                   'line9'
+                   'line10'
+                  ).
+        top open
+                                                                        [exEnd]
 "
 ! !
 
@@ -803,7 +865,7 @@
     "Modified: 7.3.1997 / 15:03:37 / cg"
 ! !
 
-!ScrollableView methodsFor:'accessing - components'!
+!ScrollableView methodsFor:'accessing-components'!
 
 horizontalScrollBar
     "return the horizontal scrollbar (or nil, if there is none)"
@@ -870,22 +932,34 @@
 !ScrollableView methodsFor:'accessing-look'!
 
 hideScrollBars:aBoolean
+    "set/clear the flag which controls if scrollBars should
+     be made invisible dynamically, if there is nothing to scroll
+     (and shown if there is). 
+     This flags setting is normally controlled by the styleSheet."
+
     hideScrollBars := aBoolean.
 
     "Created: 7.3.1997 / 21:57:23 / cg"
+    "Modified: 19.3.1997 / 16:28:42 / cg"
 !
 
 horizontalMini:aBoolean
+    "control the horizontal scrollBar to be either a miniScroller,
+     or a full scrollBar."
+
     horizontalMini ~~ aBoolean ifTrue:[
         horizontalMini := aBoolean.
         self setupViews
     ].
 
     "Created: 7.3.1997 / 21:57:02 / cg"
-    "Modified: 7.3.1997 / 22:09:46 / cg"
+    "Modified: 19.3.1997 / 16:29:43 / cg"
 !
 
 horizontalScrollable:aBoolean
+    "enable/disable horizontal scrollability.
+     If disabled, the horizontal scrollBar is made invisible."
+
     hasHorizontalScrollBar ~~ aBoolean ifTrue:[
         hasHorizontalScrollBar := aBoolean.
         hScrollBarHidden := false.
@@ -893,20 +967,26 @@
     ].
 
     "Created: 7.3.1997 / 21:56:28 / cg"
-    "Modified: 7.3.1997 / 22:10:21 / cg"
+    "Modified: 19.3.1997 / 16:30:29 / cg"
 !
 
 verticalMini:aBoolean
+    "control the vertical scrollBar to be either a miniScroller,
+     or a full scrollBar."
+
     verticalMini ~~ aBoolean ifTrue:[
         verticalMini := aBoolean.
         self setupViews
     ]
 
     "Created: 7.3.1997 / 21:56:57 / cg"
-    "Modified: 7.3.1997 / 22:09:57 / cg"
+    "Modified: 19.3.1997 / 16:29:49 / cg"
 !
 
 verticalScrollable:aBoolean
+    "enable/disable vertical scrollability.
+     If disabled, the vertical scrollBar is made invisible."
+
     hasVerticalScrollBar ~~ aBoolean ifTrue:[
         hasVerticalScrollBar := aBoolean.
         vScrollBarHidden := false.
@@ -914,7 +994,7 @@
     ]
 
     "Created: 7.3.1997 / 21:56:39 / cg"
-    "Modified: 7.3.1997 / 22:10:39 / cg"
+    "Modified: 19.3.1997 / 16:30:38 / cg"
 ! !
 
 !ScrollableView methodsFor:'changes '!
@@ -1069,6 +1149,8 @@
 !
 
 sizeChanged:how
+    "handle size changes - this may change any scrollBars visibility"
+
     |orgX orgY scroll|
 
     "/ resize components manually, in an order which is optimal
@@ -1151,31 +1233,53 @@
     ].
     self updateScrollBarVisibility.
 
-    "Modified: 7.3.1997 / 22:18:23 / cg"
+    "Modified: 19.3.1997 / 16:31:13 / cg"
 ! !
 
 !ScrollableView methodsFor:'forced scroll'!
 
 pageDown
-    "page down"
+    "page down - but only if there is a vertical scrollbar"
 
     vScrollBar notNil ifTrue:[
         vScrollBar pageDown
     ]
 
-    "Modified: 6.3.1997 / 17:01:51 / cg"
     "Created: 6.3.1997 / 18:06:23 / cg"
+    "Modified: 19.3.1997 / 16:32:34 / cg"
+!
+
+pageLeft
+    "page left - but only if there is a horizontal scrollbar"
+
+    hScrollBar notNil ifTrue:[
+        hScrollBar pageDown
+    ]
+
+    "Created: 19.3.1997 / 16:32:14 / cg"
+    "Modified: 19.3.1997 / 16:32:44 / cg"
+!
+
+pageRight
+    "page right - but only if there is a horizontal scrollbar"
+
+    hScrollBar notNil ifTrue:[
+        hScrollBar pageUp
+    ]
+
+    "Created: 19.3.1997 / 16:32:22 / cg"
+    "Modified: 19.3.1997 / 16:32:48 / cg"
 !
 
 pageUp
-    "page up"
+    "page up - but only if there is a vertical scrollbar"
 
     vScrollBar notNil ifTrue:[
         vScrollBar pageUp
     ]
 
-    "Modified: 6.3.1997 / 17:01:58 / cg"
     "Created: 6.3.1997 / 18:06:23 / cg"
+    "Modified: 19.3.1997 / 16:32:38 / cg"
 ! !
 
 !ScrollableView methodsFor:'initialization'!
@@ -1183,7 +1287,7 @@
 initStyle
     "initialize style specifics"
 
-    <resource: #style (#scrollBarPosition)>
+    <resource: #style (#scrollBarPosition scrollBarHiding)>
 
     super initStyle.
 
@@ -1192,7 +1296,7 @@
     hideScrollBars := styleSheet at:'scrollBarHiding' default:false.
 
     "Created: 6.3.1997 / 18:06:23 / cg"
-    "Modified: 7.3.1997 / 21:47:32 / cg"
+    "Modified: 19.3.1997 / 16:32:59 / cg"
 !
 
 realize
@@ -1286,6 +1390,9 @@
 !
 
 setupDimensions
+    "set the components dimensions (i.e. layouts) according to
+     the scrollability and hidden settings"
+
     |scrolledViewMargin scrollBarSpacing
      scrolledViewLayout hScrollBarLayout vScrollBarLayout
      vBd         "{ Class: SmallInteger }"
@@ -1448,7 +1555,7 @@
     ].
 
     "Created: 6.3.1997 / 18:06:23 / cg"
-    "Modified: 7.3.1997 / 22:41:14 / cg"
+    "Modified: 19.3.1997 / 16:33:56 / cg"
 !
 
 setupVertical:isVertical mini:miniV horizontal:isHorizontal mini:miniH 
@@ -1619,9 +1726,12 @@
 !ScrollableView methodsFor:'slave-view messages'!
 
 clear
+    "convenient method: forward this to the scrolledView"
+
     scrolledView notNil ifTrue:[scrolledView clear]
 
     "Created: 6.3.1997 / 18:06:24 / cg"
+    "Modified: 19.3.1997 / 16:34:19 / cg"
 !
 
 doesNotUnderstand:aMessage
@@ -1712,5 +1822,5 @@
 !ScrollableView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/ScrView.st,v 1.55 1997-03-19 15:49:31 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/ScrView.st,v 1.56 1997-03-19 16:23:20 cg Exp $'
 ! !
--- a/ScrollableView.st	Wed Mar 19 17:12:21 1997 +0100
+++ b/ScrollableView.st	Wed Mar 19 17:23:20 1997 +0100
@@ -13,7 +13,8 @@
 SimpleView subclass:#ScrollableView
 	instanceVariableNames:'scrolledView vScrollBar hScrollBar scrollBarPosition lockUpdates
 		hideScrollBars hasHorizontalScrollBar hasVerticalScrollBar
-		horizontalMini verticalMini vScrollBarHidden hScrollBarHidden'
+		horizontalMini verticalMini vScrollBarHidden hScrollBarHidden
+		vScrollBarVisible hScrollBarVisible'
 	classVariableNames:'DefaultScrolledViewLevel DefaultScrolledViewMargin
 		DefaultScrollBarSpacing DefaultScrolledViewBorderWidth
 		DefaultLevel DefaultScrollBarLevel MyDefaultViewBackgroundColor'
@@ -116,14 +117,14 @@
 
 examples
 "
-    example1 (simple scrolled text):
+  simple scrolled text:
                                                                         [exBegin]
         |top scr txt|
 
         top := StandardSystemView label:'scroll example1'.
         top extent:200@100.
 
-        scr := NewScrollableView for:EditTextView in:top.
+        scr := ScrollableView for:EditTextView in:top.
         scr origin:0.0@0.0 corner:1.0@1.0.
         txt := scr scrolledView.
 
@@ -141,7 +142,7 @@
                                                                         [exEnd]
 
 
-    example2 (changing the scrolledView later):
+  changing the scrolledView later:
                                                                         [exBegin]
         |top scr txtView1 txtView2 browserView|
 
@@ -184,7 +185,7 @@
 
 
 
-    example3 (using a miniscroller):
+  using a miniscroller:
                                                                         [exBegin]
         |top scr txt|
 
@@ -210,7 +211,10 @@
 
 
 
-    example4 (scrolling in both directions):
+  scrolling in both directions:
+    Notice: HVScrollableView remains existent for backward compatibility;
+            scrollability can now be controlled in both directions at any
+            time (see examples below).
                                                                         [exBegin]
         |top scr txt|
 
@@ -236,7 +240,10 @@
 
 
 
-    example5 (using a full scroller vertically, miniscroller horizontally):
+  using a full scroller vertically, miniscroller horizontally:
+    Notice: HVScrollableView remains existent for backward compatibility;
+            scrollability can now be controlled in both directions at any
+            time (see examples below).
                                                                         [exBegin]
         |top scr txt|
 
@@ -262,7 +269,10 @@
 
 
 
-    example6 (using miniscrollers for both directions ):
+  using miniscrollers for both directions:
+    Notice: HVScrollableView remains existent for backward compatibility;
+            scrollability can now be controlled in both directions at any
+            time (see examples below).
                                                                         [exBegin]
         |top scr txt|
 
@@ -285,6 +295,58 @@
                   ).
         top open
                                                                         [exEnd]
+  controlling scrollability:
+                                                                        [exBegin]
+        |top scr txt|
+
+        top := StandardSystemView label:'scroll example6'.
+        top extent:200@100.
+
+        txt := EditTextView new.
+        
+        scr := ScrollableView forView:txt in:top.
+        scr origin:0.0@0.0 corner:1.0@1.0.
+        scr horizontalScrollable:true.
+        scr verticalScrollable:false.
+
+        txt list:#('line1'
+                   'line2'
+                   'line3'
+                   'line4'
+                   'line5'
+                   'line7'
+                   'line8'
+                   'line9'
+                   'line10'
+                  ).
+        top open
+                                                                        [exEnd]
+  controlling scrollability and miniScroller:
+                                                                        [exBegin]
+        |top scr txt|
+
+        top := StandardSystemView label:'scroll example6'.
+        top extent:200@100.
+
+        txt := EditTextView new.
+
+        scr := ScrollableView forView:txt in:top.
+        scr origin:0.0@0.0 corner:1.0@1.0.
+        scr horizontalScrollable:true; horizontalMini:true.
+        scr verticalScrollable:false.
+
+        txt list:#('line1'
+                   'line2'
+                   'line3'
+                   'line4'
+                   'line5'
+                   'line7'
+                   'line8'
+                   'line9'
+                   'line10'
+                  ).
+        top open
+                                                                        [exEnd]
 "
 ! !
 
@@ -803,7 +865,7 @@
     "Modified: 7.3.1997 / 15:03:37 / cg"
 ! !
 
-!ScrollableView methodsFor:'accessing - components'!
+!ScrollableView methodsFor:'accessing-components'!
 
 horizontalScrollBar
     "return the horizontal scrollbar (or nil, if there is none)"
@@ -870,22 +932,34 @@
 !ScrollableView methodsFor:'accessing-look'!
 
 hideScrollBars:aBoolean
+    "set/clear the flag which controls if scrollBars should
+     be made invisible dynamically, if there is nothing to scroll
+     (and shown if there is). 
+     This flags setting is normally controlled by the styleSheet."
+
     hideScrollBars := aBoolean.
 
     "Created: 7.3.1997 / 21:57:23 / cg"
+    "Modified: 19.3.1997 / 16:28:42 / cg"
 !
 
 horizontalMini:aBoolean
+    "control the horizontal scrollBar to be either a miniScroller,
+     or a full scrollBar."
+
     horizontalMini ~~ aBoolean ifTrue:[
         horizontalMini := aBoolean.
         self setupViews
     ].
 
     "Created: 7.3.1997 / 21:57:02 / cg"
-    "Modified: 7.3.1997 / 22:09:46 / cg"
+    "Modified: 19.3.1997 / 16:29:43 / cg"
 !
 
 horizontalScrollable:aBoolean
+    "enable/disable horizontal scrollability.
+     If disabled, the horizontal scrollBar is made invisible."
+
     hasHorizontalScrollBar ~~ aBoolean ifTrue:[
         hasHorizontalScrollBar := aBoolean.
         hScrollBarHidden := false.
@@ -893,20 +967,26 @@
     ].
 
     "Created: 7.3.1997 / 21:56:28 / cg"
-    "Modified: 7.3.1997 / 22:10:21 / cg"
+    "Modified: 19.3.1997 / 16:30:29 / cg"
 !
 
 verticalMini:aBoolean
+    "control the vertical scrollBar to be either a miniScroller,
+     or a full scrollBar."
+
     verticalMini ~~ aBoolean ifTrue:[
         verticalMini := aBoolean.
         self setupViews
     ]
 
     "Created: 7.3.1997 / 21:56:57 / cg"
-    "Modified: 7.3.1997 / 22:09:57 / cg"
+    "Modified: 19.3.1997 / 16:29:49 / cg"
 !
 
 verticalScrollable:aBoolean
+    "enable/disable vertical scrollability.
+     If disabled, the vertical scrollBar is made invisible."
+
     hasVerticalScrollBar ~~ aBoolean ifTrue:[
         hasVerticalScrollBar := aBoolean.
         vScrollBarHidden := false.
@@ -914,7 +994,7 @@
     ]
 
     "Created: 7.3.1997 / 21:56:39 / cg"
-    "Modified: 7.3.1997 / 22:10:39 / cg"
+    "Modified: 19.3.1997 / 16:30:38 / cg"
 ! !
 
 !ScrollableView methodsFor:'changes '!
@@ -1069,6 +1149,8 @@
 !
 
 sizeChanged:how
+    "handle size changes - this may change any scrollBars visibility"
+
     |orgX orgY scroll|
 
     "/ resize components manually, in an order which is optimal
@@ -1151,31 +1233,53 @@
     ].
     self updateScrollBarVisibility.
 
-    "Modified: 7.3.1997 / 22:18:23 / cg"
+    "Modified: 19.3.1997 / 16:31:13 / cg"
 ! !
 
 !ScrollableView methodsFor:'forced scroll'!
 
 pageDown
-    "page down"
+    "page down - but only if there is a vertical scrollbar"
 
     vScrollBar notNil ifTrue:[
         vScrollBar pageDown
     ]
 
-    "Modified: 6.3.1997 / 17:01:51 / cg"
     "Created: 6.3.1997 / 18:06:23 / cg"
+    "Modified: 19.3.1997 / 16:32:34 / cg"
+!
+
+pageLeft
+    "page left - but only if there is a horizontal scrollbar"
+
+    hScrollBar notNil ifTrue:[
+        hScrollBar pageDown
+    ]
+
+    "Created: 19.3.1997 / 16:32:14 / cg"
+    "Modified: 19.3.1997 / 16:32:44 / cg"
+!
+
+pageRight
+    "page right - but only if there is a horizontal scrollbar"
+
+    hScrollBar notNil ifTrue:[
+        hScrollBar pageUp
+    ]
+
+    "Created: 19.3.1997 / 16:32:22 / cg"
+    "Modified: 19.3.1997 / 16:32:48 / cg"
 !
 
 pageUp
-    "page up"
+    "page up - but only if there is a vertical scrollbar"
 
     vScrollBar notNil ifTrue:[
         vScrollBar pageUp
     ]
 
-    "Modified: 6.3.1997 / 17:01:58 / cg"
     "Created: 6.3.1997 / 18:06:23 / cg"
+    "Modified: 19.3.1997 / 16:32:38 / cg"
 ! !
 
 !ScrollableView methodsFor:'initialization'!
@@ -1183,7 +1287,7 @@
 initStyle
     "initialize style specifics"
 
-    <resource: #style (#scrollBarPosition)>
+    <resource: #style (#scrollBarPosition scrollBarHiding)>
 
     super initStyle.
 
@@ -1192,7 +1296,7 @@
     hideScrollBars := styleSheet at:'scrollBarHiding' default:false.
 
     "Created: 6.3.1997 / 18:06:23 / cg"
-    "Modified: 7.3.1997 / 21:47:32 / cg"
+    "Modified: 19.3.1997 / 16:32:59 / cg"
 !
 
 realize
@@ -1286,6 +1390,9 @@
 !
 
 setupDimensions
+    "set the components dimensions (i.e. layouts) according to
+     the scrollability and hidden settings"
+
     |scrolledViewMargin scrollBarSpacing
      scrolledViewLayout hScrollBarLayout vScrollBarLayout
      vBd         "{ Class: SmallInteger }"
@@ -1448,7 +1555,7 @@
     ].
 
     "Created: 6.3.1997 / 18:06:23 / cg"
-    "Modified: 7.3.1997 / 22:41:14 / cg"
+    "Modified: 19.3.1997 / 16:33:56 / cg"
 !
 
 setupVertical:isVertical mini:miniV horizontal:isHorizontal mini:miniH 
@@ -1619,9 +1726,12 @@
 !ScrollableView methodsFor:'slave-view messages'!
 
 clear
+    "convenient method: forward this to the scrolledView"
+
     scrolledView notNil ifTrue:[scrolledView clear]
 
     "Created: 6.3.1997 / 18:06:24 / cg"
+    "Modified: 19.3.1997 / 16:34:19 / cg"
 !
 
 doesNotUnderstand:aMessage
@@ -1712,5 +1822,5 @@
 !ScrollableView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ScrollableView.st,v 1.55 1997-03-19 15:49:31 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ScrollableView.st,v 1.56 1997-03-19 16:23:20 cg Exp $'
 ! !