rwlogo

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Friends
IlvTimeScaleRow Class Referenceabstract

Time scale row class. More...

#include <ilviews/graphics/timescalerow.h>

Inheritance diagram for IlvTimeScaleRow:
IlvDayTimeScaleRow IlvHalfDayTimeScaleRow IlvHourTimeScaleRow IlvMinuteTimeScaleRow IlvMonthTimeScaleRow IlvQuarterTimeScaleRow IlvWeekTimeScaleRow IlvYearTimeScaleRow

Public Types

enum  TextPos { LEFT, RIGHT, CENTER }
 Position of labels in a time scale row. This type indicates the predefined positions of the labels in a time scale row. More...
 

Public Member Functions

 IlvTimeScaleRow (IlvTimeScale *parent)
 Constructor. More...
 
virtual IlvTimeScaleRowcopy () const
 Returns a copy of the current time scale row.
 
IlString getAdditionalString () const
 Returns the additional text string displayed in the first interval. More...
 
IlCalendargetCalendar () const
 Gets the internal calendar of the parent scale.
 
IlCalendargetCalendar (IlDate time) const
 Gets the internal calendar of the parent scale set to the specified time. More...
 
IlvDisplaygetDisplay () const
 Returns the IlvDisplay of the parent scale.
 
IlInt getIntervalMinWidth () const
 Returns the minimal interval required to draw a text between two ticks. More...
 
IlvPalettegetPalette () const
 Returns the IlvPalette of the parent scale.
 
virtual IlInt getPreferredHeight () const
 Returns the preferred height of the time scale row.
 
IlvColorgetTextColor () const
 Gets the color of the row labels.
 
IlvFontgetTextFont () const
 Gets the font of the row labels.
 
IlvPalettegetTextPalette () const
 Gets the palette of the row labels.
 
TextPos getTextPosition () const
 Returns the position of labels. More...
 
IlvColorgetTickColor () const
 Gets the color of the row ticks.
 
IlvPalettegetTickPalette () const
 Gets the palette of the row ticks.
 
IlvTimeScalegetTimeScale () const
 Gets the referring time scale. More...
 
const IlTimeUnitgetTimeUnit () const
 Gets the internal time unit.
 
virtual
IlvTimeScaleRowFactory::rowtype 
getType () const =0
 Returns the type of the IlvTimeScaleRow. More...
 
virtual IlDate incrementTime (IlDate dateval)=0
 Increments the specified date by the value of the scale time unit. More...
 
IlBoolean isOverlappingLabelAllowed () const
 Indicates whether overlapping labels are allowed. More...
 
IlBoolean isVisible ()
 Indicates whether the row is visible. More...
 
virtual IlDate nextUnitTime (IlDate dateval)
 Computes the next unit value after the specified date. More...
 
virtual IlDate previousUnitTime (IlDate dateval)=0
 Computes the previous unit value before the specified date. More...
 
virtual void read (IlvInputFile &infile)
 Reads the time scale row description from an input file. More...
 
void setAdditionalString (IlString str)
 Sets the additional text string displayed in the first interval. More...
 
void setIntervalMinWidth (IlInt value)
 Sets the minimal interval required to draw a text between two ticks. More...
 
void setOverlappingLabelAllowed (IlBoolean overlap)
 Specifies whether overlapping labels are allowed. More...
 
void setTextColor (IlvColor *c)
 Sets the color of the row labels.
 
void setTextFont (IlvFont *f)
 Sets the font of the row labels.
 
void setTextPosition (TextPos pos)
 Sets the position of labels. More...
 
void setTickColor (IlvColor *c)
 Sets the colors of the row ticks.
 
void setTimeScale (IlvTimeScale *timescale)
 Sets the referring IlvTimeScale. More...
 
void setVisible (IlBoolean visible)
 Sets the visibility of the time scale row. More...
 
