HVScrollableView.st
changeset 130 338e856bddc9
parent 105 3d064ba4a0cc
child 159 edf6853aa18b
equal deleted inserted replaced
129:a0728fb8d54e 130:338e856bddc9
    20 HVScrollableView comment:'
    20 HVScrollableView comment:'
    21 
    21 
    22 COPYRIGHT (c) 1991 by Claus Gittinger
    22 COPYRIGHT (c) 1991 by Claus Gittinger
    23 	      All Rights Reserved
    23 	      All Rights Reserved
    24 
    24 
    25 $Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.10 1995-03-18 05:14:47 claus Exp $
    25 $Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.11 1995-06-06 04:13:58 claus Exp $
    26 written jan 91 by claus
    26 written jan 91 by claus
    27 '!
    27 '!
    28 
    28 
    29 !HVScrollableView class methodsFor:'documentation'!
    29 !HVScrollableView class methodsFor:'documentation'!
    30 
    30 
    42 "
    42 "
    43 !
    43 !
    44 
    44 
    45 version
    45 version
    46 "
    46 "
    47 $Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.10 1995-03-18 05:14:47 claus Exp $
    47 $Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.11 1995-06-06 04:13:58 claus Exp $
    48 "
    48 "
    49 !
    49 !
    50 
    50 
    51 documentation
    51 documentation
    52 "
    52 "
    53     a view containing both horizontal and vertical scrollbars
    53     a view containing both horizontal and vertical scrollbars
    54     and some other (slave-)view
    54     and some other (slave-)view.
       
    55 
       
    56     Please see the documentation and examples in my superclass, ScrollableView
    55 "
    57 "
    56 ! !
    58 ! !
    57 
    59 
    58 !HVScrollableView methodsFor:'initialization'!
    60 !HVScrollableView methodsFor:'initialization'!
    59 
    61 
    60 initializeFor:aViewClass miniScrollerH:miniH miniScrollerV:miniV
    62 initializeFor:aViewClass miniScrollerH:miniH miniScrollerV:miniV
    61     |negativeOffset halfMargin orgX mrg halfSpacing is3D cls hBorderWidth isST80|
    63     |negativeOffset halfMargin orgX mrg halfSpacing 
       
    64      is3D cls hBorderWidth isST80 isOpenWin extra|
    62 
    65 
    63     isST80 := StyleSheet name = #st80.  "leftover - remove it"
    66     isST80 := StyleSheet name = #st80.  "leftover - remove it"
    64 
    67 
    65     isST80 ifTrue:[
    68     isST80 ifTrue:[
    66 	cls := HorizontalScrollBar
    69 	cls := HorizontalScrollBar
    75 	miniScrollerH:miniH 
    78 	miniScrollerH:miniH 
    76 	miniScrollerV:miniV.
    79 	miniScrollerV:miniV.
    77 
    80 
    78     negativeOffset := borderWidth negated.
    81     negativeOffset := borderWidth negated.
    79     halfMargin := innerMargin // 2.
    82     halfMargin := innerMargin // 2.
    80     is3D := StyleSheet is3D.
    83     is3D := styleSheet is3D.
       
    84     isOpenWin := styleSheet name = #openwin.
    81 
    85 
    82     "
    86     "
    83      change vertical scrollbars size
    87      change vertical scrollbars size
    84     "
    88     "
    85     mrg := hScrollBar borderWidth.
    89     mrg := hScrollBar borderWidth.
    92 	] ifFalse:[
    96 	] ifFalse:[
    93 	    mrg := mrg + innerMargin + innerMargin.
    97 	    mrg := mrg + innerMargin + innerMargin.
    94 	    halfSpacing := ViewSpacing // 2.
    98 	    halfSpacing := ViewSpacing // 2.
    95 	].
    99 	].
    96     ].
   100     ].
    97     scrollBar extent:[scrollBar width @ (height - hScrollBar height - mrg)].
   101 
       
   102     extra := 0.
       
   103     isOpenWin ifTrue:[
       
   104 	extra := 2.
       
   105     ].
       
   106 
       
   107     scrollBar extent:[scrollBar width 
       
   108 		      @ 
       
   109 		     (height - hScrollBar height - mrg + extra)].
    98 
   110 
    99     hScrollBar thumbOrigin:0 thumbHeight:100.
   111     hScrollBar thumbOrigin:0 thumbHeight:100.
   100 
   112 
   101     scrollBarPosition == #left ifTrue:[
   113     scrollBarPosition == #left ifTrue:[
   102 	orgX := scrollBar origin x + scrollBar width.
   114 	orgX := scrollBar origin x + scrollBar width.
   106 		orgX := orgX - (scrolledView margin)
   118 		orgX := orgX - (scrolledView margin)
   107 	    ]
   119 	    ]
   108 	]
   120 	]
   109     ] ifFalse:[
   121     ] ifFalse:[
   110 	orgX := 0 - hBorderWidth.
   122 	orgX := 0 - hBorderWidth.
   111 	isST80 ifTrue:[
   123 "/      isST80 ifTrue:[
   112 "/            orgX := orgX + 1
   124 "/            orgX := orgX + 1
   113 	]
   125 "/      ]
       
   126     ].
       
   127     isOpenWin ifTrue:[
       
   128 	orgX := orgX + 1
   114     ].
   129     ].
   115 
   130 
   116     is3D ifTrue:[
   131     is3D ifTrue:[
   117 	hScrollBar origin:[(orgX + innerMargin - halfSpacing - hScrollBar margin)
   132 	hScrollBar origin:[(orgX + innerMargin - halfSpacing - hScrollBar margin)
   118 			   @
   133 			   @
   119 			   (height - hScrollBar height - halfMargin)
   134 			   (height - hScrollBar height - halfMargin)
   120 			  ]
   135 			  ]
   121 		   extent:[(width - scrollBar width - (innerMargin * 2))
   136 		   extent:[(width - scrollBar width - (innerMargin * 2) + extra)
   122 			   @
   137 			   @
   123 			   hScrollBar height
   138 			   hScrollBar height
   124 			  ]
   139 			  ]
   125     ] ifFalse:[
   140     ] ifFalse:[
   126 	scrollBarPosition == #left ifTrue:[
   141 	scrollBarPosition == #left ifTrue:[
   196     "set the scrolled view"
   211     "set the scrolled view"
   197 
   212 
   198     super scrolledView:aView.
   213     super scrolledView:aView.
   199 
   214 
   200     "redefine subviews size"
   215     "redefine subviews size"
   201     StyleSheet is3D ifTrue:[
   216     styleSheet is3D ifTrue:[
   202 	scrolledView 
   217 	scrolledView 
   203 	    extent:[(width 
   218 	    extent:[(width 
   204 		     - scrollBar width 
   219 		     - scrollBar width 
   205 		     - (innerMargin * 2))
   220 		     - (innerMargin * 2))
   206 		    @
   221 		    @
   224     self setScrollActions
   239     self setScrollActions
   225 ! !
   240 ! !
   226 
   241 
   227 !HVScrollableView methodsFor:'queries'!
   242 !HVScrollableView methodsFor:'queries'!
   228 
   243 
   229 preferedExtent
   244 preferredExtent
       
   245     |pref m2|
       
   246 
   230     scrolledView notNil ifTrue:[ 
   247     scrolledView notNil ifTrue:[ 
   231        | pref |
   248 	m2 := innerMargin * 2.
   232        pref := scrolledView preferedExtent.
   249         pref := scrolledView preferredExtent.
   233        ^ (pref x + scrollBar width + (innerMargin * 2)) 
   250         ^ (pref x + scrollBar width + m2) 
   234 	 @ 
   251 	  @ 
   235 	 (pref y + hScrollBar height + (innerMargin * 2)).
   252 	  (pref y + hScrollBar height + m2).
   236     ].
   253     ].
   237     ^ super preferedExtent.
   254     ^ super preferredExtent.
   238 ! !
   255 ! !
   239 
   256 
   240 !HVScrollableView methodsFor:'changes '!
   257 !HVScrollableView methodsFor:'changes '!
   241 
   258 
   242 update:something with:argument from:changedObject
   259 update:something with:argument from:changedObject