TSliderControl Class Reference
A slider control with configurable background and thumb images.
More...
#include <TSliderControl.h>
Inheritance diagram for TSliderControl:
[legend]Collaboration diagram for TSliderControl:
[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
|
- 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] |
|
void TSliderControl::DrawStaticBackground |
( |
RgnHandle |
inLimitRgn, |
|
|
CGContextRef |
inContext, |
|
|
bool |
inCompositing |
|
) |
[protected, virtual] |
|
virtual UInt32 TSliderControl::GetBehaviors |
( |
|
) |
[inline, protected, virtual] |
|
SInt32 TSliderControl::GetCorrectedValue |
( |
|
) |
[protected] |
|
OSStatus TSliderControl::GetData |
( |
OSType |
inTag, |
|
|
ControlPartCode |
inPart, |
|
|
Size |
inSize, |
|
|
Size * |
outSize, |
|
|
void * |
inPtr |
|
) |
[protected, virtual] |
|
ControlKind TSliderControl::GetKind |
( |
|
) |
[protected, virtual] |
|
bool TSliderControl::GetProperty |
( |
OSType |
propID, |
|
|
CFStringRef & |
value |
|
) |
[virtual] |
|
bool TSliderControl::GetProperty |
( |
OSType |
propID, |
|
|
int32_t & |
value |
|
) |
[virtual] |
|
bool TSliderControl::GetProperty |
( |
OSType |
propID, |
|
|
double & |
value |
|
) |
[virtual] |
|
OSStatus TSliderControl::Initialize |
( |
TCarbonEvent & |
inEvent |
) |
[protected, virtual] |
|
TRect TSliderControl::ScaledThumbBounds |
( |
|
) |
[protected] |
|
float TSliderControl::ScaleX |
( |
|
) |
[protected, virtual] |
|
float TSliderControl::ScaleY |
( |
|
) |
[protected, virtual] |
|
void TSliderControl::SetCorrectedValue |
( |
SInt32 |
val |
) |
[protected] |
|
OSStatus TSliderControl::SetData |
( |
OSType |
inTag, |
|
|
ControlPartCode |
inPart, |
|
|
Size |
inSize, |
|
|
const void * |
inPtr |
|
) |
[protected, virtual] |
|
void TSliderControl::SetProperty |
( |
OSType |
propID, |
|
|
int32_t |
value |
|
) |
[virtual] |
|
void TSliderControl::SetProperty |
( |
OSType |
propID, |
|
|
CFStringRef |
value |
|
) |
[virtual] |
|
void TSliderControl::SetProperty |
( |
OSType |
propID, |
|
|
double |
value |
|
) |
[virtual] |
|
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] |
|
void TSliderControl::TitleChanged |
( |
|
) |
[protected, virtual] |
|
virtual bool TSliderControl::UseNonblockingTracking |
( |
|
) |
[inline, protected, virtual] |
|
void TSliderControl::ValueChanged |
( |
|
) |
[protected, virtual] |
|
Member Data Documentation
The documentation for this class was generated from the following files:
Generated on Sat Jul 8 13:10:49 2006 for AUGUI Framework by
1.4.6