*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Sat, 24 Oct 2009 12:07:32 +0200
changeset 5408 1eb5612a463a
parent 5407 767945d3ad71
child 5409 760947d044f1
*** empty log message ***
Border.st
--- a/Border.st	Sat Oct 24 12:07:22 2009 +0200
+++ b/Border.st	Sat Oct 24 12:07:32 2009 +0200
@@ -1,6 +1,6 @@
 "
  COPYRIGHT (c) 1997 by eXept Software AG
-              All Rights Reserved
+	      All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -12,7 +12,7 @@
 "{ Package: 'stx:libview' }"
 
 AbstractBorder subclass:#Border
-	instanceVariableNames:'left right top bottom leftColor rightColor topColor bottomColor'
+	instanceVariableNames:'leftColor rightColor topColor bottomColor'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Graphics-Support'
@@ -23,7 +23,7 @@
 copyright
 "
  COPYRIGHT (c) 1997 by eXept Software AG
-              All Rights Reserved
+	      All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -40,25 +40,25 @@
     It is (currently) not used by ST/X, but provided as a comatibility hook.
     (... however, ST/X is being rewritten to make use of it soon).
 
-    Notice: 
-        this class was implemented using protocol information
-        from alpha testers, from reading PD programs and 
-        from the Hopkins/Horan book.
-        - it may not be complete or compatible to the corresponding ST-80 class. 
-        If you encounter any incompatibilities, please forward a note 
-        describing the incompatibility verbal (i.e. no code) to the ST/X team.
+    Notice:
+	this class was implemented using protocol information
+	from alpha testers, from reading PD programs and
+	from the Hopkins/Horan book.
+	- it may not be complete or compatible to the corresponding ST-80 class.
+	If you encounter any incompatibilities, please forward a note
+	describing the incompatibility verbal (i.e. no code) to the ST/X team.
 
     [see also:]
-        Wrapper SimpleView
+	Wrapper SimpleView
 
     [author:]
-        Claus Gittinger
+	Claus Gittinger
 "
 !
 
 examples
 "
-                                                        [exBegin]
+							[exBegin]
      |v b|
 
      v := StandardSystemView extent:10@10.
@@ -76,9 +76,9 @@
      Delay waitForSeconds:1.
      b setRightColor:Color magenta.
      b displayOn:v forDisplayBox:(0@0 corner:9@9).
-                                                        [exEnd]
+							[exEnd]
 
-                                                        [exBegin]
+							[exBegin]
      |v b|
 
      v := StandardSystemView extent:100@100.
@@ -89,19 +89,19 @@
 
      Delay waitForSeconds:1.
      b setLeft:5.
-     v clear.   
+     v clear.
      b displayOn:v forDisplayBox:(0@0 corner:99@99).
      Delay waitForSeconds:1.
      b setTop:3.
-     v clear.   
+     v clear.
      b displayOn:v forDisplayBox:(0@0 corner:99@99).
      Delay waitForSeconds:1.
      b setRight:1.
-     v clear.   
+     v clear.
      b displayOn:v forDisplayBox:(0@0 corner:99@99).
-                                                        [exEnd]
+							[exEnd]
 
-                                                        [exBegin]
+							[exBegin]
      |v sub1 sub2 sub3|
 
      v := StandardSystemView extent:200@200.
@@ -115,21 +115,12 @@
      sub3 border:(SimpleBorder width:1 color:Color green ).
 
      v open.
-                                                        [exEnd]
+							[exEnd]
 "
 ! !
 
 !Border methodsFor:'accessing'!
 
-bottom
-    "return the bottom border width"
-
-    ^ bottom
-
-    "Created: 10.2.1997 / 14:51:34 / cg"
-    "Modified: 10.2.1997 / 15:39:01 / cg"
-!
-
 bottomColor
     "return the value of the instance variable 'bottomColor' (automatically generated)"
 
@@ -138,23 +129,22 @@
     "Created: 10.2.1997 / 14:51:34 / cg"
 !
 
+bottomColor:aColor
+    "set the bottomColor"
+
+    bottomColor := aColor
+
+    "Created: 10.2.1997 / 15:37:51 / cg"
+!
+
 color:newColor
     "set all four colors"
 
-    self setBorderColor:newColor
+     leftColor := rightColor := topColor := bottomColor := newColor
 
     "Created: 10.2.1997 / 15:27:01 / cg"
 !
 
