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

TTUIBase.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 
00003 Copyright (c) 2005, TomTom B.V.
00004 
00005 All rights reserved
00006 
00007 
00008 ***********************************************************************/
00009 
00010 
00011 #ifndef __TTUIBASE_H__
00012 #define __TTUIBASE_H__
00013 
00014 #include <assert.h>
00015 #include <string.h>
00016 #include <memory.h>
00017 
00018 #ifndef min
00019 
00020 #define min( a, b ) ( ( ( a ) < ( b ) ) ? ( a ): ( b ) )
00021 #endif
00022 
00023 #ifndef max
00024 
00025 #define max( a, b ) ( ( ( a ) > ( b ) ) ? ( a ): ( b ) )
00026 #endif
00027 
00034 struct CUIPoint
00035 {
00036  public:
00038   CUIPoint(int aX, int aY):
00039     iX( aX ),
00040     iY( aY )
00041     {}
00042 
00046   CUIPoint():
00047    iX( 0 ),
00048    iY( 0 )
00049    {}   
00050 
00051   int iX;   
00052   int iY;   
00053 };
00054 
00057 class CUIRect
00058 {
00059  public:
00063   CUIRect():
00064    iTopLeft(), 
00065    iSize()
00066    {}
00067 
00069   CUIRect( const CUIPoint& aTopLeft, const CUIPoint& aSize ):
00070    iTopLeft( aTopLeft ), 
00071    iSize( aSize )
00072    {}
00073 
00075   CUIRect( int aX, int aY, int aSizeX, int aSizeY ):
00076    iTopLeft( aX, aY ),
00077    iSize( aSizeX, aSizeY )
00078    {}
00079 
00081   bool Contains( const CUIPoint& aPoint )
00082     { return 
00083        ( ( aPoint.iX >= iTopLeft.iX && aPoint.iX < iTopLeft.iX + iSize.iX ) && 
00084          ( aPoint.iY >= iTopLeft.iY && aPoint.iY < iTopLeft.iY + iSize.iY ) 
00085        ) ? true: false;
00086     };
00087 
00089   bool Contains( unsigned int aX, unsigned int aY )
00090     { return 
00091        ( ( static_cast< int >( aX ) >= iTopLeft.iX && static_cast< int >( aX ) < iTopLeft.iX + iSize.iX ) && 
00092          ( static_cast< int >( aY ) >= iTopLeft.iY && static_cast< int >( aY ) < iTopLeft.iY + iSize.iY ) 
00093        ) ? true: false;
00094     };
00095 
00097   bool Contains( const CUIRect& aOther )
00098   {
00099    return Contains( aOther.iTopLeft ) &&
00100           Contains( aOther.iTopLeft.iX + aOther.iSize.iX,
00101                     aOther.iTopLeft.iY + aOther.iSize.iY );
00102   }
00103   
00104   CUIPoint iTopLeft; 
00105   CUIPoint iSize;    
00106 };
00107 
00108 #endif
00109 

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