mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-06 14:52:03 +01:00
Updated wikipage Triggering Pick-and-Drop. (Signed-off-by:jocelyn).
git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2286 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[[Property:modification_date|Tue, 09 Feb 2021 18:31:11 GMT]]
|
||||
[[Property:modification_date|Tue, 09 Feb 2021 18:40:35 GMT]]
|
||||
[[Property:publication_date|Tue, 09 Feb 2021 18:31:11 GMT]]
|
||||
[[Property:uuid|53571D42-854B-40C2-A98D-A1A5EF5DDA3B]]
|
||||
[[Property:weight|0]]
|
||||
@@ -44,27 +44,18 @@ If the mechanism is initiated successfully, a cursor change can occur, to help c
|
||||
|
||||
Ideally, the `accept_cursor` conveys transport state, and the nature of the pebble. It might be as generic as a bull's eye or crosshairs, but it can be anything that is acceptable as a cursor image.
|
||||
|
||||
The major elements needed to complete a pick-and-drop arrangement are:* <div style="margin-left:0.3799in;margin-right:0in;">A pick-and-drop-able element</div>
|
||||
|
||||
* Needed for assignment of the pebble or pebble function
|
||||
* Need not <u>be</u> the pebble to be transported
|
||||
|
||||
* <div style="margin-left:0.3799in;margin-right:0in;">A drop handler</div>
|
||||
|
||||
* A routine that will be called as the target of a drop
|
||||
|
||||
* <div style="margin-left:0.3799in;margin-right:0in;">A pebble <u>or</u> a pebble function</div>
|
||||
|
||||
* Pebble:
|
||||
|
||||
* An instance of the class defined as argument to the drop handler
|
||||
* Should be distinct; unique within the context (it needs to make sense)
|
||||
|
||||
* Pebble function:
|
||||
|
||||
* A function whose Result is an appropriate pebble, or <span style="color:#1f497d;">Void</span>
|
||||
|
||||
|
||||
The major elements needed to complete a pick-and-drop arrangement are:
|
||||
* A pick-and-drop-able element
|
||||
** Needed for assignment of the pebble or pebble function
|
||||
** Need not ''be'' the pebble to be transported
|
||||
* A drop handler
|
||||
** A routine that will be called as the target of a drop
|
||||
* A pebble ''or'' a pebble function
|
||||
** Pebble:
|
||||
*** An instance of the class defined as argument to the drop handler
|
||||
*** Should be distinct; unique within the context (it needs to make sense)
|
||||
** Pebble function:
|
||||
*** A function whose Result is an appropriate pebble, or `Void`
|
||||
|
||||
The pick-and-dropable element is also the element through which a custom trigger (i.e. other than the right-click) is initiated. More on that later.
|
||||
|
||||
@@ -72,7 +63,7 @@ The pick-and-dropable element is also the element through which a custom trigger
|
||||
|
||||
For the most part, the classes that would be involved in a typical Eiffel graphical application are the ones being used. For custom invocation, there is one more class that needs to be considered: `EV_PICK_AND_DROPABLE_IMP`. It is via an instance of this class that invocation can be triggered.
|
||||
|
||||
<div style="text-align:center;">[[Image:Picture 1.png|top]]</div>
|
||||
[[Image:trigger_pnd_img0.png]]
|
||||
|
||||
''The diagram uses an adaptation of BON. Notably, the dashed supplier links denote detachable references and the feature names with leading asterisks denote features deferred at that level of the hierarchy.''
|
||||
|
||||
@@ -106,7 +97,7 @@ For example, there might be an image (a pixmap) presenting multiple items. Unlik
|
||||
|
||||
For a rather simplistic example, use a 100 pixels square pixmap with 4 distinct items presented in it, each in its own 50x50 area, resembling (but not actually ''being'') a 2x2 matrix.
|
||||
|
||||
<div style="text-align:center;">[[Image:Picture 2.png|top]]</div>
|
||||
[[Image:trigger_pnd_img1.png]]
|
||||
|
||||
By capturing the coordinates of the mouse click, the application can determine which information or element is associated with that position.
|
||||
|
||||
@@ -131,7 +122,7 @@ pm_pebble (xp, yp: INTEGER; pm: EV_PIXMAP): SOME_THING
|
||||
end
|
||||
```
|
||||
|
||||
Note that, in this example a third argument is passed to the pebble function, that being the pixmap. This would be unnecessary if the pixmap in question were unique to the context, but serves to illustrate the option. Here, the pixmap is passed to <span style="color:#1f497d;">Result</span>, but this is just as an example. The pebble function can do whatever is necessary to support the intended behavior.
|
||||
Note that, in this example a third argument is passed to the pebble function, that being the pixmap. This would be unnecessary if the pixmap in question were unique to the context, but serves to illustrate the option. Here, the pixmap is passed to `Result`, but this is just as an example. The pebble function can do whatever is necessary to support the intended behavior.
|
||||
|
||||
The type of the `Result` of the pebble function must be the same as the type expected by the drop handler routine. In this example, the `Result` would be an instance of class `SOME_THING`, it representing the item depicted in that area of the pixmap.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user