-left
-    "return the left border width"
-
-    ^ left
-
-    "Created: 10.2.1997 / 14:51:34 / cg"
-    "Modified: 10.2.1997 / 15:39:05 / cg"
-!
-
 leftColor
     "return the value of the instance variable 'leftColor' (automatically generated)"
 
@@ -163,13 +153,12 @@
     "Created: 10.2.1997 / 14:51:34 / cg"
 !
 
-right
-    "return the right border width"
+leftColor:aColor
+    "set the leftColor"
 
-    ^ right
+    leftColor := aColor
 
-    "Created: 10.2.1997 / 14:51:34 / cg"
-    "Modified: 10.2.1997 / 15:39:08 / cg"
+    "Created: 10.2.1997 / 15:38:02 / cg"
 !
 
 rightColor
@@ -180,47 +169,7 @@
     "Created: 10.2.1997 / 14:51:34 / cg"
 !
 
-setBottom:aSmallInteger
-    "set the bottom border width"
-
-    bottom := aSmallInteger
-
-    "Created: 10.2.1997 / 15:38:50 / cg"
-!
-
-setBottomColor:aColor
-    "set the bottomColor"
-
-    bottomColor := aColor
-
-    "Created: 10.2.1997 / 15:37:51 / cg"
-!
-
-setLeft:aSmallInteger
-    "set the left border width"
-
-    left := aSmallInteger
-
-    "Created: 10.2.1997 / 15:39:33 / cg"
-!
-
-setLeftColor:aColor
-    "set the leftColor"
-
-    leftColor := aColor
-
-    "Created: 10.2.1997 / 15:38:02 / cg"
-!
-
-setRight:aSmallInteger
-    "set the right border width"
-
-    right := aSmallInteger
-
-    "Created: 10.2.1997 / 15:39:44 / cg"
-!
-
-setRightColor:aColor
+rightColor:aColor
     "set the rightColor"
 
     rightColor := aColor
@@ -228,31 +177,6 @@
     "Created: 10.2.1997 / 15:38:08 / cg"
 !
 
-setTop:aSmallInteger
-    "set the top border width"
-
-    top := aSmallInteger
-
-    "Created: 10.2.1997 / 15:39:27 / cg"
-!
-
-setTopColor:aColor
-    "set the topColor"
-
-    topColor := aColor
-
-    "Created: 10.2.1997 / 15:38:17 / cg"
-!
-
-top
-    "return the top border width"
-
-    ^ top
-
-    "Created: 10.2.1997 / 14:51:34 / cg"
-    "Modified: 10.2.1997 / 15:39:11 / cg"
-!
-
 topColor
     "return the value of the instance variable 'topColor' (automatically generated)"
 
@@ -261,34 +185,30 @@
     "Created: 10.2.1997 / 14:51:34 / cg"
 !
 
-width:newBorderWidth
-    "set all four widths"
+topColor:aColor
+    "set the topColor"
 
-    self setBorderWidth:newBorderWidth
+    topColor := aColor
+
+    "Created: 10.2.1997 / 15:38:17 / cg"
 ! !
 
 !Border methodsFor:'displaying'!
 
-displayOn:aGC forDisplayBox:aRectangle using:colorSource
+displayOn:aGC forDisplayBox:aRectangle
     "display the border represented by the receiver in the given rectangle.
      colorSource is ignored here, but subclasses (i.e. 3D-borders) may use
      it to ask for shadow/lightColors.
      The gc's state is restored after the drawing."
 
-    |clipRectangle paint oldPaint 
+    |paint oldPaint
      t r l b rL rR rT rB rW rH|
 
-"/    clipRectangle := aGC clippingBounds.
-"/    ((self insetDisplayBoxFor: aRectangle) contains: clipRectangle) ifTrue: [^self].
+    width == 0 ifTrue:[ ^ self ].
 
     oldPaint := aGC paint.
     r := aRectangle copy.
 
-    t := self top.
-    l := self left.
-    r := self right.
-    b := self bottom.
-
     rL := aRectangle left.
     rT := aRectangle top.
     rR := aRectangle right.
@@ -296,36 +216,24 @@
     rH := aRectangle height.
     rW := aRectangle width.
 
