Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Drag-drop interactor for graphic objects. More...
#include <ilviews/graphics/inter.h>
Public Member Functions | |
IlvDragDropInteractor (IlvView *target=0, IlvGraphic *ghost=0) | |
Constructor. | |
virtual void | checkPosition (IlvPoint &position) |
Allows you to modify the position at each step of the interaction. | |
virtual void | doIt (IlvView *target, IlvGraphic *ghost, const IlvPoint &position) |
Finalizes the interaction. | |
virtual void | drawGhost (IlvView *view, IlvGraphic *ghost, const IlvPoint &position, const IlvTransformer *t=0) |
Visual feedback during interaction. | |
virtual void | endOperation () |
Performs the actions needed when the interaction ends. | |
IlvView * | getTarget () const |
Returns the target view. | |
virtual IlBoolean | handleEvent (IlvGraphic *obj, IlvEvent &event, const IlvTransformer *t) |
Handles events received by the interactor. | |
virtual IlBoolean | inTarget (const IlvPoint &point) |
Indicates whether the current position is in the target view. | |
void | setGhost (IlvGraphic *ghost) |
Sets the graphic object used as ghost image. | |
void | setTarget (IlvView *target) |
Sets the target view. | |
void | useGhostRectangle (IlBoolean val) |
Sets the policy for drawGhost() . | |
IlBoolean | useGhostRectangle () const |
Status of the policy for drawGhost() . |
Drag-drop interactor for graphic objects.
Library: views
Use this class to drag an object to another view, and then drop it to perform a particular action. This class is designed to be subtyped so you can implement your own drop mechanism.
The registered name of this interactor is "DragDrop".
IlvDragDropInteractor::IlvDragDropInteractor | ( | IlvView * | target = 0 , |
|
IlvGraphic * | ghost = 0 | |||
) |
Constructor.
The constructor specifies the target view where the object can be dropped. If a graphic object is specified for the ghost parameter, this object is used by the interactor as a ghost image during the interaction. Otherwise, the object to be drawn is the one being dragged.
target | The target view. | |
ghost | The graphic object used as ghost image. |
virtual void IlvDragDropInteractor::checkPosition | ( | IlvPoint & | position | ) | [virtual] |
Allows you to modify the position at each step of the interaction.
Called when you drag the mouse. You can modify the coordinates of the point position so that they satisfy a given set of constraint.
position | The current position provided by the interaction, in the screen coordinate system. |
virtual void IlvDragDropInteractor::doIt | ( | IlvView * | target, | |
IlvGraphic * | ghost, | |||
const IlvPoint & | position | |||
) | [virtual] |
Finalizes the interaction.
Called when you release the object over the target view.
target | The target view where the mouse button is released. | |
ghost | The graphic object used as ghost image. | |
position | The coordinates of the ghost image in the screen coordinate system. |
virtual void IlvDragDropInteractor::drawGhost | ( | IlvView * | view, | |
IlvGraphic * | ghost, | |||
const IlvPoint & | position, | |||
const IlvTransformer * | t = 0 | |||
) | [virtual] |
Visual feedback during interaction.
Called to draw a preview image of the resulting user action. The default implementation draws the ghost image on the display screen port.
view | The source view that received the IlvButtonDown event. | |
ghost | The graphic used as ghost image. | |
position | The position where the drawing must be performed, in the screen coordinate system. | |
t | The transformer applied to the view view. |
IlvDisplay::screenPort
. virtual void IlvDragDropInteractor::endOperation | ( | ) | [virtual] |
Performs the actions needed when the interaction ends.
The default implementation resets the interactor flags and remove it from its parent, if it exists.
IlvStackInteractorInterface::removeFromParent
Reimplemented from IlvInteractor.
IlvView* IlvDragDropInteractor::getTarget | ( | ) | const |
Returns the target view.
virtual IlBoolean IlvDragDropInteractor::handleEvent | ( | IlvGraphic * | g, | |
IlvEvent & | event, | |||
const IlvTransformer * | t | |||
) | [virtual] |
Handles events received by the interactor.
This method is the entry point of all events dispatched to this interactor.
g | The graphic object that receives the event. | |
event | The received event. | |
t | The transformer applied to the view in which the event occurred. |
IlTrue
if the event was successfully handled and IlFalse
otherwise. Implements IlvInteractor.
Indicates whether the current position is in the target view.
IlTrue
if the point point
is contained in the target view, and IlFalse
otherwise. point | The current position. |
void IlvDragDropInteractor::setGhost | ( | IlvGraphic * | ghost | ) |
Sets the graphic object used as ghost image.
ghost | The new ghost image. |
void IlvDragDropInteractor::setTarget | ( | IlvView * | target | ) |
Sets the target view.
This method can be used to perform a multi-view drag&drop.
target | The new target view. |
void IlvDragDropInteractor::useGhostRectangle | ( | IlBoolean | val | ) |
Sets the policy for drawGhost()
.
Specifies whether you want a ghost image or a hollow rectangle to be displayed.
val | If IlTrue , a ghost rectangle is drawn. Otherwise, the ghost image graphic object is used. |
IlBoolean IlvDragDropInteractor::useGhostRectangle | ( | ) | const |
Status of the policy for drawGhost()
.
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.