Nokia N97 SDK
Example Applications Guide

NShapes::TCircle Class Reference

#include <circle.h>

Inheritance diagram for NShapes::TCircle:

NShapes::TShape List of all members.

Detailed Description

TCircle An instance of class TCircle is a circular shape.

Definition at line 37 of file circle.h.


Public Member Functions

IMPORT_C  TCircle (const TPoint &aCenter, TInt aRadius)
IMPORT_C  TCircle ()
IMPORT_C void  Draw (CWindowGc &aActiveGraphicsContext) const
IMPORT_C TRect  GetRect () const
IMPORT_C void  ExternalizeL (RWriteStream &aStream) const
IMPORT_C void  InternalizeL (RReadStream &aStream)

Static Public Member Functions

static IMPORT_C TShapeType  ReadShapeTypeL (RReadStream &aStream)

Protected Attributes

const TShapeType  iShapeType
TPoint  iOrigin

Private Attributes

TInt  iRadius


Constructor & Destructor Documentation

EXPORT_C TCircle::TCircle (  const TPoint &  aCenter,
TInt  aRadius
) 
 

TCircle. Create an instance of TCircle at a specified position, and of a specified radius.

Parameters:
aCenter  where the center of the circle is located.
aRadius  The radius of the circle

Definition at line 31 of file circle.cpp.

00032 : TShape( KCircle, aCenter - TSize( aRadius, aRadius ) ),
00033   iRadius( aRadius )
00034     {
00035     // Create an instance of TCircle at a specified position,
00036     // and of a specified radius.
00037     // No implementation required
00038     }

EXPORT_C TCircle::TCircle (   ) 
 

TCircle. Create an instance of TCircle

Definition at line 45 of file circle.cpp.

00045                           : TShape( KCircle, TPoint( 0,0 ) ), iRadius( 0 )
00046     {
00047     // Create an instance of TCircle.
00048     // No implementation required
00049     }


Member Function Documentation

EXPORT_C void TCircle::Draw (  CWindowGc &  aActiveGraphicsContext  )  const [virtual]
 

Draw Virtual method that draws the shape to the specified graphics context.

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

Implements NShapes::TShape.

Definition at line 57 of file circle.cpp.

References GetRect().

00058     {
00059     aActiveGraphicsContext.DrawEllipse( GetRect() );
00060     }

EXPORT_C TRect TCircle::GetRect (   )  const [virtual]
 

GetRect Return the smallest bounding rectangle that entirely contains the shape.

Returns:
The rectangle

Implements NShapes::TShape.

Definition at line 68 of file circle.cpp.

References NShapes::TShape::iOrigin, and iRadius.

Referenced by Draw().

00069     {
00070     return TRect( iOrigin, TSize( iRadius * 2, iRadius * 2 ) );
00071     }

EXPORT_C void TCircle::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 from NShapes::TShape.

Definition at line 78 of file circle.cpp.

References NShapes::TShape::ExternalizeL(), and iRadius.

00079     {
00080     TShape::ExternalizeL( aStream );
00081     aStream.WriteInt32L( iRadius );
00082     }

EXPORT_C void TCircle::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 from NShapes::TShape.

Definition at line 89 of file circle.cpp.

References NShapes::TShape::InternalizeL(), and iRadius.

00090     {
00091     TShape::InternalizeL( aStream );
00092     iRadius = aStream.ReadInt32L();
00093     }

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

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     }


Member Data Documentation

TInt NShapes::TCircle::iRadius [private]
 

iRadius, The Radius of the circle

Definition at line 98 of file circle.h.

Referenced by ExternalizeL(), GetRect(), and InternalizeL().

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

iShapeType The type of the actual shape

Definition at line 110 of file shape.h.

Referenced by NShapes::TShape::ExternalizeL().

TPoint NShapes::TShape::iOrigin [protected, inherited]
 

iOrigin The origin of the shape

Definition at line 113 of file shape.h.

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


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

© Nokia 2009

Back to top