--- a/LabelAndIcon.st Sat Jun 20 20:34:25 1998 +0200
+++ b/LabelAndIcon.st Sun Jun 21 04:48:23 1998 +0200
@@ -12,7 +12,7 @@
ListEntry subclass:#LabelAndIcon
- instanceVariableNames:'icon gap string image'
+ instanceVariableNames:'icon gap string image offset'
classVariableNames:''
poolDictionaries:''
category:'Views-Support'
@@ -259,6 +259,15 @@
image := anImage
!
+offset:pixels
+ "set the left offset (i.e. spacing to the left of the icon).
+ The default is 0."
+
+ offset := pixels.
+
+ "Created: / 21.6.1998 / 03:11:03 / cg"
+!
+
string
"return my string part"
@@ -298,7 +307,7 @@
stringHeight := string size > 0 ifTrue:[string heightOn:aGC] ifFalse:[0].
maxHeight := ((iconHeight max: imageHeight) + gapY) max: stringHeight.
- x1 := x.
+ x1 := x + offset.
icon notNil ifTrue:[
y1 := y - asc + (maxHeight - iconHeight + 1 // 2).
@@ -322,8 +331,10 @@
stringHeight ~~ 0 ifTrue:[
y1 := y + (maxHeight - stringHeight + 1 // 2).
- string displayOn:aGC x:x1 y:y1
- ]
+ string displayOn:aGC x:x1 y:y1 opaque:opaque
+ ]
+
+ "Modified: / 21.6.1998 / 03:52:12 / cg"
!
on:aDevice
@@ -347,7 +358,10 @@
!LabelAndIcon methodsFor:'initialization'!
initialize
- gap := 4
+ gap := 4.
+ offset := 0.
+
+ "Modified: / 21.6.1998 / 03:10:19 / cg"
! !
!LabelAndIcon methodsFor:'queries'!
@@ -382,7 +396,7 @@
|width|
- width := 0.
+ width := offset.
icon notNil ifTrue:[
width := width + icon width
].
@@ -393,11 +407,12 @@
width := width + gap + (string widthOn:aGC)
].
^width
-
+
+ "Modified: / 21.6.1998 / 03:11:14 / cg"
! !
!LabelAndIcon class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/LabelAndIcon.st,v 1.21 1998-03-09 16:07:25 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/LabelAndIcon.st,v 1.22 1998-06-21 02:48:23 cg Exp $'
! !