Game Accessibility Library logo SourceForge.net Logo
Game Accessibility Suite: CATGUI/CATListBox.h Source File

CATListBox.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------
00002 /// \file CATListBox.h
00003 /// \brief list 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 //---------------------------------------------------------------------------
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 /// \class CATListBox
00033 /// \brief list box for GUI
00034 /// \\ingroup CATGUI
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     // GetString retrieves current string, which is either the nulltext
00086     // or whatever is selected.
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 

Generated on Mon Feb 11 04:09:54 2008 for Game Accessibility Suite by doxygen 1.5.4