# HG changeset patch # User Claus Gittinger # Date 1265120366 -3600 # Node ID e257439bdea5f3879b6d41d072eadfbc2aac35a9 # Parent 926b7fe3db6aecc4606c025b7ef2684ec144bb90 support drag&drop from the find-file resultlist diff -r 926b7fe3db6a -r e257439bdea5 FindFileApplication.st --- a/FindFileApplication.st Tue Feb 02 14:15:13 2010 +0100 +++ b/FindFileApplication.st Tue Feb 02 15:19:26 2010 +0100 @@ -386,6 +386,13 @@ valueChangeSelector: fileSelected: useIndex: true sequenceList: shownListHolder + properties: + (PropertyListDictionary + startDragSelector: doStartDrag:in: + dragArgument: findFileList + displayObjectSelector: getDisplayObjects: + dropObjectSelector: getDropObjects: + ) ) ) @@ -1200,6 +1207,48 @@ super update:something with:aParameter from:changedObject ! ! +!FindFileApplication methodsFor:'drag & drop'! + +getDisplayObjects:anArgument + "retrieve the objects displayed during a drag" + + | sel string size fnName stream| + + sel := self selectionHolder value. + size := sel size. + size == 0 ifTrue:[^ '']. + + stream := WriteStream on:''. + stream nextPutAll:((resultList at:sel first) asFilename baseName asString). + size == 1 ifTrue:[ + fnName := 'ui_menuitem.xpm'. + ] ifFalse:[ + fnName := 'ui_submenu_open.xpm'. + stream nextPutAll:' ... '. + stream nextPutAll:((resultList at:sel last) asFilename baseName asString). + ]. + string := stream contents. + + ^ Array with:(LabelAndIcon + icon:(Image fromFile:fnName) + string:(Text string:string emphasis:#bold)) +! + +getDropObjects:anArgument + "common code, used in subclasses" + + |sel| + + sel := self selectionHolder value. + ^ sel + collect:[:idx| + |el| + + el := resultList at:idx. + DropObject newFile:(el asFilename) + ]. +! ! + !FindFileApplication methodsFor:'event handling'! fileDoubleClick:entries @@ -1813,9 +1862,9 @@ !FindFileApplication class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/FindFileApplication.st,v 1.87 2009-10-22 12:41:32 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/FindFileApplication.st,v 1.88 2010-02-02 14:19:26 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libtool/FindFileApplication.st,v 1.87 2009-10-22 12:41:32 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/FindFileApplication.st,v 1.88 2010-02-02 14:19:26 cg Exp $' ! !