DropTarget.st
changeset 1550 b58979898957
parent 873 c5cd8f56dc6e
child 1822 ceeb17948f5d
equal deleted inserted replaced
1549:1b5274878f87 1550:b58979898957
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 
    13 
       
    14 "{ Package: 'stx:libview2' }"
       
    15 
    14 Object subclass:#DropTarget
    16 Object subclass:#DropTarget
    15 	instanceVariableNames:'receiver enterSelector leaveSelector overSelector dropSelector
    17 	instanceVariableNames:'receiver enterSelector leaveSelector overSelector dropSelector
    16 		canDropSelector argument'
    18 		canDropSelector argument'
    17 	classVariableNames:''
    19 	classVariableNames:''
    18 	poolDictionaries:''
    20 	poolDictionaries:''
   283 !DropTarget methodsFor:'private'!
   285 !DropTarget methodsFor:'private'!
   284 
   286 
   285 perform:aSelector withContext:aContext
   287 perform:aSelector withContext:aContext
   286     "perform the selector
   288     "perform the selector
   287     "
   289     "
   288     |numArgs|
       
   289 
       
   290     aSelector notNil ifTrue:[
   290     aSelector notNil ifTrue:[
   291         (numArgs := aSelector numArgs) == 0 ifTrue:[
   291         ^ receiver perform:aSelector withOptionalArgument:aContext and:argument
   292             receiver perform:aSelector
       
   293         ] ifFalse:[
       
   294             numArgs == 1 ifTrue:[
       
   295                 receiver perform:aSelector with:aContext
       
   296             ] ifFalse:[
       
   297                 receiver perform:aSelector with:aContext with:argument
       
   298             ]
       
   299         ]
       
   300     ]
   292     ]
   301 ! !
   293 ! !
   302 
   294 
   303 !DropTarget methodsFor:'queries'!
   295 !DropTarget methodsFor:'queries'!
   304 
   296 
   305 canDrop:aContext
   297 canDrop:aContext
   306     "send to the receiver to ask if the context is droppable
   298     "send to the receiver to ask if the context is droppable
   307     "
   299     "
   308     |numArgs|
       
   309 
       
   310     canDropSelector notNil ifTrue:[
   300     canDropSelector notNil ifTrue:[
   311         (numArgs := canDropSelector numArgs) == 0 ifTrue:[
   301         ^ receiver perform:canDropSelector withOptionalArgument:aContext and:argument
   312             ^ receiver perform:canDropSelector
       
   313         ].
       
   314         numArgs == 1 ifTrue:[
       
   315             ^ receiver perform:canDropSelector with:aContext
       
   316         ].
       
   317         ^ receiver perform:canDropSelector with:aContext with:argument
       
   318     ].
   302     ].
   319     ^ true
   303     ^ true
   320 ! !
   304 ! !
   321 
   305 
   322 !DropTarget class methodsFor:'documentation'!
   306 !DropTarget class methodsFor:'documentation'!
   323 
   307 
   324 version
   308 version
   325     ^ '$Header: /cvs/stx/stx/libview2/DropTarget.st,v 1.1 1998-03-30 11:59:33 ca Exp $'
   309     ^ '$Header: /cvs/stx/stx/libview2/DropTarget.st,v 1.2 2001-12-14 10:51:34 cg Exp $'
   326 ! !
   310 ! !