UIPainterView.st
changeset 1914 229b3e455c98
parent 1894 ce8fcfb4389a
child 1953 3b5022bccca4
equal deleted inserted replaced
1913:bed277fdbd85 1914:229b3e455c98
   492 ! !
   492 ! !
   493 
   493 
   494 !UIPainterView methodsFor:'drag & drop'!
   494 !UIPainterView methodsFor:'drag & drop'!
   495 
   495 
   496 canDrop:something
   496 canDrop:something
   497     "returns true if something can be droped
   497     "returns true if something can be dropped"
   498     "
   498 
   499     (something size == 1 and:[self enabled and:[self numberOfSelections <= 1]]) ifTrue:[
   499     (something size == 1 and:[self enabled and:[self numberOfSelections <= 1]]) ifTrue:[
   500       ^ something first theObject isKindOf:UISpecification
   500         ^ something first theObject isKindOf:UISpecification
   501     ].
   501     ].
   502     ^ false
   502     ^ false
   503 !
   503 !
   504 
   504 
   505 canPaste
   505 canPaste
   506     "returns true if something to be past exists and can be paste into
   506     "returns true if there is something which can be pasted in the clipboard"
   507      the selection if exists
   507 
   508     "
       
   509     ^ self canPaste:(self getClipboardObject)
   508     ^ self canPaste:(self getClipboardObject)
   510 !
   509 !
   511 
   510 
   512 canPaste:something
   511 canPaste:something
   513     "returns true if something could be paste
   512     "returns true if something could be pasted"
   514     "
   513 
   515     |el size|
   514     |el size|
   516 
   515 
   517     ((size := self numberOfSelections) <= 1 and:[self enabled]) ifFalse:[
   516     ((size := self numberOfSelections) <= 1 and:[self enabled]) ifFalse:[
   518 	^ false
   517         ^ false
   519     ].
   518     ].
   520     something isCollection ifTrue:[something notEmpty ifTrue:[el := something first]]
   519     something isCollection 
   521 			  ifFalse:[el := something].
   520         ifTrue:[something notEmpty ifTrue:[el := something first]]
       
   521         ifFalse:[el := something].
   522 
   522 
   523     (el isKindOf:UISpecification) ifFalse:[
   523     (el isKindOf:UISpecification) ifFalse:[
   524 	^ false
   524         ^ false
   525     ].
   525     ].
   526 
   526 
   527     size == 1 ifTrue:[
   527     size == 1 ifTrue:[
   528 	^ self canPasteInto:(self singleSelection)
   528         ^ self canPasteInto:(self singleSelection)
   529     ].
   529     ].
   530   ^ true
   530     ^ true
   531 !
   531 !
   532 
   532 
   533 canPasteInto:aView
   533 canPasteInto:aView
   534     "can paste into a view
   534     "return true, if I can paste into a view"
   535     "
   535 
   536     |prop|
   536     |prop|
   537 
   537 
   538     aView isNil ifTrue:[ ^ false ].
   538     aView isNil ifTrue:[ ^ false ].
   539 
   539 
   540     (prop := self propertyOfView:aView) notNil ifTrue:[
   540     (prop := self propertyOfView:aView) notNil ifTrue:[