HierarchicalListView.st
changeset 2488 74c81c1e30d7
parent 2421 f5654eeb3118
child 2500 1477b0a5a918
equal deleted inserted replaced
2487:5ca73a020d36 2488:74c81c1e30d7
   468 
   468 
   469     icon := aBlock value.
   469     icon := aBlock value.
   470     icon isNil ifTrue:[^ nil].
   470     icon isNil ifTrue:[^ nil].
   471 
   471 
   472     realized ifTrue:[
   472     realized ifTrue:[
   473         icon := self imageOnDevice:icon
   473         icon := self imageOnMyDevice:icon
   474     ].
   474     ].
   475     icons at:aKey put:icon.
   475     icons at:aKey put:icon.
   476   ^ icon
   476   ^ icon
   477 !
   477 !
   478 
   478 
   484     (aDictionary isNil or:[aDictionary isEmpty]) ifTrue:[
   484     (aDictionary isNil or:[aDictionary isEmpty]) ifTrue:[
   485         ^ self
   485         ^ self
   486     ].
   486     ].
   487 
   487 
   488     aDictionary keysAndValuesDo:[:aKey :anImage|
   488     aDictionary keysAndValuesDo:[:aKey :anImage|
   489         (image := self imageOnDevice:anImage) notNil ifTrue:[
   489         (image := self imageOnMyDevice:anImage) notNil ifTrue:[
   490             icons at:aKey put:image
   490             icons at:aKey put:image
   491         ] ifFalse:[
   491         ] ifFalse:[
   492             icons removeKey:aKey ifAbsent:nil
   492             icons removeKey:aKey ifAbsent:nil
   493         ]
   493         ]
   494     ]
   494     ]
   495 
       
   496 !
   495 !
   497 
   496 
   498 showIndicators
   497 showIndicators
   499     "returns true if indicators are shown
   498     "returns true if indicators are shown
   500     "
   499     "
  1229     |image defaultWidth|
  1228     |image defaultWidth|
  1230 
  1229 
  1231     super fetchResources.
  1230     super fetchResources.
  1232 
  1231 
  1233     lineColor      := lineColor onDevice:device.
  1232     lineColor      := lineColor onDevice:device.
  1234     openIndicator  := self imageOnDevice:openIndicator.
  1233     openIndicator  := self imageOnMyDevice:openIndicator.
  1235     closeIndicator := self imageOnDevice:closeIndicator.
  1234     closeIndicator := self imageOnMyDevice:closeIndicator.
  1236     defaultWidth   := imageWidth.
  1235     defaultWidth   := imageWidth.
  1237 
  1236 
  1238     icons keysAndValuesDo:[:aKey :anImage|
  1237     icons keysAndValuesDo:[:aKey :anImage|
  1239         anImage isNil ifTrue:[
  1238         anImage isNil ifTrue:[
  1240             ('HierachicalListView [warning]: missing image: ' , aKey) errorPrintCR.
  1239             ('HierachicalListView [warning]: missing image: ' , aKey) errorPrintCR.
  1241         ] ifFalse:[
  1240         ] ifFalse:[
  1242             image := self imageOnDevice:anImage.
  1241             image := self imageOnMyDevice:anImage.
  1243             icons at:aKey put:image.
  1242             icons at:aKey put:image.
  1244             imageWidth := image width max:imageWidth.
  1243             imageWidth := image width max:imageWidth.
  1245         ]
  1244         ]
  1246     ].
  1245     ].
  1247     imageWidth      := (imageWidth + 1 // 2 * 2) max:defaultWidth.
  1246     imageWidth      := (imageWidth + 1 // 2 * 2) max:defaultWidth.
  1305             "/ got an image; have to register the image on my device
  1304             "/ got an image; have to register the image on my device
  1306 
  1305 
  1307             iconOrKey device == device ifTrue:[
  1306             iconOrKey device == device ifTrue:[
  1308                 ^ iconOrKey
  1307                 ^ iconOrKey
  1309             ].
  1308             ].
  1310             ^ icons at:iconOrKey ifAbsentPut:[ self imageOnDevice:iconOrKey ].
  1309             ^ icons at:iconOrKey ifAbsentPut:[ self imageOnMyDevice:iconOrKey ].
  1311         ].
  1310         ].
  1312 
  1311 
  1313         image := icons at:iconOrKey ifAbsent:nil.
  1312         image := icons at:iconOrKey ifAbsent:nil.
  1314         image notNil ifTrue:[ ^ image ].
  1313         image notNil ifTrue:[ ^ image ].
  1315     ].
  1314     ].
  1318     useDefaultIcons ifFalse:[
  1317     useDefaultIcons ifFalse:[
  1319         ^ nil
  1318         ^ nil
  1320     ].
  1319     ].
  1321 
  1320 
  1322     anItem hasChildren ifFalse:[
  1321     anItem hasChildren ifFalse:[
  1323         ^ icons at:#empty ifAbsentPut:[ self imageOnDevice:(self class emptyIcon) ]
  1322         ^ icons at:#empty ifAbsentPut:[ self imageOnMyDevice:(self class emptyIcon) ]
  1324     ].
  1323     ].
  1325 
  1324 
  1326     anItem isExpanded ifTrue:[
  1325     anItem isExpanded ifTrue:[
  1327         ^ icons at:#expanded ifAbsentPut:[ self imageOnDevice:(self class expandedIcon) ].
  1326         ^ icons at:#expanded ifAbsentPut:[ self imageOnMyDevice:(self class expandedIcon) ].
  1328     ].
  1327     ].
  1329     ^ icons at:#collapsed ifAbsentPut:[ self imageOnDevice:(self class collapsedIcon) ].
  1328     ^ icons at:#collapsed ifAbsentPut:[ self imageOnMyDevice:(self class collapsedIcon) ].
  1330 !
  1329 !
  1331 
  1330 
  1332 lineHeightFor:anItem
  1331 lineHeightFor:anItem
  1333     "returns the computed line height for an item
  1332     "returns the computed line height for an item
  1334     "
  1333     "
  1583 ! !
  1582 ! !
  1584 
  1583 
  1585 !HierarchicalListView class methodsFor:'documentation'!
  1584 !HierarchicalListView class methodsFor:'documentation'!
  1586 
  1585 
  1587 version
  1586 version
  1588     ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.80 2002-12-23 08:14:58 ca Exp $'
  1587     ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.81 2003-04-25 00:09:43 cg Exp $'
  1589 ! !
  1588 ! !