home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Archive / Games / Soundboard / CSliderControl.h < prev    next >
Encoding:
Text File  |  2000-09-28  |  2.1 KB  |  77 lines  |  [TEXT/MMCC]

  1. // ===========================================================================
  2. //    CSliderControl.h            ©1995 Apple Computer, Inc. All rights reserved.
  3. // ===========================================================================
  4.  
  5. #pragma once
  6.  
  7. #include <LStdControl.h>
  8.  
  9. enum { sliderCntlProc = 4352 };
  10.  
  11. class    CSliderControl : public LStdControl {
  12. public:
  13.     enum { 
  14.         class_ID = 'Sldr',
  15.         rSliderBase = 310 
  16.     };
  17.  
  18.     static void            SetSliderJmpAddress();
  19.     static pascal long    SliderCtl(short varCode, ControlHandle ctl, short msg, long parm);
  20.  
  21. /*    static LStdControl*    CreateFromCNTL(ResIDT inCNTLid,
  22.                             MessageT inValueMessage, ResIDT inTextTraitsID,
  23.                             LView *inSuperView);
  24. */
  25.     static CSliderControl*    CreateSliderControlStream(LStream *inStream);
  26.     
  27.                         CSliderControl(Int16 inControlKind);
  28.                         CSliderControl(const CSliderControl &inOriginal);
  29.                         CSliderControl(const SPaneInfo &inPaneInfo,
  30.                             MessageT inValueMessage, Int32 inValue,
  31.                             Int32 inMinValue, Int32 inMaxValue,
  32.                             Int16 inControlKind, ResIDT inTextTraitsID,
  33.                             Str255 inTitle, Int32 inMacRefCon);
  34.                         CSliderControl(const SPaneInfo &inPaneInfo,
  35.                             MessageT inValueMessage, Int32 inValue,
  36.                             Int32 inMinValue, Int32 inMaxValue,
  37.                             Int16 inControlKind, ResIDT inTextTraitsID,
  38.                             ControlHandle inMacControlH);
  39.                         CSliderControl(LStream *inStream);
  40.  
  41.     virtual                ~CSliderControl();
  42.  
  43.     virtual void        AdjustSlider(Int32 val, Int32 max);
  44.     virtual long        GetSliderRefCon(void);
  45.     virtual void        SetSliderRefCon(long refCon);
  46.     
  47. protected:
  48.     Point                mLastClick;
  49.     long                mRefCon;
  50.     
  51.     void                InitSlider(void);
  52.  
  53.     virtual void        SliderAction(short newPos);
  54.     virtual void        TrackAndRun(Point *mouseLoc);
  55.     
  56.     void                UpdateSlider(short hiliteCap = -1);
  57.     virtual void        TrackSlider(Point origMouseLoc);
  58.     void                SliderDrawCIcon(CIconHandle iconHndl, short hloc, short vloc);
  59.     Rect                CalcSliderRect();
  60.     short                CalcSliderValue(Point mouseLoc);
  61. };
  62.  
  63. // === Inline Functions ===
  64.  
  65. inline long
  66. CSliderControl::GetSliderRefCon(void)
  67. {
  68.     return mRefCon;
  69. }
  70.  
  71. inline void
  72. CSliderControl::SetSliderRefCon(long refCon)
  73. {
  74.     mRefCon = refCon;
  75. }
  76.  
  77.