about to merge V & HV scrollableView into a single
ScrollableView class ...
--- a/HVScrView.st Thu Mar 06 16:14:22 1997 +0100
+++ b/HVScrView.st Thu Mar 06 17:08:06 1997 +0100
@@ -11,7 +11,7 @@
"
ScrollableView subclass:#HVScrollableView
- instanceVariableNames:'hScrollBar'
+ instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Views-Basic'
@@ -163,12 +163,6 @@
!HVScrollableView methodsFor:'accessing - components'!
-horizontalScrollBar
- "return the horizontal scrollbar"
-
- ^ hScrollBar
-!
-
scrolledView:aView
"set the scrolled view"
@@ -178,7 +172,7 @@
styleSheet is3D ifTrue:[
scrolledView
extent:[(width
- - scrollBar width
+ - vScrollBar width
- (innerMargin * 2))
@
(height
@@ -188,8 +182,8 @@
] ifFalse:[
scrolledView
extent:[(width
- - scrollBar width
- - scrollBar borderWidth
+ - vScrollBar width
+ - vScrollBar borderWidth
"- scrolledView borderWidth")
@
(height
@@ -200,62 +194,7 @@
].
self setScrollActions.
- "Modified: 1.8.1996 / 12:44:37 / cg"
-! !
-
-!HVScrollableView methodsFor:'changes '!
-
-update:something with:argument from:changedObject
- "whenever the scrolledview changes its contents, we have to
- update the scrollers too"
-
- changedObject == scrolledView ifTrue:[
- something == #sizeOfContents ifTrue:[
- scrollBar setThumbFor:scrolledView.
- hScrollBar setThumbFor:scrolledView.
- ^ self
- ].
- something == #originOfContents ifTrue:[
- lockUpdates ifFalse:[
- scrollBar setThumbOriginFor:scrolledView.
- hScrollBar setThumbOriginFor:scrolledView.
- ].
- ^ self
- ].
- ].
-! !
-
-!HVScrollableView methodsFor:'event processing'!
-
-sizeChanged:how
- |orgY orgX scroll|
-
- super sizeChanged:how.
- scrolledView notNil ifTrue:[
- scrollBar setThumbFor:scrolledView.
- hScrollBar setThumbFor:scrolledView.
-
- orgY := scrollBar thumbOrigin.
- orgX := hScrollBar thumbOrigin.
- scroll := false.
-
- orgY + scrollBar thumbHeight >= 100 ifTrue:[
- scrollBar thumbOrigin:(100 - scrollBar thumbHeight).
- orgY := scrollBar thumbOrigin.
- scroll := true.
- ].
- orgX + hScrollBar thumbHeight >= 100 ifTrue:[
- hScrollBar thumbOrigin:(100 - hScrollBar thumbHeight).
- orgX := hScrollBar thumbOrigin.
- scroll := true.
- ].
- scroll ifTrue:[
- scrolledView scrollToPercent:(orgX@orgY).
- ].
- ].
-
- "Modified: 8.9.1995 / 12:46:36 / claus"
- "Modified: 5.8.1996 / 12:18:52 / stefan"
+ "Modified: 6.3.1997 / 17:04:47 / cg"
! !
!HVScrollableView methodsFor:'initialization'!
@@ -305,14 +244,14 @@
extra := 2.
].
- scrollBar extent:[scrollBar width
+ vScrollBar extent:[vScrollBar width
@
(height - hScrollBar height - mrg + extra)].
hScrollBar thumbOrigin:0 thumbHeight:100.
scrollBarPosition == #left ifTrue:[
- orgX := scrollBar origin x + scrollBar width.
+ orgX := vScrollBar origin x + vScrollBar width.
is3D ifTrue:[
orgX := orgX + halfSpacing + 1.
scrolledView notNil ifTrue:[
@@ -336,22 +275,22 @@
@
(height - hScrollBar height - halfMargin)
]
- extent:[(width - scrollBar width - (innerMargin * 2) + extra)
+ extent:[(width - vScrollBar width - (innerMargin * 2) + extra)
@
hScrollBar height
]
] ifFalse:[
scrollBarPosition == #left ifTrue:[
hScrollBar
- origin:[(orgX + scrollBar borderWidth)
+ origin:[(orgX + vScrollBar borderWidth)
@
(height - hScrollBar height - hBorderWidth)
]
- extent:[(width - scrollBar width) @ hScrollBar height]
+ extent:[(width - vScrollBar width) @ hScrollBar height]
] ifFalse:[
hScrollBar
origin:[orgX @ (height - hScrollBar height - hBorderWidth) ]
- extent:[(width - scrollBar width - hBorderWidth) @ hScrollBar height]
+ extent:[(width - vScrollBar width - hBorderWidth) @ hScrollBar height]
]
].
@@ -359,12 +298,12 @@
"redefine subviews size"
is3D ifTrue:[
scrolledView
- extent:[(width - scrollBar width - (innerMargin * 2))
+ extent:[(width - vScrollBar width - (innerMargin * 2))
@
(height - hScrollBar height - (innerMargin * 2)) ]
] ifFalse:[
scrolledView
- extent:[(width - scrollBar width - scrollBar borderWidth)
+ extent:[(width - vScrollBar width - vScrollBar borderWidth)
@
(height - hScrollBar height - hScrollBar borderWidth)
]
@@ -372,99 +311,11 @@
self setScrollActions.
]
- "Modified: 16.1.1997 / 19:06:07 / cg"
-!
-
-realize
- super realize.
- scrolledView notNil ifTrue:[
- hScrollBar setThumbFor:scrolledView
- ]
-! !
-
-!HVScrollableView methodsFor:'private'!
-
-setScrollActions
- lockUpdates := false.
-
- scrollBar scrollAction:[:position |
- lockUpdates := true.
- scrolledView scrollVerticalToPercent:position.
- lockUpdates := false
- ].
- scrollBar scrollUpAction:[scrolledView scrollUp].
- scrollBar scrollDownAction:[scrolledView scrollDown].
-
- hScrollBar scrollAction:[:position |
- lockUpdates := true.
- scrolledView scrollHorizontalToPercent:position.
- lockUpdates := false
- ].
- hScrollBar scrollLeftAction:[scrolledView scrollLeft].
- hScrollBar scrollRightAction:[scrolledView scrollRight].
-
- scrolledView addDependent:self.
-
- "
- pass my keyboard input (and other subviews input)
- to the scrolled view ...
- "
- self delegate:(KeyboardForwarder toView:scrolledView).
-
- "Modified: 1.8.1996 / 12:44:16 / cg"
+ "Modified: 6.3.1997 / 17:06:14 / cg"
! !
!HVScrollableView methodsFor:'queries'!
-isHorizontalScrollable
- "return true, because I am horizontal scrollable"
-
- ^ true
-
- "Modified: 5.8.1996 / 12:29:10 / stefan"
-!
-
-preferredExtent
- "return the components preferredExtent."
-
- |pref m2|
-
- "/ If I have an explicit preferredExtent ..
-
- preferredExtent notNil ifTrue:[
- ^ preferredExtent
- ].
-
- scrolledView notNil ifTrue:[
- m2 := innerMargin * 2.
- pref := scrolledView preferredExtent.
- ^ (pref x + scrollBar width + m2)
- @
- (pref y + hScrollBar height + m2).
- ].
- ^ super preferredExtent.
-
- "Modified: 19.7.1996 / 20:44:16 / cg"
-!
-
-preferredExtentForLines:numLines cols:numCols
- "return my preferredExtent for given number of lines and cols."
-
- |pref m2|
-
- scrolledView notNil ifTrue:[
- m2 := innerMargin * 2.
- pref := scrolledView preferredExtentForLines:numLines cols:numCols.
- ^ (pref x + scrollBar width + m2)
- @
- (pref y + hScrollBar height + m2).
- ].
- ^ super preferredExtent.
-
- "Modified: 23.4.1996 / 00:15:25 / cg"
- "Created: 24.5.1996 / 17:15:43 / cg"
-!
-
specClass
self class == HVScrollableView ifTrue:[^ ScrollableViewSpec].
^ super specClass
@@ -473,5 +324,5 @@
!HVScrollableView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/Attic/HVScrView.st,v 1.24 1997-02-28 09:31:09 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/Attic/HVScrView.st,v 1.25 1997-03-06 16:08:06 cg Exp $'
! !
--- a/HVScrollableView.st Thu Mar 06 16:14:22 1997 +0100
+++ b/HVScrollableView.st Thu Mar 06 17:08:06 1997 +0100
@@ -11,7 +11,7 @@
"
ScrollableView subclass:#HVScrollableView
- instanceVariableNames:'hScrollBar'
+ instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Views-Basic'
@@ -163,12 +163,6 @@
!HVScrollableView methodsFor:'accessing - components'!
-horizontalScrollBar
- "return the horizontal scrollbar"
-
- ^ hScrollBar
-!
-
scrolledView:aView
"set the scrolled view"
@@ -178,7 +172,7 @@
styleSheet is3D ifTrue:[
scrolledView
extent:[(width
- - scrollBar width
+ - vScrollBar width
- (innerMargin * 2))
@
(height
@@ -188,8 +182,8 @@
] ifFalse:[
scrolledView
extent:[(width
- - scrollBar width
- - scrollBar borderWidth
+ - vScrollBar width
+ - vScrollBar borderWidth
"- scrolledView borderWidth")
@
(height
@@ -200,62 +194,7 @@
].
self setScrollActions.
- "Modified: 1.8.1996 / 12:44:37 / cg"
-! !
-
-!HVScrollableView methodsFor:'changes '!
-
-update:something with:argument from:changedObject
- "whenever the scrolledview changes its contents, we have to
- update the scrollers too"
-
- changedObject == scrolledView ifTrue:[
- something == #sizeOfContents ifTrue:[
- scrollBar setThumbFor:scrolledView.
- hScrollBar setThumbFor:scrolledView.
- ^ self
- ].
- something == #originOfContents ifTrue:[
- lockUpdates ifFalse:[
- scrollBar setThumbOriginFor:scrolledView.
- hScrollBar setThumbOriginFor:scrolledView.
- ].
- ^ self
- ].
- ].
-! !
-
-!HVScrollableView methodsFor:'event processing'!
-
-sizeChanged:how
- |orgY orgX scroll|
-
- super sizeChanged:how.
- scrolledView notNil ifTrue:[
- scrollBar setThumbFor:scrolledView.
- hScrollBar setThumbFor:scrolledView.
-
- orgY := scrollBar thumbOrigin.
- orgX := hScrollBar thumbOrigin.
- scroll := false.
-
- orgY + scrollBar thumbHeight >= 100 ifTrue:[
- scrollBar thumbOrigin:(100 - scrollBar thumbHeight).
- orgY := scrollBar thumbOrigin.
- scroll := true.
- ].
- orgX + hScrollBar thumbHeight >= 100 ifTrue:[
- hScrollBar thumbOrigin:(100 - hScrollBar thumbHeight).
- orgX := hScrollBar thumbOrigin.
- scroll := true.
- ].
- scroll ifTrue:[
- scrolledView scrollToPercent:(orgX@orgY).
- ].
- ].
-
- "Modified: 8.9.1995 / 12:46:36 / claus"
- "Modified: 5.8.1996 / 12:18:52 / stefan"
+ "Modified: 6.3.1997 / 17:04:47 / cg"
! !
!HVScrollableView methodsFor:'initialization'!
@@ -305,14 +244,14 @@
extra := 2.
].
- scrollBar extent:[scrollBar width
+ vScrollBar extent:[vScrollBar width
@
(height - hScrollBar height - mrg + extra)].
hScrollBar thumbOrigin:0 thumbHeight:100.
scrollBarPosition == #left ifTrue:[
- orgX := scrollBar origin x + scrollBar width.
+ orgX := vScrollBar origin x + vScrollBar width.
is3D ifTrue:[
orgX := orgX + halfSpacing + 1.
scrolledView notNil ifTrue:[
@@ -336,22 +275,22 @@
@
(height - hScrollBar height - halfMargin)
]
- extent:[(width - scrollBar width - (innerMargin * 2) + extra)
+ extent:[(width - vScrollBar width - (innerMargin * 2) + extra)
@
hScrollBar height
]
] ifFalse:[
scrollBarPosition == #left ifTrue:[
hScrollBar
- origin:[(orgX + scrollBar borderWidth)
+ origin:[(orgX + vScrollBar borderWidth)
@
(height - hScrollBar height - hBorderWidth)
]
- extent:[(width - scrollBar width) @ hScrollBar height]
+ extent:[(width - vScrollBar width) @ hScrollBar height]
] ifFalse:[
hScrollBar
origin:[orgX @ (height - hScrollBar height - hBorderWidth) ]
- extent:[(width - scrollBar width - hBorderWidth) @ hScrollBar height]
+ extent:[(width - vScrollBar width - hBorderWidth) @ hScrollBar height]
]
].
@@ -359,12 +298,12 @@
"redefine subviews size"
is3D ifTrue:[
scrolledView
- extent:[(width - scrollBar width - (innerMargin * 2))
+ extent:[(width - vScrollBar width - (innerMargin * 2))
@
(height - hScrollBar height - (innerMargin * 2)) ]
] ifFalse:[
scrolledView
- extent:[(width - scrollBar width - scrollBar borderWidth)
+ extent:[(width - vScrollBar width - vScrollBar borderWidth)
@
(height - hScrollBar height - hScrollBar borderWidth)
]
@@ -372,99 +311,11 @@
self setScrollActions.
]
- "Modified: 16.1.1997 / 19:06:07 / cg"
-!
-
-realize
- super realize.
- scrolledView notNil ifTrue:[
- hScrollBar setThumbFor:scrolledView
- ]
-! !
-
-!HVScrollableView methodsFor:'private'!
-
-setScrollActions
- lockUpdates := false.
-
- scrollBar scrollAction:[:position |
- lockUpdates := true.
- scrolledView scrollVerticalToPercent:position.
- lockUpdates := false
- ].
- scrollBar scrollUpAction:[scrolledView scrollUp].
- scrollBar scrollDownAction:[scrolledView scrollDown].
-
- hScrollBar scrollAction:[:position |
- lockUpdates := true.
- scrolledView scrollHorizontalToPercent:position.
- lockUpdates := false
- ].
- hScrollBar scrollLeftAction:[scrolledView scrollLeft].
- hScrollBar scrollRightAction:[scrolledView scrollRight].
-
- scrolledView addDependent:self.
-
- "
- pass my keyboard input (and other subviews input)
- to the scrolled view ...
- "
- self delegate:(KeyboardForwarder toView:scrolledView).
-
- "Modified: 1.8.1996 / 12:44:16 / cg"
+ "Modified: 6.3.1997 / 17:06:14 / cg"
! !
!HVScrollableView methodsFor:'queries'!
-isHorizontalScrollable
- "return true, because I am horizontal scrollable"
-
- ^ true
-
- "Modified: 5.8.1996 / 12:29:10 / stefan"
-!
-
-preferredExtent
- "return the components preferredExtent."
-
- |pref m2|
-
- "/ If I have an explicit preferredExtent ..
-
- preferredExtent notNil ifTrue:[
- ^ preferredExtent
- ].
-
- scrolledView notNil ifTrue:[
- m2 := innerMargin * 2.
- pref := scrolledView preferredExtent.
- ^ (pref x + scrollBar width + m2)
- @
- (pref y + hScrollBar height + m2).
- ].
- ^ super preferredExtent.
-
- "Modified: 19.7.1996 / 20:44:16 / cg"
-!
-
-preferredExtentForLines:numLines cols:numCols
- "return my preferredExtent for given number of lines and cols."
-
- |pref m2|
-
- scrolledView notNil ifTrue:[
- m2 := innerMargin * 2.
- pref := scrolledView preferredExtentForLines:numLines cols:numCols.
- ^ (pref x + scrollBar width + m2)
- @
- (pref y + hScrollBar height + m2).
- ].
- ^ super preferredExtent.
-
- "Modified: 23.4.1996 / 00:15:25 / cg"
- "Created: 24.5.1996 / 17:15:43 / cg"
-!
-
specClass
self class == HVScrollableView ifTrue:[^ ScrollableViewSpec].
^ super specClass
@@ -473,5 +324,5 @@
!HVScrollableView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.24 1997-02-28 09:31:09 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.25 1997-03-06 16:08:06 cg Exp $'
! !
--- a/ScrView.st Thu Mar 06 16:14:22 1997 +0100
+++ b/ScrView.st Thu Mar 06 17:08:06 1997 +0100
@@ -11,8 +11,8 @@
"
SimpleView subclass:#ScrollableView
- instanceVariableNames:'scrolledView scrollBar helpView innerMargin scrollBarPosition
- lockUpdates'
+ instanceVariableNames:'scrolledView vScrollBar hScrollBar helpView innerMargin
+ scrollBarPosition lockUpdates'
classVariableNames:'DefaultScrolledViewLevel'
poolDictionaries:''
category:'Views-Basic'
@@ -534,16 +534,29 @@
!ScrollableView methodsFor:'accessing - components'!
+horizontalScrollBar
+ "return the horizontal scrollbar (or nil, if there is none)"
+
+ ^ hScrollBar
+
+ "Created: 6.3.1997 / 16:47:50 / cg"
+ "Modified: 6.3.1997 / 16:59:24 / cg"
+!
+
scrollBar
- "return the scrollbar"
+ "return the vertical scrollbar (or nil, if there is none)"
- ^ scrollBar
+ ^ vScrollBar
+
+ "Modified: 6.3.1997 / 16:59:29 / cg"
!
scrolledView
- "return the scrolled view"
+ "return the scrolled view (or nil, if there is none)"
^ scrolledView
+
+ "Modified: 6.3.1997 / 16:48:09 / cg"
!
scrolledView:aView
@@ -580,20 +593,20 @@
scrolledView
origin:halfMargin asPoint
extent:[(width -
- scrollBar width -
+ vScrollBar width -
twoMargins)
@
(height - innerMargin)
].
] ifFalse:[
scrolledView
- origin:((scrollBar origin x
- + scrollBar width
+ origin:((vScrollBar origin x
+ + vScrollBar width
+ innerMargin)
@
halfMargin)
extent:[(width
- - scrollBar width
+ - vScrollBar width
- twoMargins)
@
(height - innerMargin)
@@ -606,8 +619,8 @@
origin:scrolledView borderWidth negated asPoint
] ifFalse:[
scrolledView
- origin:((scrollBar width
- + scrollBar borderWidth
+ origin:((vScrollBar width
+ + vScrollBar borderWidth
- scrolledView borderWidth)
@
scrolledView borderWidth negated)
@@ -615,10 +628,10 @@
scrolledView
extent:[
(width
- - scrollBar width
+ - vScrollBar width
- scrolledView borderWidth)
@
- (height + (scrollBar borderWidth))
+ (height + (vScrollBar borderWidth))
]
].
@@ -630,27 +643,48 @@
scrolledView realize
].
- "Modified: 28.1.1997 / 19:03:17 / cg"
+ "Modified: 6.3.1997 / 17:00:04 / cg"
+!
+
+verticalScrollBar
+ "return the vertical scrollbar (or nil, if there is none)"
+
+ ^ vScrollBar
+
+ "Modified: 6.3.1997 / 16:59:24 / cg"
+ "Created: 6.3.1997 / 17:05:15 / cg"
! !
!ScrollableView methodsFor:'changes '!
update:something with:argument from:changedObject
- "whenever the scrolledView changes its contents, the scroller must
- be updated"
+ "whenever the scrolledView changes its contents, the scroller(s) must
+ be updated as well"
changedObject == scrolledView ifTrue:[
- something == #sizeOfContents ifTrue:[
- scrollBar setThumbFor:scrolledView.
- ^ self
- ].
- something == #originOfContents ifTrue:[
- lockUpdates ifFalse:[
- scrollBar setThumbOriginFor:scrolledView.
- ].
- ^ self
- ].
+ something == #sizeOfContents ifTrue:[
+ vScrollBar notNil ifTrue:[
+ vScrollBar setThumbFor:scrolledView.
+ ].
+ hScrollBar notNil ifTrue:[
+ hScrollBar setThumbFor:scrolledView.
+ ].
+ ^ self
+ ].
+ something == #originOfContents ifTrue:[
+ lockUpdates ifFalse:[
+ vScrollBar notNil ifTrue:[
+ vScrollBar setThumbOriginFor:scrolledView.
+ ].
+ hScrollBar notNil ifTrue:[
+ hScrollBar setThumbOriginFor:scrolledView.
+ ].
+ ].
+ ^ self
+ ].
].
+
+ "Modified: 6.3.1997 / 17:00:23 / cg"
! !
!ScrollableView methodsFor:'event processing'!
@@ -667,21 +701,61 @@
!
sizeChanged:how
+ |orgX orgY scroll|
+
super sizeChanged:how.
"/ The following action will be done in a atomic operation
"/ in HVScrollableView
- (scrolledView notNil and:[self isHorizontalScrollable not]) ifTrue:[
- scrollBar setThumbFor:scrolledView.
- scrollBar thumbOrigin + scrollBar thumbHeight >= 100 ifTrue:[
- scrollBar thumbOrigin:(100 - scrollBar thumbHeight).
- scrolledView scrollVerticalToPercent:scrollBar thumbOrigin.
+ scrolledView isNil ifTrue:[^ self].
+
+ vScrollBar notNil ifTrue:[
+ vScrollBar setThumbFor:scrolledView.
+ ].
+ hScrollBar notNil ifTrue:[
+ hScrollBar setThumbFor:scrolledView.
+ ].
+
+ hScrollBar isNil ifTrue:[
+ "/ only care for vertical ...
+ vScrollBar thumbOrigin + vScrollBar thumbHeight >= 100 ifTrue:[
+ vScrollBar thumbOrigin:(100 - vScrollBar thumbHeight).
+ scrolledView scrollVerticalToPercent:vScrollBar thumbOrigin.
].
+ ^ self
].
- "Modified: 8.9.1995 / 12:46:36 / claus"
- "Modified: 5.8.1996 / 12:31:34 / stefan"
+ vScrollBar isNil ifTrue:[
+ "/ only care for horizontal ...
+ hScrollBar thumbOrigin + hScrollBar thumbHeight >= 100 ifTrue:[
+ hScrollBar thumbOrigin:(100 - hScrollBar thumbHeight).
+ scrolledView scrollVerticalToPercent:hScrollBar thumbOrigin.
+ ].
+ ^ self
+ ].
+
+ "/ care for both ...
+
+ orgY := vScrollBar thumbOrigin.
+ orgX := hScrollBar thumbOrigin.
+ scroll := false.
+
+ orgY + vScrollBar thumbHeight >= 100 ifTrue:[
+ vScrollBar thumbOrigin:(100 - vScrollBar thumbHeight).
+ orgY := vScrollBar thumbOrigin.
+ scroll := true.
+ ].
+ orgX + hScrollBar thumbHeight >= 100 ifTrue:[
+ hScrollBar thumbOrigin:(100 - hScrollBar thumbHeight).
+ orgX := hScrollBar thumbOrigin.
+ scroll := true.
+ ].
+ scroll ifTrue:[
+ scrolledView scrollToPercent:(orgX@orgY).
+ ].
+
+ "Modified: 6.3.1997 / 17:01:30 / cg"
! !
!ScrollableView methodsFor:'forced scroll'!
@@ -689,13 +763,21 @@
pageDown
"page down"
- scrollBar pageDown
+ vScrollBar notNil ifTrue:[
+ vScrollBar pageDown
+ ]
+
+ "Modified: 6.3.1997 / 17:01:51 / cg"
!
pageUp
"page up"
- scrollBar pageUp
+ vScrollBar notNil ifTrue:[
+ vScrollBar pageUp
+ ]
+
+ "Modified: 6.3.1997 / 17:01:58 / cg"
! !
!ScrollableView methodsFor:'initialization'!
@@ -719,7 +801,8 @@
!
initializeFor:aViewClass miniScrollerH:miniH miniScrollerV:miniV
- |negativeOffset twoMargins halfMargin cls isST80 isOpenWin is3D lvl extra|
+ |negativeOffset twoMargins halfMargin cls isST80 isOpenWin is3D lvl extra
+ scrollBarSpacing|
super initialize.
@@ -735,14 +818,17 @@
is3D := styleSheet is3D.
isST80 ifTrue:[
- innerMargin := 0
+ innerMargin := scrollBarSpacing := 0
] ifFalse:[
is3D ifTrue:[
- innerMargin := ViewSpacing.
+ innerMargin := scrollBarSpacing := ViewSpacing.
] ifFalse:[
- innerMargin := 0
+ innerMargin := scrollBarSpacing := 0
]
].
+ scrollBarSpacing := styleSheet at:'scrollBarSeparation' default:scrollBarSpacing.
+Transcript showCR:scrollBarSpacing.
+
negativeOffset := borderWidth negated.
"create the scrollbar"
@@ -753,8 +839,8 @@
cls := miniV ifTrue:[MiniScroller] ifFalse:[ScrollBar].
].
- scrollBar := cls in:self.
- scrollBar thumbOrigin:0 thumbHeight:100.
+ vScrollBar := cls in:self.
+ vScrollBar thumbOrigin:0 thumbHeight:100.
extra := 0.
@@ -771,76 +857,73 @@
scrolledView borderWidth:1.
] ifFalse:[
lvl := DefaultScrolledViewLevel.
-"/ isST80 ifTrue:[
-"/ "/ scrolledView level:1.
-"/ lvl := 1.
-"/ ] ifFalse:[
-"/ "/ scrolledView level:-1
-"/ lvl := -1
-"/ ]
].
scrolledView level:lvl.
extra := scrolledView borderWidth * 2.
].
- scrollBar extent:[scrollBar extent x
+ vScrollBar extent:[vScrollBar extent x
@
- (height - innerMargin "new:" + extra)].
+ (height - innerMargin + extra)].
+
scrolledView notNil ifTrue:[
scrolledView
extent:[(width
- - scrollBar width
- - twoMargins)
+ - vScrollBar width
+ - innerMargin - scrollBarSpacing)
@
(height - innerMargin)].
].
(scrollBarPosition == #right) ifTrue:[
- scrollBar origin:[width - scrollBar extent x
- - (scrollBar borderWidth * 2)
+ vScrollBar origin:[width - vScrollBar extent x
+ - (vScrollBar borderWidth * 2)
- halfMargin
@
- halfMargin].
+ halfMargin
+ ].
scrolledView notNil ifTrue:[
scrolledView origin:halfMargin asPoint
- ]
+ ]
] ifFalse:[
- scrollBar origin:halfMargin asPoint.
+ vScrollBar origin:halfMargin asPoint.
scrolledView notNil ifTrue:[
- scrolledView origin:((scrollBar origin x + scrollBar width + innerMargin)
+ scrolledView origin:((vScrollBar origin x
+ + vScrollBar width
+ + scrollBarSpacing)
@
halfMargin)
]
].
] ifFalse:[
(scrollBarPosition == #right) ifTrue:[
- scrollBar origin:[width - scrollBar extent x
- - scrollBar borderWidth
+ vScrollBar origin:[width - vScrollBar extent x
+ - vScrollBar borderWidth
@
negativeOffset]
] ifFalse:[
- scrollBar origin:negativeOffset asPoint
+ vScrollBar origin:negativeOffset asPoint
].
- scrollBar extent:[scrollBar extent x
+ vScrollBar extent:[vScrollBar extent x
@
- (height "+ (scrollBar borderWidth * 1)")].
+ (height "+ (vScrollBar borderWidth * 1)")].
aViewClass notNil ifTrue:[
scrolledView := aViewClass in:self.
(scrollBarPosition == #right) ifTrue:[
scrolledView origin:scrolledView borderWidth negated asPoint
] ifFalse:[
- scrolledView origin:((scrollBar width +
- scrollBar borderWidth -
+ scrolledView origin:((vScrollBar width +
+ vScrollBar borderWidth -
scrolledView borderWidth)
@
scrolledView borderWidth negated)
].
- scrolledView extent:[(width - scrollBar width - scrolledView borderWidth)
+ scrolledView extent:[(width - vScrollBar width - scrolledView borderWidth)
@
- (height + (scrollBar borderWidth))
+ (height + (vScrollBar borderWidth))
]
].
].
@@ -848,7 +931,7 @@
self setScrollActions.
]
- "Modified: 1.8.1996 / 12:44:32 / cg"
+ "Modified: 6.3.1997 / 17:03:11 / cg"
!
realize
@@ -859,8 +942,15 @@
changes; do it now
"
scrolledView notNil ifTrue:[
- scrollBar setThumbFor:scrolledView
+ vScrollBar notNil ifTrue:[
+ vScrollBar setThumbFor:scrolledView
+ ].
+ hScrollBar notNil ifTrue:[
+ hScrollBar setThumbFor:scrolledView
+ ].
]
+
+ "Modified: 6.3.1997 / 17:03:22 / cg"
!
setScrollActions
@@ -874,13 +964,24 @@
lockUpdates := false.
- scrollBar scrollAction:[:position |
- lockUpdates := true.
- scrolledView scrollVerticalToPercent:position.
- lockUpdates := false
+ vScrollBar notNil ifTrue:[
+ vScrollBar scrollAction:[:position |
+ lockUpdates := true.
+ scrolledView scrollVerticalToPercent:position.
+ lockUpdates := false
+ ].
+ vScrollBar scrollUpAction:[scrolledView scrollUp].
+ vScrollBar scrollDownAction:[scrolledView scrollDown].
].
- scrollBar scrollUpAction:[scrolledView scrollUp].
- scrollBar scrollDownAction:[scrolledView scrollDown].
+ hScrollBar notNil ifTrue:[
+ hScrollBar scrollAction:[:position |
+ lockUpdates := true.
+ scrolledView scrollHorizontalToPercent:position.
+ lockUpdates := false
+ ].
+ hScrollBar scrollUpAction:[scrolledView scrollLeft].
+ hScrollBar scrollDownAction:[scrolledView scrollRight].
+ ].
scrolledView addDependent:self.
@@ -890,23 +991,35 @@
"
self delegate:(KeyboardForwarder toView:scrolledView).
- "Modified: 1.8.1996 / 12:44:21 / cg"
+ "Modified: 6.3.1997 / 17:03:43 / cg"
! !
!ScrollableView methodsFor:'queries'!
isHorizontalScrollable
- "return false, because I am not horizontal scrollable"
+ "return true if I am horizontally scrollable"
- ^ false
+ ^ hScrollBar notNil
"Created: 5.8.1996 / 12:28:05 / stefan"
+ "Modified: 6.3.1997 / 17:03:49 / cg"
+!
+
+isVerticalScrollable
+ "return true if I am vertically scrollable"
+
+ ^ vScrollBar notNil
+
+ "Created: 6.3.1997 / 16:55:42 / cg"
+ "Modified: 6.3.1997 / 17:03:52 / cg"
!
preferredExtent
"return my preferredExtent from the scrolledViews prefExtent
plus the size of the scrollBar"
+ |slavesPref prefX prefY|
+
"/ If I have an explicit preferredExtent ..
preferredExtent notNil ifTrue:[
@@ -914,27 +1027,53 @@
].
scrolledView notNil ifTrue:[
- | pref |
- pref := scrolledView preferredExtent.
- ^ (pref x + scrollBar width + (innerMargin * 2)) @ pref y.
+ slavesPref := scrolledView preferredExtent.
+ prefX := slavesPref x.
+ prefY := slavesPref y.
+ vScrollBar notNil ifTrue:[
+ prefX := prefX + vScrollBar width + (innerMargin * 2).
+ ].
+ hScrollBar notNil ifTrue:[
+ prefY := prefY + hScrollBar height + (innerMargin * 2).
+ ].
+
+ ^ prefX @ prefY.
].
+
^ super preferredExtent.
- "Modified: 19.7.1996 / 20:45:30 / cg"
+ "Modified: 6.3.1997 / 17:04:02 / cg"
!
preferredExtentForLines:numLines cols:numCols
- "return my preferredExtent for given number of lines and cols."
+ "return my preferredExtent from the scrolledViews prefExtent
+ plus the size of the scrollBar"
+
+ |slavesPref prefX prefY|
+
+ "/ If I have an explicit preferredExtent ..
+
+ preferredExtent notNil ifTrue:[
+ ^ preferredExtent
+ ].
scrolledView notNil ifTrue:[
- | pref |
- pref := scrolledView preferredExtentForLines:numLines cols:numCols.
- ^ (pref x + scrollBar width + (innerMargin * 2)) @ pref y.
+ slavesPref := scrolledView preferredExtentForLines:numLines cols:numCols.
+ prefX := slavesPref x.
+ prefY := slavesPref y.
+ vScrollBar notNil ifTrue:[
+ prefX := prefX + vScrollBar width + (innerMargin * 2).
+ ].
+ hScrollBar notNil ifTrue:[
+ prefY := prefY + hScrollBar height + (innerMargin * 2).
+ ].
+
+ ^ prefX @ prefY.
].
+
^ super preferredExtent.
- "Created: 24.5.1996 / 17:13:26 / cg"
- "Modified: 24.5.1996 / 17:15:50 / cg"
+ "Modified: 6.3.1997 / 17:04:11 / cg"
! !
!ScrollableView methodsFor:'slave-view messages'!
@@ -1017,5 +1156,5 @@
!ScrollableView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/Attic/ScrView.st,v 1.46 1997-03-05 13:03:17 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/Attic/ScrView.st,v 1.47 1997-03-06 16:07:52 cg Exp $'
! !
--- a/ScrollableView.st Thu Mar 06 16:14:22 1997 +0100
+++ b/ScrollableView.st Thu Mar 06 17:08:06 1997 +0100
@@ -11,8 +11,8 @@
"
SimpleView subclass:#ScrollableView
- instanceVariableNames:'scrolledView scrollBar helpView innerMargin scrollBarPosition
- lockUpdates'
+ instanceVariableNames:'scrolledView vScrollBar hScrollBar helpView innerMargin
+ scrollBarPosition lockUpdates'
classVariableNames:'DefaultScrolledViewLevel'
poolDictionaries:''
category:'Views-Basic'
@@ -534,16 +534,29 @@
!ScrollableView methodsFor:'accessing - components'!
+horizontalScrollBar
+ "return the horizontal scrollbar (or nil, if there is none)"
+
+ ^ hScrollBar
+
+ "Created: 6.3.1997 / 16:47:50 / cg"
+ "Modified: 6.3.1997 / 16:59:24 / cg"
+!
+
scrollBar
- "return the scrollbar"
+ "return the vertical scrollbar (or nil, if there is none)"
- ^ scrollBar
+ ^ vScrollBar
+
+ "Modified: 6.3.1997 / 16:59:29 / cg"
!
scrolledView
- "return the scrolled view"
+ "return the scrolled view (or nil, if there is none)"
^ scrolledView
+
+ "Modified: 6.3.1997 / 16:48:09 / cg"
!
scrolledView:aView
@@ -580,20 +593,20 @@
scrolledView
origin:halfMargin asPoint
extent:[(width -
- scrollBar width -
+ vScrollBar width -
twoMargins)
@
(height - innerMargin)
].
] ifFalse:[
scrolledView
- origin:((scrollBar origin x
- + scrollBar width
+ origin:((vScrollBar origin x
+ + vScrollBar width
+ innerMargin)
@
halfMargin)
extent:[(width
- - scrollBar width
+ - vScrollBar width
- twoMargins)
@
(height - innerMargin)
@@ -606,8 +619,8 @@
origin:scrolledView borderWidth negated asPoint
] ifFalse:[
scrolledView
- origin:((scrollBar width
- + scrollBar borderWidth
+ origin:((vScrollBar width
+ + vScrollBar borderWidth
- scrolledView borderWidth)
@
scrolledView borderWidth negated)
@@ -615,10 +628,10 @@
scrolledView
extent:[
(width
- - scrollBar width
+ - vScrollBar width
- scrolledView borderWidth)
@
- (height + (scrollBar borderWidth))
+ (height + (vScrollBar borderWidth))
]
].
@@ -630,27 +643,48 @@
scrolledView realize
].
- "Modified: 28.1.1997 / 19:03:17 / cg"
+ "Modified: 6.3.1997 / 17:00:04 / cg"
+!
+
+verticalScrollBar
+ "return the vertical scrollbar (or nil, if there is none)"
+
+ ^ vScrollBar
+
+ "Modified: 6.3.1997 / 16:59:24 / cg"
+ "Created: 6.3.1997 / 17:05:15 / cg"
! !
!ScrollableView methodsFor:'changes '!
update:something with:argument from:changedObject
- "whenever the scrolledView changes its contents, the scroller must
- be updated"
+ "whenever the scrolledView changes its contents, the scroller(s) must
+ be updated as well"
changedObject == scrolledView ifTrue:[
- something == #sizeOfContents ifTrue:[
- scrollBar setThumbFor:scrolledView.
- ^ self
- ].
- something == #originOfContents ifTrue:[
- lockUpdates ifFalse:[
- scrollBar setThumbOriginFor:scrolledView.
- ].
- ^ self
- ].
+ something == #sizeOfContents ifTrue:[
+ vScrollBar notNil ifTrue:[
+ vScrollBar setThumbFor:scrolledView.
+ ].
+ hScrollBar notNil ifTrue:[
+ hScrollBar setThumbFor:scrolledView.
+ ].
+ ^ self
+ ].
+ something == #originOfContents ifTrue:[
+ lockUpdates ifFalse:[
+ vScrollBar notNil ifTrue:[
+ vScrollBar setThumbOriginFor:scrolledView.
+ ].
+ hScrollBar notNil ifTrue:[
+ hScrollBar setThumbOriginFor:scrolledView.
+ ].
+ ].
+ ^ self
+ ].
].
+
+ "Modified: 6.3.1997 / 17:00:23 / cg"
! !
!ScrollableView methodsFor:'event processing'!
@@ -667,21 +701,61 @@
!
sizeChanged:how
+ |orgX orgY scroll|
+
super sizeChanged:how.
"/ The following action will be done in a atomic operation
"/ in HVScrollableView
- (scrolledView notNil and:[self isHorizontalScrollable not]) ifTrue:[
- scrollBar setThumbFor:scrolledView.
- scrollBar thumbOrigin + scrollBar thumbHeight >= 100 ifTrue:[
- scrollBar thumbOrigin:(100 - scrollBar thumbHeight).
- scrolledView scrollVerticalToPercent:scrollBar thumbOrigin.
+ scrolledView isNil ifTrue:[^ self].
+
+ vScrollBar notNil ifTrue:[
+ vScrollBar setThumbFor:scrolledView.
+ ].
+ hScrollBar notNil ifTrue:[
+ hScrollBar setThumbFor:scrolledView.
+ ].
+
+ hScrollBar isNil ifTrue:[
+ "/ only care for vertical ...
+ vScrollBar thumbOrigin + vScrollBar thumbHeight >= 100 ifTrue:[
+ vScrollBar thumbOrigin:(100 - vScrollBar thumbHeight).
+ scrolledView scrollVerticalToPercent:vScrollBar thumbOrigin.
].
+ ^ self
].
- "Modified: 8.9.1995 / 12:46:36 / claus"
- "Modified: 5.8.1996 / 12:31:34 / stefan"
+ vScrollBar isNil ifTrue:[
+ "/ only care for horizontal ...
+ hScrollBar thumbOrigin + hScrollBar thumbHeight >= 100 ifTrue:[
+ hScrollBar thumbOrigin:(100 - hScrollBar thumbHeight).
+ scrolledView scrollVerticalToPercent:hScrollBar thumbOrigin.
+ ].
+ ^ self
+ ].
+
+ "/ care for both ...
+
+ orgY := vScrollBar thumbOrigin.
+ orgX := hScrollBar thumbOrigin.
+ scroll := false.
+
+ orgY + vScrollBar thumbHeight >= 100 ifTrue:[
+ vScrollBar thumbOrigin:(100 - vScrollBar thumbHeight).
+ orgY := vScrollBar thumbOrigin.
+ scroll := true.
+ ].
+ orgX + hScrollBar thumbHeight >= 100 ifTrue:[
+ hScrollBar thumbOrigin:(100 - hScrollBar thumbHeight).
+ orgX := hScrollBar thumbOrigin.
+ scroll := true.
+ ].
+ scroll ifTrue:[
+ scrolledView scrollToPercent:(orgX@orgY).
+ ].
+
+ "Modified: 6.3.1997 / 17:01:30 / cg"
! !
!ScrollableView methodsFor:'forced scroll'!
@@ -689,13 +763,21 @@
pageDown
"page down"
- scrollBar pageDown
+ vScrollBar notNil ifTrue:[
+ vScrollBar pageDown
+ ]
+
+ "Modified: 6.3.1997 / 17:01:51 / cg"
!
pageUp
"page up"
- scrollBar pageUp
+ vScrollBar notNil ifTrue:[
+ vScrollBar pageUp
+ ]
+
+ "Modified: 6.3.1997 / 17:01:58 / cg"
! !
!ScrollableView methodsFor:'initialization'!
@@ -719,7 +801,8 @@
!
initializeFor:aViewClass miniScrollerH:miniH miniScrollerV:miniV
- |negativeOffset twoMargins halfMargin cls isST80 isOpenWin is3D lvl extra|
+ |negativeOffset twoMargins halfMargin cls isST80 isOpenWin is3D lvl extra
+ scrollBarSpacing|
super initialize.
@@ -735,14 +818,17 @@
is3D := styleSheet is3D.
isST80 ifTrue:[
- innerMargin := 0
+ innerMargin := scrollBarSpacing := 0
] ifFalse:[
is3D ifTrue:[
- innerMargin := ViewSpacing.
+ innerMargin := scrollBarSpacing := ViewSpacing.
] ifFalse:[
- innerMargin := 0
+ innerMargin := scrollBarSpacing := 0
]
].
+ scrollBarSpacing := styleSheet at:'scrollBarSeparation' default:scrollBarSpacing.
+Transcript showCR:scrollBarSpacing.
+
negativeOffset := borderWidth negated.
"create the scrollbar"
@@ -753,8 +839,8 @@
cls := miniV ifTrue:[MiniScroller] ifFalse:[ScrollBar].
].
- scrollBar := cls in:self.
- scrollBar thumbOrigin:0 thumbHeight:100.
+ vScrollBar := cls in:self.
+ vScrollBar thumbOrigin:0 thumbHeight:100.
extra := 0.
@@ -771,76 +857,73 @@
scrolledView borderWidth:1.
] ifFalse:[
lvl := DefaultScrolledViewLevel.
-"/ isST80 ifTrue:[
-"/ "/ scrolledView level:1.
-"/ lvl := 1.
-"/ ] ifFalse:[
-"/ "/ scrolledView level:-1
-"/ lvl := -1
-"/ ]
].
scrolledView level:lvl.
extra := scrolledView borderWidth * 2.
].
- scrollBar extent:[scrollBar extent x
+ vScrollBar extent:[vScrollBar extent x
@
- (height - innerMargin "new:" + extra)].
+ (height - innerMargin + extra)].
+
scrolledView notNil ifTrue:[
scrolledView
extent:[(width
- - scrollBar width
- - twoMargins)
+ - vScrollBar width
+ - innerMargin - scrollBarSpacing)
@
(height - innerMargin)].
].
(scrollBarPosition == #right) ifTrue:[
- scrollBar origin:[width - scrollBar extent x
- - (scrollBar borderWidth * 2)
+ vScrollBar origin:[width - vScrollBar extent x
+ - (vScrollBar borderWidth * 2)
- halfMargin
@
- halfMargin].
+ halfMargin
+ ].
scrolledView notNil ifTrue:[
scrolledView origin:halfMargin asPoint
- ]
+ ]
] ifFalse:[
- scrollBar origin:halfMargin asPoint.
+ vScrollBar origin:halfMargin asPoint.
scrolledView notNil ifTrue:[
- scrolledView origin:((scrollBar origin x + scrollBar width + innerMargin)
+ scrolledView origin:((vScrollBar origin x
+ + vScrollBar width
+ + scrollBarSpacing)
@
halfMargin)
]
].
] ifFalse:[
(scrollBarPosition == #right) ifTrue:[
- scrollBar origin:[width - scrollBar extent x
- - scrollBar borderWidth
+ vScrollBar origin:[width - vScrollBar extent x
+ - vScrollBar borderWidth
@
negativeOffset]
] ifFalse:[
- scrollBar origin:negativeOffset asPoint
+ vScrollBar origin:negativeOffset asPoint
].
- scrollBar extent:[scrollBar extent x
+ vScrollBar extent:[vScrollBar extent x
@
- (height "+ (scrollBar borderWidth * 1)")].
+ (height "+ (vScrollBar borderWidth * 1)")].
aViewClass notNil ifTrue:[
scrolledView := aViewClass in:self.
(scrollBarPosition == #right) ifTrue:[
scrolledView origin:scrolledView borderWidth negated asPoint
] ifFalse:[
- scrolledView origin:((scrollBar width +
- scrollBar borderWidth -
+ scrolledView origin:((vScrollBar width +
+ vScrollBar borderWidth -
scrolledView borderWidth)
@
scrolledView borderWidth negated)
].
- scrolledView extent:[(width - scrollBar width - scrolledView borderWidth)
+ scrolledView extent:[(width - vScrollBar width - scrolledView borderWidth)
@
- (height + (scrollBar borderWidth))
+ (height + (vScrollBar borderWidth))
]
].
].
@@ -848,7 +931,7 @@
self setScrollActions.
]
- "Modified: 1.8.1996 / 12:44:32 / cg"
+ "Modified: 6.3.1997 / 17:03:11 / cg"
!
realize
@@ -859,8 +942,15 @@
changes; do it now
"
scrolledView notNil ifTrue:[
- scrollBar setThumbFor:scrolledView
+ vScrollBar notNil ifTrue:[
+ vScrollBar setThumbFor:scrolledView
+ ].
+ hScrollBar notNil ifTrue:[
+ hScrollBar setThumbFor:scrolledView
+ ].
]
+
+ "Modified: 6.3.1997 / 17:03:22 / cg"
!
setScrollActions
@@ -874,13 +964,24 @@
lockUpdates := false.
- scrollBar scrollAction:[:position |
- lockUpdates := true.
- scrolledView scrollVerticalToPercent:position.
- lockUpdates := false
+ vScrollBar notNil ifTrue:[
+ vScrollBar scrollAction:[:position |
+ lockUpdates := true.
+ scrolledView scrollVerticalToPercent:position.
+ lockUpdates := false
+ ].
+ vScrollBar scrollUpAction:[scrolledView scrollUp].
+ vScrollBar scrollDownAction:[scrolledView scrollDown].
].
- scrollBar scrollUpAction:[scrolledView scrollUp].
- scrollBar scrollDownAction:[scrolledView scrollDown].
+ hScrollBar notNil ifTrue:[
+ hScrollBar scrollAction:[:position |
+ lockUpdates := true.
+ scrolledView scrollHorizontalToPercent:position.
+ lockUpdates := false
+ ].
+ hScrollBar scrollUpAction:[scrolledView scrollLeft].
+ hScrollBar scrollDownAction:[scrolledView scrollRight].
+ ].
scrolledView addDependent:self.
@@ -890,23 +991,35 @@
"
self delegate:(KeyboardForwarder toView:scrolledView).
- "Modified: 1.8.1996 / 12:44:21 / cg"
+ "Modified: 6.3.1997 / 17:03:43 / cg"
! !
!ScrollableView methodsFor:'queries'!
isHorizontalScrollable
- "return false, because I am not horizontal scrollable"
+ "return true if I am horizontally scrollable"
- ^ false
+ ^ hScrollBar notNil
"Created: 5.8.1996 / 12:28:05 / stefan"
+ "Modified: 6.3.1997 / 17:03:49 / cg"
+!
+
+isVerticalScrollable
+ "return true if I am vertically scrollable"
+
+ ^ vScrollBar notNil
+
+ "Created: 6.3.1997 / 16:55:42 / cg"
+ "Modified: 6.3.1997 / 17:03:52 / cg"
!
preferredExtent
"return my preferredExtent from the scrolledViews prefExtent
plus the size of the scrollBar"
+ |slavesPref prefX prefY|
+
"/ If I have an explicit preferredExtent ..
preferredExtent notNil ifTrue:[
@@ -914,27 +1027,53 @@
].
scrolledView notNil ifTrue:[
- | pref |
- pref := scrolledView preferredExtent.
- ^ (pref x + scrollBar width + (innerMargin * 2)) @ pref y.
+ slavesPref := scrolledView preferredExtent.
+ prefX := slavesPref x.
+ prefY := slavesPref y.
+ vScrollBar notNil ifTrue:[
+ prefX := prefX + vScrollBar width + (innerMargin * 2).
+ ].
+ hScrollBar notNil ifTrue:[
+ prefY := prefY + hScrollBar height + (innerMargin * 2).
+ ].
+
+ ^ prefX @ prefY.
].
+
^ super preferredExtent.
- "Modified: 19.7.1996 / 20:45:30 / cg"
+ "Modified: 6.3.1997 / 17:04:02 / cg"
!
preferredExtentForLines:numLines cols:numCols
- "return my preferredExtent for given number of lines and cols."
+ "return my preferredExtent from the scrolledViews prefExtent
+ plus the size of the scrollBar"
+
+ |slavesPref prefX prefY|
+
+ "/ If I have an explicit preferredExtent ..
+
+ preferredExtent notNil ifTrue:[
+ ^ preferredExtent
+ ].
scrolledView notNil ifTrue:[
- | pref |
- pref := scrolledView preferredExtentForLines:numLines cols:numCols.
- ^ (pref x + scrollBar width + (innerMargin * 2)) @ pref y.
+ slavesPref := scrolledView preferredExtentForLines:numLines cols:numCols.
+ prefX := slavesPref x.
+ prefY := slavesPref y.
+ vScrollBar notNil ifTrue:[
+ prefX := prefX + vScrollBar width + (innerMargin * 2).
+ ].
+ hScrollBar notNil ifTrue:[
+ prefY := prefY + hScrollBar height + (innerMargin * 2).
+ ].
+
+ ^ prefX @ prefY.
].
+
^ super preferredExtent.
- "Created: 24.5.1996 / 17:13:26 / cg"
- "Modified: 24.5.1996 / 17:15:50 / cg"
+ "Modified: 6.3.1997 / 17:04:11 / cg"
! !
!ScrollableView methodsFor:'slave-view messages'!
@@ -1017,5 +1156,5 @@
!ScrollableView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/ScrollableView.st,v 1.46 1997-03-05 13:03:17 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/ScrollableView.st,v 1.47 1997-03-06 16:07:52 cg Exp $'
! !