TSliderControl Class Reference

A slider control with configurable background and thumb images. More...

#include <TSliderControl.h>

Inheritance diagram for TSliderControl:

Inheritance graph
[legend]
Collaboration diagram for TSliderControl:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual void SetProperty (OSType propID, double value)
virtual void SetProperty (OSType propID, CFStringRef value)
virtual void SetProperty (OSType propID, int32_t value)
virtual bool GetProperty (OSType propID, double &value)
virtual bool GetProperty (OSType propID, int32_t &value)
virtual bool GetProperty (OSType propID, CFStringRef &value)

Protected Types

enum  SliderOrientation { kHorizontalOrientation, kVerticalOrientation }

Protected Member Functions

 TSliderControl (HIViewRef inControl)
virtual ~TSliderControl ()
virtual ControlKind GetKind ()
virtual bool UseNonblockingTracking ()
 To enable the non-blocking tracking a subclass must override this method to return true.
virtual OSStatus Initialize (TCarbonEvent &inEvent)
virtual OSStatus StillTracking (TCarbonEvent &inEvent, HIPoint &from)
 Called during mouse tracking.
virtual OSStatus StartTracking (TCarbonEvent &inEvent, HIPoint &from)
 Called before tracking.
virtual void DrawStaticBackground (RgnHandle inLimitRgn, CGContextRef inContext, bool inCompositing)
 The fun part of the control.
virtual void CompatibleDraw (RgnHandle inLimitRgn, CGContextRef inContext, bool inCompositing)
 The fun part of the control.
virtual void TitleChanged ()
virtual void ValueChanged ()
virtual UInt32 GetBehaviors ()
virtual OSStatus SetData (OSType inTag, ControlPartCode inPart, Size inSize, const void *inPtr)
virtual OSStatus GetData (OSType inTag, ControlPartCode inPart, Size inSize, Size *outSize, void *inPtr)
 Get some data about the view Only 'TVew' is supported.
SInt32 GetCorrectedValue ()
void SetCorrectedValue (SInt32 val)
virtual float ScaleX ()
virtual float ScaleY ()
SliderOrientation OrientationForRect (const TRect &theRect)
TRect ScaledThumbBounds ()
TRect BackgroundRect ()

Protected Attributes

CGImageRef mThumbImage
CGImageRef mBackImage
CFStringRef mImageName
float mXInset
float mTopInset
float mBottomInset
SliderOrientation mImageOrientation
bool mUseDetent
SInt32 mDetentValue
SInt32 mDetentRange
float mTotalDetentMoved
bool mRevert

Detailed Description

A slider control with configurable background and thumb images.

This slider control operates very much like the standard Aqua slider 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 slider. 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 slider, so they become top inset, left inset, and right inset for a horizontally oriented slider. This is also true for when the slider is rotated due to the bounds orientation.

Another optional feature of the slider 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.


Member Enumeration Documentation

enum TSliderControl::SliderOrientation [protected]
 

Enumerator:
kHorizontalOrientation 
kVerticalOrientation 


Constructor & Destructor Documentation

TSliderControl::TSliderControl HIViewRef  inControl  )  [protected]
 

TSliderControl::~TSliderControl  )  [protected, virtual]
 


Member Function Documentation

TRect TSliderControl::BackgroundRect  )  [protected]
 

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

The fun part of the control.

XXX need to test with vertically oriented images

Implements TViewNoCompositingCompatible.

Reimplemented in TArcSliderControl, TArcSliderControl2, TMeterControl, TMeterPartialControl, and TMinMaxSlider.

void TSliderControl::DrawStaticBackground RgnHandle  inLimitRgn,
CGContextRef  inContext,
bool  inCompositing
[protected, virtual]
 

The fun part of the control.

XXX need to test with vertically oriented images

Reimplemented from TViewNoCompositingCompatible.

Reimplemented in TArcSliderControl, and TArcSliderControl2.

virtual UInt32 TSliderControl::GetBehaviors  )  [inline, protected, virtual]
 

GetBehaviors