virtual void write (IlvOutputFile &outfile) const
 Saves the time scale row in an output file. More...
 

Protected Member Functions

virtual IlvTimeScaleRowcloneType (IlvTimeScale *scale) const =0
 Returns an object of the same type. More...
 
virtual void draw (IlvPort *dst, const IlvTransformer *t, const IlvTimeScalePaintContext &context, const IlvRect &rect) const
 Draws the time scale row on a specified port. More...
 
virtual void drawLabel (IlvPort *dst, const IlvTransformer *t, const IlvPoint &prevPos, const IlvPoint &nextPos, IlString text) const
 Draws a label in a scale interval. More...
 
virtual void drawTick (IlvPort *dst, const IlvTransformer *t, const IlvPoint &pos, IlInt height) const
 Draws a scale row tick. More...
 

Friends

class IlvTimeScale
 

Detailed Description

Time scale row class.

Library: views

This class represents a row which can be put in a IlvTimeScale.

All drawing operations are defined at this level. You should extend this class to determine the time unit management by overriding the previousUnitTime() method. The drawing operations are done in the draw() method, which displays ticks to separate each unit interval. These ticks are drawn using the drawTick() method. In the intervals, text representing the time is drawn by the drawLabel() method. By default, the text is displayed to the left of the interval.

See Also
previousUnitTime()

Member Enumeration Documentation

Position of labels in a time scale row. This type indicates the predefined positions of the labels in a time scale row.

See Also
setTextPosition()
Enumerator
LEFT 

The text is left-aligned in the interval (default behavior).

RIGHT 

The text is right-aligned in the interval.

CENTER 

The text is centered in the interval.

Constructor & Destructor Documentation

IlvTimeScaleRow::IlvTimeScaleRow ( IlvTimeScale parent)

Constructor.

This constructor creates a new instance of a time scale row. This instance can be added to an IlvTimeScale object using the addRow() method. Then, it can be removed using the removeRow() method.

Parameters
parentThe IlvTimeScale which this row is part of.
See Also
IlvTimeScale::addRow()
IlvTimeScale::setRow()
IlvTimeScale::removeRow()

Member Function Documentation

virtual IlvTimeScaleRow* IlvTimeScaleRow::cloneType ( IlvTimeScale scale) const
protectedpure virtual

Returns an object of the same type.

This method should be implemented by subclasses. It must return an object of the same type as the object on which the method is called, attached to the given IlvTimeScale.

Parameters
scaleThe IlvTimeScale on which the row is attached.
Returns
A newly allocated object of the same type as the object on which the method is called.

Implemented in IlvMinuteTimeScaleRow, IlvHourTimeScaleRow, IlvHalfDayTimeScaleRow, IlvDayTimeScaleRow, IlvWeekTimeScaleRow, IlvMonthTimeScaleRow, IlvQuarterTimeScaleRow, and IlvYearTimeScaleRow.

virtual void IlvTimeScaleRow::draw ( IlvPort dst,
const IlvTransformer t,
const IlvTimeScalePaintContext context,
const IlvRect rect 
) const
protectedvirtual

Draws the time scale row on a specified port.

This method is overridden to draw the scale row on the specified IlvPort and with the specified IlvTimeScalePaintContext.

It calls drawTick() to perform tick drawings and drawText() to label the intervals. It also uses nextUnitTime() to increment the intervals.

Parameters
dstThe destination port.
tThe transformer value. If 0, no transformation is performed.
rectThe rectangle in which the scale row should be drawn. The rectangle should be in the destination (IlvPort) coordinates.
contextThe paint context in which the scale row paints.
See Also
drawTick()
drawText()
getTimeScale()
nextUnitTime()
IlvTimeScale::getTime()
IlvTimeScale::getLocation()
virtual void IlvTimeScaleRow::drawLabel ( IlvPort dst,
const IlvTransformer t,
const IlvPoint prevPos,
const IlvPoint nextPos,
IlString  text 
) const
protectedvirtual

