rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvDrawSelection Class Reference

Base class for selection objects. More...

#include <ilviews/graphics/select.h>

Inheritance diagram for IlvDrawSelection:
IlvSimpleGraphic IlvGraphic IlvPolyPointsSelection IlvReshapeSelection IlvSplineSelection

List of all members.

Public Member Functions

virtual void apply (IlvApplyObject f, IlAny a)
 Applies a function to objects that compose another object.
virtual void applyReferences (IlvApplyObject f, IlAny a)
 Applies a function to objects that are referenced by another object.
virtual void applyTransform (const IlvTransformer *t)
 Applies a transformation function to the graphic object.
virtual void boundingBox (IlvRect &r, const IlvTransformer *t=0) const
 Retrieves the bounding box of the graphic object.
const char * className () const
 Returns the class name of an object.
virtual void computeRegion (IlvRegion &r, const IlvTransformer *t=0) const
 Returns the region covered by the object.
virtual IlBoolean contains (const IlvPoint &p, const IlvPoint &tp, const IlvTransformer *t) const
 Checks whether a point is in the object.
virtual IlvDirection direction (const IlvPoint &p, const IlvTransformer *t=0) const
 Returns the direction associated to a given point.
virtual void draw (IlvPort *dst, const IlvTransformer *t, const IlvRegion *clip=0) const
 Draws the graphic object.
virtual void drawHandle (IlvPort *dst, IlUInt idx, const IlvRect &rect, const IlvRegion *clip=0) const
 Draws a selection handle.
virtual IlvClassInfogetClassInfo () const
 Gets class information.
virtual IlBoolean getHandleLocation (IlUInt idx, IlvPoint &p, const IlvTransformer *t) const =0
 Returns the location of a given selection handle.
IlBoolean getHandleRect (IlUInt idx, IlvRect &rect, const IlvTransformer *t) const
 Returns the rectangle covered by a given selection handle.
virtual IlUInt getHandlesCount (const IlvTransformer *t=0) const =0
 Returns the number of selection handles.
IlvGraphicgetObject () const
 Returns the referenced graphic object.
IlvDim getSize () const
 Returns the size of the selection handles.
IlBoolean isSubtypeOf (const IlvClassInfo *c) const
 Checks whether this object's class is a subclass.
IlBoolean isSubtypeOf (const char *t) const
 Checks whether this object's class is a subclass of a given parent class.
IlBoolean isVisible (const IlvPort *dst) const
 Indicates whether the selection object is visible.
virtual void setMode (IlvDrawMode m)
 Sets the drawing mode of the object temporarily.
void setObject (IlvGraphic *object)
 Changes the referenced graphic object.
virtual void setOverwrite (IlBoolean o)
 Sets an overwrite mode that modifies how the drawing member functions operate.
virtual void setPalette (IlvPalette *palette)
 Sets the internal palette to the given palette value.
void setSize (IlvDim size)
 Changes the size of the selection handles.
virtual IlUInt whichHandle (const IlvPoint &p, const IlvTransformer *t=0) const
 Returns the selection handle containing a given point.
virtual void write (IlvOutputFile &) const
 Writes an object description to a file.
virtual IlBoolean zoomable () const
 Checks whether this object is zoomable.

Static Public Member Functions

static void AddProperty (const IlSymbol *k, IlAny v)
 Adds a property to this object's class.
static IlvPaletteGetDefaultPalette (IlvDisplay *display)
 Returns the default palette used to create selection objects.
static IlvDim GetDefaultSize ()
 Returns the default size for the selection handles.
static IlAny GetProperty (const IlSymbol *key, IlBoolean p=((IlBoolean) 0))
 Retrieves the property value associated with the key in this object's class.
static const IlvClassInfoHasProperty (const IlSymbol *key, IlBoolean p=((IlBoolean) 0))
 Checks for the existence of a property for this object's class hierarchy.
static IlBoolean IsVisibleWhenObjectIsInvisible ()
 Returns the visibility policy for selection objects.
static IlBoolean RemoveProperty (const IlSymbol *key)
 Removes a property from this object's class.
static IlBoolean ReplaceProperty (const IlSymbol *k, IlAny v)
 Replaces a property in this object's class.
static void SetDefaultPalette (IlvPalette *palette)
 Sets the default palette used to create selection objects.
static void SetDefaultSize (IlvDim size)
 Sets the default size for the selection handles.
static void SetVisibleWhenObjectIsInvisible (IlBoolean f)
 Sets the visibility policy for selection objects.

Protected Member Functions

 IlvDrawSelection (IlvDisplay *display, IlvGraphic *object, IlvDim size=0, IlvPalette *palette=0)
 Constructor.

