HierarchicalListView.st
changeset 5522 127709735589
parent 5389 d704f9a06ca8
child 5644 81b11ba37e60
equal deleted inserted replaced
5521:a834aaae42a9 5522:127709735589
  1255             icons at:aKey put:image.
  1255             icons at:aKey put:image.
  1256             imageWidth := image width max:imageWidth.
  1256             imageWidth := image width max:imageWidth.
  1257         ]
  1257         ]
  1258     ].
  1258     ].
  1259     imageWidth      := ((imageWidth + 1) // 2 * 2) max:defaultWidth.
  1259     imageWidth      := ((imageWidth + 1) // 2 * 2) max:defaultWidth.
  1260     alignTextRightX := imageWidth + 20 max:alignTextRightX.
  1260     alignTextRightX := (imageWidth + 20) max:alignTextRightX.
       
  1261 
       
  1262     "Modified (format): / 21-03-2017 / 09:54:38 / cg"
  1261 ! !
  1263 ! !
  1262 
  1264 
  1263 !HierarchicalListView methodsFor:'initialization & release'!
  1265 !HierarchicalListView methodsFor:'initialization & release'!
  1264 
  1266 
  1265 initStyle
  1267 initStyle
  1445                 ].
  1447                 ].
  1446             ].
  1448             ].
  1447         ].
  1449         ].
  1448         maxWidthOfText := maxWidthOfText max:width.
  1450         maxWidthOfText := maxWidthOfText max:width.
  1449         textX := self xVisibleOfIconAtLevel:(level + 1).
  1451         textX := self xVisibleOfIconAtLevel:(level + 1).
       
  1452         textX := textX + (viewOrigin x).
  1450 
  1453 
  1451         alignTextRightX < textX ifTrue:[
  1454         alignTextRightX < textX ifTrue:[
  1452             alignTextRightX := textX.
  1455             alignTextRightX := textX.
  1453             self invalidate.
  1456             self invalidate.
  1454         ].
  1457         ].
  1464             item parent ~~ parent ifTrue:[
  1467             item parent ~~ parent ifTrue:[
  1465                 textX  := self xVisibleOfTextAtLevel:(item level).
  1468                 textX  := self xVisibleOfTextAtLevel:(item level).
  1466                 parent := item parent.
  1469                 parent := item parent.
  1467             ].
  1470             ].
  1468             widthOfLabel   := listRenderer widthFor:item.
  1471             widthOfLabel   := listRenderer widthFor:item.
       
  1472             width          := (widthOfLabel + textX) max:width.
  1469             maxWidthOfText := maxWidthOfText max:widthOfLabel.
  1473             maxWidthOfText := maxWidthOfText max:widthOfLabel.
  1470             width          := widthOfLabel + textX max:width
  1474         ].
  1471         ].
  1475     ].
  1472     ].
  1476     ^ 20 + width + viewOrigin x.
  1473     ^ width + viewOrigin x.
  1477 
       
  1478     "Modified: / 21-03-2017 / 09:55:37 / cg"
  1474 !
  1479 !
  1475 
  1480 
  1476 xVisibleOfIconAtLevel:aLevel
  1481 xVisibleOfIconAtLevel:aLevel
  1477     "returns the visible origin x of the icon at a level.
  1482     "returns the visible origin x of the icon at a level.
  1478     "
  1483     "
  1521     opWidth2 := indicatorWidth // 2.
  1526     opWidth2 := indicatorWidth // 2.
  1522     igWidth2 := imageWidth // 2.
  1527     igWidth2 := imageWidth // 2.
  1523     xOffset  := igWidth2 + opWidth2 + imageInset.
  1528     xOffset  := igWidth2 + opWidth2 + imageInset.
  1524 
  1529 
  1525     showRoot ifTrue:[ firstLevel := 1 ]
  1530     showRoot ifTrue:[ firstLevel := 1 ]
  1526 	    ifFalse:[ firstLevel := 2 ].
  1531             ifFalse:[ firstLevel := 2 ].
  1527 
  1532 
  1528     showLeftIndicators ifTrue:[
  1533     showLeftIndicators ifTrue:[
  1529 	aLevel < firstLevel ifTrue:[
  1534         aLevel < firstLevel ifTrue:[
  1530 	    xOffset := opWidth2 - (firstLevel * xOffset)
  1535             xOffset := opWidth2 - (firstLevel * xOffset)
  1531 	] ifFalse:[
  1536         ] ifFalse:[
  1532 	    xOffset := opWidth2 + ((aLevel - firstLevel) * xOffset)
  1537             xOffset := opWidth2 + ((aLevel - firstLevel) * xOffset)
  1533 	]
  1538         ]
  1534     ] ifFalse:[
  1539     ] ifFalse:[
  1535 	aLevel < 2 ifTrue:[
  1540         aLevel < 2 ifTrue:[
  1536 	    xOffset := igWidth2 - ((aLevel - firstLevel) * xOffset)
  1541             xOffset := igWidth2 - ((aLevel - firstLevel) * xOffset)
  1537 	] ifFalse:[
  1542         ] ifFalse:[
  1538 	    xOffset := igWidth2 + ((aLevel - firstLevel - 1) * xOffset)
  1543             xOffset := igWidth2 + ((aLevel - firstLevel - 1) * xOffset)
  1539 	].
  1544         ].
  1540     ].
  1545     ].
  1541     "/ 2 := a left margin
  1546     "/ 2 := a left margin
  1542     ^ xOffset + 2 - (viewOrigin x)
  1547     ^ xOffset + 2 - (viewOrigin x)
       
  1548 
       
  1549     "Modified: / 21-03-2017 / 09:40:13 / cg"
  1543 !
  1550 !
  1544 
  1551 
  1545 yVisibleOfIndicatorForItem:anItem
  1552 yVisibleOfIndicatorForItem:anItem
  1546     |index y0 y1|
  1553     |index y0 y1|
  1547 
  1554