Draws a label in a scale interval.

This method is called to draw the label corresponding to a scale interval. This interval is defined by the rectangle (prevPos, nextPos). The text can be centered using the setTextPosition() method. The color can be changed using the setTextColor() method. The text IlString representing the time is returned by the computeDateText() method and can be preceded by an additional string set using the setAdditionalString() method if the interval begins before the visible part of the scale.

Parameters
dstThe destination port.
tThe transformer value. If 0, no transformation is performed.
prevPosThe top-left corner of the rectangle.
nextPosThe bottom-right corner of the rectangle.
textThe text to draw.
virtual void IlvTimeScaleRow::drawTick ( IlvPort dst,
const IlvTransformer t,
const IlvPoint pos,
IlInt  height 
) const
protectedvirtual

Draws a scale row tick.

This method is called to draw a tick in the scale. A tick is the line drawn between two time unit intervals.

Parameters
dstThe destination port.
tThe transformer value. If 0, no transformation is performed.
posThe bottom point of the tick.
heightThe maximum height of the tick.
See Also
setTickColor()
IlString IlvTimeScaleRow::getAdditionalString ( ) const

Returns the additional text string displayed in the first interval.

The string is displayed before the text of the first interval that opens to the left of the row if this interval extends beyond the visible part of the scale.

Returns
The text string to display.
IlCalendar* IlvTimeScaleRow::getCalendar ( IlDate  time) const

Gets the internal calendar of the parent scale set to the specified time.

Parameters
timeThe time to set the calendar to.
IlInt IlvTimeScaleRow::getIntervalMinWidth ( ) const

Returns the minimal interval required to draw a text between two ticks.

If the interval width is less than this value, the text is not drawn. If the value has never been set, the method returns -1 and the width of the first text displayed is used as the minimum width.

Returns
The minimal interval value, in pixels.
TextPos IlvTimeScaleRow::getTextPosition ( ) const

Returns the position of labels.

Returns
The position of labels in the time scale row. The default value is LEFT.
See Also
setTextPosition()
IlvTimeScale* IlvTimeScaleRow::getTimeScale ( ) const

Gets the referring time scale.

Returns
The IlvTimeScale which the row is part of.
virtual IlvTimeScaleRowFactory::rowtype IlvTimeScaleRow::getType ( ) const
pure virtual
virtual IlDate IlvTimeScaleRow::incrementTime ( IlDate  dateval)
pure virtual

Increments the specified date by the value of the scale time unit.

For example, in a timescale row whose time unit has been set to the minute, the increment time of January 14th 2001 8:12:34 is January 14th 2001 8:13:34. To implement this method, you can use a IlCalendar object provided by IlvTimeScale::getCalendar().

Parameters
datevalThe date to increment.
Returns
The value dateval + scale time unit.
See Also
IlvTimeScale::getCalendar()

Implemented in IlvMinuteTimeScaleRow, IlvHourTimeScaleRow, IlvHalfDayTimeScaleRow, IlvDayTimeScaleRow, IlvWeekTimeScaleRow, IlvMonthTimeScaleRow, IlvQuarterTimeScaleRow, and IlvYearTimeScaleRow.

IlBoolean IlvTimeScaleRow::isOverlappingLabelAllowed ( ) const

Indicates whether overlapping labels are allowed.

Returns
IlTrue if overlapping labels are allowed, otherwise IlFalse.
IlBoolean IlvTimeScaleRow::isVisible ( )

Indicates whether the row is visible.

Returns
IlTrue if the row is visible and IlFalse if it is not.
virtual IlDate IlvTimeScaleRow::nextUnitTime ( IlDate  dateval)
virtual

Computes the next unit value after the specified date.

