rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvListLabel Class Reference

Graphic class. More...

#include <ilviews/graphics/lablist.h>

Inheritance diagram for IlvListLabel:
IlvSimpleGraphic IlvGraphic

List of all members.

Public Member Functions

 IlvListLabel (IlvDisplay *display, IlUInt count, const IlvPoint &position...)
 Constructor.
 IlvListLabel (IlvDisplay *display, const IlvPoint &position, IlUInt count, const char *const *labels, IlvPalette *palette=0)
 Constructor.
void addLabel (const char *s)
 Adds a string.
IlvPosition align () const
 Returns the alignment of the strings.
IlvPosition align (IlvPosition align)
 Sets the alignment of the strings.
virtual void applyTransform (const IlvTransformer *t)
 Applies a transformation function to the graphic object.
virtual void boundingBox (IlvRect &rect, const IlvTransformer *t=0) const
 Retrieves the bounding box of the graphic object.
const char * className () const
 Returns the class name of an object.
IlBoolean contains (const IlvPoint &p, const IlvPoint &tp, const IlvTransformer *t=0) const
 Checks whether a point is in the object.
virtual IlvGraphiccopy () const
 Copies this object.
virtual void draw (IlvPort *, const IlvTransformer *t=0, const IlvRegion *clip=0) const
 Draws the graphic object.
IlUInt getCardinal () const
 Returns the number of label strings.
virtual IlvClassInfogetClassInfo () const
 Gets class information.
const char * getLabel (IlUInt index) const
 Returns the string at a given index.
const char *const * getLabels (IlUInt &count) const
 Returns the array of strings.
IlvDeltaPos getSpacing () const
 Returns the vertical spacing between lines.
const char * getText () const
 Returns the contents of an array of strings.
IlBoolean inside (const IlvRegion &trect, const IlvTransformer *t=0) const
 Determines whether an object with transformation applied is inside the bounding box.
IlBoolean intersects (const IlvRegion &trect, 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.
virtual void print (ILVSTDPREF ostream &, int level=0) const
 Prints for debugging purposes.
void removeLabel (IlUInt index)
 Removes the string at a given index.
virtual void setFont (IlvFont *)
 Sets the font of the object.
void setLabel (const char *s, IlUInt index)
 Sets a label string at a given index.
void setLabels (const char *const *s, IlUInt count, IlBoolean copy=((IlBoolean) 1))
 Sets the array of strings.
void setSpacing (IlvDeltaPos spacing)
 Sets the vertical spacing between lines.
void setText (const char *text)
 Resets the graphic object with a multiline string.
IlInt whichContains (const IlvPoint &p, const IlvTransformer *t=0) const
 Returns the index of the string containing a given point.
virtual void write (IlvOutputFile &) const
 Writes an object description to a file.
virtual IlBoolean zoomable () const
 Indicates whether the graphic object is zoomable.

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 IlvClassInfoHasProperty (const IlSymbol *key, IlBoolean p=((IlBoolean) 0))
 Checks for the existence of a property for this object's class hierarchy.
static IlvGraphicread (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.

Detailed Description

Graphic class.

Library: views

An IlvListLabel object appears as a vertical list of strings, so that it looks like a series of lines of text.

listlab.gif


- IlvListLabel -

See also:
IlvLabel.

Constructor & Destructor Documentation

IlvListLabel::IlvListLabel ( IlvDisplay display,
const IlvPoint position,
IlUInt  count,
const char *const *  labels,
IlvPalette palette = 0 
)

Constructor.

Creates an IlvListLabel graphic object from an array of strings.

Parameters:
display The display instance.
point The position of the graphic object bounding box.
count The number of strings in the array.
labels The array of strings. The strings and the array are copied.
IlvListLabel::IlvListLabel ( IlvDisplay display,
IlUInt  count,
const IlvPoint position... 
)

Constructor.

Creates an IlvListLabel graphic object from a list of strings. The variable part of the parameter list must contain exclusively count character strings. The strings are copied.

Parameters:
display The display instance.
count The number of strings given in parameter.
point The position of the graphic object bounding box.

Member Function Documentation

void IlvListLabel::addLabel ( const char *  s  ) 

Adds a string.

Adds the specified string to the array of drawn strings at the last position.

Parameters:
label The string to add. The string is copied.
static void IlvListLabel::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.

IlvPosition IlvListLabel::align (  )  const

Returns the alignment of the strings.

Returns:
The alignment of the drawn strings.
IlvPosition IlvListLabel::align ( IlvPosition  align  ) 

Sets the alignment of the strings.

Changes the alignment of the drawn strings.

Parameters:
align Specifies the alignment.
Returns:
The value of the parameter align.
virtual void IlvListLabel::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 IlvListLabel::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.

const char* IlvListLabel::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.

IlBoolean IlvListLabel::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.

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 IlvGraphic* IlvListLabel::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.

Returns:
A copy of the object.
See also:
IlvPredefinedIOMembers.

Implements IlvGraphic.

virtual void IlvListLabel::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.

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.

IlUInt IlvListLabel::getCardinal (  )  const

Returns the number of label strings.

Returns:
The number of strings drawn by the graphic object.
virtual IlvClassInfo* IlvListLabel::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.

const char* IlvListLabel::getLabel ( IlUInt  index  )  const

Returns the string at a given index.

Returns:
The string stored at the given index in the internal array of strings stored by the graphic object.
Parameters:
index The index in the array of strings.
Warning:
[note] The returned string must not be modified or deleted.
const char* const* IlvListLabel::getLabels ( IlUInt count  )  const

Returns the array of strings.

Returns:
The array of strings drawn by the graphic object. The returned array and the strings must not be deleted or modified.
Parameters:
count Used to return the number of strings in the array.
static IlAny IlvListLabel::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.

IlvDeltaPos IlvListLabel::getSpacing (  )  const

Returns the vertical spacing between lines.

Returns:
The vertical spacing between drawn strings.
const char* IlvListLabel::getText (  )  const

Returns the contents of an array of strings.

Returns:
A string composed of all the label strings drawn by the graphic object, each separated by a "<code>\n</code>" character.
static const IlvClassInfo* IlvListLabel::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.

IlBoolean IlvListLabel::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.

Parameters:
r The region to be tested.
t A transformer value, or 0 if there is no transformation.
Returns:
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 IlvGraphic.

IlBoolean IlvListLabel::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.

Parameters:
r The region to be tested.
t A transformer value, or 0 if there is no transformation.
Returns:
IlTrue when the region r overlaps the transformed object (if t is not 0) and IlFalse when this is not the case.

Reimplemented from IlvGraphic.

IlBoolean IlvListLabel::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.

IlBoolean IlvListLabel::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.

virtual void IlvListLabel::print ( ILVSTDPREF ostream &  out,
int  level = 0 
) const [virtual]

Prints for debugging purposes.

Use for debugging purposes. Depending on the debugging level given as the level parameter, basic information about this object is printed to out. Basic implementation prints the object class name, and its bounding box. When this object is defined by another object (that is, if it is a referenced object), this subobject is described only if the level parameter is not zero. When this object is defined by a group of objects, these subobjects are defined themselves if the level parameter is not zero. In general, the higher level is, the more information you get about the object.

Parameters:
out The output stream.
level The debugging level. If 0, subobjects are not described.

Reimplemented from IlvGraphic.

static IlvGraphic* IlvListLabel::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);
 }
