Nokia N97 SDK
Example Applications Guide

rectangle.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : rectangle.h
00004 *  Part of     : GuiEngine
00005 *  Interface   :
00006 *  Description :
00007 *  Version     :
00008 *
00009 *  Copyright (c) 2004 - 2006 Nokia Corporation.
00010 *  This material, including documentation and any related
00011 *  computer programs, is protected by copyright controlled by
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 
00017 #ifndef __RECTANGLE_H__
00018 #define __RECTANGLE_H__
00019 
00020 
00021 // INCLUDES
00022 #include <e32std.h>
00023 #include <w32std.h>
00024 #include "shape.h"
00025 
00026 
00027 // CLASS DECLARATION
00028 
00029 // Namespace containing shape definition
00030 namespace NShapes
00031 {
00032 
00033     /**
00034     * TRectangle
00035     * An instance of class TRectangle is a rectangular shape.
00036     */
00037     class TRectangle : public TShape
00038         {
00039         public: // Constructors
00040 
00041             /**
00042             * TRectangle
00043             * Create an instance of TRectangle at a specified position,
00044             * and of a specified size.
00045             * @param aOrigin where the origin of the shape is located.
00046             * @param aWidth The width of the rectangle
00047             * @param aHeight The height of the rectangle
00048             */
00049             IMPORT_C TRectangle( const TPoint& aOrigin,
00050                                  TInt aWidth,
00051                                  TInt aHeight );
00052 
00053             /**
00054             * TRectangle
00055             * Create an instance of TRectangle
00056             */
00057             IMPORT_C TRectangle();
00058 
00059 
00060         public: //  From TShape
00061 
00062             /**
00063             * Draw
00064             * Virtual method that draws the shape to the specified
00065             * graphics context.
00066             * @param aActiveGraphicsContext the active context to
00067             * draw the shape into.
00068             */
00069             IMPORT_C void Draw( CWindowGc& aActiveGraphicsContext ) const;
00070 
00071             /**
00072             * GetRect
00073             * Return the smallest bounding rectangle that entirely
00074             * contains the shape.
00075             * @return The rectangle
00076             */
00077             IMPORT_C TRect GetRect() const;
00078 
00079             /**
00080             * ExternalizeL
00081             * Virtual method that writes the shape to the specified
00082             * write stream.
00083             * @param aStream the stream to write the shape to.
00084             */
00085             IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
00086 
00087             /**
00088             * InternalizeL
00089             * Virtual method that reads the shape from the specified
00090             * read stream.
00091             * @param aStream the stream to read the shape from.
00092             */
00093             IMPORT_C void InternalizeL( RReadStream& aStream );
00094 
00095         private: // Data
00096 
00097             /** iWidth  The width of the rectangle  **/
00098             TInt iWidth;
00099 
00100             /** iHeight The height of the rectangle **/
00101             TInt iHeight;
00102         };
00103 
00104 
00105     }
00106 
00107 #endif  //  __RECTANGLE_H__
00108 
00109 
00110 // End of File

© Nokia 2009

Back to top