Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Time scale row class. More...
#include <ilviews/graphics/timescalerow.h>
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 IlvTimeScaleRow * | copy () const |
Returns a copy of the current time scale row. | |
IlString | getAdditionalString () const |
Returns the additional text string displayed in the first interval. More... | |
IlCalendar * | getCalendar () const |
Gets the internal calendar of the parent scale. | |
IlCalendar * | getCalendar (IlDate time) const |
Gets the internal calendar of the parent scale set to the specified time. More... | |
IlvDisplay * | getDisplay () const |
Returns the IlvDisplay of the parent scale. | |
IlInt | getIntervalMinWidth () const |
Returns the minimal interval required to draw a text between two ticks. More... | |
IlvPalette * | getPalette () const |
Returns the IlvPalette of the parent scale. | |
virtual IlInt | getPreferredHeight () const |
Returns the preferred height of the time scale row. | |
IlvColor * | getTextColor () const |
Gets the color of the row labels. | |
IlvFont * | getTextFont () const |
Gets the font of the row labels. | |
IlvPalette * | getTextPalette () const |
Gets the palette of the row labels. | |
TextPos | getTextPosition () const |
Returns the position of labels. More... | |
IlvColor * | getTickColor () const |
Gets the color of the row ticks. | |
IlvPalette * | getTickPalette () const |
Gets the palette of the row ticks. | |
IlvTimeScale * | getTimeScale () const |
Gets the referring time scale. More... | |
const IlTimeUnit * | getTimeUnit () 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 IlvTimeScaleRow * | cloneType (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 |
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.
previousUnitTime
Position of labels in a time scale row. This type indicates the predefined positions of the labels in a time scale row.
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. |
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.
parent | The IlvTimeScale which this row is part of. |
|
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
.
scale | The IlvTimeScale on which the row is attached. |
Implemented in IlvMinuteTimeScaleRow, IlvHourTimeScaleRow, IlvHalfDayTimeScaleRow, IlvDayTimeScaleRow, IlvWeekTimeScaleRow, IlvMonthTimeScaleRow, IlvQuarterTimeScaleRow, and IlvYearTimeScaleRow.
|
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.
dst | The destination port. |
t | The transformer value. If 0, no transformation is performed. |
rect | The rectangle in which the scale row should be drawn. The rectangle should be in the destination (IlvPort) coordinates. |
context | The paint context in which the scale row paints. |
drawTick
#drawText
getTimeScale
nextUnitTime
IlvTimeScale::getTime
IlvTimeScale::getLocation
|
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.
dst | The destination port. |
t | The transformer value. If 0, no transformation is performed. |
prevPos | The top-left corner of the rectangle. |
nextPos | The bottom-right corner of the rectangle. |
text | The text to draw. |
|
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.
dst | The destination port. |
t | The transformer value. If 0, no transformation is performed. |
pos | The bottom point of the tick. |
height | The maximum height of the tick. |
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.
IlCalendar* IlvTimeScaleRow::getCalendar | ( | IlDate | time | ) | const |
Gets the internal calendar of the parent scale set to the specified time.
time | The 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.
TextPos IlvTimeScaleRow::getTextPosition | ( | ) | const |
Returns the position of labels.
LEFT
. setTextPosition
IlvTimeScale* IlvTimeScaleRow::getTimeScale | ( | ) | const |
Gets the referring time scale.
IlvTimeScale
which the row is part of.
|
pure virtual |
Returns the type of the IlvTimeScaleRow
.
IlvTimeScaleRow
. Implemented in IlvMinuteTimeScaleRow, IlvHourTimeScaleRow, IlvHalfDayTimeScaleRow, IlvDayTimeScaleRow, IlvWeekTimeScaleRow, IlvMonthTimeScaleRow, IlvQuarterTimeScaleRow, and IlvYearTimeScaleRow.
|
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
.
dateval | The date to increment. |
+
scale time unit. IlvTimeScale::getCalendar
Implemented in IlvMinuteTimeScaleRow, IlvHourTimeScaleRow, IlvHalfDayTimeScaleRow, IlvDayTimeScaleRow, IlvWeekTimeScaleRow, IlvMonthTimeScaleRow, IlvQuarterTimeScaleRow, and IlvYearTimeScaleRow.
IlBoolean IlvTimeScaleRow::isOverlappingLabelAllowed | ( | ) | const |
Indicates whether overlapping labels are allowed.
IlTrue
if overlapping labels are allowed, otherwise IlFalse
. IlBoolean IlvTimeScaleRow::isVisible | ( | ) |
Indicates whether the row is visible.
IlTrue
if the row is visible and IlFalse
if it is not.
|
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
.
dateval | The date to ceil. |
IlvTimeScale::getCalendar
|
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
.
dateval | The date to floor. |
IlvTimeScale::getCalendar
Implemented in IlvMinuteTimeScaleRow, IlvHourTimeScaleRow, IlvHalfDayTimeScaleRow, IlvDayTimeScaleRow, IlvWeekTimeScaleRow, IlvMonthTimeScaleRow, IlvQuarterTimeScaleRow, and IlvYearTimeScaleRow.
|
virtual |
Reads the time scale row description from an input file.
infile | The 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.
str | The 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.
value | The interval to set, in pixels. |
void IlvTimeScaleRow::setOverlappingLabelAllowed | ( | IlBoolean | overlap | ) |
Specifies whether overlapping labels are allowed.
overlap | IlTrue if overlapping labels are allowed, IlFalse if they are not. |
void IlvTimeScaleRow::setTextPosition | ( | TextPos | pos | ) |
void IlvTimeScaleRow::setTimeScale | ( | IlvTimeScale * | timescale | ) |
Sets the referring IlvTimeScale
.
timescale | The time scale which the row is part of. |
void IlvTimeScaleRow::setVisible | ( | IlBoolean | visible | ) |
Sets the visibility of the time scale row.
visible | IlTrue to make the time scale row visible and IlFalse to make it invisible. |
|
virtual |
Saves the time scale row in an output file.
outfile | The output file. |
Reimplemented in IlvMinuteTimeScaleRow, IlvHourTimeScaleRow, IlvHalfDayTimeScaleRow, IlvDayTimeScaleRow, IlvWeekTimeScaleRow, IlvMonthTimeScaleRow, IlvQuarterTimeScaleRow, and IlvYearTimeScaleRow.
© 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.