If dateval is already an integer unit value, the method returns a copy of it. The method implementation depends on the unit of the scale row. For example, in a minute-unit time scale row, the next unit time of January 14th, 2001, 8:12:34 is January 14th, 2001, 8:13:00, and the next unit time of January 14th, 2001, 9:01:00 is January 14th, 2001, 9:01:00. This method is necessary for integer-zoom interaction on the scale and useful when drawing it. To implement this method, you can use a IlCalendar object provided by IlvTimeScale::getCalendar().

Parameters
datevalThe date to ceil.
See Also
IlvTimeScale::getCalendar()
virtual IlDate IlvTimeScaleRow::previousUnitTime ( IlDate  dateval)
pure virtual

Computes the previous unit value before the specified date.

If dateval is already an integer unit value, the method returns a copy of it. For example, in a minute-unit time scale row, the previous unit time of January 14th, 2001, 8:12:34 is January 14th, 2001, 8:12:00, and the previous unit time of January 14th, 2001, 9:01:00 is January 14th, 2001, 9:01:00. Its implementation depends on the unit of the scale row. This method is necessary for integer-zoom interaction on the scale. To implement this method, you can use a IlCalendar object provided by IlvTimeScale::getCalendar().

Parameters
datevalThe date to floor.
See Also
IlvTimeScale::getCalendar()

Implemented in IlvMinuteTimeScaleRow, IlvHourTimeScaleRow, IlvHalfDayTimeScaleRow, IlvDayTimeScaleRow, IlvWeekTimeScaleRow, IlvMonthTimeScaleRow, IlvQuarterTimeScaleRow, and IlvYearTimeScaleRow.

virtual void IlvTimeScaleRow::read ( IlvInputFile infile)
virtual

Reads the time scale row description from an input file.

Parameters
infileThe input file.

Reimplemented in IlvMinuteTimeScaleRow, IlvHourTimeScaleRow, IlvHalfDayTimeScaleRow, IlvDayTimeScaleRow, IlvWeekTimeScaleRow, IlvMonthTimeScaleRow, IlvQuarterTimeScaleRow, and IlvYearTimeScaleRow.

void IlvTimeScaleRow::setAdditionalString ( IlString  str)

Sets the additional text string displayed in the first interval.

This string is displayed before the text of the time unit interval at the left side of the row if this interval extends beyond the visible part of the scale.

Parameters
strThe text string.
void IlvTimeScaleRow::setIntervalMinWidth ( IlInt  value)

Sets the minimal interval required to draw a text between two ticks.

If the interval width is less than this value, the text is not drawn. By default, the minimal interval is defined by the width of the first text displayed in the row.

Parameters
valueThe interval to set, in pixels.
void IlvTimeScaleRow::setOverlappingLabelAllowed ( IlBoolean  overlap)

Specifies whether overlapping labels are allowed.

Parameters
overlapIlTrue if overlapping labels are allowed, IlFalse if they are not.
void IlvTimeScaleRow::setTextPosition ( TextPos  pos)

Sets the position of labels.

Parameters
posCan take the TextPos values LEFT, RIGHT or CENTER.
void IlvTimeScaleRow::setTimeScale ( IlvTimeScale timescale)

Sets the referring IlvTimeScale.

Parameters
timescaleThe time scale which the row is part of.
void IlvTimeScaleRow::setVisible ( IlBoolean  visible)

Sets the visibility of the time scale row.

Parameters
visibleIlTrue to make the time scale row visible and IlFalse to make it invisible.
virtual void IlvTimeScaleRow::write ( IlvOutputFile outfile) const
virtual

Saves the time scale row in an output file.

Parameters
outfileThe output file.

Reimplemented in IlvMinuteTimeScaleRow, IlvHourTimeScaleRow, IlvHalfDayTimeScaleRow, IlvDayTimeScaleRow, IlvWeekTimeScaleRow, IlvMonthTimeScaleRow, IlvQuarterTimeScaleRow, and IlvYearTimeScaleRow.


© Copyright 2015, 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.