DragAndDropManager.st
author Claus Gittinger <cg@exept.de>
Tue, 14 Jan 1997 18:02:37 +0100
changeset 365 47e0d48fd769
parent 348 74f1fda9deb0
child 394 0539d7b29aa7
permissions -rw-r--r--
commentary
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
Object subclass:#DragAndDropManager
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
	instanceVariableNames:'dragView motionAction releaseAction initialPoint previousPoint
345
626e8241dc76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
     3
		rememberedDelegate dragBlock lineMode dropAction'
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
	classVariableNames:''
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
	poolDictionaries:''
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	category:'Interface-Support'
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
!
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
343
3a611a1f882d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 342
diff changeset
     9
View subclass:#DemoView2
342
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    10
	instanceVariableNames:''
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    11
	classVariableNames:''
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    12
	poolDictionaries:''
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    13
	privateIn:DragAndDropManager
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    14
!
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    15
345
626e8241dc76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
    16
View subclass:#DemoView3
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:''
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	privateIn:DragAndDropManager
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
348
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    23
View subclass:#DemoView
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    24
	instanceVariableNames:''
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    25
	classVariableNames:''
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    26
	poolDictionaries:''
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    27
	privateIn:DragAndDropManager
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    28
!
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    29
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
!DragAndDropManager class methodsFor:'documentation'!
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
348
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    32
documentation
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    33
"
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    34
    this class provides low-level drag & drop mechanisms.
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    35
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    36
    [author:]
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    37
        Claus Gittinger
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    38
"
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    39
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    40
!
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    41
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
history
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    "Created: 26.10.1996 / 15:02:00 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    "Modified: 26.10.1996 / 15:21:42 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
! !
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
342
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    48
!DragAndDropManager methodsFor:'dragging - generic'!
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    49
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    50
doGenericDragX:x y:y
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    51
    previousPoint notNil ifTrue:[
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    52
        self invertGenericAt:previousPoint
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    53
    ].
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    54
    previousPoint := x @ y.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    55
    self invertGenericAt:previousPoint
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    56
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    57
    "Modified: 26.10.1996 / 15:16:59 / cg"
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    58
!
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    59
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    60
endGenericDragX:x y:y
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    61
    previousPoint notNil ifTrue:[
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    62
        self invertGenericAt:previousPoint
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    63
    ].
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    64
    previousPoint := nil.
346
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
    65
    self uncatchEvents.
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
    66
    self endDragAt:x @ y
342
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    67
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    68
    "Created: 26.10.1996 / 15:17:20 / cg"
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    69
    "Modified: 26.10.1996 / 15:22:41 / cg"
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    70
!
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    71
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    72
invertGenericAt:ip
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    73
    |t offs p rootView|
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    74
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    75
    rootView := dragView device rootView.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    76
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    77
    p := ip.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    78
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    79
    "
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    80
     get device coordinates
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    81
    "
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    82
    (t := dragView transformation) notNil ifTrue:[
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    83
        p := t applyTo:p.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    84
    ].
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    85
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    86
    "
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    87
     translate to screen
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    88
    "
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    89
    offs := dragView device 
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    90
                translatePoint:0@0 
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    91
                from:(dragView id) to:(rootView id).
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    92
    p := p + offs.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    93
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    94
    rootView clippedByChildren:false.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    95
    rootView xoring:[
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    96
        rootView lineWidth:0. 
348
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
    97
        dragBlock value:p value:rootView.
342
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    98
        rootView flush
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    99
    ].
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   100
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   101
    "Created: 26.10.1996 / 15:15:26 / cg"
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   102
    "Modified: 26.10.1996 / 15:27:09 / cg"
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   103
!
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   104
348
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   105
startGenericDrag:aTwoArgDragBlock in:aView at:p atEnd:aFourArgEndBlock
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   106
    "start a generic (caller-provided drag);
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   107
     the dragBlock, aTwoArgDragBlock will be called with two args
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   108
     aPoint and a drawingGC, to perform the drawing at some dragPoint.
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   109
     The drag starts in aView at point p.
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   110
     When finished, the endAction is called with four args:
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   111
     the targetView, the targetViews windowID (useful, if its an alien view),
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   112
     the dropPoint in root-coordinates and the dropPoint within the targetView"
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   113
342
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   114
    self catchEventsFrom:aView.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   115
    motionAction := #doGenericDragX:y:.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   116
    releaseAction := #endGenericDragX:y:.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   117
    initialPoint := p.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   118
    previousPoint := nil.
348
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   119
    dragBlock := aTwoArgDragBlock.
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   120
    dropAction := aFourArgEndBlock.