Detailed Description

Base class for selection objects.

Library: views

IlvDrawSelection is the abstract base class for selection objects. A selection object draws several selection handles that can be used to edit its associated graphic object.


Constructor & Destructor Documentation

IlvDrawSelection::IlvDrawSelection ( IlvDisplay display,
IlvGraphic object,
IlvDim  size = 0,
IlvPalette palette = 0 
) [protected]

Constructor.

The constructor initializes an IlvDrawSelection object with the IlvGraphic object object. If palette is equal to 0, then this new instance will use the palette set with the IlvDrawSelection::SetDefaultPalette method. The parameter size indicates the size of the squares to be drawn (the actual dimension of the squares will be twice this size). If size is equal to 0, then the object will be initialized with the size returned by the IlvDrawSelection::GetDefaultSize method.

Parameters:
display The display connection that will handle the drawing of this object.
object The selected object to which this instance is associated.
size The size of the squares
palette The palette used to draw this object.

Member Function Documentation

static void IlvDrawSelection::AddProperty ( const IlSymbol key,
IlAny  value 
) [static]

Adds a property to this object's class.

This static function associates the given value with the given key for the class of this object only.

Parameters:
key The key to be associated.
value The value to be associated.

Reimplemented from IlvSimpleGraphic.

Reimplemented in IlvPolyPointsSelection, IlvSplineSelection, and IlvReshapeSelection.

virtual void IlvDrawSelection::apply ( IlvApplyObject  function,
IlAny  arg 
) [virtual]

Applies a function to objects that compose another object.

Implements a technique for applying a function to objects that compose another object. This member function is useful only when the object is a composite one like an instance of IlvGraphicSet or IlvGraphicHandle. The IlvApplyObject function successively receives each of the components as well as the arg parameter.

Parameters:
function The function to be applied.
arg An argument parameter.

Reimplemented from IlvGraphic.

virtual void IlvDrawSelection::applyReferences ( IlvApplyObject  function,
IlAny  arg 
) [virtual]

Applies a function to objects that are referenced by another object.

Implements a technique for applying a function to objects that are referenced by another object.

Parameters:
function The function to be applied.
arg An argument parameter.

Reimplemented from IlvGraphic.

virtual void IlvDrawSelection::applyTransform ( const IlvTransformer t  )  [virtual]

Applies a transformation function to the graphic object.

Applies the transformer t to the shape of the object. Unless the transformation is a scaling operation, the result of applying it to certain objects can be insignificant. For example, applying a non-scaling transformer to an IlvRectangle object is meaningless, since the rectangle remains a rectangle. On the other hand, meaningful transformations can be applied to objects that are instances of types such as IlvLine or IlvPolyPoints.

Warning:
[note] applyTransform is one of the most important method to be rewritten for classes derived from IlvGraphic, since it is called by the resize, move, moveResize, scale, etc., methods.
Parameters:
t The transformer value. If 0, no transformation is performed.

Implements IlvGraphic.

virtual void IlvDrawSelection::boundingBox ( IlvRect bbox,
const IlvTransformer t = 0 
) const [virtual]

Retrieves the bounding box of the graphic object.

Sets bbox, the rectangle reference parameter, to be the bounding box of the object. Since the object can appear within a transformed environment (for example, in a multiview editor), an IlvTransformer object occurs as an optional parameter in order to compute the bounding box in the coordinate system of the transformed environment. When there is no transformation, t is set to 0.

Parameters:
bbox The bounding box to be set.
t A transformer value or 0 if there is no transformation.

Implements IlvGraphic.

Reimplemented in IlvPolyPointsSelection, and IlvReshapeSelection.

const char* IlvDrawSelection::className (  )  const

Returns the class name of an object.

This method is equivalent to getClassInfo()->getClassName().

Returns:
The class name of the object. For example, for an IlvRectangle object, the className function returns "IlvRectangle".

Reimplemented from IlvSimpleGraphic.

Reimplemented in IlvPolyPointsSelection, IlvSplineSelection, and IlvReshapeSelection.

virtual void IlvDrawSelection::computeRegion ( IlvRegion r,
const IlvTransformer t = 0 
) const [virtual]

Returns the region covered by the object.

This method returns in region the region that covers the selection object if it is displayed with the transformer t. The default implementation fills the region with the rectangles returned by the IlvDrawSelection::getHandleRect method for each selection handle.

Parameters:
r The returned region.
t The transformer applied to this object.

Reimplemented in IlvPolyPointsSelection, and IlvReshapeSelection.