Parameters:
file The name of the file to be read from.
palette The name of the palette for the object.
See also:
DeclareTypeInfoRO, DeclareTypeInfo, IlvPredefinedIOMembers.
Warning:
[note] The read method is not capitalized like other static methods so that it is consistent with the write method.

Reimplemented from IlvGraphic.

void IlvListLabel::removeLabel ( IlUInt  index  ) 

Removes the string at a given index.

Removes the label at the specified index from the array of drawn strings.

static IlBoolean IlvListLabel::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.

static IlBoolean IlvListLabel::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.

virtual void IlvListLabel::setFont ( IlvFont font  )  [virtual]

Sets the font of the object.

Parameters:
font The new font.

Reimplemented from IlvSimpleGraphic.

void IlvListLabel::setLabel ( const char *  s,
IlUInt  index 
)

Sets a label string at a given index.

Replaces the string at the given index by a new one. The previous one is deleted.

Parameters:
label The new label string. The string is copied.
index Specifies the index in the internal array of strings.
void IlvListLabel::setLabels ( const char *const *  s,
IlUInt  count,
IlBoolean  copy = ((IlBoolean) 1) 
)

Sets the array of strings.

Replaces the array of strings by a new one. The old array and its strings are deleted.

Parameters:
labels The new array of strings.
count The number of strings in the new array.
copy If IlTrue, a copy of the strings and a copy of the array holding them is made. Otherwise, the graphic object directly uses the array of strings passed in argument.
void IlvListLabel::setSpacing ( IlvDeltaPos  spacing  ) 

Sets the vertical spacing between lines.

Changes the vertical spacing between drawn strings.

Parameters:
spacing The new spacing value.
void IlvListLabel::setText ( const char *  text  ) 

Resets the graphic object with a multiline string.

Resets the object by extracting from text the substrings separated by a "<code>\n</code>" character.

IlInt IlvListLabel::whichContains ( const IlvPoint p,
const IlvTransformer t = 0 
) const

Returns the index of the string containing a given point.

Returns:
-1 if the point is not in the graphic object. Otherwise, it returns the index of the drawn string containing the point.
Parameters:
p The point, possibly transformed.
t If a transformer is specified, it is applied to the graphic object before testing if it contains the point.
virtual void IlvListLabel::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 IlvListLabel::zoomable (  )  const [virtual]

Indicates whether the graphic object is zoomable.

Returns:
IlFalse. Subclasses can implement a different behavior allowing the graphic object to zoom, in which case the method must be redefined to return IlFalse.

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.