00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #if !defined(_TSliderControl_h_)
00011 #define _TSliderControl_h_
00012
00013 #include "TViewNoCompositingCompatible.h"
00014
00016 #define kSliderControlDetentValueTag FOUR_CHAR_CODE('CDet')
00017
00020 #define kSliderControlDetentRangeTag FOUR_CHAR_CODE('RDet')
00021
00023 #define kSliderControlUseDetentTag FOUR_CHAR_CODE('UDet')
00024
00075 class TSliderControl : public TViewNoCompositingCompatible
00076 {
00077 AUGUIDefineControl(TSliderControl, TViewNoCompositingCompatible, "slider");
00078
00079 public:
00080
00081 virtual void SetProperty(OSType propID, double value);
00082 virtual void SetProperty(OSType propID, CFStringRef value);
00083 virtual void SetProperty(OSType propID, int32_t value);
00084 virtual bool GetProperty(OSType propID, double &value);
00085 virtual bool GetProperty(OSType propID, int32_t &value);
00086 virtual bool GetProperty(OSType propID, CFStringRef &value);
00087
00088 protected:
00089
00090 TSliderControl(HIViewRef inControl);
00091 virtual ~TSliderControl();
00092
00093 virtual ControlKind GetKind();
00094
00095 virtual bool UseNonblockingTracking() { return true; }
00096
00097 virtual OSStatus Initialize(TCarbonEvent& inEvent);
00098 virtual OSStatus StillTracking(TCarbonEvent&inEvent, HIPoint& from);
00099 virtual OSStatus StartTracking(TCarbonEvent&inEvent, HIPoint& from);
00100 virtual void DrawStaticBackground(RgnHandle inLimitRgn, CGContextRef inContext, bool inCompositing );
00101 virtual void CompatibleDraw(RgnHandle inLimitRgn, CGContextRef inContext, bool inCompositing);
00102 virtual void TitleChanged();
00103 virtual void ValueChanged();
00104 virtual UInt32 GetBehaviors() { return TViewNoCompositingCompatible::GetBehaviors() | kControlSupportsEmbedding ; }
00105
00106 virtual OSStatus SetData(OSType inTag, ControlPartCode inPart, Size inSize, const void* inPtr);
00107 virtual OSStatus GetData(OSType inTag, ControlPartCode inPart, Size inSize, Size* outSize, void* inPtr);
00108
00109 SInt32 GetCorrectedValue();
00110 void SetCorrectedValue(SInt32 val);
00111 protected:
00112 typedef enum {
00113 kHorizontalOrientation,
00114 kVerticalOrientation
00115 } SliderOrientation;
00116
00117 CGImageRef mThumbImage;
00118 CGImageRef mBackImage;
00119 CFStringRef mImageName;
00120 float mXInset;
00121 float mTopInset;
00122 float mBottomInset;
00123 SliderOrientation mImageOrientation;
00124 bool mUseDetent;
00125 SInt32 mDetentValue;
00126 SInt32 mDetentRange;
00127 float mTotalDetentMoved;
00128 bool mRevert;
00129 virtual float ScaleX();
00130 virtual float ScaleY();
00131 SliderOrientation OrientationForRect(const TRect& theRect);
00132 TRect ScaledThumbBounds();
00133 TRect BackgroundRect();
00134 };
00135
00136
00137 #endif // _TSliderControl_h_