virtual IlBoolean IlvDrawSelection::contains ( const IlvPoint p,
const IlvPoint tp,
const IlvTransformer t 
) const [virtual]

Checks whether a point is in the object.

Checks whether the coordinates are located in the shape of this object. A transformation parameter allows you to use the view's coordinate system for this test.

Parameters:
p The point to be tested.
tp The transformed point obtained by applying the transformer t to the point p.
t A transformer value, or 0 if there is no transformation.
Returns:
IlTrue when the point p lies inside the outline of the object.

Reimplemented from IlvGraphic.

virtual IlvDirection IlvDrawSelection::direction ( const IlvPoint p,
const IlvTransformer t = 0 
) const [virtual]

Returns the direction associated to a given point.

Returns the direction associated to the selection handles containing the point p. This method is used to assign a resizing behavior to selection handles. The default implementation returns IlvBadPosition.

Parameters:
p The considered point.
t The transformer applied to this object.
Returns:
The direction value of the selection handle containing the point p, or IlvBadPosition if p doesn't lie in any of the selection handle.
See also:
IlvReshapeSelection.

Reimplemented in IlvReshapeSelection.

virtual void IlvDrawSelection::draw ( IlvPort dst,
const IlvTransformer t,
const IlvRegion clip = 0 
) const [virtual]

Draws the graphic object.

Draws the object in the given IlvPort using the transformer t which might have the value 0. The clip parameter, which can also be 0, represents the clipping region relative to the transformed object.

Parameters:
dst The destination port.
t The transformer value. If 0, no transformation is performed.
clip The clipping region, or 0 if none.

Implements IlvGraphic.

Reimplemented in IlvPolyPointsSelection, IlvSplineSelection, and IlvReshapeSelection.

virtual void IlvDrawSelection::drawHandle ( IlvPort dst,
IlUInt  idx,
const IlvRect rect,
const IlvRegion clip = 0 
) const [virtual]

Draws a selection handle.

Draws the selection handle of index idx, defined by the rectangle rect. The default implementation draws rectangle filled with the background color of the object's palette and outlined with the foreground color of the object's palette.

Parameters:
dst The drawing port.
idx The index of the considered handle.
rect The rectangle of the considered handle.
clip The clip applied to the drawing.
virtual IlvClassInfo* IlvDrawSelection::getClassInfo (  )  const [virtual]

Gets class information.

Returns a pointer to the IlvClassInfo object associated with this object's class.

Returns:
A pointer to the class information object of the class of this object.

Reimplemented from IlvSimpleGraphic.

Reimplemented in IlvPolyPointsSelection, IlvSplineSelection, and IlvReshapeSelection.

static IlvPalette* IlvDrawSelection::GetDefaultPalette ( IlvDisplay display  )  [static]

Returns the default palette used to create selection objects.

Returns the default palette that will be used to create selection objects through the display connection dpy. This palette is used when 0 is passed to the palette parameter of the IlvDrawSelection constructor.

Parameters:
display The display connection for the created objects
Returns:
The default palette.
See also:
SetDefaultPalette.
static IlvDim IlvDrawSelection::GetDefaultSize (  )  [static]

Returns the default size for the selection handles.

This size is used when 0 is passed to the size parameter of the IlvDrawSelection constructor.

Returns:
The default size for the selection handles.
See also:
SetDefaultSize.
virtual IlBoolean IlvDrawSelection::getHandleLocation ( IlUInt  idx,
IlvPoint p,
const IlvTransformer t 
) const [pure virtual]

Returns the location of a given selection handle.

This method must be redefined in subclasses.

Parameters:
idx The index of the considered handle.
p The returned point.
t The transformer applied to the object.
Returns:
IlTrue if idx is a valid index and IlFalse otherwise.

Implemented in IlvPolyPointsSelection, IlvSplineSelection, and IlvReshapeSelection.

IlBoolean IlvDrawSelection::getHandleRect ( IlUInt  idx,
IlvRect rect,
const IlvTransformer t 
) const

Returns the rectangle covered by a given selection handle.

This method returns the square of size 2*getSize() centered at the point returned by the IlvDrawSelection::getHandleLocation method.

Parameters:
idx The index of the considered handle.
rect The returned rectangle.
t The transformer applied to the object.
Returns:
IlTrue if idx is a valid index and IlFalse otherwise.
virtual IlUInt IlvDrawSelection::getHandlesCount ( const IlvTransformer t = 0  )  const [pure virtual]

Returns the number of selection handles.

This method must be redefined in subclasses.

Parameters:
t The transformer applied to the object.
Returns:
The number of selection handles.

Implemented in IlvPolyPointsSelection, and IlvReshapeSelection.

