Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Graphic class that displays a time scale. More...
#include <ilviews/graphics/timescale.h>
Public Member Functions | |
IlvTimeScale (IlvDisplay *display, const IlvRect &drawrect, IlvPalette *palette=0) | |
Constructor. | |
virtual void | addRow (IlvTimeScaleRow *row) |
Append the specified IlvTimeScaleRow to the scale. | |
void | applyTransform (const IlvTransformer *) |
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 IlvGraphic * | copy () const |
Copies this object. | |
IlvTimeScalePaintContext * | createPaintContext (IlDate start, IlvDuration duration, IlvRect viewport) |
Create a IlvTimeScalePaintContext . | |
void | draw (IlvPort *, const IlvTransformer *=0, const IlvRegion *=0) const |
Draws the graphic object. | |
IlCalendar * | getCalendar (IlDate time) |
Get the internal calendar set to the specified time. | |
IlCalendar * | getCalendar () |
Get the internal calendar. | |
virtual IlvClassInfo * | getClassInfo () const |
Gets class information. | |
virtual IlInt | getLocation (IlDate time, const IlvTimeScalePaintContext &) |
Get the x position corresponding to the specified time in the specified paint context. | |
virtual IlInt | getLocation (IlDate time) |
Get the x position corresponding to the specified time. | |
virtual IlDate | getMaxVisibleTime () const |
Returns the maximum time that the time scrollable can show. | |
virtual IlDate | getMinVisibleTime () const |
Returns the minimum time that the time scrollable can show. | |
IlDouble | getOffset () const |
Get the scale offset. | |
IlvTimeScalePaintContext * | getPaintContext () |
Gets the scales' cached IlvTimeScalePaintContext . | |
virtual IlvTimeScaleRow * | getRow (IlInt index) const |
Get the IlvTimeScaleRow at a specified index. | |
virtual IlDate | getTime (IlInt x) |
Get the time that is under the x position in the component. | |
IlvTimeConverter * | getTimeConverter () const |
virtual IlvDuration | getVisibleDuration () const |
Returns the duration of the time interval displayed by the time scrollable. | |
virtual IlvTimeInterval | getVisibleInterval () const |
Returns the time interval displayed by the scale. | |
virtual IlDate | getVisibleTime () const |
Returns the beginning of the time interval displayed by the time scrollable. | |
IlDouble | getZoomFactor () const |
Get the scale zoom factor. | |
virtual void | hideRow (IlInt index) |
Hide the specified row. | |
virtual void | hideRow (IlvTimeScaleRow *row) |
Hide the specified row. | |
IlBoolean | isLabelVisible () const |
Returns whether the labels should be visible. | |
IlBoolean | isSeparatorVisible () const |
Returns whether the separators should be visible. | |
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 | move (IlvPos x, IlvPos y) |
Internal methods. | |
virtual IlBoolean | removeRow (IlvTimeScaleRow *row) |
Remove a row from the IlvTimeScale object. | |
void | setLabelVisible (IlBoolean visible) |
Specifies whether the labels should be visible. | |
virtual void | setMaxVisibleTime (IlDate d) |
Sets the maximum time that the time scrollable can show. | |
virtual void | setMinVisibleTime (IlDate d) |
Sets the minimum time that the time scrollable can show. | |
virtual void | setRow (IlInt index, IlvTimeScaleRow *row) |
Change the IlvTimeScaleRow object at a specified index. | |
void | setSeparatorVisible (IlBoolean visible) |
Specifies whether the separators should be visible. | |
void | setTimeConverter (IlvTimeConverter *t) |
Sets the convertor of the time scale. | |
virtual void | setVisibleDuration (IlvDuration duration) |
Sets the duration of the time interval displayed by the time scrollable. | |
virtual void | setVisibleInterval (IlDate time, IlvDuration duration) |
Sets the time interval displayed by the scale. | |
virtual void | setVisibleTime (IlDate time) |
Sets the beginning of the time interval displayed by the time scrollable. | |
virtual void | showRow (IlInt index) |
Show the specified row. | |
virtual void | showRow (IlvTimeScaleRow *row) |
Show the specified row. | |
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. | |
Protected Member Functions | |
void | shiftRows (IlInt index, IlvDim height) |
Shift rows vertically of height. | |
Friends | |
class | IlvTimeScalePaintContext |
Graphic class that displays a time scale.
Library: views
The IlvTimeScale
class is a time scale component that contains several IlvTimeScaleRow
objects. Each row represents a particular time unit and is responsible for drawing itself. The rows are not true UI components, but behave like renderers.
To scroll through the scale or to zoom on it when changing the time value and the visible duration, a new IlvTimeConverter
object must be set for the scale.
setTimeConverter
IlvTimeScale::IlvTimeScale | ( | IlvDisplay * | display, | |
const IlvRect & | drawrect, | |||
IlvPalette * | palette = 0 | |||
) |
Constructor.
Creates a new IlvTimeScale
that initially contains no rows. By default, the time scale uses an IlvLinearTimeConverter
. The time scale's time converter can be set by calling the setTimeConverter
method.
display | The display this graphic will use. | |
drawrect | The rectangle the scale will be drawn into. | |
palette | The palette to use, or 0 to use the default palette. |
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 IlvCalendarScale.
virtual void IlvTimeScale::addRow | ( | IlvTimeScaleRow * | row | ) | [virtual] |
Append the specified IlvTimeScaleRow
to the scale.
To see the modification, you must redraw the object.
row | The row to be added. |
removeRow
void IlvTimeScale::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 IlvTimeScale::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. |
Implements IlvGraphic.
const char* IlvTimeScale::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 IlvCalendarScale.
virtual IlvGraphic* IlvTimeScale::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 IlvCalendarScale.
IlvTimeScalePaintContext* IlvTimeScale::createPaintContext | ( | IlDate | start, | |
IlvDuration | duration, | |||
IlvRect | viewport | |||
) |
Create a IlvTimeScalePaintContext
.
Creates a IlvTimeScalePaintContext
so that the time scale paints the specified time interval into the specified view port. Caller owns the returned object.
start | The begin of the visible time interval. | |
duration | The duration of the visible time interval. | |
viewport | The rectangle defining the position the time scale to paint to. |
void IlvTimeScale::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.
IlCalendar* IlvTimeScale::getCalendar | ( | IlDate | time | ) |
Get the internal calendar set to the specified time.
time | The time to set the calendar to. |
virtual IlvClassInfo* IlvTimeScale::getClassInfo | ( | ) | const [virtual] |
Gets class information.
Returns a pointer to the IlvClassInfo
object associated with this object's class.
Reimplemented from IlvSimpleGraphic.
Reimplemented in IlvCalendarScale.
virtual IlInt IlvTimeScale::getLocation | ( | IlDate | time, | |
const IlvTimeScalePaintContext & | ||||
) | [virtual] |
Get the x position corresponding to the specified time in the specified paint context.
time | The time. | |
context | The paint context. |
virtual IlInt IlvTimeScale::getLocation | ( | IlDate | time | ) | [virtual] |
Get the x position corresponding to the specified time.
time | The time. |
IlDate
. virtual IlDate IlvTimeScale::getMaxVisibleTime | ( | ) | const [virtual] |
Returns the maximum time that the time scrollable can show.
setMaxVisibleTime
Implements IlvTimeScrollable.
virtual IlDate IlvTimeScale::getMinVisibleTime | ( | ) | const [virtual] |
Returns the minimum time that the time scrollable can show.
setMinVisibleTime
Implements IlvTimeScrollable.
IlvTimeScalePaintContext* IlvTimeScale::getPaintContext | ( | ) |
Gets the scales' cached IlvTimeScalePaintContext
.
Gets the cached IlvTimeScalePaintContext
used to paint the time scale on screen.
Caller owns the returned object
static IlAny IlvTimeScale::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 IlvCalendarScale.
virtual IlvTimeScaleRow* IlvTimeScale::getRow | ( | IlInt | index | ) | const [virtual] |
Get the IlvTimeScaleRow
at a specified index.
index | The index of the returned row. The index value must be valid (not greater than the actual number of rows). |
IlvTimeScaleRow
. virtual IlDate IlvTimeScale::getTime | ( | IlInt | x | ) | [virtual] |
Get the time that is under the x position in the component.
x | The x position in the component. |
IlDate
corresponding to the position. IlvTimeConverter* IlvTimeScale::getTimeConverter | ( | ) | const |
Returns the IlvTimeConverter
object of this scale.
virtual IlvDuration IlvTimeScale::getVisibleDuration | ( | ) | const [virtual] |
Returns the duration of the time interval displayed by the time scrollable.
setVisibleDuration
Implements IlvTimeScrollable.
virtual IlvTimeInterval IlvTimeScale::getVisibleInterval | ( | ) | const [virtual] |
Returns the time interval displayed by the scale.
setVisibleInterval
Implements IlvTimeScrollable.
virtual IlDate IlvTimeScale::getVisibleTime | ( | ) | const [virtual] |
Returns the beginning of the time interval displayed by the time scrollable.
setVisibleTime
Implements IlvTimeScrollable.
static const IlvClassInfo* IlvTimeScale::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 IlvCalendarScale.
virtual void IlvTimeScale::hideRow | ( | IlInt | index | ) | [virtual] |
Hide the specified row.
row | The index of the row to be hidden. |
virtual void IlvTimeScale::hideRow | ( | IlvTimeScaleRow * | row | ) | [virtual] |
Hide the specified row.
row | The row to be hidden. |
IlBoolean IlvTimeScale::isLabelVisible | ( | ) | const |
Returns whether the labels should be visible.
IlBoolean IlvTimeScale::isSeparatorVisible | ( | ) | const |
Returns whether the separators should be visible.
IlTrue
if the separators should be visible, otherwise IlFalse
. IlBoolean IlvTimeScale::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 IlvCalendarScale.
IlBoolean IlvTimeScale::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 IlvCalendarScale.
static IlvGraphic* IlvTimeScale::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 IlvCalendarScale.
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 IlvCalendarScale.
virtual IlBoolean IlvTimeScale::removeRow | ( | IlvTimeScaleRow * | row | ) | [virtual] |
Remove a row from the IlvTimeScale
object.
To see the modification, you must redraw the object.
row | The row to be removed. |
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 IlvCalendarScale.
void IlvTimeScale::setLabelVisible | ( | IlBoolean | visible | ) |
Specifies whether the labels should be visible.
visible | IlTrue if the labels should be visible or IlFalse if they should not. |
virtual void IlvTimeScale::setMaxVisibleTime | ( | IlDate | d | ) | [virtual] |
Sets the maximum time that the time scrollable can show.
The current visible time and duration are trimmed to fit the new min-max interval by calling the IlvTimeScrollUtil::trimInterval
method.
d | The maximum visible time. |
getMaxVisibleTime
getVisibleDuration
Implements IlvTimeScrollable.
virtual void IlvTimeScale::setMinVisibleTime | ( | IlDate | d | ) | [virtual] |
Sets the minimum time that the time scrollable can show.
The current visible time and duration are trimmed to fit the new min-max interval by calling the IlvTimeScrollUtil::trimInterval
method.
d | The minimum visible time. |
getMinVisibleTime
getVisibleDuration
Implements IlvTimeScrollable.
virtual void IlvTimeScale::setRow | ( | IlInt | index, | |
IlvTimeScaleRow * | row | |||
) | [virtual] |
Change the IlvTimeScaleRow
object at a specified index.
index | The index of the changed row. The index value must be valid (not greater than the actual number of rows). | |
row | The new IlvTimeScaleRow . |
Reimplemented in IlvCalendarScale.
void IlvTimeScale::setSeparatorVisible | ( | IlBoolean | visible | ) |
Specifies whether the separators should be visible.
visible | IlTrue if the separators should be visible or IlFalse if they shoud not. |
void IlvTimeScale::setTimeConverter | ( | IlvTimeConverter * | t | ) |
Sets the convertor of the time scale.
This method can be used to change the IlvTimeConverter
object of this scale.
This object allows you to draw the scale correctly by converting time value to units on the screen.
timeConverter | The new IlvTimeConverter object. |
virtual void IlvTimeScale::setVisibleDuration | ( | IlvDuration | duration | ) | [virtual] |
Sets the duration of the time interval displayed by the time scrollable.
The specified duration is compared against the min and max visible times and is trimmed if necessary by calling the IlvTimeScrollUtil::trimInterval
method. If you are changing both the visible time and duration, it is preferable to use the setVisibleInterval
method instead.
duration | The new duration value. |
Implements IlvTimeScrollable.
Reimplemented in IlvCalendarScale.
virtual void IlvTimeScale::setVisibleInterval | ( | IlDate | time, | |
IlvDuration | duration | |||
) | [virtual] |
Sets the time interval displayed by the scale.
The specified duration is compared against the min and max visible times and is trimmed if necessary by calling the IlvTimeScrollUtil::trimInterval
method.
time | The new time value. | |
duration | The new duration value. |
getMinVisibleTime
getMaxVisibleTime
Implements IlvTimeScrollable.
Reimplemented in IlvCalendarScale.
virtual void IlvTimeScale::setVisibleTime | ( | IlDate | time | ) | [virtual] |
Sets the beginning of the time interval displayed by the time scrollable.
The specified time value is compared against the min and max visible times and is trimmed if necessary by calling the IlvTimeScrollUtil::trimInterval
method. If you are changing both the visible time and duration, it is preferable to use the setVisibleInterval
method instead.
time | The new time value. |
Implements IlvTimeScrollable.
Shift rows vertically of height.
index | The index of the first row to be shifted. | |
height | The height in pixel of which to shift the rows. |
virtual void IlvTimeScale::showRow | ( | IlInt | index | ) | [virtual] |
Show the specified row.
row | The index of the row to be shown. |
virtual void IlvTimeScale::showRow | ( | IlvTimeScaleRow * | row | ) | [virtual] |
Show the specified row.
row | The row to be shown. |
virtual void IlvTimeScale::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 IlvCalendarScale.
© 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.