support of LabelAndIcon
authorca
Thu, 29 Jan 1998 13:00:05 +0100
changeset 703 f07158f92e36
parent 702 cf639897acfd
child 704 01140e14c065
support of LabelAndIcon
TabView.st
TabWidget.st
--- a/TabView.st	Thu Jan 29 10:14:41 1998 +0100
+++ b/TabView.st	Thu Jan 29 13:00:05 1998 +0100
@@ -1196,6 +1196,17 @@
     ^ false
 !
 
+getBackgroundPaintForTab:aTab
+    "returns background color of the tab
+    "
+    |key|
+
+    key := aTab == (self tabAt:selection) ifFalse:[#unselectedColor]
+                                           ifTrue:[#selectedColor].
+
+    ^ tabStyle at:key
+!
+
 isEnabled
     "returns enabled state
     "
@@ -1218,6 +1229,12 @@
 
 !TabView methodsFor:'selection'!
 
+isTabSelected:aTab
+    "returns true if tab is selected
+    "
+    ^ aTab == (self tabAt:selection)
+!
+
 selection
     "return the selection index or nil
     "
@@ -1337,5 +1354,5 @@
 !TabView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/TabView.st,v 1.31 1998-01-28 14:09:33 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/TabView.st,v 1.32 1998-01-29 11:59:52 ca Exp $'
 ! !
--- a/TabWidget.st	Thu Jan 29 10:14:41 1998 +0100
+++ b/TabWidget.st	Thu Jan 29 13:00:05 1998 +0100
@@ -367,12 +367,16 @@
 redrawLabel
     "redraw label only
     "
-    |fg direction origin anchor x y label |
+    |fg direction origin originX originY anchor anchorX anchorY x y label|
 
     label     := self printableLabel.
     direction := tabView direction.
     anchor    := tabView styleAt:#labelAnchor.
+    anchorX := anchor x.
+    anchorY := anchor y.
     origin    := self computeOrigin.
+    originX := origin x.
+    originY := origin y.
 
  "/ set label color
 
@@ -394,27 +398,33 @@
     ].
 
     (direction == #top or:[direction == #bottom]) ifTrue:[
-        y := origin y.
-        x := origin x + anchor x.
+        y := originY.
+        x := originX + anchorX.
 
         direction == #top ifTrue:[
-            y := y + anchor y.
+            y := y + anchorY.
         ] ifFalse:[
-            y := y - anchor y - (label heightOn:tabView).
+            y := y - anchorY - (label heightOn:tabView).
         ].
         labelType == #string ifTrue:[
             y := y + tabView fontAscent
         ].
     ] ifFalse:[
         direction == #right ifTrue:[
-            x := origin x - anchor y - (label heightOn:tabView).
+            x := originX - anchorY - (label heightOn:tabView).
         ] ifFalse:[
-            x := origin x + anchor y.
+            x := originX + anchorY.
         ].
-        y := origin y + anchor x.
+        y := originY + anchorX.
 
         labelType == #string ifTrue:[
             x := x + tabView fontDescent.
+            "/ workaround for a bug in display-with-angle,
+            "/ iff displayed string is a labelAndIcon.
+            "/ (In this case, display is always opaque, and the current
+            "/  backgroundPaint color is used to fill the underlying rectangle)
+            "/
+            tabView backgroundPaint:(tabView getBackgroundPaintForTab:self).
             tabView displayString:label x:x y:y angle:90.
           ^ self.
         ].
@@ -1044,5 +1054,5 @@
 !TabWidget class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/TabWidget.st,v 1.14 1998-01-28 14:09:48 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/TabWidget.st,v 1.15 1998-01-29 12:00:05 ca Exp $'
 ! !