TabWidget.st
changeset 350 cb420d4899ab
parent 343 dd49faa984ce
child 351 6c46f186d84f
--- a/TabWidget.st	Mon Apr 07 17:13:12 1997 +0200
+++ b/TabWidget.st	Mon Apr 07 17:13:39 1997 +0200
@@ -13,20 +13,20 @@
 
 
 Object subclass:#TabWidget
-	instanceVariableNames:'tabView label origin extent inset'
+	instanceVariableNames:'tabView label origin extent inset lineNr'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Views-Interactors'
 !
 
-TabWidget subclass:#Folder
+TabWidget subclass:#Window
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:TabWidget
 !
 
-TabWidget subclass:#Window
+TabWidget subclass:#Folder
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
@@ -140,6 +140,10 @@
 
 labelLeftInset
     ^ 4
+!
+
+labelRightInset
+    ^ 4
 ! !
 
 !TabWidget methodsFor:'accessing'!
@@ -175,6 +179,18 @@
      + ((tabView styleAt:#leftOverLap) @ (tabView styleAt:#lableTopInset))
 !
 
+lineNr
+    "returns line number
+    "
+    ^ lineNr
+!
+
+lineNr:aLineNr
+    "change line number
+    "
+    lineNr := aLineNr
+!
+
 origin
     "returns the tab origin
     "
@@ -207,7 +223,10 @@
     label isNil ifTrue:[
         ^ self class defaultExtent
     ].
-    x := 2 + (label  widthOn:tabView).
+    x := (label widthOn:tabView)
+        + (self class labelRightInset)
+        + (self class labelLeftInset).
+
     y :=   (label heightOn:tabView)
          + (tabView styleAt:#labelBottomInset)
          + (tabView styleAt:#lableTopInset).
@@ -292,100 +311,6 @@
 
 ! !
 
-!TabWidget::Folder class methodsFor:'accessing'!
-
-tabStyleOn:aView
-    |style|
-
-    style := super tabStyleOn:aView.
-
-    style at:#hspace           put:2.
-    style at:#vspace           put:2.
-    style at:#labelBottomInset put:10.
-    style at:#expandSelection  put:4@8.
-
-  ^ style
-
-
-! !
-
-!TabWidget::Folder class methodsFor:'constants'!
-
-folderTabSize
-    ^ 4@4
-
-
-! !
-
-!TabWidget::Folder methodsFor:'redefined'!
-
-labelOriginWithinFrame
-    |org|
-
-    org := super labelOriginWithinFrame.
-    org  y:(org y + self class folderTabSize y).
-  ^ org
-
-!
-
-redrawSelected:isSelected
-    "full redraw; excluding the label
-    "
-    |lightColor shadowColor polygon fs x y y1 y2 x1 x2 x3 eX eY level|
-
-    polygon := Array new:8.
-    x  := origin x.
-    y  := origin y.
-    eX := x + extent x - 1.
-    eY := tabView extent y - inset.
-    fs := self class folderTabSize.
-    x1 := fs x.
-    y1 := fs y.
-    y2 := y + y1.
-    x3 := x + x1.
-    x2 := 10.
-    level := 2.
-
-    polygon at:1 put:(Point x:x            y:eY).
-    polygon at:2 put:(Point x:x            y:y2).
-    polygon at:3 put:(Point x:x3           y:y).
-    polygon at:4 put:(Point x:(x3+x2)      y:y).
-    polygon at:5 put:(Point x:(x3+x2+x1)   y:y2).
-    polygon at:6 put:(Point x:(eX-x1)      y:y2).
-    polygon at:7 put:(Point x:(eX)         y:(y2+y1)).
-    polygon at:8 put:(Point x:(eX)         y:eY).
-
-    isSelected ifFalse:[
-        tabView paintColor:#unselectedColor.
-        lightColor := tabView styleAt:#lightColorUnselected.
-        shadowColor := tabView styleAt:#shadowColorUnselected.
-    ] ifTrue:[
-        tabView paintColor:#selectedColor.
-        lightColor := tabView styleAt:#lightColorSelected.
-        shadowColor := tabView styleAt:#shadowColorSelected.
-    ].
-
-    tabView fillPolygon:polygon.
-    tabView paint:lightColor.
-
-    0 to:level do:[:i|
-        tabView displayLineFromX:(x+i)      y:(eY)     toX:(x+i)        y:(y2).
-        tabView displayLineFromX:(x+1)      y:(y2+i-1) toX:(x3+1)       y:(y+i-1).
-        tabView displayLineFromX:(x3+1)     y:(y+i)    toX:(x3+x2)      y:(y+i).
-        tabView displayLineFromX:(x3+x2)    y:(y+i)    toX:(x3+x2+x1)   y:(y2+i).
-        tabView displayLineFromX:(x3+x2+x1) y:(y2+i)   toX:(eX-x1)      y:(y2+i).
-    ].
-
-    tabView paint:shadowColor.
-    0 to:level do:[:i|
-        tabView displayLineFromX:(eX-x1) y:(y2+i+1) toX:eX     y:(y2+y1+i).
-        tabView displayLineFromX:(eX-i)  y:(y2+y1)  toX:(eX-i) y:(eY).
-        tabView displayPointX:eX-x1-i y:y2+level
-    ].
-
-
-! !
-
 !TabWidget::Window class methodsFor:'accessing'!
 
 tabStyleOn:aView
@@ -493,6 +418,100 @@
 
 ! !
 
+!TabWidget::Folder class methodsFor:'accessing'!
+
+tabStyleOn:aView
+    |style|
+
+    style := super tabStyleOn:aView.
+
+    style at:#hspace           put:2.
+    style at:#vspace           put:2.
+    style at:#labelBottomInset put:10.
+    style at:#expandSelection  put:4@8.
+
+  ^ style
+
+
+! !
+
+!TabWidget::Folder class methodsFor:'constants'!
+
+folderTabSize
+    ^ 4@4
+
+
+! !
+
+!TabWidget::Folder methodsFor:'redefined'!
+
+labelOriginWithinFrame
+    |org|
+
+    org := super labelOriginWithinFrame.
+    org  y:(org y + self class folderTabSize y).
+  ^ org
+
+!
+
+redrawSelected:isSelected
+    "full redraw; excluding the label
+    "
+    |lightColor shadowColor polygon fs x y y1 y2 x1 x2 x3 eX eY level|
+
+    polygon := Array new:8.
+    x  := origin x.
+    y  := origin y.
+    eX := x + extent x - 1.
+    eY := tabView extent y - inset.
+    fs := self class folderTabSize.
+    x1 := fs x.
+    y1 := fs y.
+    y2 := y + y1.
+    x3 := x + x1.
+    x2 := 10.
+    level := 2.
+
+    polygon at:1 put:(Point x:x            y:eY).
+    polygon at:2 put:(Point x:x            y:y2).
+    polygon at:3 put:(Point x:x3           y:y).
+    polygon at:4 put:(Point x:(x3+x2)      y:y).
+    polygon at:5 put:(Point x:(x3+x2+x1)   y:y2).
+    polygon at:6 put:(Point x:(eX-x1)      y:y2).
+    polygon at:7 put:(Point x:(eX)         y:(y2+y1)).
+    polygon at:8 put:(Point x:(eX)         y:eY).
+
+    isSelected ifFalse:[
+        tabView paintColor:#unselectedColor.
+        lightColor := tabView styleAt:#lightColorUnselected.
+        shadowColor := tabView styleAt:#shadowColorUnselected.
+    ] ifTrue:[
+        tabView paintColor:#selectedColor.
+        lightColor := tabView styleAt:#lightColorSelected.
+        shadowColor := tabView styleAt:#shadowColorSelected.
+    ].
+
+    tabView fillPolygon:polygon.
+    tabView paint:lightColor.
+
+    0 to:level do:[:i|
+        tabView displayLineFromX:(x+i)      y:(eY)     toX:(x+i)        y:(y2).
+        tabView displayLineFromX:(x+1)      y:(y2+i-1) toX:(x3+1)       y:(y+i-1).
+        tabView displayLineFromX:(x3+1)     y:(y+i)    toX:(x3+x2)      y:(y+i).
+        tabView displayLineFromX:(x3+x2)    y:(y+i)    toX:(x3+x2+x1)   y:(y2+i).
+        tabView displayLineFromX:(x3+x2+x1) y:(y2+i)   toX:(eX-x1)      y:(y2+i).
+    ].
+
+    tabView paint:shadowColor.
+    0 to:level do:[:i|
+        tabView displayLineFromX:(eX-x1) y:(y2+i+1) toX:eX     y:(y2+y1+i).
+        tabView displayLineFromX:(eX-i)  y:(y2+y1)  toX:(eX-i) y:(eY).
+        tabView displayPointX:eX-x1-i y:y2+level
+    ].
+
+
+! !
+
 !TabWidget::Mac class methodsFor:'accessing'!
 
 tabStyleOn:aView
@@ -569,5 +588,5 @@
 !TabWidget class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/TabWidget.st,v 1.1 1997-04-03 17:35:04 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/TabWidget.st,v 1.2 1997-04-07 15:13:39 ca Exp $'
 ! !