Rogue Wave Views
Manager Package API Reference Guide
Product Documentation:

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

An interactor designed for translation, zooming in, and zooming out on an IlvView. More...

#include <ilviews/manager/paninter.h>

Inheritance diagram for IlvPanZoomInteractor:
IlvManagerViewInteractor IlvValueInterface

Public Member Functions

 IlvPanZoomInteractor (IlvManager *manager, IlvView *view, IlvCursor *handup=0, IlvCursor *handdown=0, IlvCursor *zoomin=0, IlvCursor *zoomout=0)
 Constructor. More...
 
 IlvPanZoomInteractor (IlvCursor *handup=0, IlvCursor *handdown=0, IlvCursor *zoomin=0, IlvCursor *zoomout=0)
 Constructor. More...
 
virtual void abort ()
 Aborts the interaction. More...
 
void allocateBitmap ()
 Allocates an IlvBitmap to simulate double buffering. More...
 
virtual void drawGhost ()
 Draws a ghost rectangle representing the translation. More...
 
IlvCursorgetDefaultCursor () const
 Returns the default IlvCursor set on the associated view when no mouse drag is performed. More...
 
IlvCursorgetDragCursor () const
 Returns the drag IlvCursor. More...
 
IlFloat getMaxZoomingFactor () const
 Returns the maximum zooming factor. More...
 
IlFloat getMinZoomingFactor () const
 Returns the minimum zooming factor. More...
 
IlvCursorgetZoomInCursor () const
 Returns the "zoom in" IlvCursor. More...
 
IlFloat getZoomingRatio () const
 Returns the zooming ratio used by the zoomView method. More...
 
IlvCursorgetZoomOutCursor () const
 Returns the "zoom out" IlvCursor. More...
 
virtual IlBoolean handleEvent (IlvEvent &event)
 Handles events for the manager view. More...
 
virtual void init ()
 Initialization, when the interactor is attached to a view. More...
 
IlBoolean isDrawingBitmap () const
 Returns whether the interactor is drawing a bitmap or not before the translation.
 
IlBoolean isOpaqueMove () const
 Returns whether the interactor is in Opaque Move mode. More...
 
virtual void setDefaultCursor (IlvCursor *c)
 Sets the cursor for this interactor. More...
 
virtual void setDragCursor (IlvCursor *c)
 Sets the drag cursor. More...
 
void setDrawingBitmap (IlBoolean set)
 Sets the "drawing bitmap" mode. More...
 
void setMaxZoomingFactor (IlFloat sx)
 Sets the maximum "zooming in" factors. More...
 
void setMinZoomingFactor (IlFloat sx)
 Sets the minimum zooming factor. More...
 
void setOpaqueMove (IlBoolean set)
 Sets the interactor in Opaque Move mode. More...
 
virtual void setZoomInCursor (IlvCursor *c)
 Sets the "Zooming in" cursor. More...
 
void setZoomingRatio (IlFloat sx)
 Sets the zooming ratio used by the zoomView method. More...
 
virtual void setZoomOutCursor (IlvCursor *c)
 Sets the "Zooming out" cursor. More...
 
- Public Member Functions inherited from IlvManagerViewInteractor
 IlvManagerViewInteractor (IlvManager *manager, IlvView *view)
 Initializes a new IlvManagerViewInteractor. More...
 
virtual void ensureVisible (const IlvPoint &point)
 Ensures the visibility of a given location. More...
 
IlvDisplaygetDisplay () const
 Returns the display of the manager view. More...
 
IlvManagergetManager () const
 Returns the manager. More...
 
IlvTransformergetTransformer () const
 Returns the transformer used with the manager view. More...
 
IlvViewgetView () const
 Returns the manager view. More...
 
virtual void handleExpose (IlvRegion *clip=0)
 Called when the manager view receives an expose event. More...
 

Protected Member Functions

virtual void doTranslate (IlvPos dx, IlvPos dy, IlBoolean reDraw)
 Called by the handleEvent() method in order to translate the view. More...
 
virtual void doZoom (const IlvPoint &center, IlFloat scalex, IlBoolean reDraw)
 Called by the handleEvent() method in order to zoom the view. More...
 
virtual void drawBitmap ()
 Called to draw a bitmap simulating the translation. More...
 

Detailed Description

An interactor designed for translation, zooming in, and zooming out on an IlvView.

Library: ilvmgr

The translation is done while dragging the mouse.
The zooming action is performing by dragging the mouse with the middle or the right button pressed down. The view will zoom in if the mouse is dragged downwards, and zoom out if the mouse is dragged upwards.
In addition, in a Microsoft Windows environment, the zooming action can be performed using the mouse wheel.

Constructor & Destructor Documentation

