Nokia N97 SDK
Example Applications Guide

NShapes::TRectangle Class Reference

#include <rectangle.h>

Inheritance diagram for NShapes::TRectangle:

NShapes::TShape List of all members.

Detailed Description

TRectangle An instance of class TRectangle is a rectangular shape.

Definition at line 37 of file rectangle.h.


Public Member Functions

IMPORT_C  TRectangle (const TPoint &aOrigin, TInt aWidth, TInt aHeight)
IMPORT_C  TRectangle ()
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  iWidth
TInt  iHeight


Constructor & Destructor Documentation

EXPORT_C TRectangle::TRectangle (  const TPoint &  aOrigin,
TInt  aWidth,
TInt  aHeight
) 
 

TRectangle Create an instance of TRectangle at a specified position, and of a specified size.

Parameters:
aOrigin  where the origin of the shape is located.
aWidth  The width of the rectangle
aHeight  The height of the rectangle

Definition at line 28 of file rectangle.cpp.

00028                                                                                  :
00029                                  TShape( KRectangle, aOrigin ),
00030                                  iWidth( aWidth ),
00031                                  iHeight( aHeight )
00032     {
00033     // Create an instance of TRectangle at a specified position,
00034     // and of a specified size.
00035     // No implementation required
00036     }

EXPORT_C TRectangle::TRectangle (   ) 
 

TRectangle Create an instance of TRectangle

Definition at line 44 of file rectangle.cpp.

00044                                 : TShape( KRectangle, TPoint( 0,0 ) ),
00045                                             iWidth( 0 ),
00046                                             iHeight( 0 )
00047     {
00048     // Create an instance of TRectangle
00049     //  No implementation required
00050     }


Member Function Documentation

EXPORT_C void TRectangle::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 rectangle.cpp.

References GetRect().

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

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

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

Returns:
The rectangle

Implements NShapes::TShape.

Definition at line 67 of file rectangle.cpp.

References iHeight, NShapes::TShape::iOrigin, and iWidth.

Referenced by Draw().

00068     {
00069     return TRect( iOrigin, TSize( iWidth, iHeight ) );
00070     }

EXPORT_C void TRectangle::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 77 of file rectangle.cpp.

References NShapes::TShape::ExternalizeL(), iHeight, and iWidth.

00078     {
00079     TShape::ExternalizeL( aStream );
00080     aStream.WriteInt32L( iWidth );
00081     aStream.WriteInt32L( iHeight );
00082     }

EXPORT_C void TRectangle::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 rectangle.cpp.

References iHeight, NShapes::TShape::InternalizeL(), and iWidth.

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

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::TRectangle::iWidth [private]
 

iWidth The width of the rectangle

Definition at line 98 of file rectangle.h.

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

TInt NShapes::TRectangle::iHeight [private]
 

iHeight The height of the rectangle

Definition at line 101 of file rectangle.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(), GetRect(), NShapes::TCircle::GetRect(), and NShapes::TShape::InternalizeL().


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

© Nokia 2009

Back to top