Game Accessibility Library logo SourceForge.net Logo
Game Accessibility Suite: CATGUI/CATKnob.h Source File

CATKnob.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------
00002 /// \file CATKnob.h
00003 /// \brief Knob control for GUI
00004 /// \ingroup CATGUI
00005 /// 
00006 /// Copyright (c) 2003-2008 by Michael Ellison.
00007 /// See COPYING.txt for the \ref gaslicense License (MIT License).
00008 ///
00009 // $Author: mikeellison $
00010 // $Date: 2008-01-24 06:27:32 -0600 (Thu, 24 Jan 2008) $
00011 // $Revision:   $
00012 // $NoKeywords: $
00013 //---------------------------------------------------------------------------
00014 #ifndef CATKnob_H_
00015 #define CATKnob_H_
00016 
00017 #include "CATControl.h"
00018 
00019 class CATKnob;
00020 class CATFilterEWMA;
00021 class CATEditBox;
00022 
00023 enum CATKNOB_STYLE
00024 {
00025     CATKNOB_VERTICAL,
00026     CATKNOB_CIRCLE
00027 };
00028 
00029 /// \class CATKnob
00030 /// \brief Knob control for GUI
00031 /// \ingroup CATGUI
00032 class CATKnob : public CATControl
00033 {
00034 public:
00035     /// CATKnob constructor (inherited from CATControl->CATXMLObject)
00036     /// \param element - Type name ("Button")
00037     /// \param attribs - attribute information for the window
00038     /// \param rootDir - root directory of skin
00039     /// \param parent - parent XML object (should be a "Window" element)
00040     CATKnob(     const CATString&               element, 
00041         const CATString&               rootDir);
00042 
00043     virtual ~CATKnob();          
00044 
00045     /// RectFromAttribs() recalculates the control's rectangle from
00046     /// the attributes.  This can only be called after ParseAttributes() has
00047     /// loaded the images.
00048     virtual CATResult    RectFromAttribs();
00049 
00050     // Tracked mouse events - only called when the control is initially pressed
00051     virtual void   TrackMouseMove(  const CATPOINT& point, 
00052         bool                leftButton, 
00053         CATMODKEY           modKey);
00054 
00055     virtual void   TrackMouseTimer( CATMODKEY           modKey);
00056 
00057     virtual void   TrackMouseDown(  const CATPOINT& point, 
00058         CATMODKEY           modKey);      
00059 
00060     virtual void   TrackMouseRelease(const CATPOINT& point,
00061         CATMODKEY           modKey);      
00062 
00063     virtual void   OnMouseWheel(        const CATPOINT& point,
00064         CATFloat32        wheelMove,
00065         CATMODKEY           modKey);
00066 
00067     virtual void   OnKeyDown(   const CATKeystroke& keystroke);
00068     virtual void   OnKeyPress(  const CATKeystroke& keystroke);
00069 
00070     virtual void   Draw(            CATImage*                   image, 
00071         const CATRect&          dirtyRect);      
00072 
00073     /// PostDraw() draws any stuff that requires an OS-specific draw
00074     /// context.
00075     virtual void   PostDraw(    CATDRAWCONTEXT          drawContext, 
00076         const CATRect&          dirtyRect);
00077 
00078     /// Knob styles
00079     virtual CATKNOB_STYLE GetKnobStyle();
00080     virtual void   SetKnobStyle(CATKNOB_STYLE style);
00081 
00082     virtual CATString GetHint() const;
00083 
00084 
00085     /// OnMouseDoubleClick() is called the mouse is double clicked.
00086     ///
00087     /// \param modKey - Key state modifiers for ctrl/shift/alt/etc.
00088     virtual void         OnMouseDoubleClick( CATMODKEY modKey);
00089 
00090 #ifdef _WIN32
00091     virtual CATUInt32     GetAccessRole() {return CAT_ROLE_SYSTEM_SLIDER;}
00092 #endif
00093 
00094 protected:      
00095     CATKNOB_STYLE GetActiveStyle(       CATMODKEY           modKey );
00096 
00097     virtual void SetValueFromPoint( const CATPOINT& point, 
00098         CATMODKEY           modKey);
00099 
00100     /// ParseAttributes() parses the known attributes for an object.
00101     virtual CATResult ParseAttributes();
00102 
00103 
00104     bool           fCommandTrack;
00105     bool                fCursorHidden;
00106 
00107     CATKNOB_STYLE   fKnobStyle;   
00108     CATKNOB_STYLE   fLastKnobStyle;   
00109     CATFilterEWMA*  fFilter;
00110     CATInt32         fLastKnob;
00111     CATPOINT        fStartPoint;
00112     CATPOINT        fLastPoint;
00113     CATPOINT        fLastMove;
00114     clock_t        fLastTime;
00115     CATFloat32        fFilterCoef;
00116     CATFloat32        fMinDegree;
00117     CATFloat32        fMaxDegree;
00118 
00119     CATVALUE_TYPE   fValueType;
00120     CATFloat32          fMinAdjVal;
00121     CATFloat32          fMaxAdjVal;
00122 };
00123 
00124 #endif // CATKnob_H_
00125 
00126 

Generated on Mon Feb 11 04:09:54 2008 for Game Accessibility Suite by doxygen 1.5.4