'From Pharo1.3a of ''18 January 2011'' [Latest update: #13072] on 6 April 2011 at 5:12:20 pm'! Morph subclass: #MorphTreeNodeMorph instanceVariableNames: 'parent index indentLevel isExpanded complexContents firstChild container nextSibling icon controls lineColor ' classVariableNames: '' poolDictionaries: '' category: 'Morphic-MorphTreeWidget'! ScrollPane subclass: #MorphTreeMorph instanceVariableNames: 'getListSelector setSelectionSelector keystrokeActionSelector autoMultiSelection columns potentialDropMorph rowInset columnInset columnResizers withHLines preferedPaneColor indentGap expandedToggleImage notExpandedToggleImage resizerWidth gapAfterIcon gapAfterToggle hasToggleAtRoot scrollDeltaHeight getSelectionSelector topHeader topHeaderBackground unboundLastColumn lastClickedMorph columnDropUnabled iconReservedExtent columnColors rowColors selectedMorphList doubleClickBlock pager nodeList multipleSelection nodeSortBlock shiftSelectedMorph autoDeselection iconBlock treeLineWidth lineColorBlock treeLineDashes privateSelectionUpdateFromMouseDown ' classVariableNames: '' poolDictionaries: '' category: 'Morphic-MorphTreeWidget'! !MorphTreeNodeMorph methodsFor: 'accessing' stamp: 'IgorStasenko 4/6/2011 16:48'! icon "answer the receiver's icon" ^ container iconBlock value: self complexContents. ! ! !MorphTreeNodeMorph methodsFor: 'accessing' stamp: 'IgorStasenko 4/6/2011 17:10'! minWidth "Fixed to work such that guessed width is unnecessary in #adjustSubmorphPositions." | gap | gap := container ifNil: [ 0 ] ifNotNil: [ self indentGap ]. ^ gap max: super minWidth! ! !MorphTreeNodeMorph methodsFor: 'accessing' stamp: 'IgorStasenko 4/6/2011 16:41'! spacerWidth | sRect | sRect := bounds. self mustTakeIntoAccountToggleSpace ifTrue: [sRect := sRect withLeft: self toggleRectangle right + container gapAfterToggle] ifFalse: [sRect := sRect withLeft: self toggleRectangle left]. ^ sRect left - bounds left. ! ! !MorphTreeNodeMorph methodsFor: 'drawing' stamp: 'IgorStasenko 4/6/2011 17:06'! drawOn: aCanvas | tRect | container withHLines ifTrue: [ aCanvas frameRectangle: self selectionFrame width: 1 colors: {Color veryLightGray. Color transparent} dashes: #(1 2)]. tRect := self toggleRectangle. self hasToggle ifTrue: [self drawToggleOn: aCanvas in: tRect]. ! ! !MorphTreeNodeMorph methodsFor: 'initialization' stamp: 'IgorStasenko 4/6/2011 17:00'! initWithContents: anObject prior: priorMorph forList: hostList indentLevel: newLevel container := hostList. self cellInset: (container resizerWidth @ 0). complexContents := anObject. isExpanded := false. nextSibling := firstChild := nil. priorMorph ifNotNil: [priorMorph nextSibling: self]. indentLevel := newLevel. self initRow ! ! !MorphTreeNodeMorph methodsFor: 'testing' stamp: 'IgorStasenko 4/6/2011 16:59'! hasIcon "Answer whether the receiver has an icon." ^ self icon notNil! ! !MorphTreeNodeMorph methodsFor: 'updating' stamp: 'IgorStasenko 4/6/2011 16:59'! delete parent := nil. complexContents := nil. firstChild := nil. container := nil. nextSibling := nil. controls := nil. super delete. ! ! !MorphTreeMorph methodsFor: 'accessing' stamp: 'IgorStasenko 4/6/2011 17:01'! leftGap ^self toggleImageWidth + self gapAfterToggle. ! ! !MorphTreeColumn methodsFor: 'column drawing' stamp: 'IgorStasenko 4/6/2011 17:05'! rowMorphFor: aNode | rowMorph cont | rowMorph := self rowMorphGetSelector ifNil: [aNode rowMorphForColumn: self] ifNotNil: [self rowMorphGetterBlock value: aNode value: self container]. rowMorph ifNotNil: [rowMorph borderWidth: 0] ifNil: [rowMorph := self defaultRowMorph]. cont := Morph new color: Color transparent; layoutPolicy: RowLayout new; hResizing: #shrinkWrap; vResizing: #shrinkWrap; layoutInset: container columnInset @ container rowInset; listDirection: #leftToRight; cellInset: 4@0; yourself. cont addMorph: rowMorph. self isFirstColumn ifTrue: [ | icon | icon := container iconBlock value: aNode. icon ifNotNil: [ cont addMorph: icon asMorph ]. "for first column we don't use horizontal inset" cont layoutInset: 0 @ container rowInset. ]. ^ cont ! ! !MorphTreeColumn methodsFor: 'testing' stamp: 'IgorStasenko 4/6/2011 16:31'! isFirstColumn ^ container columns first = self! ! MorphTreeMorph removeSelector: #gapAfterIcon! MorphTreeMorph removeSelector: #gapAfterIcon:! MorphTreeMorph removeSelector: #iconReservedExtent! MorphTreeMorph removeSelector: #iconReservedExtent:! ScrollPane subclass: #MorphTreeMorph instanceVariableNames: 'getListSelector setSelectionSelector keystrokeActionSelector autoMultiSelection columns potentialDropMorph rowInset columnInset columnResizers withHLines preferedPaneColor indentGap expandedToggleImage notExpandedToggleImage resizerWidth gapAfterToggle hasToggleAtRoot scrollDeltaHeight getSelectionSelector topHeader topHeaderBackground unboundLastColumn lastClickedMorph columnDropUnabled columnColors rowColors selectedMorphList doubleClickBlock pager nodeList multipleSelection nodeSortBlock shiftSelectedMorph autoDeselection iconBlock treeLineWidth lineColorBlock treeLineDashes privateSelectionUpdateFromMouseDown' classVariableNames: '' poolDictionaries: '' category: 'Morphic-MorphTreeWidget'! MorphTreeNodeMorph removeSelector: #minHeight! Morph subclass: #MorphTreeNodeMorph instanceVariableNames: 'parent index indentLevel isExpanded complexContents firstChild container nextSibling controls lineColor' classVariableNames: '' poolDictionaries: '' category: 'Morphic-MorphTreeWidget'!