--- a/ClrListEntry.st Thu Nov 23 03:25:38 1995 +0100
+++ b/ClrListEntry.st Thu Nov 23 03:29:00 1995 +0100
@@ -10,8 +10,6 @@
hereby transferred.
"
-'From Smalltalk/X, Version:2.10.5 on 15-may-1995 at 8:03:34 am'!
-
ListEntry subclass:#ColoredListEntry
instanceVariableNames:'color string bgColor'
classVariableNames:''
@@ -35,10 +33,6 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libwidg2/Attic/ClrListEntry.st,v 1.6 1995-11-21 13:34:54 cg Exp $'
-!
-
documentation
"
Instances of ColoredListEntry can be used in place of strings
@@ -89,6 +83,10 @@
v := PopUpList on:selList.
v open
"
+!
+
+version
+ ^ '$Header: /cvs/stx/stx/libwidg2/Attic/ClrListEntry.st,v 1.7 1995-11-23 02:28:13 cg Exp $'
! !
!ColoredListEntry class methodsFor:'instance creation'!
@@ -101,6 +99,31 @@
^ self new string:aString foregroundColor:fgColor backgroundColor:bgColor
! !
+!ColoredListEntry methodsFor:'accessing'!
+
+string:aString color:aColor
+ string := aString.
+ color := aColor
+!
+
+string:aString foregroundColor:fg backgroundColor:bg
+ string := aString.
+ color := fg.
+ bgColor := bg.
+
+ "Created: 16.11.1995 / 16:53:17 / cg"
+! !
+
+!ColoredListEntry methodsFor:'converting'!
+
+asString
+ ^ string
+!
+
+string
+ ^ string
+! !
+
!ColoredListEntry methodsFor:'drawing'!
displayOn:aGC x:x y:y
@@ -123,31 +146,6 @@
"Modified: 16.11.1995 / 16:54:40 / cg"
! !
-!ColoredListEntry methodsFor:'accessing'!
-
-string:aString color:aColor
- string := aString.
- color := aColor
-!
-
-string:aString foregroundColor:fg backgroundColor:bg
- string := aString.
- color := fg.
- bgColor := bg.
-
- "Created: 16.11.1995 / 16:53:17 / cg"
-! !
-
-!ColoredListEntry methodsFor:'converting'!
-
-string
- ^ string
-!
-
-asString
- ^ string
-! !
-
!ColoredListEntry methodsFor:'queries'!
widthIn:aGC
@@ -155,3 +153,4 @@
^ aGC font widthOf:(string withTabsExpanded)
! !
+
--- a/ColoredListEntry.st Thu Nov 23 03:25:38 1995 +0100
+++ b/ColoredListEntry.st Thu Nov 23 03:29:00 1995 +0100
@@ -10,8 +10,6 @@
hereby transferred.
"
-'From Smalltalk/X, Version:2.10.5 on 15-may-1995 at 8:03:34 am'!
-
ListEntry subclass:#ColoredListEntry
instanceVariableNames:'color string bgColor'
classVariableNames:''
@@ -35,10 +33,6 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libwidg2/ColoredListEntry.st,v 1.6 1995-11-21 13:34:54 cg Exp $'
-!
-
documentation
"
Instances of ColoredListEntry can be used in place of strings
@@ -89,6 +83,10 @@
v := PopUpList on:selList.
v open
"
+!
+
+version
+ ^ '$Header: /cvs/stx/stx/libwidg2/ColoredListEntry.st,v 1.7 1995-11-23 02:28:13 cg Exp $'
! !
!ColoredListEntry class methodsFor:'instance creation'!
@@ -101,6 +99,31 @@
^ self new string:aString foregroundColor:fgColor backgroundColor:bgColor
! !
+!ColoredListEntry methodsFor:'accessing'!
+
+string:aString color:aColor
+ string := aString.
+ color := aColor
+!
+
+string:aString foregroundColor:fg backgroundColor:bg
+ string := aString.
+ color := fg.
+ bgColor := bg.
+
+ "Created: 16.11.1995 / 16:53:17 / cg"
+! !
+
+!ColoredListEntry methodsFor:'converting'!
+
+asString
+ ^ string
+!
+
+string
+ ^ string
+! !
+
!ColoredListEntry methodsFor:'drawing'!
displayOn:aGC x:x y:y
@@ -123,31 +146,6 @@
"Modified: 16.11.1995 / 16:54:40 / cg"
! !
-!ColoredListEntry methodsFor:'accessing'!
-
-string:aString color:aColor
- string := aString.
- color := aColor
-!
-
-string:aString foregroundColor:fg backgroundColor:bg
- string := aString.
- color := fg.
- bgColor := bg.
-
- "Created: 16.11.1995 / 16:53:17 / cg"
-! !
-
-!ColoredListEntry methodsFor:'converting'!
-
-string
- ^ string
-!
-
-asString
- ^ string
-! !
-
!ColoredListEntry methodsFor:'queries'!
widthIn:aGC
@@ -155,3 +153,4 @@
^ aGC font widthOf:(string withTabsExpanded)
! !
+
--- a/ListEntry.st Thu Nov 23 03:25:38 1995 +0100
+++ b/ListEntry.st Thu Nov 23 03:29:00 1995 +0100
@@ -10,8 +10,6 @@
hereby transferred.
"
-'From Smalltalk/X, Version:2.10.5 on 15-may-1995 at 9:37:01 am'!
-
Object subclass:#ListEntry
instanceVariableNames:''
classVariableNames:''
@@ -35,10 +33,6 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libwidg2/ListEntry.st,v 1.3 1995-11-22 23:25:21 cg Exp $'
-!
-
documentation
"
ListEntry is an abstract superclass for objects which can be used
@@ -47,6 +41,10 @@
If you want to create new subclasses, implement (at least) the methods
found in the 'required protocol' category.
"
+!
+
+version
+ ^ '$Header: /cvs/stx/stx/libwidg2/ListEntry.st,v 1.4 1995-11-23 02:28:22 cg Exp $'
! !
!ListEntry methodsFor:'queries'!
@@ -61,20 +59,14 @@
!ListEntry methodsFor:'required protocol'!
-displayOn:aGC x:x y:y
- "display the receiver on a GC"
-
- ^ self subclassResponsibility
-!
-
asString
"return the receiver as a string (for example, to store it in a file)"
^ self subclassResponsibility
!
-widthIn:aGC
- "return the width (in device units) of the receiver when displayed in aGC"
+displayOn:aGC x:x y:y
+ "display the receiver on a GC"
^ self subclassResponsibility
!
@@ -87,5 +79,11 @@
^ aGC font height
"Created: 23.11.1995 / 00:19:45 / cg"
+!
+
+widthIn:aGC
+ "return the width (in device units) of the receiver when displayed in aGC"
+
+ ^ self subclassResponsibility
! !
--- a/MCLEntry.st Thu Nov 23 03:25:38 1995 +0100
+++ b/MCLEntry.st Thu Nov 23 03:29:00 1995 +0100
@@ -10,8 +10,6 @@
hereby transferred.
"
-'From Smalltalk/X, Version:2.10.5 on 15-may-1995 at 9:15:44 am'!
-
ListEntry subclass:#MultiColListEntry
instanceVariableNames:'strings tabSpec'
classVariableNames:'DefaultTabSpec'
@@ -35,10 +33,6 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libwidg2/Attic/MCLEntry.st,v 1.9 1995-11-17 17:23:36 cg Exp $'
-!
-
documentation
"
Instances of MultiColListEntry can be used in place of strings
@@ -260,10 +254,29 @@
v extent:600@200.
v open
"
+!
+
+version
+ ^ '$Header: /cvs/stx/stx/libwidg2/Attic/MCLEntry.st,v 1.10 1995-11-23 02:28:32 cg Exp $'
! !
!MultiColListEntry class methodsFor:'instance creation'!
+fromString:aString
+ ^ self fromString:aString separatedBy:Character space
+!
+
+fromString:aString separatedBy:separatorCharacter
+ |subStrings e|
+
+ e := self new.
+ subStrings := aString asCollectionOfSubstringsSeparatedBy:separatorCharacter.
+ subStrings keysAndValuesDo:[:i :sub |
+ e colAt:i put:sub.
+ ].
+ ^ e
+!
+
new:numberOfColumns
|e|
@@ -280,21 +293,61 @@
^ (self new:numberOfColumns) tabulatorSpecification:aTabSpec
"Modified: 30.8.1995 / 16:34:23 / claus"
+! !
+
+!MultiColListEntry methodsFor:'accessing'!
+
+colAt:index
+ "return the substring at column index"
+
+ index > strings size ifTrue:[^ nil].
+ ^ strings at:index
!
-fromString:aString
- ^ self fromString:aString separatedBy:Character space
+colAt:index put:aString
+ "replace the substring at column index"
+
+ strings isNil ifTrue:[
+ strings := OrderedCollection new:index
+ ].
+ index > strings size ifTrue:[strings grow:index].
+ strings at:index put:aString
+!
+
+strings:aCollectionOfStrings
+ "replace all substrings"
+
+ strings := OrderedCollection withAll:aCollectionOfStrings.
!
-fromString:aString separatedBy:separatorCharacter
- |subStrings e|
+tabulatorSpecification:aTabSpec
+ "set the tabulator spec"
+
+ tabSpec := aTabSpec
+! !
+
+!MultiColListEntry methodsFor:'converting'!
+
+asString
+ "return the receiver as a string with embedded tabs"
+
+ |s sub tab
+ nSub "{ Class: SmallInteger }"|
- e := self new.
- subStrings := aString asCollectionOfSubstringsSeparatedBy:separatorCharacter.
- subStrings keysAndValuesDo:[:i :sub |
- e colAt:i put:sub.
+ s := ''.
+ tab := Character tab asString.
+ nSub := strings size.
+ 1 to:nSub do:[:subStringIndex |
+ sub := strings at:subStringIndex.
+ sub notNil ifTrue:[
+ s := s , sub.
+ ].
+ subStringIndex == strings size ifFalse:[
+ s := s , tab
+ ]
].
- ^ e
+
+ ^ s
! !
!MultiColListEntry methodsFor:'defaults'!
@@ -353,37 +406,6 @@
"Modified: 17.11.1995 / 12:21:18 / cg"
! !
-!MultiColListEntry methodsFor:'accessing'!
-
-colAt:index put:aString
- "replace the substring at column index"
-
- strings isNil ifTrue:[
- strings := OrderedCollection new:index
- ].
- index > strings size ifTrue:[strings grow:index].
- strings at:index put:aString
-!
-
-tabulatorSpecification:aTabSpec
- "set the tabulator spec"
-
- tabSpec := aTabSpec
-!
-
-strings:aCollectionOfStrings
- "replace all substrings"
-
- strings := OrderedCollection withAll:aCollectionOfStrings.
-!
-
-colAt:index
- "return the substring at column index"
-
- index > strings size ifTrue:[^ nil].
- ^ strings at:index
-! !
-
!MultiColListEntry methodsFor:'queries'!
widthIn:aGC
@@ -420,27 +442,3 @@
^ xMax
! !
-!MultiColListEntry methodsFor:'converting'!
-
-asString
- "return the receiver as a string with embedded tabs"
-
- |s sub tab
- nSub "{ Class: SmallInteger }"|
-
- s := ''.
- tab := Character tab asString.
- nSub := strings size.
- 1 to:nSub do:[:subStringIndex |
- sub := strings at:subStringIndex.
- sub notNil ifTrue:[
- s := s , sub.
- ].
- subStringIndex == strings size ifFalse:[
- s := s , tab
- ]
- ].
-
- ^ s
-! !
-
--- a/MultiColListEntry.st Thu Nov 23 03:25:38 1995 +0100
+++ b/MultiColListEntry.st Thu Nov 23 03:29:00 1995 +0100
@@ -10,8 +10,6 @@
hereby transferred.
"
-'From Smalltalk/X, Version:2.10.5 on 15-may-1995 at 9:15:44 am'!
-
ListEntry subclass:#MultiColListEntry
instanceVariableNames:'strings tabSpec'
classVariableNames:'DefaultTabSpec'
@@ -35,10 +33,6 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libwidg2/MultiColListEntry.st,v 1.9 1995-11-17 17:23:36 cg Exp $'
-!
-
documentation
"
Instances of MultiColListEntry can be used in place of strings
@@ -260,10 +254,29 @@
v extent:600@200.
v open
"
+!
+
+version
+ ^ '$Header: /cvs/stx/stx/libwidg2/MultiColListEntry.st,v 1.10 1995-11-23 02:28:32 cg Exp $'
! !
!MultiColListEntry class methodsFor:'instance creation'!
+fromString:aString
+ ^ self fromString:aString separatedBy:Character space
+!
+
+fromString:aString separatedBy:separatorCharacter
+ |subStrings e|
+
+ e := self new.
+ subStrings := aString asCollectionOfSubstringsSeparatedBy:separatorCharacter.
+ subStrings keysAndValuesDo:[:i :sub |
+ e colAt:i put:sub.
+ ].
+ ^ e
+!
+
new:numberOfColumns
|e|
@@ -280,21 +293,61 @@
^ (self new:numberOfColumns) tabulatorSpecification:aTabSpec
"Modified: 30.8.1995 / 16:34:23 / claus"
+! !
+
+!MultiColListEntry methodsFor:'accessing'!
+
+colAt:index
+ "return the substring at column index"
+
+ index > strings size ifTrue:[^ nil].
+ ^ strings at:index
!
-fromString:aString
- ^ self fromString:aString separatedBy:Character space
+colAt:index put:aString
+ "replace the substring at column index"
+
+ strings isNil ifTrue:[
+ strings := OrderedCollection new:index
+ ].
+ index > strings size ifTrue:[strings grow:index].
+ strings at:index put:aString
+!
+
+strings:aCollectionOfStrings
+ "replace all substrings"
+
+ strings := OrderedCollection withAll:aCollectionOfStrings.
!
-fromString:aString separatedBy:separatorCharacter
- |subStrings e|
+tabulatorSpecification:aTabSpec
+ "set the tabulator spec"
+
+ tabSpec := aTabSpec
+! !
+
+!MultiColListEntry methodsFor:'converting'!
+
+asString
+ "return the receiver as a string with embedded tabs"
+
+ |s sub tab
+ nSub "{ Class: SmallInteger }"|
- e := self new.
- subStrings := aString asCollectionOfSubstringsSeparatedBy:separatorCharacter.
- subStrings keysAndValuesDo:[:i :sub |
- e colAt:i put:sub.
+ s := ''.
+ tab := Character tab asString.
+ nSub := strings size.
+ 1 to:nSub do:[:subStringIndex |
+ sub := strings at:subStringIndex.
+ sub notNil ifTrue:[
+ s := s , sub.
+ ].
+ subStringIndex == strings size ifFalse:[
+ s := s , tab
+ ]
].
- ^ e
+
+ ^ s
! !
!MultiColListEntry methodsFor:'defaults'!
@@ -353,37 +406,6 @@
"Modified: 17.11.1995 / 12:21:18 / cg"
! !
-!MultiColListEntry methodsFor:'accessing'!
-
-colAt:index put:aString
- "replace the substring at column index"
-
- strings isNil ifTrue:[
- strings := OrderedCollection new:index
- ].
- index > strings size ifTrue:[strings grow:index].
- strings at:index put:aString
-!
-
-tabulatorSpecification:aTabSpec
- "set the tabulator spec"
-
- tabSpec := aTabSpec
-!
-
-strings:aCollectionOfStrings
- "replace all substrings"
-
- strings := OrderedCollection withAll:aCollectionOfStrings.
-!
-
-colAt:index
- "return the substring at column index"
-
- index > strings size ifTrue:[^ nil].
- ^ strings at:index
-! !
-
!MultiColListEntry methodsFor:'queries'!
widthIn:aGC
@@ -420,27 +442,3 @@
^ xMax
! !
-!MultiColListEntry methodsFor:'converting'!
-
-asString
- "return the receiver as a string with embedded tabs"
-
- |s sub tab
- nSub "{ Class: SmallInteger }"|
-
- s := ''.
- tab := Character tab asString.
- nSub := strings size.
- 1 to:nSub do:[:subStringIndex |
- sub := strings at:subStringIndex.
- sub notNil ifTrue:[
- s := s , sub.
- ].
- subStringIndex == strings size ifFalse:[
- s := s , tab
- ]
- ].
-
- ^ s
-! !
-
--- a/TabSpec.st Thu Nov 23 03:25:38 1995 +0100
+++ b/TabSpec.st Thu Nov 23 03:29:00 1995 +0100
@@ -33,10 +33,6 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libwidg2/Attic/TabSpec.st,v 1.6 1995-11-11 16:29:28 cg Exp $'
-!
-
documentation
"
This is a helper class for table widgets and tabular data in
@@ -190,6 +186,10 @@
listView open
"
+!
+
+version
+ ^ '$Header: /cvs/stx/stx/libwidg2/Attic/TabSpec.st,v 1.7 1995-11-23 02:29:00 cg Exp $'
! !
!TabulatorSpecification class methodsFor:'instance creation'!
@@ -204,6 +204,99 @@
"Modified: 30.8.1995 / 16:37:50 / claus"
! !
+!TabulatorSpecification methodsFor:'accessing'!
+
+align
+ "return the align-vector"
+
+ ^ tabTypes
+!
+
+align:types
+ "
+ an array of tab-types; each one is
+ #left
+ #right
+ #center
+ #decimal
+ or a symbol which gives align of all tabs
+
+ "
+ tabTypes := types
+!
+
+positions
+ "return the position-vector"
+
+ ^ tabPositions
+!
+
+positions:tabs
+ "set the position-vector"
+
+ tabPositions := tabs
+!
+
+size
+ "return the number of tabs in this spec"
+
+ ^ tabPositions size
+!
+
+unit
+ "return the unit"
+
+ ^ tabUnit
+!
+
+unit:aSymbol
+ "set the unit.
+ allowed are: #inch, #mm, #cm, #pixel and #col"
+
+ tabUnit := aSymbol
+!
+
+unitRelativeTo:someObject
+ "set for a relative unit. someObject should return its width
+ and the tabs are set fraction-relative to this number (in pixel)."
+
+ tabUnit := #relative.
+ unitReference := someObject
+!
+
+widths
+ "return a width-vector"
+
+ |prev|
+
+ prev := 0.
+ ^ tabPositions collect:[:p | |w| w := p - prev. prev := p. w].
+
+ "
+ |spec|
+
+ spec := TabulatorSpecification new.
+ spec unit:#inch.
+ spec positions:#(0 1 2.5 3.5 4 5 ).
+ spec align: #(#left #left #right #right #center #decimal ).
+ spec widths
+ "
+!
+
+widths:fieldWidths
+ "set the position-vector from a vector of field widths"
+
+ |pos|
+
+ pos := 0.
+ tabPositions := fieldWidths collect:[:w |
+ |p|
+
+ p := pos.
+ pos := pos + w.
+ p].
+! !
+
!TabulatorSpecification methodsFor:'queries'!
pixelsPerUnitOn:aGC
@@ -235,32 +328,6 @@
^ 1.
!
-typeOfTab:index
- "return the type of the tab at position index."
-
- tabPositions isNil ifTrue:[^ #left].
- tabTypes notNil ifTrue:[
- (tabTypes isMemberOf:Symbol) ifTrue:[
- ^ tabTypes
- ].
- ^ tabTypes at:index.
- ].
- "default is left"
- ^ #left
-!
-
-positionOfTab:index on:aGC
- "return the position (in device units) of the tab at index"
-
- |unit pos|
-
- tabPositions isNil ifTrue:[^ nil].
-
- unit := self pixelsPerUnitOn:aGC.
- pos := ((tabPositions at:index) * unit).
- ^ pos
-!
-
positionOfTab:index forString:aString on:aGC
"return the position (in device units) of the string to be drawn
at position index."
@@ -288,98 +355,31 @@
].
"default is left"
^ pos
-! !
-
-!TabulatorSpecification methodsFor:'accessing'!
-
-size
- "return the number of tabs in this spec"
-
- ^ tabPositions size
-!
-
-unit:aSymbol
- "set the unit.
- allowed are: #inch, #mm, #cm, #pixel and #col"
-
- tabUnit := aSymbol
!
-unitRelativeTo:someObject
- "set for a relative unit. someObject should return its width
- and the tabs are set fraction-relative to this number (in pixel)."
+positionOfTab:index on:aGC
+ "return the position (in device units) of the tab at index"
- tabUnit := #relative.
- unitReference := someObject
-!
-
-unit
- "return the unit"
+ |unit pos|
- ^ tabUnit
-!
+ tabPositions isNil ifTrue:[^ nil].
-align:types
- "
- an array of tab-types; each one is
- #left
- #right
- #center
- #decimal
- or a symbol which gives align of all tabs
-
- "
- tabTypes := types
+ unit := self pixelsPerUnitOn:aGC.
+ pos := ((tabPositions at:index) * unit).
+ ^ pos
!
-align
- "return the align-vector"
-
- ^ tabTypes
-!
-
-widths
- "return a width-vector"
-
- |prev|
-
- prev := 0.
- ^ tabPositions collect:[:p | |w| w := p - prev. prev := p. w].
-
- "
- |spec|
-
- spec := TabulatorSpecification new.
- spec unit:#inch.
- spec positions:#(0 1 2.5 3.5 4 5 ).
- spec align: #(#left #left #right #right #center #decimal ).
- spec widths
- "
-!
+typeOfTab:index
+ "return the type of the tab at position index."
-widths:fieldWidths
- "set the position-vector from a vector of field widths"
-
- |pos|
-
- pos := 0.
- tabPositions := fieldWidths collect:[:w |
- |p|
-
- p := pos.
- pos := pos + w.
- p].
-!
-
-positions:tabs
- "set the position-vector"
-
- tabPositions := tabs
-!
-
-positions
- "return the position-vector"
-
- ^ tabPositions
+ tabPositions isNil ifTrue:[^ #left].
+ tabTypes notNil ifTrue:[
+ (tabTypes isMemberOf:Symbol) ifTrue:[
+ ^ tabTypes
+ ].
+ ^ tabTypes at:index.
+ ].
+ "default is left"
+ ^ #left
! !
--- a/TabulatorSpecification.st Thu Nov 23 03:25:38 1995 +0100
+++ b/TabulatorSpecification.st Thu Nov 23 03:29:00 1995 +0100
@@ -33,10 +33,6 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libwidg2/TabulatorSpecification.st,v 1.6 1995-11-11 16:29:28 cg Exp $'
-!
-
documentation
"
This is a helper class for table widgets and tabular data in
@@ -190,6 +186,10 @@
listView open
"
+!
+
+version
+ ^ '$Header: /cvs/stx/stx/libwidg2/TabulatorSpecification.st,v 1.7 1995-11-23 02:29:00 cg Exp $'
! !
!TabulatorSpecification class methodsFor:'instance creation'!
@@ -204,6 +204,99 @@
"Modified: 30.8.1995 / 16:37:50 / claus"
! !
+!TabulatorSpecification methodsFor:'accessing'!
+
+align
+ "return the align-vector"
+
+ ^ tabTypes
+!
+
+align:types
+ "
+ an array of tab-types; each one is
+ #left
+ #right
+ #center
+ #decimal
+ or a symbol which gives align of all tabs
+
+ "
+ tabTypes := types
+!
+
+positions
+ "return the position-vector"
+
+ ^ tabPositions
+!
+
+positions:tabs
+ "set the position-vector"
+
+ tabPositions := tabs
+!
+
+size
+ "return the number of tabs in this spec"
+
+ ^ tabPositions size
+!
+
+unit
+ "return the unit"
+
+ ^ tabUnit
+!
+
+unit:aSymbol
+ "set the unit.
+ allowed are: #inch, #mm, #cm, #pixel and #col"
+
+ tabUnit := aSymbol
+!
+
+unitRelativeTo:someObject
+ "set for a relative unit. someObject should return its width
+ and the tabs are set fraction-relative to this number (in pixel)."
+
+ tabUnit := #relative.
+ unitReference := someObject
+!
+
+widths
+ "return a width-vector"
+
+ |prev|
+
+ prev := 0.
+ ^ tabPositions collect:[:p | |w| w := p - prev. prev := p. w].
+
+ "
+ |spec|
+
+ spec := TabulatorSpecification new.
+ spec unit:#inch.
+ spec positions:#(0 1 2.5 3.5 4 5 ).
+ spec align: #(#left #left #right #right #center #decimal ).
+ spec widths
+ "
+!
+
+widths:fieldWidths
+ "set the position-vector from a vector of field widths"
+
+ |pos|
+
+ pos := 0.
+ tabPositions := fieldWidths collect:[:w |
+ |p|
+
+ p := pos.
+ pos := pos + w.
+ p].
+! !
+
!TabulatorSpecification methodsFor:'queries'!
pixelsPerUnitOn:aGC
@@ -235,32 +328,6 @@
^ 1.
!
-typeOfTab:index
- "return the type of the tab at position index."
-
- tabPositions isNil ifTrue:[^ #left].
- tabTypes notNil ifTrue:[
- (tabTypes isMemberOf:Symbol) ifTrue:[
- ^ tabTypes
- ].
- ^ tabTypes at:index.
- ].
- "default is left"
- ^ #left
-!
-
-positionOfTab:index on:aGC
- "return the position (in device units) of the tab at index"
-
- |unit pos|
-
- tabPositions isNil ifTrue:[^ nil].
-
- unit := self pixelsPerUnitOn:aGC.
- pos := ((tabPositions at:index) * unit).
- ^ pos
-!
-
positionOfTab:index forString:aString on:aGC
"return the position (in device units) of the string to be drawn
at position index."
@@ -288,98 +355,31 @@
].
"default is left"
^ pos
-! !
-
-!TabulatorSpecification methodsFor:'accessing'!
-
-size
- "return the number of tabs in this spec"
-
- ^ tabPositions size
-!
-
-unit:aSymbol
- "set the unit.
- allowed are: #inch, #mm, #cm, #pixel and #col"
-
- tabUnit := aSymbol
!
-unitRelativeTo:someObject
- "set for a relative unit. someObject should return its width
- and the tabs are set fraction-relative to this number (in pixel)."
+positionOfTab:index on:aGC
+ "return the position (in device units) of the tab at index"
- tabUnit := #relative.
- unitReference := someObject
-!
-
-unit
- "return the unit"
+ |unit pos|
- ^ tabUnit
-!
+ tabPositions isNil ifTrue:[^ nil].
-align:types
- "
- an array of tab-types; each one is
- #left
- #right
- #center
- #decimal
- or a symbol which gives align of all tabs
-
- "
- tabTypes := types
+ unit := self pixelsPerUnitOn:aGC.
+ pos := ((tabPositions at:index) * unit).
+ ^ pos
!
-align
- "return the align-vector"
-
- ^ tabTypes
-!
-
-widths
- "return a width-vector"
-
- |prev|
-
- prev := 0.
- ^ tabPositions collect:[:p | |w| w := p - prev. prev := p. w].
-
- "
- |spec|
-
- spec := TabulatorSpecification new.
- spec unit:#inch.
- spec positions:#(0 1 2.5 3.5 4 5 ).
- spec align: #(#left #left #right #right #center #decimal ).
- spec widths
- "
-!
+typeOfTab:index
+ "return the type of the tab at position index."
-widths:fieldWidths
- "set the position-vector from a vector of field widths"
-
- |pos|
-
- pos := 0.
- tabPositions := fieldWidths collect:[:w |
- |p|
-
- p := pos.
- pos := pos + w.
- p].
-!
-
-positions:tabs
- "set the position-vector"
-
- tabPositions := tabs
-!
-
-positions
- "return the position-vector"
-
- ^ tabPositions
+ tabPositions isNil ifTrue:[^ #left].
+ tabTypes notNil ifTrue:[
+ (tabTypes isMemberOf:Symbol) ifTrue:[
+ ^ tabTypes
+ ].
+ ^ tabTypes at:index.
+ ].
+ "default is left"
+ ^ #left
! !