rwlogo
Rogue Wave Views 5.5.1

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvDragDropInteractor Class Reference

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

#include <ilviews/graphics/inter.h>

Inheritance diagram for IlvDragDropInteractor:
IlvInteractor

List of all members.

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.
IlvViewgetTarget () 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().

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:
target The target view.
ghost The 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:
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.

Warning:
If you plan to create a new object from the ghost parameter, you must create a copy of it.
Parameters:
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.

Parameters:
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.
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:
g The graphic object that receives the event.
event The received event.
t The 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:
point The current position.
void IlvDragDropInteractor::setGhost ( IlvGraphic ghost  ) 

Sets the graphic object used as ghost image.

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

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

Parameters:
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().

Returns:
A Boolean value indicating whether you prefer a rectangle to be displayed instead of a ghost image of the dragged object.

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