342
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   121
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   122
    "Modified: 26.10.1996 / 15:09:26 / cg"
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   123
    "Created: 26.10.1996 / 15:16:13 / cg"
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   124
! !
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   125
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   126
!DragAndDropManager methodsFor:'dragging - lines'!
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
doLineDragX:x y:y
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
    previousPoint notNil ifTrue:[
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
        self invertLineFrom:initialPoint to:previousPoint
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    ].
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    previousPoint := x @ y.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    self invertLineFrom:initialPoint to:previousPoint
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
    "Modified: 26.10.1996 / 15:16:59 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
!
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
endLineDragX:x y:y
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
    previousPoint notNil ifTrue:[
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
        self invertLineFrom:initialPoint to:previousPoint
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
    ].
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
    previousPoint := nil.
346
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   143
    self uncatchEvents.
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   144
    self endDragAt:x @ y
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
    "Created: 26.10.1996 / 15:17:20 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
    "Modified: 26.10.1996 / 15:22:41 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
!
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
invertLineFrom:ip1 to:ip2
342
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   151
    |t offs p1 p2 rootView a|
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
    rootView := dragView device rootView.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    p1 := ip1.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
    p2 := ip2.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
    "
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
     get device coordinates
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
    "
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
    (t := dragView transformation) notNil ifTrue:[
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
        p1 := t applyTo:p1.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
        p2 := t applyTo:p2.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
    ].
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    "
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
     translate to screen
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
    "
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
    offs := dragView device 
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
                translatePoint:0@0 
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
                from:(dragView id) to:(rootView id).
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
    p1 := p1 + offs.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
    p2 := p2 + offs.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
    rootView clippedByChildren:false.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
    rootView xoring:[
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
        rootView lineWidth:0. 
342
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   178
        lineMode == #arrow ifTrue:[
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   179
            a := Arrow from:p1 to:p2.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   180
            a arrowHeadLength:(rootView device horizontalPixelPerMillimeter * 4) rounded.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   181
            a displayFilledOn:rootView.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   182
        ] ifFalse:[
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   183
            rootView displayLineFrom:p1 to:p2.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   184
        ].
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
        rootView flush
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
    ].
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
    "Created: 26.10.1996 / 15:15:26 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
    "Modified: 26.10.1996 / 15:27:09 / cg"
342
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   190
!
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
345
626e8241dc76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
   192
startArrowDragIn:aView at:p atEnd:aBlock
348
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   193
    "start a line-drag of an arrow-line.
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   194
     The drag starts in aView at point p.
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   195
     When finished, the endAction is called with four args:
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   196
     the targetView, the targetViews windowID (useful, if its an alien view),
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   197
     the dropPoint in root-coordinates and the dropPoint within the targetView"
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   198
342
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   199
    self catchEventsFrom:aView.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   200
    motionAction := #doLineDragX:y:.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   201
    releaseAction := #endLineDragX:y:.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   202
    initialPoint := p.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   203
    previousPoint := nil.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   204
    dragBlock := nil.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   205
    lineMode := #arrow.
345
626e8241dc76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
   206
    dropAction := aBlock.
342
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   207
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   208
    "Modified: 26.10.1996 / 15:09:26 / cg"
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   209
    "Created: 26.10.1996 / 15:16:13 / cg"
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   210
!
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
348
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   212
startLineDragIn:aView at:p atEnd:aFourArgEndBlock
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   213
    "start a line-drag of a normal line.
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   214
     The drag starts in aView at point p.
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   215
     When finished, the endAction is called with four args:
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   216
     the targetView, the targetViews windowID (useful, if its an alien view),
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   217
     the dropPoint in root-coordinates and the dropPoint within the targetView"
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   218
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
    self catchEventsFrom:aView.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
    motionAction := #doLineDragX:y:.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
    releaseAction := #endLineDragX:y:.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
    initialPoint := p.
342
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   223
    previousPoint := nil.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   224
    dragBlock := nil.
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   225
    lineMode := nil.
348
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   226
    dropAction := aFourArgEndBlock.
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    "Modified: 26.10.1996 / 15:09:26 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
    "Created: 26.10.1996 / 15:16:13 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
! !
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
!DragAndDropManager methodsFor:'event catching'!
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
buttonMotion:button x:x y:y view:aView
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
    self perform:motionAction with:x with:y
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
    "Created: 26.10.1996 / 15:09:00 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
!
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
buttonRelease:button x:x y:y view:aView
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
    self perform:releaseAction with:x with:y
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
    "Created: 26.10.1996 / 15:09:14 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
!
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
handlesButtonMotion:button inView:aView
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
    "query from event processor: am I interested in button-events ?
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
     yes I am (to activate the clicked-on field)."
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
    ^ aView == dragView
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
    "Created: 26.10.1996 / 15:05:36 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
!
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
handlesButtonRelease:button inView:aView
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
    "query from event processor: am I interested in button-events ?
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
     yes I am (to activate the clicked-on field)."
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
    ^ aView == dragView
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
    "Created: 26.10.1996 / 15:05:48 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
