SelectionInListView.st
changeset 22 ac872628ef2d
parent 15 0dbce35d3c69
child 24 966098a893f8
--- a/SelectionInListView.st	Sat Jan 08 18:27:56 1994 +0100
+++ b/SelectionInListView.st	Sat Jan 08 18:30:02 1994 +0100
@@ -19,7 +19,7 @@
                               listAttributes multipleSelectOk clickLine
                               listSymbol initialSelectionSymbol printItems oneItem
                               hilightLevel hilightFrameColor ignoreReselect'
-       classVariableNames:   'hand'
+       classVariableNames:   'RightArrowShadowForm RightArrowLightForm RightArrowForm'
        poolDictionaries:''
        category:'Views-Text'
 !
@@ -37,7 +37,7 @@
 this one is a ListView with a selected line (which is shown highlighted)
 If multipleSelectionsOk is true, it is also allowed to shift-click multiple entries.
 
-$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.5 1993-12-20 17:24:19 claus Exp $
+$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.6 1994-01-08 17:29:52 claus Exp $
 
 written spring/summer 89 by claus
 3D Jan 90 by claus
@@ -45,6 +45,110 @@
 "
 ! !
 
+!SelectionInListView class methodsFor:'defaults'!
+
+rightArrowLightFormOn:aDevice
+    "return the form used for the right arrow light pixels (3D only)"
+
+    |f|
+
+    ((aDevice == Display) and:[RightArrowLightForm notNil]) ifTrue:[
+        ^ RightArrowLightForm
+    ].
+    f := Form fromFile:'RightArrowLight.xbm' resolution:100 on:aDevice.
+    f isNil ifTrue:[
+        f := Form width:16 height:16 fromArray:#(2r00000000 2r00000000 
+                                                 2r00000000 2r00000000 
+                                                 2r00000000 2r00000000 
+                                                 2r00000110 2r00000000 
+                                                 2r00000101 2r00000000 
+                                                 2r00000100 2r10000000 
+                                                 2r00000100 2r01000000 
+                                                 2r00000100 2r00100000 
+                                                 2r00000100 2r00000000 
+                                                 2r00000100 2r00000000
+                                                 2r00000100 2r00000000 
+                                                 2r00000100 2r00000000 
+                                                 2r00000100 2r00000000
+                                                 2r00000100 2r00000000 
+                                                 2r00000000 2r00000000 
+                                                 2r00000000 2r00000000)
+                                              on:aDevice
+    ].
+    (aDevice == Display) ifTrue:[
+        RightArrowLightForm := f
+    ].
+    ^ f
+!
+
+rightArrowShadowFormOn:aDevice
+    "return the form used for the right arrow light pixels (3D only)"
+
+    |f|
+
+    ((aDevice == Display) and:[RightArrowShadowForm notNil]) ifTrue:[
+        ^ RightArrowShadowForm
+    ].
+    f := Form fromFile:'RightArrowShadow.xbm' resolution:100 on:aDevice.
+    f isNil ifTrue:[
+        f := Form width:16 height:16 fromArray:#(2r00000000 2r00000000 
+                                                 2r00000000 2r00000000 
+                                                 2r00000000 2r00000000 
+                                                 2r00000000 2r00000000 
+                                                 2r00000000 2r00000000 
+                                                 2r00000000 2r00000000 
+                                                 2r00000000 2r00000000 
+                                                 2r00000000 2r00000000 
+                                                 2r00000000 2r00010000 
+                                                 2r00000000 2r00100000
+                                                 2r00000000 2r01000000 
+                                                 2r00000000 2r10000000 
+                                                 2r00000001 2r00000000
+                                                 2r00000010 2r00000000 
+                                                 2r00000000 2r00000000 
+                                                 2r00000000 2r00000000)
+                                              on:aDevice
+    ].
+    (aDevice == Display) ifTrue:[
+        RightArrowShadowForm := f
+    ].
+    ^ f
+!
+
+rightArrowFormOn:aDevice
+    "return the form used for the right arrow (non 3D)"
+
+    |f|
+
+    ((aDevice == Display) and:[RightArrowForm notNil]) ifTrue:[
+        ^ RightArrowForm
+    ].
+    f := Form fromFile:'RightArrow.xbm' resolution:100 on:aDevice.
+    f isNil ifTrue:[
+        f := Form width:16 height:16 fromArray:#(2r00000000 2r00000000 
+                                                 2r00000000 2r00000000 
+                                                 2r00000000 2r00000000 
+                                                 2r00000110 2r00000000 
+                                                 2r00000101 2r00000000 
+                                                 2r00000100 2r10000000 
+                                                 2r00000100 2r01000000 
+                                                 2r00000100 2r00100000 
+                                                 2r00000100 2r00010000 
+                                                 2r00000100 2r00100000
+                                                 2r00000100 2r01000000 
+                                                 2r00000100 2r10000000 
+                                                 2r00000101 2r00000000
+                                                 2r00000110 2r00000000 
+                                                 2r00000000 2r00000000 
+                                                 2r00000000 2r00000000)
+                                              on:aDevice
+    ].
+    (aDevice == Display) ifTrue:[
+        RightArrowForm := f
+    ].
+    ^ f
+! !
+
 !SelectionInListView class methodsFor:'instance creation'!
 
 on:aModel printItems:print oneItem:one aspect:aspect
@@ -618,6 +722,33 @@
 
 !SelectionInListView methodsFor:'redrawing'!
 
+drawRightArrowInVisibleLine:visLineNr
+    "draw a right arrow (for submenus).
+     This method is not used here, but provided for subclasses such
+     as menus or file-lists."
+
+    |w h y x l form|
+
+    x := width - 16.
+    y := (self yOfLine:visLineNr).
+
+    device depth == 1 ifTrue:[
+        form := self class rightArrowFormOn:device.
+        y := y + ((font height - form height) // 2).
+        self foreground:Black.
+        self drawForm:form x:x y:y.
+    ] ifFalse:[
+        form := self class rightArrowLightFormOn:device.
+        y := y + ((font height - form height) // 2).
+
+        self foreground:lightColor.
+        self drawForm:form x:x y:y.
+
+        self foreground:shadowColor.
+        self drawForm:(self class rightArrowShadowFormOn:device) x:x y:y.
+    ]
+!
+
 redrawElement:aNumber
     "redraw an individual element"