Rogue Wave Views Manager Package API Reference Guide |
Rogue Wave Views Documentation Home |
Manager class. More...
#include <ilviews/manager/grid.h>
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... | |
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:
visible or invisible,
active or inactive.
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.
IlvManager
, IlvView
. 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.
palette | The palette used to draw the grid dots |
origin | The 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). |
spacingx | The spacing of grid along the horizontal axis. |
spacingy | The spacing of grid along the vertical axis. |
visible | Specifies whether grid is visible when created (IlTrue ) or invisible (IlFalse ). |
active | Specifies whether the grid is active when created (IlTrue ) or inactive (IlFalse ). |
shownx | (see following parameter) |
showny | The 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. |
|
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.
dst | The destination port. |
t | The transformer (may be null). |
clip | The clipping region. |
void IlvManagerGrid::getOrigin | ( | IlvPoint & | origin | ) | const |
Returns the grid origin.
origin | Used to return the origin coordinates of the grid. |
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.
sx | Used to return the horizontal frequency. |
sy | Used to return the vertical frequency. |
Returns the horizontal and vertical spacing.
sx | Used to return the horizontal spacing value of the grid. |
sy | Used to return the vertical spacing value of the grid. |
IlBoolean IlvManagerGrid::isActive | ( | ) | const |
Returns whether the grid is active.
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. IlBoolean IlvManagerGrid::isVisible | ( | ) | const |
Returns the grid visibility.
IlTrue
if the grid is visible. Otherwise, it returns IlFalse
. void IlvManagerGrid::setActive | ( | IlBoolean | active | ) |
Enables or disables the grid.
Sets the activity state of the grid.
active | Specifies whether or not the grid must be active. |
void IlvManagerGrid::setForeground | ( | IlvColor * | foreground | ) |
Sets the foreground color of the grid.
foreground | Specifies the foreground color to use. |
void IlvManagerGrid::setOrigin | ( | const IlvPoint & | origin | ) |
Sets the origin of the grid.
origin | The new origin of the grid. |
Sets the grid frequency parameters.
Sets the display frequency of the dots.
sx | The horizontal frequency. |
sy | The vertical frequency. |
Sets the horizontal and vertical spacing dimensions.
sx | Specifies the horizontal spacing. |
sy | Specifies the vertical spacing. |
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.
v | Specifies whether the grid is visible. |
|
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.
p | Used both to specify the initial point to move and to hold the return value. |
© 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.