IlvGraphic* IlvDrawSelection::getObject (  )  const

Returns the referenced graphic object.

Returns:
The referenced graphic object.
static IlAny IlvDrawSelection::GetProperty ( const IlSymbol key,
IlBoolean  checkSuperClass = ((IlBoolean) 0) 
) [static]

Retrieves the property value associated with the key in this object's class.

Retrieves the property value associated with the property name key. If the property cannot be found in the class of this object, and if checkSuperClass is set to IlTrue, then the function operates iteratively on each superclass until the property is found. If the property cannot be found, then 0 is returned.

Parameters:
key The key with which the property value is associated.
checkSuperClass IlTrue specifies iterative search on superclasses.
Returns:
The property value associated with the proper name key, or 0.

Reimplemented from IlvSimpleGraphic.

Reimplemented in IlvPolyPointsSelection, IlvSplineSelection, and IlvReshapeSelection.

IlvDim IlvDrawSelection::getSize (  )  const

Returns the size of the selection handles.

Returns:
Half the length of the side of the square used to draw the selection handles.
See also:
setSize.
static const IlvClassInfo* IlvDrawSelection::HasProperty ( const IlSymbol key,
IlBoolean  checkSuperClass = ((IlBoolean) 0) 
) [static]

Checks for the existence of a property for this object's class hierarchy.

Retrieves a pointer to the IlvClassInfo that indicates a class where the key property exists. If the returned value is non-0, then this property actually exists for this class. If this is not the case and if checkSuperClass is set to IlTrue, then the function operates iteratively on each superclass until a match is found. If the property cannot be found, then 0 is returned.

Parameters:
key The key with which the property value is associated.
checkSuperClass IlTrue specifies iterative search on superclasses.
Returns:
A pointer to the ClassInfo that indicates a class where the key property exists, or 0.

Reimplemented from IlvSimpleGraphic.

Reimplemented in IlvPolyPointsSelection, IlvSplineSelection, and IlvReshapeSelection.

IlBoolean IlvDrawSelection::isSubtypeOf ( const IlvClassInfo classInfo  )  const

Checks whether this object's class is a subclass.

This method is equivalent to getClassInfo()->isSubtypeOf(classInfo).

Parameters:
classInfo The name of a class on which the object's class is tested.
Returns:
Either IlTrue or IlFalse, depending on whether or not this object's class is a subclass of the class indicated by classInfo.

Reimplemented from IlvSimpleGraphic.

Reimplemented in IlvPolyPointsSelection, IlvSplineSelection, and IlvReshapeSelection.

IlBoolean IlvDrawSelection::isSubtypeOf ( const char *  parentClass  )  const

Checks whether this object's class is a subclass of a given parent class.

This method is equivalent to getClassInfo()->isSubtypeOf(parentClass).

Parameters:
parentClass A string representing the parent class.
Returns:
Either IlTrue or IlFalse, depending on whether or not this object's class inherits parentClass attributes. The parentClass parameter should be a string representing the class name of an IlvGraphic subclass. A call to this member function for a given class instance returns IlTrue if given the name of its class.

Reimplemented from IlvSimpleGraphic.

Reimplemented in IlvPolyPointsSelection, IlvSplineSelection, and IlvReshapeSelection.

IlBoolean IlvDrawSelection::isVisible ( const IlvPort dst  )  const

Indicates whether the selection object is visible.

The visibility of a selection object depends on the policy specified by the IlvDrawSelection::IsVisibleWhenObjectIsInvisible method.

Parameters:
dst The considered port.
Returns:
IlTrue if the selection object is visible in the port dst, and IlFalse otherwise.
static IlBoolean IlvDrawSelection::IsVisibleWhenObjectIsInvisible (  )  [static]

Returns the visibility policy for selection objects.

If this method returns IlFalse, then the selection handle will be invisible if its referenced object is invisible. The default value, which is IlTrue, indicates that the selection remains visible even when the object is not visible.

Returns:
The visibility policy for selection objects.
static IlBoolean IlvDrawSelection::RemoveProperty ( const IlSymbol key  )  [static]

Removes a property from this object's class.

This static function removes the indicated property to the class of this object.

Parameters:
key The key property to be removed.
Returns:
IlTrue if the key property was actually found, or IlFalse otherwise.

Reimplemented from IlvSimpleGraphic.

Reimplemented in IlvPolyPointsSelection, IlvSplineSelection, and IlvReshapeSelection.

static IlBoolean IlvDrawSelection::ReplaceProperty ( const IlSymbol key,
IlAny  value 
) [static]

Replaces a property in this object's class.