! !
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
!DragAndDropManager methodsFor:'private'!
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
catchEventsFrom:aView
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
    dragView := aView.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
    rememberedDelegate := aView delegate.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
    aView delegate:self
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
    "Created: 26.10.1996 / 15:03:12 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
    "Modified: 26.10.1996 / 15:21:57 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
!
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
346
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   275
endDragAt:ip
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   276
    |rootPoint t viewId offs destinationId lastViewId destinationView
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   277
     rootView destinationPoint device|
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   278
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   279
    dropAction notNil ifTrue:[
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   280
        device := dragView device.
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   281
        rootView := device rootView.
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   282
        rootPoint := ip.
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   283
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   284
        "
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   285
         get device coordinates
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   286
        "
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   287
        (t := dragView transformation) notNil ifTrue:[
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   288
            rootPoint := t applyTo:ip.
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   289
        ].
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   290
        viewId := rootView id.
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   291
        
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   292
        "
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   293
         translate to screen
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   294
        "
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   295
        offs := device translatePoint:0@0 from:(dragView id) to:viewId.
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   296
        rootPoint := rootPoint + offs.
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   297
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   298
        "search view the drop is in"
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   299
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   300
        [viewId notNil] whileTrue:[
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   301
            destinationId := device viewIdFromPoint:rootPoint in:viewId.
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   302
            lastViewId := viewId.
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   303
            viewId := destinationId
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   304
        ].
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   305
        destinationView := device viewFromId:lastViewId.
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   306
        destinationId := lastViewId.
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   307
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   308
        "into another one"
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   309
        destinationView notNil ifTrue:[
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   310
            destinationPoint := device translatePoint:rootPoint
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   311
                                                 from:(rootView id) 
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   312
                                                   to:(destinationView id).
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   313
            destinationView transformation notNil ifTrue:[
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   314
                destinationPoint := destinationView transformation applyInverseTo:destinationPoint
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   315
            ].
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   316
        ] ifFalse:[
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   317
            "
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   318
             not one of my views
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   319
            "
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   320
        ].
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   321
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   322
        dropAction value:destinationView
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   323
                   value:destinationId
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   324
                   value:rootPoint
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   325
                   value:destinationPoint
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   326
    ]
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   327
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   328
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   329
!
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   330
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
uncatchEvents
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
    dragView delegate:rememberedDelegate.
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
    "Created: 26.10.1996 / 15:22:29 / cg"
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
! !
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
343
3a611a1f882d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 342
diff changeset
   337
!DragAndDropManager::DemoView2 methodsFor:'events'!
342
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   338
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   339
buttonPress:button x:x y:y
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   340
    DragAndDropManager new
348
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   341
        startGenericDrag:[:p :v | v displayString:'hello' at:p]
345
626e8241dc76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
   342
        in:self 
626e8241dc76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
   343
        at:(x@y) 
346
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   344
        atEnd:[:view
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   345
               :viewID
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   346
               :rootPoint
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   347
               :viewPoint | ]
345
626e8241dc76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
   348
342
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   349
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   350
    "
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   351
     self new open
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   352
    "
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   353
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   354
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   355
! !
7563cbf04502 added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   356
345
626e8241dc76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
   357
!DragAndDropManager::DemoView3 methodsFor:'events'!
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
buttonPress:button x:x y:y
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
    DragAndDropManager new
345
626e8241dc76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
   361
        startArrowDragIn:self 
626e8241dc76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
   362
        at:(x@y)
346
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   363
        atEnd:[:view
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   364
               :viewID
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   365
               :rootPoint
1612c23d9c5d pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
   366
               :viewPoint | ]
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
    "
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
     self new open
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
    "
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
! !
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
348
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   373
!DragAndDropManager::DemoView methodsFor:'events'!
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   374
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   375
buttonPress:button x:x y:y
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   376
    DragAndDropManager new
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   377
        startLineDragIn:self at:(x@y) 
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   378
        atEnd:[:view
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   379
               :viewID
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   380
               :rootPoint
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   381
               :viewPoint | 
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   382
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   383
               Transcript show:'dropped at ';
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   384
                          show:viewPoint;
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   385
                          show:' in '.
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   386
               view notNil ifTrue:[
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   387
                   Transcript showCR:view
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   388
               ] ifFalse:[
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   389
                   Transcript show:'alien view ';
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   390
                              showCR:viewID address
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   391
               ] 
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   392
        ].
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   393
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   394
    "
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   395
     self new open
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   396
    "
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   397
! !
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   398
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
!DragAndDropManager class methodsFor:'documentation'!
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   401
version
348
74f1fda9deb0 more args & comments
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   402
    ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.6 1996-11-14 15:16:42 cg Exp $'
341
5afe98e6185b intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
! !