IlvPanZoomInteractor::IlvPanZoomInteractor ( IlvManager manager,
IlvView view,
IlvCursor handup = 0,
IlvCursor handdown = 0,
IlvCursor zoomin = 0,
IlvCursor zoomout = 0 
)

Constructor.

Parameters
managerThe IlvManager of the interactor.
viewThe IlvView where the pan is done.
handupThe IlvCursor set on the view when no event occurs. If this parameter is not specified, a default internal IlvCursor is used.
handdownThe IlvCursor set on the view when drag events occurs. If this parameter is not specified, a default internal IlvCursor is used.
zoominThe IlvCursor set on the view when a "zooming in" transformation occurs. If this parameter is not specified, a default internal IlvCursor is used.
zoomoutThe IlvCursor set on the view when a "zooming out" transformation occurs. If this parameter is not specified, a default internal IlvCursor is used.
IlvPanZoomInteractor::IlvPanZoomInteractor ( IlvCursor handup = 0,
IlvCursor handdown = 0,
IlvCursor zoomin = 0,
IlvCursor zoomout = 0 
)

Constructor.

Parameters
handupThe IlvCursor set on the view when no event occurs. If this parameter is not specified, a default internal IlvCursor is used.
handdownthe IlvCursor set on the view when drag events occurs. If this parameter is not specified, a default internal IlvCursor is used.
zoominthe IlvCursor set on the view when a "zooming in" transformation occurs. If this parameter is not specified, a default internal IlvCursor is used.
zoomoutthe IlvCursor set on the view when a "zooming out" transformation occurs. If this parameter is not specified, a default internal IlvCursor is used.

Member Function Documentation

virtual void IlvPanZoomInteractor::abort ( )
virtual

Aborts the interaction.

Called by the manager when the user changes the current interactor. It resets the interactor to a state in which it appears to have never been launched. A common implementation is to erase the ghost image. Call this member function to inhibit the interactor action in particular circumstances.

Reimplemented from IlvManagerViewInteractor.

void IlvPanZoomInteractor::allocateBitmap ( )

Allocates an IlvBitmap to simulate double buffering.