This static function replaces the indicated property value to the class of this object.

Parameters:
key The key to be replaced.
value The value to be replaced.
Returns:
IlTrue if the key property was actually found, or IlFalse otherwise.

Reimplemented from IlvSimpleGraphic.

Reimplemented in IlvPolyPointsSelection, IlvSplineSelection, and IlvReshapeSelection.

static void IlvDrawSelection::SetDefaultPalette ( IlvPalette palette  )  [static]

Sets the default palette used to create selection objects.

Sets palette as the default palette that will be used to create selection objects. The initial default palette is build using two application resources:

  • selHandleFg for the default foreground.
  • selHandleBg for the default background.

If these resources are not defined, selection handles are drawn with a white background and a black foreground.

Parameters:
palette The new default palette.
See also:
GetDefaultPalette.
static void IlvDrawSelection::SetDefaultSize ( IlvDim  size  )  [static]

Sets the default size for the selection handles.

Parameters:
The new default size for the selection handles..
See also:
GetDefaultSize.
virtual void IlvDrawSelection::setMode ( IlvDrawMode  mode  )  [virtual]

Sets the drawing mode of the object temporarily.

Changing the IlvDrawMode attribute of an object is considered a temporary operation. You have to set the mode to its default value when you no longer need another mode different from the value IlvModeSet. The drawing mode information is passed to the palette of the graphic object (see the IlvPalette::setOverwrite method for more details).

Parameters:
mode The drawing mode to be set.

Reimplemented from IlvSimpleGraphic.

void IlvDrawSelection::setObject ( IlvGraphic object  ) 

Changes the referenced graphic object.

Parameters:
object The new associated graphic object.
virtual void IlvDrawSelection::setOverwrite ( IlBoolean  over  )  [virtual]

Sets an overwrite mode that modifies how the drawing member functions operate.

Modifies the way the drawing member functions operate. The information is passed to the palette of the graphic object (see the IlvPalette::setOverwrite method for more details).

Parameters:
over If IlFalse, sets selective hidden drawing operations.

Reimplemented from IlvSimpleGraphic.

virtual void IlvDrawSelection::setPalette ( IlvPalette palette  )  [virtual]

Sets the internal palette to the given palette value.

Sets the internal palette to the given palette value. The previous palette is unlocked, and palette is locked.

Parameters:
palette The new palette of this object.

Reimplemented from IlvSimpleGraphic.

void IlvDrawSelection::setSize ( IlvDim  size  ) 

Changes the size of the selection handles.

Sets to 2 * size the size of the square used by the object to draw the selection handles.

Parameters:
size The new size.
See also:
getSize.
static void IlvDrawSelection::SetVisibleWhenObjectIsInvisible ( IlBoolean  f  )  [static]

Sets the visibility policy for selection objects.

Parameters:
f A Boolean indicating whether the selection handle is visible when its referenced object is invisible.
See also:
IsVisibleWhenObjectIsInvisible.
virtual IlUInt IlvDrawSelection::whichHandle ( const IlvPoint p,
const IlvTransformer t = 0 
) const [virtual]

Returns the selection handle containing a given point.

Parameters:
p The considered point.
t The transformer applied to the object.
Returns:
The index of the handle containing the point p, or IlvBadIndex if it does not lie in any of the handle.

Reimplemented in IlvSplineSelection, and IlvReshapeSelection.

virtual void IlvDrawSelection::write ( IlvOutputFile output  )  const [virtual]

Writes an object description to a file.

Writes out, in a file, the object description. This description contains all the information necessary to create an exact copy of this object by means of the member function read. Information concerning any IlvPalette object attached to this object is written out by the object containers. All other information, such as the position and size of the object, is written out by this virtual member function.
For example, suppose we have an IlvLabel class that implements a graphic object drawn as a text string at a given position. It maintains its position in an internal IlvPoint field called _position and its textual content in an internal character array field called _text. The only information we need to save is the contents of those fields. So, the member function write of such an object should have the following form:

 void
 IlvLabel::write(IlvOutputFile& file) const
 {
     // Save the position field
     file.getStream() << IlvSpc() << _position;
     // Save the text field
     IlvWriteString(file.getStream(), _text);
 }
Parameters:
output The the output file to be written to.
See also:
DeclareTypeInfo.

Implements IlvGraphic.

virtual IlBoolean IlvDrawSelection::zoomable (  )  const [virtual]

Checks whether this object is zoomable.

Returns:
IlTrue if the graphic object can be zoomed, and IlFalse otherwise. See the member functions IsZoomAllowed and AllowZoom below.

Reimplemented from IlvGraphic.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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