--- a/DSVLabelView.st Fri Sep 25 17:01:16 1998 +0200
+++ b/DSVLabelView.st Fri Sep 25 17:02:01 1998 +0200
@@ -21,14 +21,6 @@
category:'Views-DataSet'
!
-Object subclass:#Item
- instanceVariableNames:'label selector argument adjust font fgColor bgColor layout
- preferredExtent'
- classVariableNames:'DefaultLayout'
- poolDictionaries:''
- privateIn:DSVLabelView
-!
-
!DSVLabelView class methodsFor:'documentation'!
copyright
@@ -374,7 +366,7 @@
height := 0.
columnView columnsDo:[:aColumn||item|
- items add:(item := Item column:aColumn font:font on:self).
+ items add:(item := aColumn label).
height := (item preferredExtent y) max:height.
].
height := height + self class verticalInset.
@@ -391,7 +383,7 @@
"returns item at point x@y or nil
"
items do:[:anItem|
- (anItem layout containsPointX:x y:y) ifTrue:[ ^ anItem ]
+ (anItem layout containsPointX:x y:y) ifTrue:[ ^ anItem ].
].
^ nil
@@ -414,248 +406,8 @@
].
! !
-!DSVLabelView::Item class methodsFor:'constants'!
-
-defaultLayout
- "returns the default layout used for initialization
- "
- DefaultLayout isNil ifTrue:[
- DefaultLayout := Rectangle left:0 right:0 top:0 bottom:0
- ].
- ^ DefaultLayout
-
-
-! !
-
-!DSVLabelView::Item class methodsFor:'documentation'!
-
-documentation
-"
- describes the label of one column entry.
-
- [Instance variables:]
-
- label <Object> the label of the column
-
- selector <Symbol> a selector, which is evaluated with the argument
- if the item is selected and the button is released.
-
- argument <Object> user defined argument for the selector.
-
- adjust <Symbol> align label left, right or center; default is center
-
- font <Font> font used to dispaly the label; if the font is
- undefined, the default font is used.
-
- fgColor <Color> foreground color for the label; if the fgColor is
- undefined, the default foreground color is used.
-
- bgColor <Color> background color for the label; if the bgColor is
- undefined, the default background color is used.
-
- layout <Rectangle> the layout of the item
-
- preferredExtent <Point> preferred extent of the label
-
-
- [author:]
- Claus Atzkern
-"
-! !
-
-!DSVLabelView::Item class methodsFor:'instance creation'!
-
-column:aColumn font:aFont on:aGC
- "create a new item for a column
- "
- ^ (self new) column:aColumn font:aFont on:aGC
-
-
-! !
-
-!DSVLabelView::Item methodsFor:'accessing'!
-
-backgroundColor
- "returns the background color of the column or nil
- "
- ^ bgColor
-
-
-!
-
-foregroundColor
- "returns the foreground color of the column or nil
- "
- ^ fgColor
-
-
-!
-
-label
- "returns the label of the column or nil
- "
- ^ label
-
-
-! !
-
-!DSVLabelView::Item methodsFor:'accessing dimensions'!
-
-layout
- "returns the item's layout, a Rectangle
- "
- ^ layout
-
-
-!
-
-layout:aLayout
- "set the item's layout, a Rectangle
- "
- layout := aLayout
-
-
-!
-
-preferredExtent
- "returns the preferred extent of the label
- "
- ^ preferredExtent
-
-
-! !
-
-!DSVLabelView::Item methodsFor:'actions'!
-
-sendClickMsgTo:aReceiver
- "inform the receiver of a button release notification
- "
- (aReceiver notNil and:[selector notNil]) ifTrue:[
- selector numArgs ~~ 0 ifTrue:[
- aReceiver perform:selector with:argument
- ] ifFalse:[
- aReceiver perform:selector
- ]
- ]
-
-! !
-
-!DSVLabelView::Item methodsFor:'drawing'!
-
-redrawLabelOn:aGC hInset:hInset
- "redraw the label; the background is cleared and the paint is set
- "
- |x y|
-
- label isNil ifTrue:[
- ^ self
- ].
-
- adjust == #left ifTrue:[
- x := layout left + hInset.
- ] ifFalse:[
- adjust == #right ifTrue:[
- x := layout right - preferredExtent x - hInset
- ] ifFalse:[
- x := layout left + (((layout width - preferredExtent x) // 2) max:0)
- ]
- ].
- y := layout top + (layout height - preferredExtent y // 2).
-
- font notNil ifTrue:[
- aGC font:font.
- y := y + font ascent.
- ].
-
- label displayOn:aGC x:x y:y.
-
-
-! !
-
-!DSVLabelView::Item methodsFor:'instance creation'!
-
-column:aColumn font:aFont on:aGC
- "create instance for a column
- "
- |img|
-
- label := aColumn label.
- selector := aColumn description labelActionSelector.
- argument := (aColumn description labelActionArgument) ? label.
-
- adjust := aColumn labelAlignment.
- layout := self class defaultLayout.
-
- (fgColor := aColumn labelForegroundColor) notNil ifTrue:[
- fgColor := fgColor on:(aGC device)
- ].
-
- (bgColor := aColumn labelBackgroundColor) notNil ifTrue:[
- bgColor := bgColor on:(aGC device)
- ].
-
- label notNil ifTrue:[
- label isString ifFalse:[
- label := label on:aGC device.
-
- label isImage ifTrue:[
- label clearMaskedPixels
- ]
- ] ifTrue:[
- label withoutSeparators isEmpty ifTrue:[
- label := nil
- ]
- ].
-
- (label respondsTo:#string) ifTrue:[
- font := aColumn labelFont.
-
- font notNil ifTrue:[ font := font on:(aGC device) ]
- ifFalse:[ font := aFont ].
-
- aGC font:font.
-
- label class == LabelAndIcon ifTrue:[
- label := label on:(aGC device).
- (img := label image) isImage ifTrue:[img clearMaskedPixels].
- (img := label icon) isImage ifTrue:[img clearMaskedPixels].
- ]
- ]
- ].
-
- preferredExtent := label notNil ifTrue:[ Point x:(label widthOn:aGC) y:(label heightOn:aGC) ]
- ifFalse:[ 0 @ 0 ].
-
-! !
-
-!DSVLabelView::Item methodsFor:'notification'!
-
-originChanged:aDeltaPoint
- "called when the origin of the layout changed; scrolling left or right
- "
- |origin extent|
-
- origin := layout origin.
- extent := layout extent.
-
- layout origin:(origin - aDeltaPoint) extent:extent
-
-
-! !
-
-!DSVLabelView::Item methodsFor:'queries'!
-
-isSelectable
- "returns true if the item is selectable; a valid selector
- to notify the receiver for a release button event exists
- "
- ^ selector notNil
-
-
-! !
-
!DSVLabelView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.19 1998-09-06 13:20:59 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.20 1998-09-25 15:02:01 cg Exp $'
! !