HierarchicalListView.st
changeset 3870 18c8952dc8cc
parent 3850 c9b77f759762
child 3883 090387ed8844
equal deleted inserted replaced
3869:20d5ddff9541 3870:18c8952dc8cc
  1394 
  1394 
  1395 !HierarchicalListView methodsFor:'private'!
  1395 !HierarchicalListView methodsFor:'private'!
  1396 
  1396 
  1397 iconFor:anItem
  1397 iconFor:anItem
  1398     "returns an icon or image for the item or nil if the item
  1398     "returns an icon or image for the item or nil if the item
  1399      provides no image and #useDefaultIcons is switched off.
  1399      provides no image and useDefaultIcons is switched off,
       
  1400      or if anItem returns #none from the icon query.
  1400     "
  1401     "
  1401     |iconOrKey image|
  1402     |iconOrKey image|
  1402 
  1403 
  1403     "/ get the icon or access key from the item
  1404     "/ get the icon or access key from the item
  1404     iconOrKey := anItem icon.
  1405     iconOrKey := anItem icon.
  1405 
  1406 
  1406     iconOrKey notNil ifTrue:[
  1407     iconOrKey notNil ifTrue:[
  1407 	iconOrKey isImageOrForm ifTrue:[
  1408         iconOrKey isImageOrForm ifTrue:[
  1408 	    "/ got an image; have to register the image on my device
  1409             "/ got an image; have to register the image on my device
  1409 
  1410 
  1410 	    iconOrKey device == device ifTrue:[
  1411             iconOrKey device == device ifTrue:[
  1411 		^ iconOrKey
  1412                 ^ iconOrKey
  1412 	    ].
  1413             ].
  1413 	    ^ icons at:iconOrKey ifAbsentPut:[ self imageOnMyDevice:iconOrKey ].
  1414             ^ icons at:iconOrKey ifAbsentPut:[ self imageOnMyDevice:iconOrKey ].
  1414 	].
  1415         ].
  1415 
  1416         iconOrKey == #none ifTrue:[^ nil].
  1416 	image := icons at:iconOrKey ifAbsent:nil.
  1417 
  1417 	image notNil ifTrue:[ ^ image ].
  1418         image := icons at:iconOrKey ifAbsent:nil.
       
  1419         image notNil ifTrue:[ ^ image ].
  1418     ].
  1420     ].
  1419 
  1421 
  1420     "/ test whether a default image should be returned
  1422     "/ test whether a default image should be returned
  1421     useDefaultIcons ifFalse:[
  1423     useDefaultIcons ifFalse:[
  1422 	^ nil
  1424         ^ nil
  1423     ].
  1425     ].
  1424 
  1426 
  1425     anItem hasChildren ifFalse:[
  1427     anItem hasChildren ifFalse:[
  1426 	anItem isDirectoryItem ifFalse:[
  1428         anItem isDirectoryItem ifFalse:[
  1427 	    ^ icons at:#empty ifAbsentPut:[ self imageOnMyDevice:(self class emptyIcon) ]
  1429             ^ icons at:#empty ifAbsentPut:[ self imageOnMyDevice:(self class emptyIcon) ]
  1428 	].
  1430         ].
  1429 	^ icons at:#collapsed ifAbsentPut:[ self imageOnMyDevice:(self class collapsedIcon) ].
  1431         ^ icons at:#collapsed ifAbsentPut:[ self imageOnMyDevice:(self class collapsedIcon) ].
  1430     ].
  1432     ].
  1431 
  1433 
  1432     anItem isExpanded ifTrue:[
  1434     anItem isExpanded ifTrue:[
  1433 	^ icons at:#expanded ifAbsentPut:[ self imageOnMyDevice:(self class expandedIcon) ].
  1435         ^ icons at:#expanded ifAbsentPut:[ self imageOnMyDevice:(self class expandedIcon) ].
  1434     ].
  1436     ].
  1435     ^ icons at:#collapsed ifAbsentPut:[ self imageOnMyDevice:(self class collapsedIcon) ].
  1437     ^ icons at:#collapsed ifAbsentPut:[ self imageOnMyDevice:(self class collapsedIcon) ].
  1436 
  1438 
  1437     "Modified: / 23-06-2006 / 12:47:33 / fm"
  1439     "Modified: / 23-06-2006 / 12:47:33 / fm"
  1438 !
  1440 !
  1734 ! !
  1736 ! !
  1735 
  1737 
  1736 !HierarchicalListView class methodsFor:'documentation'!
  1738 !HierarchicalListView class methodsFor:'documentation'!
  1737 
  1739 
  1738 version
  1740 version
  1739     ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.116 2009-11-05 19:55:57 stefan Exp $'
  1741     ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.117 2010-01-30 12:49:59 cg Exp $'
  1740 !
  1742 !
  1741 
  1743 
  1742 version_CVS
  1744 version_CVS
  1743     ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.116 2009-11-05 19:55:57 stefan Exp $'
  1745     ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.117 2010-01-30 12:49:59 cg Exp $'
  1744 ! !
  1746 ! !