Reimplemented from TViewNoCompositingCompatible.

SInt32 TSliderControl::GetCorrectedValue  )  [protected]
 

OSStatus TSliderControl::GetData OSType  inTag,
ControlPartCode  inPart,
Size  inSize,
Size *  outSize,
void *  inPtr
[protected, virtual]
 

Get some data about the view Only 'TVew' is supported.

It is returning the C++ object.

Reimplemented from TViewNoCompositingCompatible.

Reimplemented in TMinMaxSlider.

ControlKind TSliderControl::GetKind  )  [protected, virtual]
 

Reimplemented in TMinMaxSlider.

bool TSliderControl::GetProperty OSType  propID,
CFStringRef &  value
[virtual]
 

Reimplemented from TViewNoCompositingCompatible.

bool TSliderControl::GetProperty OSType  propID,
int32_t &  value
[virtual]
 

Reimplemented from TViewNoCompositingCompatible.

bool TSliderControl::GetProperty OSType  propID,
double &  value
[virtual]
 

Reimplemented from TViewNoCompositingCompatible.

Reimplemented in TArcSliderControl2.

OSStatus TSliderControl::Initialize TCarbonEvent &  inEvent  )  [protected, virtual]
 

TSliderControl::SliderOrientation TSliderControl::OrientationForRect const TRect &  theRect  )  [protected]
 

TRect TSliderControl::ScaledThumbBounds  )  [protected]
 

float TSliderControl::ScaleX  )  [protected, virtual]
 

float TSliderControl::ScaleY  )  [protected, virtual]
 

Reimplemented in TMeterControl.

void TSliderControl::SetCorrectedValue SInt32  val  )  [protected]
 

OSStatus TSliderControl::SetData OSType  inTag,
ControlPartCode  inPart,
Size  inSize,
const void *  inPtr
[protected, virtual]
 

Reimplemented in TMinMaxSlider.

void TSliderControl::SetProperty OSType  propID,
int32_t  value
[virtual]
 

Reimplemented from TViewNoCompositingCompatible.

void TSliderControl::SetProperty OSType  propID,
CFStringRef  value
[virtual]
 

Reimplemented from TViewNoCompositingCompatible.

void TSliderControl::SetProperty OSType  propID,
double  value
[virtual]
 

Reimplemented from TViewNoCompositingCompatible.

Reimplemented in TArcSliderControl2.

OSStatus TSliderControl::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 TViewNoCompositingCompatible.

Reimplemented in TArcSliderControl2, TMeterControl, and TMinMaxSlider.

OSStatus TSliderControl::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 TViewNoCompositingCompatible.

Reimplemented in TArcSliderControl2, TMeterControl, and TMinMaxSlider.

void TSliderControl::TitleChanged  )  [protected, virtual]
 

Reimplemented in TArcSliderControl, and TArcSliderControl2.

virtual bool TSliderControl::UseNonblockingTracking  )  [inline, protected, virtual]
 

To enable the non-blocking tracking a subclass must override this method to return true.

Reimplemented from TViewNoCompositingCompatible.

void TSliderControl::ValueChanged  )  [protected, virtual]
 


Member Data Documentation

CGImageRef TSliderControl::mBackImage [protected]
 

float TSliderControl::mBottomInset [protected]
 

SInt32 TSliderControl::mDetentRange [protected]
 

SInt32 TSliderControl::mDetentValue [protected]
 

CFStringRef TSliderControl::mImageName [protected]
 

SliderOrientation TSliderControl::mImageOrientation [protected]
 

bool TSliderControl::mRevert [protected]
 

CGImageRef TSliderControl::mThumbImage [protected]
 

float TSliderControl::mTopInset [protected]
 

float TSliderControl::mTotalDetentMoved [protected]
 

bool TSliderControl::mUseDetent [protected]
 

float TSliderControl::mXInset [protected]
 


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




Generated on Sat Jul 8 13:10:49 2006 for AUGUI Framework by doxygen1.4.6

hosted on SourceForge.net Logo