TMeterControl Class Reference

A meter control with configurable background and moving part. More...

#include <TMeterControl.h>

Inheritance diagram for TMeterControl:

Inheritance graph
[legend]
Collaboration diagram for TMeterControl:

Collaboration graph
[legend]
List of all members.

Protected Member Functions

 TMeterControl (HIViewRef inControl)
virtual ~TMeterControl ()
virtual OSStatus StillTracking (TCarbonEvent &inEvent, HIPoint &from)
 Called during mouse tracking.
virtual OSStatus StartTracking (TCarbonEvent &inEvent, HIPoint &from)
 Called before tracking.
virtual void CompatibleDraw (RgnHandle inLimitRgn, CGContextRef inContext, bool inCompositing)
 The fun part of the control.
virtual float ScaleY ()

Detailed Description

A meter control with configurable background and moving part.

This meter control operates very much like the standard Aqua meter provided by Apple. The major improvements are configurable background and thumb images, and high precision modes accessed by the option and control keys.

Another feature is that the control can be used either vertically or horizontally, regardless of the original image orientation. The original orientation is determined by the height and width of the background image. If the image is higher than it is wide, the orientation is vertical, otherwise the orientation is horizontal. The thumb is assumed to have the same orientation as the background, but can be any size. So it is possible to have a thumb wider than it is tall when the orientation is vertical.

Like the image orientation, the control orientation is determined by the height and width of the control's bounding rectangle. If its height is greater than its width, the control has a vertical orientation. When the orientation of the background image does not match that of the control, the graphics, both background and thumb, are rotated 90 degrees clockwise.

The control title specifies the base image file name used by the meter. Currently the only file format supported in PNG. The filename given in the control title has ".png" added to it to construct the background image filename. The thumb's filename is the base name plus "Thumb.png".

In addition to the base file name, the title can contain several other fields, each separated by a single space character. These fields are, in order: left inset, top inset, and bottom inset. These field names are for a vertically oriented meter, so they become top inset, left inset, and right inset for a horizontally oriented meter. This is also true for when the meter is rotated due to the bounds orientation.

Another optional feature of the meter is support for a center detent value. If this is used, the cursor will "stick" when the control hits this value and will have to move more pixels than normal to continue sliding. Turn on center detent support by writing a UInt32 value of 1 to the tagged data kSliderControlUseDetentTag, using SetControlData(). Set the value at which the center detent appears (which is 0 by default) using the data tag kSliderControlDetentValueTag. Finally, you can control the range that the value will "fall into" the center detent by setting the kSliderControlDetentRangeTag tagged data. If the range is 100, then the difference between the current value and the center detent value must be less than 100 for the mouse to stick.


Constructor & Destructor Documentation

TMeterControl::TMeterControl HIViewRef  inControl  )  [protected]
 

TMeterControl::~TMeterControl  )  [protected, virtual]
 


Member Function Documentation

void TMeterControl::CompatibleDraw RgnHandle  inLimitRgn,
CGContextRef  inContext,
bool  inCompositing
[protected, virtual]
 

The fun part of the control.

XXX need to test with vertically oriented images

Reimplemented from TSliderControl.

Reimplemented in TMeterPartialControl.

float TMeterControl::ScaleY  )  [protected, virtual]
 

Reimplemented from TSliderControl.

OSStatus TMeterControl::StartTracking TCarbonEvent &  inEvent,
HIPoint &  from
[protected, virtual]
 

Called before tracking.

The new control value is calculated so that the slider thumb ends up centered on the mouse. This takes into account all of the inset and size values, and also considers the background image and thumb orientation compared to the slider orientation.

Reimplemented from TSliderControl.

OSStatus TMeterControl::StillTracking TCarbonEvent &  inEvent,
HIPoint &  from
[protected, virtual]
 

Called during mouse tracking.

Works basically the same as the StartTracking() member function, except that thus function also calculates the amount of control value change based on how much the mouse position has changed since the last call to StillTracking(). This delta value is used for the control and option key modifiers, for higher precision slider control.

Reimplemented from TSliderControl.


The documentation for this class was generated from the following files:




Generated on Sat Jul 8 13:09:58 2006 for AUGUI Framework by doxygen1.4.6

hosted on SourceForge.net Logo