Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

TEnvelop Class Reference

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

#include <TEnvelop.h>

Inheritance diagram for TEnvelop:

Inheritance graph
[legend]
Collaboration diagram for TEnvelop:

Collaboration graph
[legend]
List of all members.

Static Public Member Functions

CFStringRef GetControlName ()

Protected Types

enum  SliderOrientation { kHorizontalOrientation, kVerticalOrientation }

Protected Member Functions

 TEnvelop (HIViewRef inControl)
virtual ~TEnvelop ()
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.

virtual float ScaleX ()
virtual float ScaleY ()
SliderOrientation OrientationForRect (const TRect &theRect)
TRect ScaledThumbBounds ()

Protected Attributes

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

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 TEnvelop::SliderOrientation [protected]
 

Enumeration values:
kHorizontalOrientation 
kVerticalOrientation 


Constructor & Destructor Documentation

TEnvelop::TEnvelop HIViewRef  inControl  )  [protected]
 

TEnvelop::~TEnvelop  )  [protected, virtual]
 


Member Function Documentation

void TEnvelop::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.

void TEnvelop::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.

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

GetBehaviors

Reimplemented from TViewNoCompositingCompatible.

CFStringRef TEnvelop::GetControlName  )  [inline, static]
 

OSStatus TEnvelop::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.

ControlKind TEnvelop::GetKind  )  [protected, virtual]
 

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

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

TRect TEnvelop::ScaledThumbBounds  )  [protected]
 

float TEnvelop::ScaleX  )  [protected, virtual]
 

float TEnvelop::ScaleY  )  [protected, virtual]
 

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

OSStatus TEnvelop::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.

OSStatus TEnvelop::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.

void TEnvelop::TitleChanged  )  [protected, virtual]
 

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

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

Reimplemented from TViewNoCompositingCompatible.

void TEnvelop::ValueChanged  )  [protected, virtual]
 


Member Data Documentation

CGImageRef TEnvelop::mBackImage [protected]
 

float TEnvelop::mBottomInset [protected]
 

SInt32 TEnvelop::mDetentRange [protected]
 

SInt32 TEnvelop::mDetentValue [protected]
 

SliderOrientation TEnvelop::mImageOrientation [protected]
 

CGImageRef TEnvelop::mThumbImage [protected]
 

float TEnvelop::mTopInset [protected]
 

float TEnvelop::mTotalDetentMoved [protected]
 

bool TEnvelop::mUseDetent [protected]
 

float TEnvelop::mXInset [protected]
 


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




Generated on Sun May 23 19:32:04 2004 for AUGUI Framework by doxygen1.3.7

hosted on SourceForge.net Logo