Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

CUIListBox.h

00001 /**********************************************************************
00002 
00003 Copyright (c) 2005, TomTom B.V.
00004 
00005 All rights reserved
00006 
00007 
00008 ***********************************************************************/
00009 
00010 
00011 #ifndef __CUILISTBOX_H__
00012 #define __CUILISTBOX_H__
00013 
00014 #include "CUIWidgetGroup.h"
00015 
00026 class CUIListBox: public CUIWidgetGroup
00027 {
00028   public:      
00035     CUIListBox( const CUIRect&         aRectangle, 
00036                 const char*            aTitle, 
00037                 MUIWidgetEvents*       aObserver );
00038 
00039     virtual void Draw();
00040     virtual bool HandlePenEvent( MInputReader::TTouchEventData& aData );
00041     virtual bool HandleKeyEvent( MInputReader::TKeyEventData& aData );
00042 
00043     virtual bool SetActive( bool aActive );
00044 
00045     virtual void RestoreBackground( CUIRect& aRect );
00046 
00048     virtual unsigned int GetItemsNumber()                                    = 0;
00049 
00057     virtual unsigned int GetItemHeight( unsigned int aItemIndex )            = 0;
00058 
00060     virtual void         DrawItem( unsigned int aItemIndex, CUIRect& aRect ) = 0;
00061 
00067     void CalculateParameters();
00068 
00069   private:
00070    CUIListBox();
00071    CUIListBox( const CUIListBox& );
00072    CUIListBox& operator=( const CUIListBox& );
00073 
00074   public:
00076    enum EListBoxOptions  
00077    {
00078     KTransparentDraw = 0x01, 
00079     KConstItemHeight = 0x02, 
00083     KDefaultOptions = KTransparentDraw | KConstItemHeight
00084    };
00085 
00086   unsigned int    iNrItemsPerPage; 
00087   unsigned int    iPage;           
00088            int    iSelected;       
00089   EListBoxOptions iOptions;        
00091   private:
00092    enum { KListBoxButtonWidth = 32, KTextOffset = 2 };
00093 
00094    int  iCurrentTopIndex;
00095    bool iUpPressed;
00096    bool iDownPressed;
00097 
00098    void DoDrawSlider( CUIRect& aRect, bool aUp, bool aPressed, bool aEnabled ) const;
00099    void DrawPressedSlider( bool aUp, bool aEnabled )                           const;
00100    void GetSliderRect( CUIRect& aRect, bool aUp )                              const;
00101 
00102    bool NextPage();
00103    bool PrevPage();
00104 
00105    bool UpSliderEnabled()                                  const { return iCurrentTopIndex ? true: false; }
00106    bool DownSliderEnabled( unsigned int aItemsNumber = 0 )       { return ( iCurrentTopIndex + iNrItemsPerPage < ( aItemsNumber ? aItemsNumber: GetItemsNumber() ) ) ? true: false; }
00107 
00108    void ResetActiveWidget();
00109    void ResetSliders();
00110 };
00111 
00112 #endif // __CUILISTBOX_H__
00113 

Generated on Fri Jul 15 16:46:44 2005 for TomTom GO User Interface library by doxygen 1.3.5