SelectionInTreeView.st
changeset 1175 1fa0de353686
parent 1171 0199f65bc8ce
child 1188 5c365b74eedd
equal deleted inserted replaced
1174:8d0c73401ea8 1175:1fa0de353686
    17 		itemClass lineColor computeResources showRoot
    17 		itemClass lineColor computeResources showRoot
    18 		showDirectoryIndicator closeIndicator openIndicator
    18 		showDirectoryIndicator closeIndicator openIndicator
    19 		showDirectoryIndicatorForRoot imageOpened imageClosed imageItem
    19 		showDirectoryIndicatorForRoot imageOpened imageClosed imageItem
    20 		discardMotionEvents registeredImages supportsExpandAll
    20 		discardMotionEvents registeredImages supportsExpandAll
    21 		buildInArray drawVLinesFromLevel highlightMode editorWidget
    21 		buildInArray drawVLinesFromLevel highlightMode editorWidget
    22 		editorIndex'
    22 		editorIndex editValueFgColor'
    23 	classVariableNames:'DefaultHilightMode SelectionInset'
    23 	classVariableNames:'DefaultHilightMode SelectionInset'
    24 	poolDictionaries:''
    24 	poolDictionaries:''
    25 	category:'Views-Text'
    25 	category:'Views-Text'
    26 !
    26 !
    27 
    27 
   970              ifFalse:[self paint:fgColor on:bgColor].
   970              ifFalse:[self paint:fgColor on:bgColor].
   971 
   971 
   972         self displayOpaqueString:label x:x0 y:y0.
   972         self displayOpaqueString:label x:x0 y:y0.
   973 
   973 
   974         value notNil ifTrue:[
   974         value notNil ifTrue:[
       
   975             isSel ifFalse:[
       
   976                 self paint:editValueFgColor on:bgColor
       
   977             ].
   975             self displayOpaqueString:value x:(xV + SelectionInset) y:y0
   978             self displayOpaqueString:value x:(xV + SelectionInset) y:y0
   976         ].
   979         ].
   977 
   980 
   978     ].
   981     ].
   979 
   982 
  1420     super create.
  1423     super create.
  1421     lineMask := lineMask onDevice:device.
  1424     lineMask := lineMask onDevice:device.
  1422 
  1425 
  1423     lineColor := lineColor isNil ifTrue:[fgColor]
  1426     lineColor := lineColor isNil ifTrue:[fgColor]
  1424                                 ifFalse:[lineColor onDevice:device].
  1427                                 ifFalse:[lineColor onDevice:device].
       
  1428 
       
  1429     editValueFgColor := editValueFgColor onDevice:device.
  1425 !
  1430 !
  1426 
  1431 
  1427 destroy
  1432 destroy
  1428     "remove dependencies
  1433     "remove dependencies
  1429     "
  1434     "
  1554     buildInArray := Array new:50.       "/ used for temporary calculation
  1559     buildInArray := Array new:50.       "/ used for temporary calculation
  1555                                         "/ suppress garbage collection
  1560                                         "/ suppress garbage collection
  1556 
  1561 
  1557     self model:nil.     "/ creates a default model.
  1562     self model:nil.     "/ creates a default model.
  1558     highlightMode := #label.
  1563     highlightMode := #label.
       
  1564     editValueFgColor := Color blue.
  1559 !
  1565 !
  1560 
  1566 
  1561 realize
  1567 realize
  1562     super realize.
  1568     super realize.
  1563     self  refetchDeviceResources.
  1569     self  refetchDeviceResources.
  1780 !
  1786 !
  1781 
  1787 
  1782 openEditor
  1788 openEditor
  1783     "open an editor on selection
  1789     "open an editor on selection
  1784     "
  1790     "
  1785     |node x0 x1 y0 focusView|
  1791     |node x0 x1 y0|
  1786 
  1792 
  1787     editorWidget notNil ifTrue:[
  1793     editorWidget notNil ifTrue:[
  1788         ^ self
  1794         ^ self
  1789     ].
  1795     ].
  1790     editorIndex := self selectedIndex.
  1796     editorIndex := self selectedIndex.
  1793      or:[(y0           := self listLineToVisibleLine:editorIndex) isNil
  1799      or:[(y0           := self listLineToVisibleLine:editorIndex) isNil
  1794      or:[(editorWidget := node editor) isNil]]
  1800      or:[(editorWidget := node editor) isNil]]
  1795     ) ifTrue:[   
  1801     ) ifTrue:[   
  1796         ^ self
  1802         ^ self
  1797     ].
  1803     ].
  1798     focusView := nil.
  1804     editorWidget withAllSubViewsDo:[:v| v font:font ].
  1799     editorWidget withAllSubViewsDo:[:v|
  1805 
  1800         focusView := v.
       
  1801         v font:font
       
  1802     ].
       
  1803     y0 := self yOfVisibleLine:y0.
  1806     y0 := self yOfVisibleLine:y0.
  1804     x0 := self xOfValueNode:node.
  1807     x0 := self xOfValueNode:node.
  1805     x1 := (editorWidget preferredExtent x) max:50.
  1808     x1 := (editorWidget preferredExtent x) max:50.
  1806     x1 := (x0 + x1) min:(self width - 5).
  1809     x1 := (x0 + x1) min:(self width - 5).
  1807 
  1810 
  1808     "/ editorWidget geometryLayout:(Rectangle left:x0 right:x1 top:y0 + 1 bottom:y0 - 2 + fontHeight).
       
  1809     editorWidget geometryLayout:(Rectangle left:x0 right:x1 top:y0 bottom:y0 + fontHeight).
  1811     editorWidget geometryLayout:(Rectangle left:x0 right:x1 top:y0 bottom:y0 + fontHeight).
  1810 
  1812 
  1811     self addComponent:editorWidget.
  1813     self addComponent:editorWidget.
  1812     editorWidget realize.
  1814     editorWidget realize.
  1813     self windowGroup focusView:focusView.
       
  1814     self paint:bgColor.
  1815     self paint:bgColor.
  1815 
  1816 
  1816     self fillRectangleX:(x0 - SelectionInset)
  1817     self fillRectangleX:(x0 - SelectionInset)
  1817                       y:y0
  1818                       y:y0
  1818                   width:SelectionInset + SelectionInset + (x1 - x0)
  1819                   width:SelectionInset + SelectionInset + (x1 - x0)
  2309 ! !
  2310 ! !
  2310 
  2311 
  2311 !SelectionInTreeView class methodsFor:'documentation'!
  2312 !SelectionInTreeView class methodsFor:'documentation'!
  2312 
  2313 
  2313 version
  2314 version
  2314     ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTreeView.st,v 1.69 1998-10-31 12:02:10 ca Exp $'
  2315     ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTreeView.st,v 1.70 1998-11-01 12:57:46 ca Exp $'
  2315 ! !
  2316 ! !