00001 //--------------------------------------------------------------------------- 00002 /// \file CATSwitch.h 00003 /// \brief On/Off switch 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 // 00015 //--------------------------------------------------------------------------- 00016 #ifndef _GGSwitch_H_ 00017 #define _GGSwitch_H_ 00018 00019 #include "CATControl.h" 00020 00021 class CATSwitch; 00022 00023 /// \class CATSwitch 00024 /// \brief On/Off switch for GUI 00025 /// \ingroup CATGUI 00026 class CATSwitch : public CATControl 00027 { 00028 public: 00029 /// CATSwitch constructor (inherited from CATControl->CATXMLObject) 00030 /// \param element - Type name ("Switch") 00031 /// \param attribs - attribute information for the window 00032 /// \param parent - parent XML object (should be a "Window" element) 00033 /// \param rootDir - root directory of skin for bin/png loads 00034 CATSwitch( const CATString& element, 00035 const CATString& rootDir); 00036 00037 virtual ~CATSwitch(); 00038 00039 virtual void OnMouseClick(); 00040 00041 /// Draw() draws the control into the parent's image 00042 /// \param image - parent image to draw into 00043 /// \param dirtyRect - portion of control (in window coordinates) 00044 /// that requires redrawing. 00045 virtual void Draw(CATImage* image, const CATRect& dirtyRect); 00046 00047 /// ParseAttributes() parses the known attributes for an object. 00048 virtual CATResult ParseAttributes(); 00049 00050 /// Load() loads the skin in 00051 virtual CATResult Load( CATPROGRESSCB progressCB = 0, 00052 void* progressParam = 0, 00053 CATFloat32 progMin = 0.0f, 00054 CATFloat32 progMax = 1.0f); 00055 00056 virtual CATString GetHint() const; 00057 #ifdef _WIN32 00058 virtual CATUInt32 GetAccessRole() {return CAT_ROLE_SYSTEM_PUSHBUTTON;} 00059 #endif //_WIN32 00060 00061 protected: 00062 CATImage* fImageOn; 00063 CATImage* fImageDisabledOn; 00064 CATImage* fImagePressedOn; 00065 CATImage* fImageFocusOn; 00066 CATImage* fImageActiveOn; 00067 }; 00068 00069 #endif // _GGSwitch_H_ 00070 00071