added tabLevel
authorClaus Gittinger <cg@exept.de>
Tue, 18 Sep 2001 11:55:56 +0200
changeset 2010 644587a3b8e2
parent 2009 4f556ff9fec5
child 2011 128778a6a31d
added tabLevel
NoteBookView.st
--- a/NoteBookView.st	Fri Sep 14 18:25:48 2001 +0200
+++ b/NoteBookView.st	Tue Sep 18 11:55:56 2001 +0200
@@ -20,7 +20,7 @@
 		canvasFrameLevel canvasHolder halfLightColor halfShadowColor
 		fitLastRow tabModus lastComputedExtent keepCanvas tabMargin
 		activeForegroundColor drawLightColor edgeStyle tabBgColor
-		activeTabBgColor disabledForegroundColor'
+		activeTabBgColor disabledForegroundColor tabLevel'
 	classVariableNames:'DefaultForegroundColor DefaultActiveForegroundColor
 		DefaultShadowColor DefaultHalfShadowColor DefaultLightColor
 		DefaultHalfLightColor DefaultEdgeStyle DisabledForegroundColor'
@@ -214,7 +214,7 @@
 !
 
 canvas:aCanvas
-    "change canvas; the containter view
+    "change the canvas; the containter view
     "
     aCanvas == canvas ifFalse:[
         canvas notNil ifTrue:[
@@ -253,15 +253,14 @@
     ^ canvasFrameLevel
 !
 
-canvasFrameLevel:aFrameLevel
-    "inset of the canvas relative to my canvas boundery
+canvasFrameLevel:anInteger
+    "set the inset of the canvas relative to my canvas boundery
     "
-    canvasFrameLevel ~~ aFrameLevel ifTrue:[
-        canvasFrameLevel := aFrameLevel.
+    canvasFrameLevel ~~ anInteger ifTrue:[
+        canvasFrameLevel := anInteger.
         self recomputeList.
         self invalidate.
     ].
-
 !
 
 canvasInset
@@ -359,6 +358,22 @@
 
 !
 
+tabLevel
+    "level of the tab relative to the canvas
+    "
+    ^ tabLevel
+!
+
+tabLevel:anInteger
+    "set the level of the tab relative to the canvas
+    "
+    tabLevel ~~ anInteger ifTrue:[
+        tabLevel := anInteger.
+"/        self recomputeList.
+        self invalidate.
+    ].
+!
+
 useIndex
     "use index instead of name
     "
@@ -821,7 +836,7 @@
 redrawX:x y:y width:w height:h
     "a region must be redrawn
     "
-    |savClip selectedTab selectedTabsLineNr damage lyt savLyt|
+    |savClip selectedTab selectedTabsLineNr damage lyt savLyt right|
 
     self shown ifFalse:[
         ^ self
@@ -868,16 +883,31 @@
 
     tabModus ifFalse:[
         lyt := self computeBorderLayout.
-        self drawEdgesForX:lyt left 
-                         y:lyt top
-                     width:lyt width 
-                    height:lyt height
-                     level:canvasFrameLevel
-                    shadow:shadowColor 
-                     light:lightColor
-                halfShadow:halfShadowColor 
-                 halfLight:halfLightColor
-                     style:edgeStyle
+        canvasFrameLevel ~~ 0 ifTrue:[
+            self drawEdgesForX:lyt left 
+                             y:lyt top
+                         width:lyt width 
+                        height:lyt height
+                         level:canvasFrameLevel
+                        shadow:shadowColor 
+                         light:lightColor
+                    halfShadow:halfShadowColor 
+                     halfLight:halfLightColor
+                         style:edgeStyle
+        ] ifFalse:[
+            (tabLevel notNil and:[tabLevel ~~ 0]) ifTrue:[
+                list size > 0 ifTrue:[
+                    right := lyt left + lyt width - 1.
+                    self paint:lightColor.
+                    1 to:tabLevel do:[:i |
+                        |y|
+
+                        y := lyt top + tabLevel - i.
+                        self displayDeviceLineFromX:(lyt left) y:y toX:right y:y.
+                    ]       
+                ]       
+            ]
+        ]
     ].
 
     selectedTab notNil ifTrue:[
@@ -1175,7 +1205,6 @@
     canvas notNil ifTrue:[
         canvas := canvas in:self.
     ].
-
 !
 
 realize
@@ -1262,7 +1291,7 @@
 computeLayoutForTab:aTab
     "calculate extent of a tab
     "
-    |layout x y w h level|
+    |layout x y w h level tlevel|
 
     layout := aTab layout.
 
@@ -1270,7 +1299,9 @@
         ^ layout
     ].
 
-    level  := canvasFrameLevel abs.
+    level  := tlevel := canvasFrameLevel abs.
+    level == 0 ifTrue:[ tlevel := tabLevel ? 0].
+
     layout := layout copy.
     w := expandSelection x.
     h := expandSelection y.
@@ -1280,12 +1311,12 @@
     (direction == #top or:[direction == #bottom]) ifTrue:[
         layout setLeft:(layout left   - x).
         layout   width:(layout width  + w).
-        layout  height:(layout height + y + level).
+        layout  height:(layout height + y + tlevel).
 
         direction == #top ifTrue:[
             layout setTop:(layout top - y).
         ] ifFalse:[
-            layout setTop:(layout top - level).
+            layout setTop:(layout top - tlevel).
         ].
         ^ layout
     ].
@@ -1375,6 +1406,7 @@
      first     "{ Class:SmallInteger }"
      last      "{ Class:SmallInteger }"
     |
+
     startX     := expandSelection x // 2 + canvasFrameLevel abs - 2.
     lineWidth  := self width - startX.
     tabHeight  := self maxTabHeight.
@@ -1448,7 +1480,6 @@
         ].
         first := last + 1.
     ]
-
 !
 
 recomputeListVertical
@@ -1465,6 +1496,7 @@
      first     "{ Class:SmallInteger }"
      last      "{ Class:SmallInteger }"
     |
+
     startY     := expandSelection x // 2 + canvasFrameLevel abs - 2.
     lineHeight := self height - startY.
     tabHeight  := self maxTabHeight.
@@ -1537,11 +1569,21 @@
 !
 
 resizeCanvas
-    |layout|
+    |layout lvl|
 
     canvas notNil ifTrue:[
         layout := self computeBorderLayout.
-        layout := layout insetBy:(canvasInset + canvasFrameLevel abs).
+        lvl := canvasFrameLevel abs.
+        layout := layout insetBy:(canvasInset + lvl).
+        lvl == 0 ifTrue:[
+            tabLevel notNil ifTrue:[
+                layout := Rectangle
+                                left:layout left
+                                top:layout top + tabLevel
+                                width:layout width
+                                height:layout height - tabLevel.
+            ]
+        ].
 "/        ((direction == #top) or:[direction ==#bottom]) ifTrue:[
 "/            layout := layout insetBy:((0@canvasInset y) + canvasFrameLevel abs).
 "/        ] ifFalse:[
@@ -2090,13 +2132,13 @@
     aGC displayLineFromX:xR-1 y:yB toX:xR-1 y:yT+1.
 
     aGC paint:(aGC drawLightColor).
-    aGC displayLineFromX:xL+2 y:yT toX:xR-2 y:yT.
-    aGC displayLineFromX:xL   y:yB toX:xL   y:yT+2.
+    aGC displayLineFromX:xL+2 y:yT toX:xR-2 y:yT.          "/ top line
+    aGC displayLineFromX:xL   y:yB toX:xL   y:yT+2.        "/ left line
     aGC displayPointX:xL+1    y:yT+1.
 
     aGC paint:(aGC halfLightColor).
-    aGC displayLineFromX:xL+2 y:yT+1 toX:xR-2 y:yT+1.
-    aGC displayLineFromX:xL+1 y:yB toX:xL+1 y:yT+2.
+    aGC displayLineFromX:xL+2 y:yT+1 toX:xR-2 y:yT+1.      "/ top line 2
+    aGC displayLineFromX:xL+1 y:yB toX:xL+1 y:yT+2.        "/ left line 2
 
     isSelected ifFalse:[^ self].
     (aGC isLastTabInLine:self)  ifFalse:[aGC displayPointX:xR y:yB].
@@ -2270,5 +2312,5 @@
 !NoteBookView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.52 2001-09-12 15:44:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.53 2001-09-18 09:55:56 cg Exp $'
 ! !