-    (l ~~ 0 and: [(paint := self leftColor) notNil]) ifTrue:[
-        aGC paint:paint.
-        aGC fillRectangleX:rL
-                         y:rT
-                     width:l
-                    height:rH + 1 - b
+    leftColor notNil ifTrue:[
+        aGC paint:leftColor.
+        aGC fillRectangleX:rL y:rT width:width height:rH + 1 - b
     ].
 
-    (t ~~ 0 and: [(paint := self topColor) notNil]) ifTrue:[
-        aGC paint:paint.
-        aGC fillRectangleX:(rL + l)
-                         y:rT
-                     width:rW - l
-                    height:t
+    topColor notNil ifTrue:[
+        aGC paint:topColor.
+        aGC fillRectangleX:(rL + l) y:rT width:rW - l height:width
     ].
 
-    (r ~~ 0 and: [(paint := self rightColor) notNil]) ifTrue:[
-        aGC paint:paint.
-        aGC fillRectangleX:(rR - r)
-                         y:(rT + t)
-                     width:r
-                    height:rH + 1 - t
+    rightColor notNil ifTrue:[
+        aGC paint:rightColor.
+        aGC fillRectangleX:(rR - r) y:(rT + t) width:width height:rH + 1 - t
     ].
 
-    (b ~~ 0 and: [(paint := self bottomColor) notNil]) ifTrue:[
+    bottomColor notNil ifTrue:[
         aGC paint:paint.
-        aGC fillRectangleX:(rL)
-                         y:(rB + 1 - b)
-                     width:rW - r
-                    height:b
+        aGC fillRectangleX:(rL) y:(rB + 1 - b) width:rW - r height:width
     ].
 
     aGC paint: oldPaint
@@ -333,75 +241,12 @@
     "Modified: 10.2.1997 / 15:55:04 / cg"
 ! !
 
-!Border methodsFor:'private accessing'!
-
-setBorderColor:aColor
-     leftColor := rightColor := topColor := bottomColor := aColor
-!
-
-setBorderWidth:aWidth
-     left := right := top := bottom := aWidth.
-!
-
-setBorderWidth:aWidth color:aColor
-     left := right := top := bottom := aWidth.
-     leftColor := rightColor := topColor := bottomColor := aColor
-
-    "Created: 10.2.1997 / 15:21:27 / cg"
-! !
-
-!Border methodsFor:'queries'!
-
-allSidesEqual:aSmallInteger
-    left ~~ aSmallInteger ifTrue:[^ false].
-    top ~~ aSmallInteger ifTrue:[^ false].
-    right ~~ aSmallInteger ifTrue:[^ false].
-    bottom ~~ aSmallInteger ifTrue:[^ false].
-    ^ true
-
-    "Created: 10.2.1997 / 14:53:13 / cg"
-!
-
-displayBoxFor:aRectangle
-    "return a rectangle representing the overall display box of a component
-     bordered by the receiver, which has bounds of aRectangle.
-     That is, the argument outset by the receivers borders."
-
-    |insetRectangle|
-
-    insetRectangle := aRectangle copy.
-    insetRectangle left:(insetRectangle left - self left).
-    insetRectangle right:(insetRectangle right + self right).
-    insetRectangle top:(insetRectangle top - self top).
-    insetRectangle bottom:(insetRectangle bottom + self bottom).
-    ^ insetRectangle
-
-    "Created: 10.2.1997 / 15:43:00 / cg"
-!
-
-insetDisplayBoxFor:aRectangle
-    "return a rectangle representing the display box of a component
-     bordered by the receiver in the outer bounds, aRectangle.
-     That is, the argument inset by the receivers borders."
-
-    |insetRectangle|
-
-    insetRectangle := aRectangle copy.
-    insetRectangle left:(insetRectangle left + self left).
-    insetRectangle right:(insetRectangle right - self right).
-    insetRectangle top:(insetRectangle top + self top).
-    insetRectangle bottom:(insetRectangle bottom - self bottom).
-    ^ insetRectangle
-
-    "Created: 10.2.1997 / 15:42:06 / cg"
-! !
-
 !Border class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Border.st,v 1.7 2009-10-23 15:23:48 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Border.st,v 1.8 2009-10-24 10:07:32 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/Border.st,v 1.7 2009-10-23 15:23:48 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Border.st,v 1.8 2009-10-24 10:07:32 cg Exp $'
 ! !