Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Graphic class. More...
#include <ilviews/graphics/handle.h>
Public Member Functions | |
IlvFixedSizeGraphic (IlvGraphic *obj, IlBoolean owner=((IlBoolean) 0), IlvPosition position=IlvBadPosition, const IlvPoint *point=0) | |
Constructor. | |
virtual void | applyTransform (const IlvTransformer *t) |
Applies a transformation. | |
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 | computeFocusRegion (IlvRegion &r, const IlvTransformer *t=0) const |
Computes the region needed for the drawing of the focus. | |
IlBoolean | contains (const IlvPoint &p, const IlvPoint &tp, const IlvTransformer *t=0) const |
Checks whether a point is in the object. | |
virtual IlvGraphic * | copy () const |
Copies this object. | |
void | draw (IlvPort *dst, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Draws the graphic object. | |
virtual void | drawFocus (IlvPort *dst, const IlvPalette *palette, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Draws additional drawings for an object that has the keyboard focus. | |
virtual IlvClassInfo * | getClassInfo () const |
Gets class information. | |
const IlvPoint & | getPoint () const |
Gets the fixed point. | |
IlvPosition | getPosition () const |
Gets a fixed point position. | |
IlBoolean | inside (const IlvRegion &tregion, const IlvTransformer *t=0) const |
Determines whether an object with transformation applied is inside the bounding box. | |
IlBoolean | intersects (const IlvRegion &tregion, const IlvTransformer *t=0) const |
Checks whether a region intersects the bounding box with transformation applied. | |
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. | |
void | setPoint (const IlvPoint &p) |
Sets the fixed point. | |
void | setPosition (IlvPosition position) |
Sets the fixed point position. | |
virtual void | write (IlvOutputFile &) const |
Writes an object description to a file. | |
virtual IlBoolean | zoomable () const |
Queries the zoomable capability. | |
Static Public Member Functions | |
static void | AddProperty (const IlSymbol *k, IlAny v) |
Adds a property to this object's class. | |
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 IlvClassInfo * | HasProperty (const IlSymbol *key, IlBoolean p=((IlBoolean) 0)) |
Checks for the existence of a property for this object's class hierarchy. | |
static IlvGraphic * | read (IlvInputFile &, IlvPalette *pal) |
Reads an object description from a file. | |
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. |
Graphic class.
Library: views
The IlvFixedSizeGraphic
class is derived from the basic handle class IlvGraphicHandle
. Thus, an IlvFixedSizeGraphic
object is a kind of handle, which is associated with a certain referenced object of the IlvGraphic
class. An IlvFixedSizeGraphic
instance is drawn by applying to its referenced object a graphic transformation so that the referenced object can never change its visible size. The appropriate transformation is internally computed to achieve this result.
IlvFixedSizeGraphic::IlvFixedSizeGraphic | ( | IlvGraphic * | obj, | |
IlBoolean | owner = ((IlBoolean) 0) , |
|||
IlvPosition | position = IlvBadPosition , |
|||
const IlvPoint * | point = 0 | |||
) |
Constructor.
The constructor initializes an instance of IlvFixedSizeGraphic
. The position argument indicates the point in the referenced object (for example, its center or the top-left corner of its bounding box) that must remain at the same position when the object is redrawn. This parameter defaults to a value that leaves the center of the drawn shape at the same location, regardless of any transformer that might be applied when redrawing the graphic object or when locating events that are redirected to these objects. The last parameter, point, can be used to specify the position of a fixed point when this object is transformed (then position is not taken into account). In the case of a transformation that is applied to the object, the transformation is actually applied to this point, and the object is then translated so that the distance between the object and this transformed point is kept constant.
object | The graphic object to be fixed. | |
owner | A Boolean value indicating if it is the owner. | |
position | The position of the point to remain fixed. | |
point | A fixed point in transformation. |
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.
key | The key to be associated. | |
value | The value to be associated. |
Reimplemented from IlvGraphicHandle.
virtual void IlvFixedSizeGraphic::applyTransform | ( | const IlvTransformer * | t | ) | [virtual] |
Applies a transformation.
t | The transformer that is applied to the referenced graphic object by calling its IlvGraphic::applyTransform member function. |
Reimplemented from IlvGraphicHandle.
virtual void IlvFixedSizeGraphic::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
.
bbox | The bounding box to be set. | |
t | A transformer value or 0 if there is no transformation. |
Reimplemented from IlvGraphicHandle.
const char* IlvFixedSizeGraphic::className | ( | ) | const |
Returns the class name of an object.
This method is equivalent to getClassInfo()->getClassName()
.
IlvRectangle
object, the className function returns "IlvRectangle"
. Reimplemented from IlvGraphicHandle.
virtual void IlvFixedSizeGraphic::computeFocusRegion | ( | IlvRegion & | r, | |
const IlvTransformer * | t = 0 | |||
) | const [virtual] |
Computes the region needed for the drawing of the focus.
This method is called to compute the region needed for the drawing of the focus (see the method drawFocus
).
r | The region that is updated. | |
t | The transformer value. If 0 , no transformation is performed. |
Reimplemented from IlvGraphicHandle.
IlBoolean IlvFixedSizeGraphic::contains | ( | const IlvPoint & | p, | |
const IlvPoint & | tp, | |||
const IlvTransformer * | t = 0 | |||
) | 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.
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. |
IlTrue
when the point p lies inside the outline of the object. Reimplemented from IlvGraphicHandle.
virtual IlvGraphic* IlvFixedSizeGraphic::copy | ( | ) | const [virtual] |
Copies this object.
Allocates and returns a copy of this object. If the object is composite, the implementation of this member function makes a copy of the object's components.
IlvPredefinedIOMembers
. Reimplemented from IlvGraphicHandle.
void IlvFixedSizeGraphic::draw | ( | IlvPort * | dst, | |
const IlvTransformer * | t = 0 , |
|||
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.
dst | The destination port. | |
t | The transformer value. If 0, no transformation is performed. | |
clip | The clipping region, or 0 if none. |
Reimplemented from IlvGraphicHandle.
virtual void IlvFixedSizeGraphic::drawFocus | ( | IlvPort * | dst, | |
const IlvPalette * | palette, | |||
const IlvTransformer * | t = 0 , |
|||
const IlvRegion * | clip = 0 | |||
) | const [virtual] |
Draws additional drawings for an object that has the keyboard focus.
This method is called to draw additional drawings when the graphic object has the keyboard focus. The default implementation draws a rectangle around the object. The drawing will be done inside the region returned by computeFocusRegion
.
dst | The destination port. | |
palette | The palette of the object. | |
t | The transformer value. If 0 , no transformation is performed. | |
clip | The clipping region. |
Reimplemented from IlvGraphicHandle.
virtual IlvClassInfo* IlvFixedSizeGraphic::getClassInfo | ( | ) | const [virtual] |
Gets class information.
Returns a pointer to the IlvClassInfo
object associated with this object's class.
Reimplemented from IlvGraphicHandle.
const IlvPoint& IlvFixedSizeGraphic::getPoint | ( | ) | const |
Gets the fixed point.
IlvPosition IlvFixedSizeGraphic::getPosition | ( | ) | const |
Gets a fixed point position.
static IlAny IlvFixedSizeGraphic::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.
key | The key with which the property value is associated. | |
checkSuperClass | IlTrue specifies iterative search on superclasses. |
0
. Reimplemented from IlvGraphicHandle.
static const IlvClassInfo* IlvFixedSizeGraphic::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.
key | The key with which the property value is associated. | |
checkSuperClass | IlTrue specifies iterative search on superclasses. |
0
. Reimplemented from IlvGraphicHandle.
IlBoolean IlvFixedSizeGraphic::inside | ( | const IlvRegion & | r, | |
const IlvTransformer * | t = 0 | |||
) | const [virtual] |
Determines whether an object with transformation applied is inside the bounding box.
Determines whether an object with transformation applied is inside the bounding box.
r | The region to be tested. | |
t | A transformer value, or 0 if there is no transformation. |
IlTrue
when the object, drawn with the transformer t, covers completely the region r. This virtual member function returns IlFalse
when this is not the case. That means that it returns IlTrue
if all rectangles that define the region completely lie inside the object. Reimplemented from IlvGraphicHandle.
IlBoolean IlvFixedSizeGraphic::intersects | ( | const IlvRegion & | r, | |
const IlvTransformer * | t = 0 | |||
) | const [virtual] |
Checks whether a region intersects the bounding box with transformation applied.
Checks whether a region intersects the bounding box with transformation applied.
r | The region to be tested. | |
t | A transformer value, or 0 if there is no transformation. |
IlTrue
when the region r overlaps the transformed object (if t is not 0
) and IlFalse
when this is not the case. Reimplemented from IlvGraphicHandle.
IlBoolean IlvFixedSizeGraphic::isSubtypeOf | ( | const IlvClassInfo * | classInfo | ) | const |
Checks whether this object's class is a subclass.
This method is equivalent to getClassInfo()->isSubtypeOf(classInfo)
.
classInfo | The name of a class on which the object's class is tested. |
IlTrue
or IlFalse
, depending on whether or not this object's class is a subclass of the class indicated by classInfo. Reimplemented from IlvGraphicHandle.
IlBoolean IlvFixedSizeGraphic::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)
.
parentClass | A string representing the parent class. |
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 IlvGraphicHandle.
static IlvGraphic* IlvFixedSizeGraphic::read | ( | IlvInputFile & | file, | |
IlvPalette * | palette | |||
) | [static] |
Reads an object description from a file.
Reads an object description from the file input, given the palette graphic attributes. It reads the information that was saved by the member function write
to be able to create a new instance of this object. Usually, because of the availability of the constructor that expects an IlvInputFile
, read should be equivalent to:
IlvGraphic* MyClass::read(IlvInputFile& file, IlvPalette* palette) { return new MyClass(file, palette); }
In the following example, the static member function read
of the IlvLabel
class could have the following form:
IlvGraphic* IlvLabel::read(IlvInputFile& file, IlvPalette* pal) { IlvPoint pos; file.getStream() >> pos; // Read the position field return new IlvLabel(pal->getDisplay(), pos, IlvReadString(file.getStream()), pal); }
file | The name of the file to be read from. | |
palette | The name of the palette for the object. |
DeclareTypeInfoRO
, DeclareTypeInfo
, IlvPredefinedIOMembers
. read
method is not capitalized like other static methods so that it is consistent with the write
method. Reimplemented from IlvGraphicHandle.
Removes a property from this object's class.
This static function removes the indicated property to the class of this object.
key | The key property to be removed. |
IlTrue
if the key property was actually found, or IlFalse
otherwise. Reimplemented from IlvGraphicHandle.
static IlBoolean IlvFixedSizeGraphic::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.
key | The key to be replaced. | |
value | The value to be replaced. |
IlTrue
if the key property was actually found, or IlFalse
otherwise. Reimplemented from IlvGraphicHandle.
void IlvFixedSizeGraphic::setPoint | ( | const IlvPoint & | p | ) |
Sets the fixed point.
p | The new reference point. |
void IlvFixedSizeGraphic::setPosition | ( | IlvPosition | position | ) |
Sets the fixed point position.
Changes the fixed point position by locating the fixed point at the indicated direction relative to the object's bounding box.
position | The new relative position. |
virtual void IlvFixedSizeGraphic::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); }
output | The the output file to be written to. |
DeclareTypeInfo
. Reimplemented from IlvGraphicHandle.
virtual IlBoolean IlvFixedSizeGraphic::zoomable | ( | ) | const [virtual] |
Queries the zoomable capability.
IlFalse
. An IlvFixedSizeGraphic
is never zoomable. Reimplemented from IlvGraphicHandle.
© 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.