|
Nokia N97 SDK Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : shape.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 __SHAPE_H__ 00018 #define __SHAPE_H__ 00019 00020 00021 // INCLUDES 00022 #include <e32std.h> 00023 #include <w32std.h> 00024 00025 00026 // CLASS DECLARATION 00027 00028 // Namespace containing shape definition 00029 namespace NShapes 00030 { 00031 00032 /** 00033 * TShapeType 00034 * Shape constants. 00035 * KRectangle represents a rectangle. 00036 * value KCircle represents a circle. 00037 */ 00038 enum TShapeType 00039 { 00040 KRectangle = 1, 00041 KCircle 00042 }; 00043 00044 /** 00045 * TShape 00046 * Abstract class for shapes. 00047 */ 00048 class TShape 00049 { 00050 public: // Constructor 00051 00052 /** 00053 * TShape 00054 * Constructor that creates the shape at a specific point. 00055 * @param aShapeType the type of the actual shape. 00056 * @param aOrigin where the origin of the shape is located. 00057 */ 00058 IMPORT_C TShape ( TShapeType aShapeType, 00059 const TPoint& aOrigin ); 00060 00061 00062 public: // New functions 00063 00064 /** 00065 * Draw 00066 * Pure virtual method that draws the shape to the specified 00067 * graphics context. 00068 * @param aActiveGraphicsContext the active context to 00069 * draw the shape into. 00070 */ 00071 virtual void Draw( CWindowGc& aActiveGraphicsContext ) const = 0; 00072 00073 00074 /** 00075 * GetRect 00076 * Pure virtual method that returns the smallest bounding 00077 * rectangle that entirely contains the shape. 00078 * @return The rectangle 00079 */ 00080 virtual TRect GetRect() const = 0; 00081 00082 /** 00083 * ReadShapeTypeL 00084 * Static method that reads the type of the next shape from 00085 * a stream. 00086 * @param aStream The stream to read from 00087 * @return Returns the type of the next shape 00088 */ 00089 IMPORT_C static TShapeType ReadShapeTypeL( RReadStream& aStream ); 00090 00091 /** 00092 * ExternalizeL 00093 * Virtual method that writes the shape to the specified 00094 * write stream. 00095 * @param aStream the stream to write the shape to. 00096 */ 00097 IMPORT_C virtual void ExternalizeL( RWriteStream& aStream ) const; 00098 00099 /** 00100 * InternalizeL 00101 * Virtual method that reads the shape from the specified 00102 * read stream. 00103 * @param aStream the stream to read the shape from. 00104 */ 00105 IMPORT_C virtual void InternalizeL( RReadStream& aStream ); 00106 00107 protected: // Data 00108 00109 /** iShapeType The type of the actual shape **/ 00110 const TShapeType iShapeType; 00111 00112 /** iOrigin The origin of the shape **/ 00113 TPoint iOrigin; 00114 }; 00115 00116 } 00117 00118 #endif // __SHAPE_H__ 00119 00120 00121 // End of File
|
© Nokia 2009 |