00001 //--------------------------------------------------------------------------- 00002 /// \file CATEditBox.h 00003 /// \brief Text edit box 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 #ifndef _CATEditBox_H_ 00016 #define _CATEditBox_H_ 00017 00018 #include "CATControlWnd.h" 00019 00020 const CATUInt32 kDefEditMaxLength = 255; 00021 00022 class CATEditBox; 00023 00024 /// \class CATEditBox CATEditBox.h 00025 /// \brief Text edit box for GUI 00026 /// \ingroup CATGUI 00027 /// 00028 /// Edit boxes currently ignore their fValue - setting it to the value of the 00029 /// string if applicable, but otherwise not really doing anything with it. 00030 class CATEditBox : public CATControlWnd 00031 { 00032 public: 00033 CATEditBox( const CATString& element, 00034 const CATString& rootDir); 00035 00036 virtual ~CATEditBox(); 00037 00038 virtual bool OnControlEvent( const CATEvent& event, CATInt32& result); 00039 00040 /// ParseAttributes() parses the known attributes for an object. 00041 virtual CATResult ParseAttributes(); 00042 00043 virtual void SetFocused(bool focused); 00044 virtual void OnEscapeChange(); 00045 virtual void OnParentCreate(); 00046 virtual void OnParentDestroy(); 00047 00048 /// GetValue() retrieves the value of the control. 00049 /// \return CATFloat32 - control value (0.0 - 1.0) 00050 virtual CATFloat32 GetValue() const; 00051 00052 virtual void SetString(const CATString& newString); 00053 virtual CATString GetString() const; 00054 /// Event handler 00055 virtual CATResult OnEvent(const CATEvent& event, CATInt32& retVal); 00056 00057 virtual CATString GetHint() const; 00058 00059 virtual void OSSelectAll(); 00060 00061 virtual bool IsReadOnly(); 00062 virtual void SetReadOnly(bool readOnly); 00063 00064 virtual void OSSetReadOnly(bool readOnly); 00065 00066 #ifdef _WIN32 00067 virtual CATUInt32 GetAccessRole() {return CAT_ROLE_SYSTEM_TEXT;} 00068 #endif 00069 00070 protected: 00071 bool fNumbersOnly; 00072 bool fReadOnly; 00073 CATUInt32 fMaxLength; 00074 00075 #ifdef _WIN32 00076 HFONT fFont; 00077 #endif 00078 }; 00079 00080 #endif // _CATEditBox_H_ 00081 00082