Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals

xlistbox.h

Go to the documentation of this file.
00001 #if !defined( __XLISTBOX_H__ )
00002 #define __XLISTBOX_H__
00003 
00004 namespace Ars
00005 {
00006 
00007 struct XListItem        {
00008 public:
00010         XListItem(std::string sItemTextIn, void *pItemDataIn , RGBColor ItemColorIn , FontEngine *aFontEngine ) 
00011         : itemText( sItemTextIn ) , pItemData( pItemDataIn ) , ItemColor( ItemColorIn ) , fontEngine( aFontEngine )
00012         { 
00013         }
00014 
00015         std::string itemText;  
00016         void* pItemData;  
00017         RGBColor ItemColor;  
00018         FontEngine *fontEngine;
00019 };
00020 
00021 class XListBox : public XBox    {
00022 protected:
00023 
00024         XScrollBar* vScrollBar;  
00025         int itemHeight;  
00026         int focusedItem;  
00027         std::vector<XListItem> listItem;  
00028         std::vector<bool> selectedItem;  
00029         bool m_bSingleSelection;  
00030 
00031 public:
00035         XListBox( void );
00036 
00038         virtual ~XListBox(void);
00039 
00040 
00046         virtual void Init( icstring &aStr );
00047 
00048         virtual const bool SetupWindow( const Message &msg );
00049 
00050         //      Height of items
00053         unsigned int GetItemHeight(void) { return itemHeight; }
00054 
00056         void SetItemHeight( const unsigned int iItemHeight )    {       itemHeight = iItemHeight;       SetDirty( true );       }
00057 
00058         //      Items
00063         const int AddItem( XListItem ListItem );
00064         const int AddItem( const std::string &aText );
00065 
00069         XListItem &GetItem( const int iItemIndex ) { return listItem[iItemIndex]; }
00070 
00073         void RemoveItem( const int iItemIndex );
00074 
00076         void ClearItems( void );
00077 
00079         int const Size( void ) { return static_cast<int>(listItem.size()); }
00080 
00081         //      Selection
00085         const bool IsSelected( const int iItemIndex ) { return selectedItem[iItemIndex]; }
00086 
00090         void SetSelection( const int iItemIndex, const bool bSelected) 
00091         {       if( GetFlags() & F_SELECTABLE )
00092                 {
00093                         selectedItem[iItemIndex] = bSelected;   
00094                         SetDirty( true );       
00095                 }
00096         }
00097 
00100         void SetAllSelections( const bool bSelected );
00101 
00102         virtual void DrawBG( void );
00103         // Object overrides
00105         virtual void Draw(void);
00106 
00109         virtual void SetWindowRect( const XRect &WindowRect );
00110 
00111         virtual const bool evMouseButtonDown( const MouseMessage &msg );
00112         virtual const bool evMouseButtonUp( const MouseMessage &msg );
00113         virtual const bool evValueChange( const CtrlMessage &msg );
00114         virtual const bool evValueChanging( const CtrlMessage &msg );
00115         virtual const bool evKeyDown( const KeyboardMessage &msg );
00116 };
00117 
00118 }
00119 
00120 #endif
00121 

Generated on Fri Dec 5 04:06:01 2003 for Borqueror by doxygen 1.3.3