2535 |
2535 |
2536 ! ! |
2536 ! ! |
2537 |
2537 |
2538 !MenuEditor::TreeView methodsFor:'drawing basics'! |
2538 !MenuEditor::TreeView methodsFor:'drawing basics'! |
2539 |
2539 |
2540 drawLabelIndex:anIndex atX:x y:yCenter |
2540 redrawLabelAt:x y:yTop index:anIndex |
2541 "draw text label assigned to a node at x y( center)" |
2541 "draw text label assigned to a node at x y( center)" |
2542 |
2542 |
2543 |y x2 type item| |
2543 |isSelected y0 x0 x1 maxX w label type item| |
2544 |
2544 |
2545 item := (listOfNodes at:anIndex) contents. |
2545 item := (listOfNodes at:anIndex) contents. |
2546 type := item separatorType. |
2546 type := item separatorType. |
2547 |
2547 |
2548 type isNil ifTrue:[ |
2548 type isNil ifTrue:[ |
2549 super drawLabelIndex:anIndex atX:x y:yCenter |
2549 ^ super redrawLabelAt:x y:yTop index:anIndex |
|
2550 ]. |
|
2551 isSelected := self isInSelection:anIndex. |
|
2552 |
|
2553 highlightMode == #label ifTrue:[ |
|
2554 x0 := x + 4. |
|
2555 |
|
2556 isSelected ifTrue:[ |
|
2557 w := 80 + 8. |
|
2558 self paint:hilightBgColor. |
|
2559 self fillRectangleX:x y:yTop width:w height:fontHeight. |
|
2560 ] |
2550 ] ifFalse:[ |
2561 ] ifFalse:[ |
2551 type == #blank ifFalse:[ |
2562 w := 0. |
2552 x2 := x + 80. |
2563 ]. |
2553 |
2564 type == #blank ifFalse:[ |
2554 self displayLineFromX:x y:yCenter toX:x2 y:yCenter. |
2565 isSelected ifTrue:[self paint:hilightFgColor] |
2555 |
2566 ifFalse:[self paint:fgColor]. |
2556 type == #double ifTrue:[ |
2567 |
2557 y := yCenter + 2. |
2568 x1 := x0 + 80. |
2558 self displayLineFromX:x y:y toX:x2 y:y. |
2569 y0 := yTop - 1 + (fontHeight // 2). |
2559 ] |
2570 self displayLineFromX:x0 y:y0 toX:x1 y:y0. |
2560 ] |
2571 |
2561 ] |
2572 type == #double ifTrue:[ |
|
2573 y0 := y0 + 2. |
|
2574 self displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
2575 ] |
|
2576 ]. |
|
2577 |
|
2578 (isSelected and:[highlightMode == #label]) ifTrue:[ |
|
2579 self redrawSelFrameAtX:x y:yTop toX:(x + w) |
|
2580 ]. |
|
2581 |
2562 ! ! |
2582 ! ! |
2563 |
2583 |
2564 !MenuEditor::TreeView methodsFor:'event handling'! |
2584 !MenuEditor::TreeView methodsFor:'event handling'! |
2565 |
2585 |
2566 keyPress:key x:x y:y |
2586 keyPress:key x:x y:y |