Allocates an IlvBitmap to simulate double buffering if the view is in simple buffering mode for the case of non-opaque zoom (for example, we allocate an IlvBitmap in order to draw the manager's content inside it and then to zoom this bitmap). Note that this method is for internal use only.

virtual void IlvPanZoomInteractor::doTranslate ( IlvPos  dx,
IlvPos  dy,
IlBoolean  reDraw 
)
protectedvirtual

Called by the handleEvent() method in order to translate the view.

Parameters
dxThe x translation factor.
dyThe y translation factor.
reDrawIf IlTrue, the view must be redrawn.
virtual void IlvPanZoomInteractor::doZoom ( const IlvPoint center,
IlFloat  scalex,
IlBoolean  reDraw 
)
protectedvirtual

Called by the handleEvent() method in order to zoom the view.

The default zooming factor used by handleEvent() is 1.5 for the zoom in operation and 1 / 1.5 for the zoom out.

Note that the performed zoom keeps the aspect ratio (that is, scaley = scalex).

Parameters
centerThe point that is left unchanged by the zoom operation. The default point used by handleEvent() method is the center of the view.
scalexThe x zooming factor.
reDrawIf IlTrue, the view must be redrawn.
virtual void IlvPanZoomInteractor::drawBitmap ( )
protectedvirtual

Called to draw a bitmap simulating the translation.

In non-opaque mode, this method is called in order to draw a bitmap simulating the translation or the zooming of the manager's contents before it is actually done.

virtual void IlvPanZoomInteractor::drawGhost ( )
virtual

Draws a ghost rectangle representing the translation.

Draws a ghost rectangle representing the translation before it is done. It is used in non-opaque mode.

Reimplemented from IlvManagerViewInteractor.

IlvCursor* IlvPanZoomInteractor::getDefaultCursor ( ) const

Returns the default IlvCursor set on the associated view when no mouse drag is performed.

See also
setDefaultCursor().
IlvCursor* IlvPanZoomInteractor::getDragCursor ( ) const

Returns the drag IlvCursor.

See also
setDragCursor().
IlFloat IlvPanZoomInteractor::getMaxZoomingFactor ( ) const

Returns the maximum zooming factor.

Returns the maximum zooming factor beyond which the interactor will not zoom in anymore (used for the non-opaque zoom mode to prevent the bitmap zooming from becoming too large).

IlFloat IlvPanZoomInteractor::getMinZoomingFactor ( ) const

Returns the minimum zooming factor.

Returns the minimum zooming factor beyond which the interactor will not zoom out anymore (used for the non-opaque zoom mode to prevent the bitmap zooming from becoming too small).

IlvCursor* IlvPanZoomInteractor::getZoomInCursor ( ) const

Returns the "zoom in" IlvCursor.

See also
setZoomInCursor().
IlFloat IlvPanZoomInteractor::getZoomingRatio ( ) const

Returns the zooming ratio used by the zoomView method.

Returns the zooming factor used by the zoomView method. The default value is 1.5. The zooming out factor is 1 / sx.

IlvCursor* IlvPanZoomInteractor::getZoomOutCursor ( ) const

Returns the "zoom out" IlvCursor.

See also
setZoomOutCursor().
virtual IlBoolean IlvPanZoomInteractor::handleEvent ( IlvEvent event)
virtual

Handles events for the manager view.

Called by the manager for which the interactor was created with every event it receives in the interactor view.

Returns
IlTrue if the event is consumed, IlFalse otherwise.

Implements IlvManagerViewInteractor.

virtual void IlvPanZoomInteractor::init ( )
virtual

Initialization, when the interactor is attached to a view.

Resets the interactor to its initial state.

Called by the manager whenever the interactor is associated with a view. An association of this kind is established by the member function IlvManager::setInteractor().

Reimplemented from IlvManagerViewInteractor.

IlBoolean IlvPanZoomInteractor::isOpaqueMove ( ) const

Returns whether the interactor is in Opaque Move mode.

The interactor has two modes to translate or zoom the attached view: The Opaque Move mode and the Ghost Move mode. In Opaque Move mode, the transformation is applied to the view for each drag event. In the Ghost Move mode, the view is transformed only when the user releases the mouse button. The default mode is the Opaque Move mode.

Returns
Specifies whether this interactor is in Opaque Move mode.
virtual void IlvPanZoomInteractor::setDefaultCursor ( IlvCursor c)
virtual

Sets the cursor for this interactor.

Sets the default IlvCursor on the associated view while this view is not being translated (the left mouse button is not pressed).

Parameters
cThe cursor object.
See also
getDefaultCursor().
virtual void IlvPanZoomInteractor::setDragCursor ( IlvCursor c)
virtual

Sets the drag cursor.

Sets the drag IlvCursor on the associated view while the left mouse button is pressed (while dragging for instance).

Parameters
cThe cursor object.
See also
getDragCursor().
void IlvPanZoomInteractor::setDrawingBitmap ( IlBoolean  set)

Sets the "drawing bitmap" mode.

Sets the "drawing bitmap" mode. If set to IlTrue, the drawBitmap method is called in order to simulate the translation of the manager contents before it is actually done (it is done after the IlvButtonUp).
If set to IlFalse, the drawGhost method is used.

Parameters
setThe Boolean value of the drawing bitmap flag.
void IlvPanZoomInteractor::setMaxZoomingFactor ( IlFloat  sx)

Sets the maximum "zooming in" factors.

Sets the maximum zooming in factor beyond which the interactor will not zoom in anymore (used for the non-opaque zoom mode to prevent the bitmap zooming from becoming too large).

Parameters
sxThe new maximum zooming factor.
void IlvPanZoomInteractor::setMinZoomingFactor ( IlFloat  sx)

Sets the minimum zooming factor.

Sets the minimum zooming factor beyond which the interactor will not zoom out anymore (used for the non-opaque zoom mode to prevent the bitmap zooming from becoming too small).

Parameters
sxThe new minimum zooming factor.
void IlvPanZoomInteractor::setOpaqueMove ( IlBoolean  set)

Sets the interactor in Opaque Move mode.

The interactor has two modes to translate or zoom the attached view: the Opaque Move mode and the Ghost Move mode. In Opaque Move mode, the transformation is applied to the view for each drag event. In the Ghost Move mode, the view is transformed only when the user releases the mouse button. The default mode is the Opaque Move mode.

Parameters
setSpecifies whether the Opaque Move mode is to be set.
virtual void IlvPanZoomInteractor::setZoomInCursor ( IlvCursor c)
virtual

Sets the "Zooming in" cursor.

Sets the zooming in IlvCursor on the associated view when zooming in transformation occurs (middle or right mouse button vertical drag from north to south).

Parameters
cThe new cursor.
See also
getZoomInCursor().
void IlvPanZoomInteractor::setZoomingRatio ( IlFloat  sx)

Sets the zooming ratio used by the zoomView method.

The zooming out factor is 1 / sx.

Parameters
sxThe new zooming ratio.
virtual void IlvPanZoomInteractor::setZoomOutCursor ( IlvCursor c)
virtual

Sets the "Zooming out" cursor.

Sets the zooming out IlvCursor on the associated view when zooming out transformation occurs (middle or right mouse button vertical drag from south to north).

Parameters
cThe cursor object.
See also
getZoomOutCursor().

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