00001 //--------------------------------------------------------------------------- 00002 /// \file CATAppButton.h 00003 /// \brief Specialized pushbutton for launching apps 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-30 06:11:10 -0600 (Wed, 30 Jan 2008) $ 00011 // $Revision: $ 00012 // $NoKeywords: $ 00013 //--------------------------------------------------------------------------- 00014 #ifndef CATAppButton_H_ 00015 #define CATAppButton_H_ 00016 00017 #include "CATButton.h" 00018 00019 /// \class CATAppButton CATAppButton.h 00020 /// \brief Specialized pushbutton for launching apps 00021 /// \ingroup CATGUI 00022 /// 00023 /// AppButtons automatically pick up the icon of the executable they are 00024 /// set to, or disable themselves if they cannot find it. 00025 /// 00026 /// A few ways to configure AppButtons for the executable. 00027 /// Currently supported attributes: 00028 /// -# "AppPath" attribute may contain full absolute path to the .exe 00029 /// -# "UninstallId" may be used to get the uninstall path. This is the 00030 /// subkey under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall 00031 /// for the game's uninstaller. InstallLocation should contain the base 00032 /// directory. 00033 /// Use "AppFile" for the relative path from the install location of the 00034 /// executable to use. 00035 /// 00036 class CATAppButton : public CATButton 00037 { 00038 public: 00039 CATAppButton( const CATString& element, 00040 const CATString& rootDir); 00041 00042 virtual ~CATAppButton(); 00043 00044 /// ParseAttributes() parses the known attributes for an object. 00045 virtual CATResult ParseAttributes(); 00046 00047 /// Draw() draws the control into the parent's image 00048 /// \param image - parent image to draw into 00049 /// \param dirtyRect - portion of control (in window coordinates) 00050 /// that requires redrawing. 00051 virtual void Draw(CATImage* image, const CATRect& dirtyRect); 00052 00053 /// PostDraw() draws any stuff that requires an OS-specific draw 00054 /// context. 00055 virtual void PostDraw(CATDRAWCONTEXT drawContext, const CATRect& dirtyRect); 00056 00057 protected: 00058 CATString fAppPath; 00059 CATString fAppName; 00060 CATICON fIconImage; 00061 CATInt32 fBorder; 00062 }; 00063 00064 #endif // CATAppButton_H_ 00065 00066