Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Graphic class. More...
#include <ilviews/graphics/gauge.h>
Public Member Functions | |
IlvGauge (IlvDisplay *display, const IlvRect &drawrect, IlFloat min=0, IlFloat max=100, IlFloat value=50, IlvPalette *palette=0) | |
Constructor. | |
virtual void | applyTransform (const IlvTransformer *t) |
Applies a transformation function to the graphic object. | |
virtual void | bboxRange (IlFloat v1, IlFloat v2, IlvRect &rect, const IlvTransformer *t=0) const =0 |
Returns the rectangle to update when the value of the gauge changes. | |
virtual void | boundingBox (IlvRect &, const IlvTransformer *t=0) const =0 |
Retrieves the bounding box of the graphic object. | |
const char * | className () const |
Returns the class name of an object. | |
virtual IlvGraphic * | copy () const |
Copies this object. | |
virtual void | draw (IlvPort *, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Draws the graphic object. | |
virtual void | drawFocus (IlvPort *, const IlvPalette *, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Draws additional drawings for an object that has the keyboard focus. | |
virtual void | drawValue (IlvPort *, const IlvTransformer *t=0, const IlvRegion *clip=0) const =0 |
Performs the drawing representing the current value of the gauge. | |
virtual IlvClassInfo * | getClassInfo () const |
Gets class information. | |
virtual const char * | getDefaultInteractor () const |
Gets the name of the default interactor for this object. | |
IlFloat | getMax () const |
Returns the maximum value of the gauge. | |
IlFloat | getMin () const |
Returns the minimum value of the gauge. | |
IlFloat | getValue () const |
Returns the current value of the gauge. | |
virtual void | invert (IlBoolean=((IlBoolean) 0)) |
Highlights the object. | |
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 IlFloat | requestValue (const IlvPoint &point, const IlvTransformer *t, IlBoolean &connect) const =0 |
Returns the value of the gauge associated with a given point. | |
virtual void | setAlpha (IlvIntensity alpha) |
Sets the alpha value of the object. | |
virtual void | setAntialiasingMode (IlvAntialiasingMode mode) |
Sets the anti-aliasing mode of the object. | |
virtual void | setBackground (IlvColor *) |
Sets the background color of the object. | |
virtual void | setForeground (IlvColor *) |
Sets the foreground color of the object. | |
void | setMax (IlFloat max) |
Sets the maximum value of the gauge. | |
void | setMin (IlFloat min) |
Sets the minimum value of the gauge. | |
virtual void | setMode (IlvDrawMode) |
Sets the drawing mode of the object temporarily. | |
virtual void | setOverwrite (IlBoolean value) |
Sets an overwrite mode that modifies how the drawing member functions operate. | |
virtual void | setPalette (IlvPalette *) |
Sets the internal palette to the given palette value. | |
virtual void | setValue (IlFloat value) |
Sets the current value of the gauge. | |
virtual void | write (IlvOutputFile &) const |
Writes an object description to a file. | |
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
Gauges are graphic objects that provide a representation of some value, which is bound between a minimum and a maximum value. Rogue Wave Views uses a main abstract class, IlvGauge
, from which all gauge objects derive. The default interactor name for this object is "<code>Gauge</code>".
IlvChartData
, IlvTransformer
, IlvGaugeInteractor
. IlvGauge::IlvGauge | ( | IlvDisplay * | display, | |
const IlvRect & | drawrect, | |||
IlFloat | min = 0 , |
|||
IlFloat | max = 100 , |
|||
IlFloat | value = 50 , |
|||
IlvPalette * | palette = 0 | |||
) |
Constructor.
display | The display instance. | |
drawrect | Specifies the size of the graphic object. | |
min | The minimum value of the gauge. | |
max | The maximum value of the gauge. | |
value | The current value of the gauge. | |
palette | The palette used to draw the graphic object. |
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 IlvSimpleGraphic.
Reimplemented in IlvCircularGauge, IlvFilledCircularGauge, IlvRectangularGauge, IlvSliderGauge, and IlvReliefGauge.
virtual void IlvGauge::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
.
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.t | The transformer value. If 0, no transformation is performed. |
Implements IlvGraphic.
virtual void IlvGauge::bboxRange | ( | IlFloat | v1, | |
IlFloat | v2, | |||
IlvRect & | rect, | |||
const IlvTransformer * | t = 0 | |||
) | const [pure virtual] |
Returns the rectangle to update when the value of the gauge changes.
v1 | Initial value of the gauge. | |
v2 | Future value of the gauge. | |
rect | Used to return the rectangle to update. | |
t | The transformer. If it is specified, the graphic object is considered to be drawn through a transformation and the returned rectangle is expressed in the transformed coordinate system. |
Implemented in IlvCircularGauge, IlvRectangularGauge, IlvSliderGauge, and IlvReliefGauge.
virtual void IlvGauge::boundingBox | ( | IlvRect & | bbox, | |
const IlvTransformer * | t = 0 | |||
) | const [pure 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. |
Implements IlvGraphic.
Implemented in IlvCircularGauge, and IlvRectangularGauge.
const char* IlvGauge::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 IlvSimpleGraphic.
Reimplemented in IlvCircularGauge, IlvFilledCircularGauge, IlvRectangularGauge, IlvSliderGauge, and IlvReliefGauge.
virtual IlvGraphic* IlvGauge::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
. Implements IlvGraphic.
Reimplemented in IlvCircularGauge, IlvFilledCircularGauge, IlvRectangularGauge, IlvSliderGauge, and IlvReliefGauge.
virtual void IlvGauge::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. |
Implements IlvGraphic.
Reimplemented in IlvRectangularGauge.
virtual void IlvGauge::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 IlvGraphic.
virtual void IlvGauge::drawValue | ( | IlvPort * | , | |
const IlvTransformer * | t = 0 , |
|||
const IlvRegion * | clip = 0 | |||
) | const [pure virtual] |
Performs the drawing representing the current value of the gauge.
Called by the member function draw
and interactors that connect to it. Draws the part of the gauge that indicates its value (such as the hand of a watch).
dst | The destination port. | |
t | The transformer to apply to the drawing. | |
clip | The clipping region. |
Implemented in IlvCircularGauge, IlvFilledCircularGauge, IlvRectangularGauge, IlvSliderGauge, and IlvReliefGauge.
virtual IlvClassInfo* IlvGauge::getClassInfo | ( | ) | const [virtual] |
Gets class information.
Returns a pointer to the IlvClassInfo
object associated with this object's class.
Reimplemented from IlvSimpleGraphic.
Reimplemented in IlvCircularGauge, IlvFilledCircularGauge, IlvRectangularGauge, IlvSliderGauge, and IlvReliefGauge.
virtual const char* IlvGauge::getDefaultInteractor | ( | ) | const [virtual] |
Gets the name of the default interactor for this object.
Reimplemented from IlvGraphic.
IlFloat IlvGauge::getMax | ( | ) | const |
Returns the maximum value of the gauge.
IlFloat IlvGauge::getMin | ( | ) | const |
Returns the minimum value of the gauge.
static IlAny IlvGauge::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 IlvSimpleGraphic.
Reimplemented in IlvCircularGauge, IlvFilledCircularGauge, IlvRectangularGauge, IlvSliderGauge, and IlvReliefGauge.
IlFloat IlvGauge::getValue | ( | ) | const |
Returns the current value of the gauge.
static const IlvClassInfo* IlvGauge::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 IlvSimpleGraphic.
Reimplemented in IlvCircularGauge, IlvFilledCircularGauge, IlvRectangularGauge, IlvSliderGauge, and IlvReliefGauge.
Highlights the object.
Highlights the object. It is implemented as swapping the foreground and background colors of the object, but can have other implementations in derived subclasses. The parameter temp controls the way you toggle between the background and the foreground. If temp is omitted or is IlFalse
, then a new palette is computed by calling the IlvDisplay::getPalette()
method. If temp is IlTrue
, the object palette is inverted, and thus all the objects referencing this palette will be affected.
temp | If IlTrue , highlights the object. |
Reimplemented from IlvSimpleGraphic.
Reimplemented in IlvReliefGauge.
IlBoolean IlvGauge::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 IlvSimpleGraphic.
Reimplemented in IlvCircularGauge, IlvFilledCircularGauge, IlvRectangularGauge, IlvSliderGauge, and IlvReliefGauge.
IlBoolean IlvGauge::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 IlvSimpleGraphic.
Reimplemented in IlvCircularGauge, IlvFilledCircularGauge, IlvRectangularGauge, IlvSliderGauge, and IlvReliefGauge.
static IlvGraphic* IlvGauge::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 IlvGraphic.
Reimplemented in IlvCircularGauge, IlvFilledCircularGauge, IlvRectangularGauge, IlvSliderGauge, and IlvReliefGauge.
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 IlvSimpleGraphic.
Reimplemented in IlvCircularGauge, IlvFilledCircularGauge, IlvRectangularGauge, IlvSliderGauge, and IlvReliefGauge.
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 IlvSimpleGraphic.
Reimplemented in IlvCircularGauge, IlvFilledCircularGauge, IlvRectangularGauge, IlvSliderGauge, and IlvReliefGauge.
virtual IlFloat IlvGauge::requestValue | ( | const IlvPoint & | point, | |
const IlvTransformer * | t, | |||
IlBoolean & | connect | |||
) | const [pure virtual] |
Returns the value of the gauge associated with a given point.
point | The point. If a transformer is specified, the point is considered to be transformed, i.e. expressed in the transformed coordinate system. | |
t | The transformer. | |
connect | If IlTrue , the provided point indicates a connection to the gauge. Mostly, this means that the point is located on the moving part of the gauge. |
Implemented in IlvCircularGauge, IlvFilledCircularGauge, IlvRectangularGauge, and IlvSliderGauge.
virtual void IlvGauge::setAlpha | ( | IlvIntensity | alpha | ) | [virtual] |
Sets the alpha value of the object.
alpha | The new alpha value. |
Reimplemented from IlvSimpleGraphic.
Reimplemented in IlvReliefGauge.
virtual void IlvGauge::setAntialiasingMode | ( | IlvAntialiasingMode | mode | ) | [virtual] |
Sets the anti-aliasing mode of the object.
mode | The new anti-aliasing mode. |
Reimplemented from IlvSimpleGraphic.
Reimplemented in IlvReliefGauge.
virtual void IlvGauge::setBackground | ( | IlvColor * | background | ) | [virtual] |
Sets the background color of the object.
Sets the background color of the object.
background | The new background color. |
Reimplemented from IlvSimpleGraphic.
virtual void IlvGauge::setForeground | ( | IlvColor * | foreground | ) | [virtual] |
Sets the foreground color of the object.
Sets the foreground color of the object.
foreground | The new foreground color. |
Reimplemented from IlvSimpleGraphic.
Reimplemented in IlvReliefGauge.
void IlvGauge::setMax | ( | IlFloat | max | ) |
Sets the maximum value of the gauge.
Sets the maximum value of the gauge.
max | The new maximum value. |
void IlvGauge::setMin | ( | IlFloat | min | ) |
Sets the minimum value of the gauge.
Sets the minimum value of the gauge.
min | The new minimum value. |
virtual void IlvGauge::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).
mode | The drawing mode to be set. |
Reimplemented from IlvSimpleGraphic.
Reimplemented in IlvReliefGauge.
virtual void IlvGauge::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).
over | If IlFalse , sets selective hidden drawing operations. |
Reimplemented from IlvSimpleGraphic.
virtual void IlvGauge::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.
palette | The new palette of this object. |
Reimplemented from IlvSimpleGraphic.
Reimplemented in IlvReliefGauge.
virtual void IlvGauge::setValue | ( | IlFloat | value | ) | [virtual] |
Sets the current value of the gauge.
Changes the current value of the gauge.
value | The new current value. |
virtual void IlvGauge::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
. Implements IlvGraphic.
Reimplemented in IlvCircularGauge, IlvRectangularGauge, IlvSliderGauge, and IlvReliefGauge.
© 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.