Patrick Rein uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-pre.215.mcz ==================== Summary ==================== Name: ToolBuilder-Morphic-pre.215 Author: pre Time: 24 April 2018, 10:30:38.738732 am UUID: f78a62d4-8ee0-6f40-84e3-7fe6f5539d8e Ancestors: ToolBuilder-Morphic-cmm.214 Adds a callback to pluggable trees to retrieve the currently selected path in the tree. Also includes a minor fix for the double click functionality as the tool builder did not pass the callback selector to the tree morph. =============== Diff against ToolBuilder-Morphic-cmm.214 =============== Item was changed: ----- Method: MorphicToolBuilder>>buildPluggableTree: (in category 'widgets required') ----- buildPluggableTree: aSpec | widget | widget := self treeClass new. self register: widget id: aSpec name. widget model: aSpec model. widget getSelectedPathSelector: aSpec getSelectedPath. + widget setSelectedPathSelector: aSpec setSelectedPath. widget setSelectedSelector: aSpec setSelected. widget getSelectedSelector: aSpec getSelected. widget setSelectedParentSelector: aSpec setSelectedParent. widget getChildrenSelector: aSpec getChildren. widget hasChildrenSelector: aSpec hasChildren. widget getLabelSelector: aSpec label. widget getIconSelector: aSpec icon. widget getHelpSelector: aSpec help. widget getMenuSelector: aSpec menu. widget keystrokeActionSelector: aSpec keyPress. widget nodeClass: aSpec nodeClass. widget getRootsSelector: aSpec roots. widget autoDeselect: aSpec autoDeselect. + widget doubleClickSelector: aSpec doubleClick. widget dropItemSelector: aSpec dropItem. widget wantsDropSelector: aSpec dropAccept. widget dragItemSelector: aSpec dragItem. widget dragStartedSelector: aSpec dragStarted. widget columns: aSpec columns. "Override default scroll bar policies if needed. Widget will use preference values otherwise." aSpec hScrollBarPolicy ifNotNil: [:policy | policy caseOf: { [#always] -> [widget alwaysShowHScrollBar]. [#never] -> [widget hideHScrollBarIndefinitely]. [#whenNeeded] -> [widget showHScrollBarOnlyWhenNeeded]. } ]. aSpec vScrollBarPolicy ifNotNil: [:policy | policy caseOf: { [#always] -> [widget alwaysShowVScrollBar]. [#never] -> [widget hideVScrollBarIndefinitely]. [#whenNeeded] -> [widget showVScrollBarOnlyWhenNeeded]. } ]. self setFrame: aSpec frame in: widget. self setLayoutHintsFor: widget spec: aSpec. parent ifNotNil:[self add: widget to: parent]. " panes ifNotNil:[ aSpec roots ifNotNil:[panes add: aSpec roots]. ]. " ^widget! Item was changed: SimpleHierarchicalListMorph subclass: #PluggableTreeMorph + instanceVariableNames: 'rootWrappers selectedWrapper getRootsSelector getChildrenSelector hasChildrenSelector getLabelSelector getIconSelector getSelectedPathSelector setSelectedPathSelector setSelectedParentSelector getHelpSelector dropItemSelector wantsDropSelector dragItemSelector dragTypeSelector nodeClass lastKeystrokeTime lastKeystrokes dragStartedSelector doubleClickSelector' - instanceVariableNames: 'rootWrappers selectedWrapper getRootsSelector getChildrenSelector hasChildrenSelector getLabelSelector getIconSelector getSelectedPathSelector setSelectedParentSelector getHelpSelector dropItemSelector wantsDropSelector dragItemSelector dragTypeSelector nodeClass lastKeystrokeTime lastKeystrokes dragStartedSelector doubleClickSelector' classVariableNames: 'FilterByLabelsOnly MaximumSearchDepth' poolDictionaries: '' category: 'ToolBuilder-Morphic'! !PluggableTreeMorph commentStamp: 'ar 2/12/2005 04:38' prior: 0! A pluggable tree morph.! Item was changed: ----- Method: PluggableTreeMorph>>setSelectedMorph: (in category 'selection') ----- setSelectedMorph: aMorph + - selectedWrapper := aMorph complexContents. "Let the model now about the selected object, not wrapper." setSelectionSelector ifNotNil: [:symbol | model perform: symbol with: (selectedWrapper ifNotNil: [:w | w item])]. + self setSelectedParentMorph: aMorph. + self setSelectedPath: aMorph.! - self setSelectedParentMorph: aMorph.! Item was added: + ----- Method: PluggableTreeMorph>>setSelectedPath: (in category 'selection') ----- + setSelectedPath: aMorph + + | items wrapperPath | + wrapperPath := selectedWrapper + ifNil: [#()] + ifNotNil: [ + wrapperPath := {selectedWrapper} asOrderedCollection. + [wrapperPath last parent notNil] + whileTrue: [wrapperPath addLast: wrapperPath last parent]. + wrapperPath]. + items := wrapperPath collect: [:w | w item]. + setSelectedPathSelector ifNotNil: [:symbol | + model + perform: symbol + with: items]. + + ! Item was added: + ----- Method: PluggableTreeMorph>>setSelectedPathSelector (in category 'accessing') ----- + setSelectedPathSelector + ^ setSelectedPathSelector + ! Item was added: + ----- Method: PluggableTreeMorph>>setSelectedPathSelector: (in category 'accessing') ----- + setSelectedPathSelector: aSymbol + setSelectedPathSelector := aSymbol. + ! |
Free forum by Nabble | Edit this page |