Views
Manager Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlvManagerGrid Class Reference

Manager class. More...

#include <ilviews/manager/grid.h>

Inheritance diagram for IlvManagerGrid:
IlvObservable IlvSmartData

Public Member Functions

 IlvManagerGrid (IlvPalette *palette, const IlvPoint &origin, IlvDim spacingx, IlvDim spacingy, IlBoolean visible=IlTrue, IlBoolean active=IlTrue, IlvDim shownx=1, IlvDim showny=1)
 Constructor. More...
 
virtual void draw (IlvPort *dst, const IlvTransformer *t, const IlvRegion &clip)
 Draws the grid. More...
 
void getOrigin (IlvPoint &origin) const
 Returns the grid origin. More...
 
void getShown (IlvDim &sx, IlvDim &sy) const
 Returns the grid frequency parameters. More...
 
void getSpacings (IlvDim &sx, IlvDim &sy) const
 Returns the horizontal and vertical spacing. More...
 
IlBoolean isActive () const
 Returns whether the grid is active. More...
 
IlBoolean isVisible () const
 Returns the grid visibility. More...
 
void setActive (IlBoolean active)
 Enables or disables the grid. More...
 
void setForeground (IlvColor *foreground)
 Sets the foreground color of the grid. More...
 
void setOrigin (const IlvPoint &origin)
 Sets the origin of the grid. More...
 
void setShown (IlvDim sx, IlvDim sy)
 Sets the grid frequency parameters. More...
 
void setSpacings (IlvDim sx, IlvDim sy)
 Sets the horizontal and vertical spacing dimensions. More...
 
void setVisible (IlBoolean v)
 Sets the grid visibility. More...
 
virtual void snap (IlvPoint &p)
 Moves a point to the closest point on the grid. More...
 

Detailed Description

Manager class.

Library: ilvmgr

Most editors provide a snapping grid that forces mouse events to occur at specified locations. The coordinates where the user can move the pointing device are located on what are called grid points. If the manager is configured to allow standard mouse events, all event locations can be automatically modified so they occur only at specific locations. Thus, the effect of filtering user events by a manager grid is to modify their locations to the closest grid point. The IlvManagerGrid class handles the modification of event locations; that is, the conversion of the coordinates of an event that occurs in a view to a valid grid point. In Rogue Wave Views, you can set or remove a snapping grid in each of the views that is handled by a manager. You can configure these grids to make them:

The grid can also be any shape, by subtyping the class. The default, implemented by the IlvManagerGrid class, is a rectangular grid, where you can set the origin and the horizontal and vertical spacing values.

See also
IlvManager, IlvView.

Constructor & Destructor Documentation

◆ IlvManagerGrid()

IlvManagerGrid::IlvManagerGrid ( IlvPalette palette,
const IlvPoint origin,
IlvDim  spacingx,
IlvDim  spacingy,
IlBoolean  visible = IlTrue,
IlBoolean  active = IlTrue,
IlvDim  shownx = 1,
IlvDim  showny = 1 
)

Constructor.

Initializes a new instance of the IlvManagerGrid class. The color of the grid is foreground color of the palette parameter.

Parameters
paletteThe palette used to draw the grid dots
originThe coordinates of a grid point used as reference to compute the other points of the grid (usually (0, 0) when the grid exactly fits the object coordinate system).
spacingxThe spacing of grid along the horizontal axis.
spacingyThe spacing of grid along the vertical axis.
visibleSpecifies whether grid is visible when created (IlTrue) or invisible (IlFalse).
activeSpecifies whether the grid is active when created (IlTrue) or inactive (IlFalse).
shownx(see following parameter)
shownyThe nature of a subset of the grid to be displayed. One out of every shownx and showny dots is displayed in the given direction. The event location snapping, however, takes place on each of the grid points.

Member Function Documentation

◆ draw()

virtual void IlvManagerGrid::draw ( IlvPort dst,
const IlvTransformer t,
const IlvRegion clip 
)
virtual

Draws the grid.

Displays the grid in the destination port (which is the associated view), applying the specified transformer. The drawing always takes place in a clipping region. The palette to be used for this drawing operation is obtained by the _palette member variable of this class.

Parameters
dstThe destination port.
tThe transformer (may be null).
clipThe clipping region.

◆ getOrigin()

void IlvManagerGrid::getOrigin ( IlvPoint origin) const

Returns the grid origin.

Parameters
originUsed to return the origin coordinates of the grid.

◆ getShown()

void IlvManagerGrid::getShown ( IlvDim sx,
IlvDim sy 
) const

Returns the grid frequency parameters.

Returns in sx and sy, the parameters that define how often the grid points are displayed. For example, a value of 1 means every dot, a value of 2 means one out of every two dots is displayed, and so on.

Parameters
sxUsed to return the horizontal frequency.
syUsed to return the vertical frequency.

◆ getSpacings()

void IlvManagerGrid::getSpacings ( IlvDim sx,
IlvDim sy 
) const

Returns the horizontal and vertical spacing.

Parameters
sxUsed to return the horizontal spacing value of the grid.
syUsed to return the vertical spacing value of the grid.

◆ isActive()

IlBoolean IlvManagerGrid::isActive ( ) const

Returns whether the grid is active.

Returns
IlTrue if the grid is active, that is, if the snap mechanism is activated. It returns IlFalse if the grid is inactive and leaves the position parameter of the member function snap untouched.

◆ isVisible()

IlBoolean IlvManagerGrid::isVisible ( ) const

Returns the grid visibility.

Returns
IlTrue if the grid is visible. Otherwise, it returns IlFalse.

◆ setActive()

void IlvManagerGrid::setActive ( IlBoolean  active)

Enables or disables the grid.

Sets the activity state of the grid.

Parameters
activeSpecifies whether or not the grid must be active.

◆ setForeground()

void IlvManagerGrid::setForeground ( IlvColor foreground)

Sets the foreground color of the grid.

Parameters
foregroundSpecifies the foreground color to use.

◆ setOrigin()

void IlvManagerGrid::setOrigin ( const IlvPoint origin)

Sets the origin of the grid.

Parameters
originThe new origin of the grid.

◆ setShown()

void IlvManagerGrid::setShown ( IlvDim  sx,
IlvDim  sy 
)

Sets the grid frequency parameters.

Sets the display frequency of the dots.

Parameters
sxThe horizontal frequency.
syThe vertical frequency.

◆ setSpacings()

void IlvManagerGrid::setSpacings ( IlvDim  sx,
IlvDim  sy 
)

Sets the horizontal and vertical spacing dimensions.

Parameters
sxSpecifies the horizontal spacing.
sySpecifies the vertical spacing.

◆ setVisible()

void IlvManagerGrid::setVisible ( IlBoolean  v)

Sets the grid visibility.

Sets the visibility attribute of the grid and refreshes the associated view to get an immediate effect.

Parameters
vSpecifies whether the grid is visible.

◆ snap()

virtual void IlvManagerGrid::snap ( IlvPoint p)
virtual

Moves a point to the closest point on the grid.

Called internally by the member function IlvManager::snapToGrid to move the event location p to a valid position, that is, generally, on a grid point. The default implementation of this function moves p to the closest point of the rectangular grid. It can be overloaded to implement a new kind of snapping.

Parameters
pUsed both to specify the initial point to move and to hold the return value.