TSliderRuler, derived from MGraphic, is a concrete class for providing a ruler for use with slider controls. This class implements the drawing of the ruler and the specifications of the minimum and maximum values on the ruler, the interval between ruler values, the ruler layout relative to the slider track, and the number formatter and styles used to display the ruler numbers.
When you construct a TSliderRuler, initialize its parameters before adopting the ruler into the slider control. If you need to change the parameters (such as the ruler coordinates) later, then you should first orphan the TSliderRuler from the slider control. Then, make your changes and adopt the TSliderRuler back into the slider control. Changes to the ruler while it is adopted in the slider control will foul up the layout of the slider, and are not supported.
Sets the ruler constraints. The minimum is the first number in the ruler, the maximum is the last number in the ruler, and the intervalSize is the amount by which the numbers increase (or decrease). Remember that the numbers shown on the ruler have no bearing on the numbers stored in the float state. The float constraints defined in the float state can be completely different from the numbers displayed on the ruler. The ruler is purely for presentation purposes only. Specify an interval size greater than zero to force the display of the optional ruler.
This does not do a relayout, nor a redraw. After calling this function, you should call GetPreferredSize and then SetBounds to set the new bounds.
Calling Context:
Call this function directly.
Parameters:
double minimum -The smallest number displayed on the ruler.
double maximum -The largest number displayed on the ruler.
double intervalSize -The interval at which other values are placed along the ruler.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Sets the layout orientation of this ruler relative to the slider track. A kLeftToRight layout indicates (for a vertical slider) that the ruler appears on the left and the track appears on the right. The order is reversed for a kRightToLeft layout. A kTopToBottom layout indicates (for a horizontal slider) that the ruler appears above and the track appears below. The order is reversed for a kBottomToTop layout.
Calling Context:
Call this function directly.
Parameters:
MControl :: ELayout rulerLayout -The orientation to set.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Returns the current tick mark length, thumb margin, and number margin of the ruler. The tick mark length determines how long each ruler tick mark should be. The thumb margin determines the amount of space between the edge of the thumb and the tick marks. The number margin determines the amount of space between each tick mark and the number displayed next to it.
Calling Context:
Call this function directly.
Parameters:
GCoordinate & tickLength -Receives the tick mark length.
GCoordinate & thumbMargin -Receives the amount of space between the edge of the thumb and the tick marks.
GCoordinate & numberMargin -Receives the amount of space between each tick mark and the number displayed next to it.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Sets the current tick mark length, thumb margin, and number margin of the ruler. The tick mark length determines how long each tick mark should be. The thumb margin determines the amount of space between the edge of the thumb and the tick marks. The number margin determines the amount of space between each tick mark and the number displayed next to it.
Calling Context:
Call this function directly.
Parameters:
GCoordinate tickLength -The tick mark length.
GCoordinate thumbMargin -The amount of space between the edge of the thumb and the tick marks.
GCoordinate numberMargin -The amount of space between each tick mark and the number displayed next to it.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Adopts the specified formatter to format the numbers displayed on the ruler. The initial formatter is a TFloatingPointNumberFormat with no integer separators, a maximum of 3 fractional digits, and a maximum number of 9999999. Adopting a NIL formatter removes the number formatter altogether, which results in no numbers. This is useful if you just want tick marks only.
Orphans the current ruler number formatter. If no new formatter is adopted, this results in no numbers at all. This is useful if you just want tick marks only.
Calling Context:
Call this function directly.
Parameters:
Takes no parameters.
Return Value:
Returns the orphaned ruler number formatter.
Exceptions:
Throws no exceptions, passes all exceptions through.