preps to allow for tabColor and activeTabColor to be
authorClaus Gittinger <cg@exept.de>
Tue, 08 Feb 2000 21:27:39 +0100
changeset 1689 ecb51abe4a6b
parent 1688 271829d6a2e4
child 1690 38b23fb1a931
preps to allow for tabColor and activeTabColor to be set different from viewBackground color
NoteBookView.st
--- a/NoteBookView.st	Tue Feb 08 19:02:27 2000 +0100
+++ b/NoteBookView.st	Tue Feb 08 21:27:39 2000 +0100
@@ -16,7 +16,8 @@
 		direction numberOfLines selectConditionBlock expandSelection
 		canvas canvasInset canvasFrameLevel canvasHolder halfLightColor
 		halfShadowColor fitLastRow tabModus lastComputedExtent keepCanvas
-		tabMargin activeForegroundColor drawLightColor edgeStyle'
+		tabMargin activeForegroundColor drawLightColor edgeStyle
+		tabBgColor activeTabBgColor'
 	classVariableNames:'DefaultForegroundColor DefaultActiveForegroundColor
 		DefaultShadowColor DefaultHalfShadowColor DefaultLightColor
 		DefaultHalfLightColor DefaultEdgeStyle'
@@ -477,6 +478,12 @@
     ^ activeForegroundColor
 !
 
+activeTabBackgroundColor
+    "get the backgroundColor of the tabs
+    "
+    ^ activeTabBgColor
+!
+
 backgroundColor
     "get backgroundColor of the notebook view
     "
@@ -532,9 +539,20 @@
     super shadowColor:aColor
 !
 
+tabBackgroundColor
+    "get the backgroundColor of the tabs
+    "
+    ^ tabBgColor
+!
+
 viewBackground:aColor
     "get backgroundColor of the notebook view
     "
+    |sameTab sameActiveTab|
+
+    sameTab := tabBgColor == viewBackground.
+    sameActiveTab := activeTabBgColor == viewBackground.
+
     super viewBackground:aColor.
 
     (edgeStyle isNil and:[viewBackground isColor]) ifTrue:[
@@ -542,6 +560,20 @@
         halfLightColor  := lightColor.
         drawLightColor  := lightColor.
     ].
+
+    DefaultShadowColor isNil ifTrue:[
+        shadowColor := aColor darkened onDevice:device
+    ].
+    DefaultLightColor isNil ifTrue:[
+        lightColor := aColor lightened onDevice:device
+    ].
+
+    sameTab ifTrue:[
+        tabBgColor := viewBackground.
+    ].
+    sameActiveTab ifTrue:[
+        activeTabBgColor := viewBackground.
+    ]
 ! !
 
 !NoteBookView methodsFor:'accessing style'!
@@ -674,6 +706,11 @@
                  and:[aTab ~~ selTab
                  and:[aTab intersects:damage]]
                 ) ifTrue:[
+                    tabBgColor ~~ viewBackground ifTrue:[
+                        self paint:tabBgColor.
+                        self fillRectangle:aTab layout.
+                    ].
+
                     aTab redrawAt:direction selected:false on:self
                 ]
             ]
@@ -702,6 +739,11 @@
         (lyt intersects:damage) ifTrue:[
             savLyt := selTab layout.
             selTab layout:lyt.
+
+            activeTabBgColor ~~ viewBackground ifTrue:[
+                self paint:activeTabBgColor.
+                self fillRectangle:lyt.
+            ].
             selTab redrawAt:direction selected:true on:self.
 
             (self hasFocus and:[styleSheet name == #win95]) ifTrue:[
@@ -865,12 +907,15 @@
     clr := DefaultForegroundColor ? foregroundColor.
     activeForegroundColor := clr onDevice:device.
 
-    clr := DefaultShadowColor ? Black.
+    clr := DefaultShadowColor ifNil:[viewBackground darkened].
     shadowColor := clr onDevice:device.
 
-    clr := DefaultLightColor ? White.
+    clr := DefaultLightColor ifNil:[viewBackground lightened].
     lightColor := clr onDevice:device.
 
+    tabBgColor := viewBackground.
+    activeTabBgColor := viewBackground.
+
     edgeStyle isNil ifTrue:[
         halfShadowColor := shadowColor.
         halfLightColor  := lightColor.
@@ -1785,7 +1830,7 @@
     |
 
     isSelected ifTrue:[
-        aGC paint:(aGC backgroundColor).
+        aGC paint:(aGC activeTabBackgroundColor).
         layout displayFilledOn:aGC.
     ].
              aDirection == #top    ifTrue:[self drawAtTopOn:aGC    selected:isSelected]
@@ -1931,5 +1976,5 @@
 !NoteBookView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.35 2000-02-08 17:59:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.36 2000-02-08 20:27:39 cg Exp $'
 ! !