00001 //--------------------------------------------------------------------------- 00002 /// \file CATComboBox.h 00003 /// \brief GUI Layer object - contains sub-controls 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 CATComboBox_H_ 00015 #define CATComboBox_H_ 00016 00017 #include "CATLayer.h" 00018 00019 class CATEditBox; 00020 class CATMenu; 00021 00022 /// \class CATComboBox CATComboBox.h 00023 /// \brief GUI Layer object 00024 /// \ingroup CATGUI 00025 class CATComboBox : public CATLayer 00026 { 00027 public: 00028 /// Constructor - mirrors CATXMLObject() constructor for now. 00029 CATComboBox( const CATString& element, 00030 const CATString& rootDir); 00031 00032 virtual ~CATComboBox(); 00033 00034 /// Load() loads the skin in 00035 virtual CATResult Load( // Optional progress callback information 00036 CATPROGRESSCB progressCB = 0, 00037 void* progressParam= 0, 00038 CATFloat32 progMin = 0.0f, 00039 CATFloat32 progMax = 1.0f); 00040 00041 virtual void OnParentCreate(); 00042 virtual void OnParentDestroy(); 00043 00044 // Process commands from children for combo. 00045 virtual void OnCommand( CATCommand& command, 00046 CATControl* ctrl); 00047 00048 /// Event handler 00049 virtual CATResult OnEvent(const CATEvent& event, CATInt32& retVal); 00050 00051 virtual CATEditBox* GetEditBox(); 00052 virtual CATMenu* GetMenu(); 00053 00054 #ifdef _WIN32 00055 virtual CATUInt32 GetAccessRole() {return CAT_ROLE_SYSTEM_COMBOBOX;} 00056 #endif 00057 00058 protected: 00059 /// ParseAttributes() parses the known attributes for an object. 00060 virtual CATResult ParseAttributes(); 00061 00062 void RebuildCombo(); 00063 void AddComboString( const CATString& string); 00064 00065 // Sub controls 00066 CATEditBox* fComboEdit; 00067 CATMenu* fComboMenu; 00068 std::vector<CATString> fMenuList; 00069 CATUInt32 fMaxMenuLength; 00070 CATString fPrefName; 00071 }; 00072 00073 #endif // CATComboBox_H_