SelectionInTreeView.st
changeset 2065 845bd5d2523c
parent 2056 b34a774d3a2b
child 2156 e16dc409ecf2
equal deleted inserted replaced
2064:0e0d1fe431fb 2065:845bd5d2523c
  1445 
  1445 
  1446     enabled ifFalse:[
  1446     enabled ifFalse:[
  1447         ^ self
  1447         ^ self
  1448     ].
  1448     ].
  1449 
  1449 
  1450     (key == #CursorLeft or:[key == #CursorRight]) ifTrue:[
  1450     "/ cg: its nicer to expand/collaps on these keys
  1451         (idx := self selectedIndex) == 0 ifTrue:[ ^ self ].
  1451     key == #CursorRight ifTrue:[
  1452 
  1452         (node := self selectedNode) notNil ifTrue:[
  1453         (key == #CursorLeft) ifTrue:[ inc := -1. end := 0 ]
  1453             model doExpand:node.
  1454                             ifFalse:[ inc :=  1. end := 1 + listOfNodes size ].
  1454             ^ self.
  1455 
  1455         ].
  1456         [(idx := idx + inc) ~~ end] whileTrue:[
  1456     ].
  1457             node := listOfNodes at:idx.
  1457     key == #CursorLeft ifTrue:[
  1458             node hasChildren ifTrue:[
  1458         (node := self selectedNode) notNil ifTrue:[
  1459                 ^ self key:key select:idx x:x y:y
  1459             model doCollapse:node.
  1460             ]
  1460             ^ self.
  1461         ].
  1461         ].
  1462         ^ self
  1462     ].
  1463     ].
  1463 
       
  1464     "/ search fwd/bwd for a node with children
       
  1465 
       
  1466 "/    (key == #CursorLeft or:[key == #CursorRight]) ifTrue:[
       
  1467 "/        (idx := self selectedIndex) == 0 ifTrue:[ ^ self ].
       
  1468 "/
       
  1469 "/        (key == #CursorLeft) ifTrue:[ inc := -1. end := 0 ]
       
  1470 "/                            ifFalse:[ inc :=  1. end := 1 + listOfNodes size ].
       
  1471 "/
       
  1472 "/        [(idx := idx + inc) ~~ end] whileTrue:[
       
  1473 "/            node := listOfNodes at:idx.
       
  1474 "/            node hasChildren ifTrue:[
       
  1475 "/                ^ self key:key select:idx x:x y:y
       
  1476 "/            ]
       
  1477 "/        ].
       
  1478 "/        ^ self
       
  1479 "/    ].
  1464     ^ super keyPress:key x:x y:y
  1480     ^ super keyPress:key x:x y:y
  1465 
       
  1466 
       
  1467 
       
  1468 
       
  1469 ! !
  1481 ! !
  1470 
  1482 
  1471 !SelectionInTreeView methodsFor:'initialize / release'!
  1483 !SelectionInTreeView methodsFor:'initialize / release'!
  1472 
  1484 
  1473 create
  1485 create
  2466 ! !
  2478 ! !
  2467 
  2479 
  2468 !SelectionInTreeView class methodsFor:'documentation'!
  2480 !SelectionInTreeView class methodsFor:'documentation'!
  2469 
  2481 
  2470 version
  2482 version
  2471     ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTreeView.st,v 1.96 2001-11-19 15:28:39 cg Exp $'
  2483     ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTreeView.st,v 1.97 2001-12-12 16:01:01 cg Exp $'
  2472 ! !
  2484 ! !