00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _GGListBox_H_
00017 #define _GGListBox_H_
00018
00019 #include "CATControlWnd.h"
00020 #include <vector>
00021
00022 class CATListBox;
00023
00024 struct CATLISTINFO
00025 {
00026 CATString DisplayText;
00027 void* ListInfo;
00028 CATListBox* BaseListBox;
00029 };
00030
00031
00032
00033
00034
00035 class CATListBox : public CATControlWnd
00036 {
00037 public:
00038 CATListBox( const CATString& element,
00039 const CATString& rootDir);
00040
00041 virtual ~CATListBox();
00042
00043 virtual bool OnControlEvent( const CATEvent& event, CATInt32& result);
00044 virtual CATResult OnEvent(const CATEvent& event, CATInt32& retVal);
00045
00046 virtual void SetFocused(bool focused);
00047
00048 virtual CATString GetHint() const ;
00049
00050 virtual void OnEscapeChange();
00051
00052 virtual void OnParentCreate();
00053 virtual void OnParentDestroy();
00054
00055 virtual CATInt32 GetCount() const;
00056
00057 virtual CATInt32 GetCurIndex() const;
00058
00059 virtual CATResult SetCurSel( CATInt32 index = -1);
00060
00061 virtual CATString GetText( CATInt32 index = -1) const;
00062
00063 virtual CATResult SetCurSelByName( const CATString& displayText);
00064
00065 virtual CATResult Insert( const CATString& displayText,
00066 void* dataPtr,
00067 CATInt32 index = -1);
00068
00069 virtual CATResult Remove( CATInt32 index);
00070
00071 virtual CATResult RemoveByName( const CATString& displayText);
00072
00073
00074 virtual CATResult Get( CATInt32 index,
00075 CATString& displayTextRef,
00076 void*& dataRef) const;
00077
00078 virtual CATResult GetByName( const CATString& displayTextRef,
00079 void*& dataRef) const;
00080
00081 virtual CATResult Clear ();
00082
00083 virtual CATCommand GetCommand() const ;
00084
00085
00086
00087 virtual CATString GetString () const;
00088
00089 virtual void OSOnMeasureItem( CATLISTINFO* listItem, CATUInt32& width, CATUInt32& height);
00090 virtual void OSOnDrawItem( CATLISTINFO* listItem, bool selected, CATDRAWCONTEXT hDC, CATRect rect );
00091 protected:
00092
00093 CATResult OSEvent(const CATEvent& event, CATInt32& retVal);
00094
00095 void OSClearList ();
00096 CATResult OSAddItem ( CATInt32 index, const CATString& displayText, const CATLISTINFO* listInfo);
00097 CATResult OSRemoveItem ( CATInt32 index );
00098 CATInt32 OSGetCurSel ();
00099 CATResult OSSetCurSel ( CATInt32 index );
00100
00101 #ifdef _WIN32
00102 virtual CATUInt32 GetAccessRole() {return CAT_ROLE_SYSTEM_LIST;}
00103 #endif
00104
00105 protected:
00106 CATFONT fFont;
00107
00108 CATInt32 fCurSel;
00109 std::vector <CATLISTINFO*> fList;
00110 };
00111
00112 #endif // _GGListBox_H_
00113
00114