Rogue Wave Views
Foundation Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions
IlvDragDropInteractor Class Reference

Drag-drop interactor for graphic objects. More...

#include <ilviews/graphics/inter.h>

Inheritance diagram for IlvDragDropInteractor:
IlvInteractor

Public Member Functions

 IlvDragDropInteractor (IlvView *target=0, IlvGraphic *ghost=0)
 Constructor. More...
 
virtual void checkPosition (IlvPoint &position)
 Allows you to modify the position at each step of the interaction. More...
 
virtual void doIt (IlvView *target, IlvGraphic *ghost, const IlvPoint &position)
 Finalizes the interaction. More...
 
virtual void drawGhost (IlvView *view, IlvGraphic *ghost, const IlvPoint &position, const IlvTransformer *t=0)
 Visual feedback during interaction. More...
 
virtual void endOperation ()
 Performs the actions needed when the interaction ends. More...
 
IlvViewgetTarget () const
 Returns the target view. More...
 
virtual IlBoolean handleEvent (IlvGraphic *obj, IlvEvent &event, const IlvTransformer *t)
 Handles events received by the interactor. More...
 
virtual IlBoolean inTarget (const IlvPoint &point)
 Indicates whether the current position is in the target view. More...
 
void setGhost (IlvGraphic *ghost)
 Sets the graphic object used as ghost image. More...
 
void setTarget (IlvView *target)
 Sets the target view. More...
 
IlBoolean useGhostRectangle () const
 Status of the policy for drawGhost(). More...
 
void useGhostRectangle (IlBoolean val)
 Sets the policy for drawGhost(). More...
 
- Public Member Functions inherited from IlvInteractor
virtual void abort (IlvGraphic *obj)
 Aborts the interactor. More...
 
virtual IlBoolean accept (const IlvGraphic *obj) const
 Indicates whether the current interactor can be associated with a given object. More...
 
virtual void getCallbackTypes (IlUInt &count, const char *const **names, const IlSymbol *const **types) const
 Gets the number of register callback types for the interactor. More...
 
const char * getRegisteredName () const
 Returns the name of the predefined shared instance. More...
 
IlBoolean isAborted () const
 Indicates whether the current interactor is in an aborted state. More...
 
IlBoolean isInOperation () const
 Indicates whether the current interactor is in an interaction state. More...
 
void lock ()
 Locks the current instance. Increments the counter that is used to know how many objects reference the current instance. More...
 
virtual void startOperation ()
 Performs the actions needed when the interaction starts. More...
 
void unLock ()
 Unlocks the current instance. Decrements the reference counter. When the counter drops down to zero, the current instance is deleted. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from IlvInteractor
static IlvInteractorGet (const char *name, IlBoolean=IlTrue)
 Returns a predefined shared interactor instance. More...
 

Detailed Description

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".

Constructor & Destructor Documentation

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.

Parameters
targetThe target view.
ghostThe graphic object used as ghost image.

Member Function Documentation

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.

Parameters
positionThe 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.

Warning
If you plan to create a new object from the ghost parameter, you must create a copy of it.
Parameters
targetThe target view where the mouse button is released.
ghostThe graphic object used as ghost image.
positionThe 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.

Parameters
viewThe source view that received the IlvButtonDown event.
ghostThe graphic used as ghost image.
positionThe position where the drawing must be performed, in the screen coordinate system.
tThe transformer applied to the view view.
See also
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.

See also
IlvStackInteractorInterface::removeFromParent().

Reimplemented from IlvInteractor.

IlvView* IlvDragDropInteractor::getTarget ( ) const

Returns the target view.

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.

Parameters
gThe graphic object that receives the event.
eventThe received event.
tThe transformer applied to the view in which the event occurred.
Returns
IlTrue if the event was successfully handled and IlFalse otherwise.

Implements IlvInteractor.

virtual IlBoolean IlvDragDropInteractor::inTarget ( const IlvPoint point)
virtual

Indicates whether the current position is in the target view.

Returns
IlTrue if the point point is contained in the target view, and IlFalse otherwise.
Parameters
pointThe current position.
void IlvDragDropInteractor::setGhost ( IlvGraphic ghost)

Sets the graphic object used as ghost image.

Parameters
ghostThe new ghost image.
void IlvDragDropInteractor::setTarget ( IlvView target)

Sets the target view.

This method can be used to perform a multi-view drag&drop.

Parameters
targetThe new target view.
IlBoolean IlvDragDropInteractor::useGhostRectangle ( ) const

Status of the policy for drawGhost().

Returns
A Boolean value indicating whether you prefer a rectangle to be displayed instead of a ghost image of the dragged object.
void IlvDragDropInteractor::useGhostRectangle ( IlBoolean  val)

Sets the policy for drawGhost().

Specifies whether you want a ghost image or a hollow rectangle to be displayed.

Parameters
valIf IlTrue, a ghost rectangle is drawn. Otherwise, the ghost image graphic object is used.

© Copyright 2016, 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.