Nokia N97 SDK
Example Applications Guide

NShapes::TShape Class Reference

#include <shape.h>

Inheritance diagram for NShapes::TShape:

NShapes::TCircle NShapes::TRectangle List of all members.

Detailed Description

TShape Abstract class for shapes.

Definition at line 48 of file shape.h.


Public Member Functions

IMPORT_C  TShape (TShapeType aShapeType, const TPoint &aOrigin)
virtual void  Draw (CWindowGc &aActiveGraphicsContext) const =0
virtual TRect  GetRect () const =0
virtual IMPORT_C void  ExternalizeL (RWriteStream &aStream) const
virtual IMPORT_C void  InternalizeL (RReadStream &aStream)

Static Public Member Functions

static IMPORT_C TShapeType  ReadShapeTypeL (RReadStream &aStream)

Protected Attributes

const TShapeType  iShapeType
TPoint  iOrigin


Constructor & Destructor Documentation

EXPORT_C TShape::TShape (  TShapeType  aShapeType,
const TPoint &  aOrigin
) 
 

TShape Constructor that creates the shape at a specific point.

Parameters:
aShapeType  the type of the actual shape.
aOrigin  where the origin of the shape is located.

Definition at line 31 of file shape.cpp.

00031                                                                      :
00032                                                 iShapeType( aShapeType ),
00033                                                 iOrigin( aOrigin )
00034     {
00035     // Constructor that creates the shape at a specific point
00036     // No implementation required
00037     }


Member Function Documentation

virtual void NShapes::TShape::Draw (  CWindowGc &  aActiveGraphicsContext  )  const [pure virtual]
 

Draw Pure virtual method that draws the shape to the specified graphics context.

Parameters:
aActiveGraphicsContext  the active context to draw the shape into.

Implemented in NShapes::TCircle, and NShapes::TRectangle.

Referenced by CGuiEngineAppView::Draw().

virtual TRect NShapes::TShape::GetRect (   )  const [pure virtual]
 

GetRect Pure virtual method that returns the smallest bounding rectangle that entirely contains the shape.

Returns:
The rectangle

Implemented in NShapes::TCircle, and NShapes::TRectangle.

EXPORT_C TShapeType TShape::ReadShapeTypeL (  RReadStream &  aStream  )  [static]
 

ReadShapeTypeL Static method that reads the type of the next shape from a stream.

Parameters:
aStream  The stream to read from
Returns:
Returns the type of the next shape

Definition at line 44 of file shape.cpp.

00045     {
00046     return static_cast<TShapeType>( aStream.ReadInt32L() );
00047     }

EXPORT_C void TShape::ExternalizeL (  RWriteStream &  aStream  )  const [virtual]
 

ExternalizeL Virtual method that writes the shape to the specified write stream.

Parameters:
aStream  the stream to write the shape to.

Reimplemented in NShapes::TCircle, and NShapes::TRectangle.

Definition at line 53 of file shape.cpp.

References iOrigin, and iShapeType.

Referenced by CShapeListManager::ExternalizeL(), NShapes::TRectangle::ExternalizeL(), and NShapes::TCircle::ExternalizeL().

00054     {
00055     aStream.WriteInt32L( iShapeType );
00056     aStream.WriteInt32L( iOrigin.iX );
00057     aStream.WriteInt32L( iOrigin.iY );
00058     }

EXPORT_C void TShape::InternalizeL (  RReadStream &  aStream  )  [virtual]
 

InternalizeL Virtual method that reads the shape from the specified read stream.

Parameters:
aStream  the stream to read the shape from.

Reimplemented in NShapes::TCircle, and NShapes::TRectangle.

Definition at line 65 of file shape.cpp.

References iOrigin.

Referenced by CShapeListManager::InternalizeL(), NShapes::TRectangle::InternalizeL(), and NShapes::TCircle::InternalizeL().

00066     {
00067     //  iShapeType has already been read
00068     iOrigin.iX = aStream.ReadInt32L();
00069     iOrigin.iY = aStream.ReadInt32L();
00070     }


Member Data Documentation

const TShapeType NShapes::TShape::iShapeType [protected]
 

iShapeType The type of the actual shape

Definition at line 110 of file shape.h.

Referenced by ExternalizeL().

TPoint NShapes::TShape::iOrigin [protected]
 

iOrigin The origin of the shape

Definition at line 113 of file shape.h.

Referenced by ExternalizeL(), NShapes::TRectangle::GetRect(), NShapes::TCircle::GetRect(), and InternalizeL().


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top