|
Nokia N97 SDK Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : circle.cpp 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 // INCLUDE FILES 00018 #include "circle.h" 00019 00020 00021 using namespace NShapes; 00022 00023 00024 // ========================= MEMBER FUNCTIONS ================================== 00025 00026 // ----------------------------------------------------------------------------- 00027 // TCircle::TCircle() 00028 // C++ default constructor can NOT contain any code, that might leave. 00029 // ----------------------------------------------------------------------------- 00030 // 00031 EXPORT_C TCircle::TCircle( const TPoint& aCenter, TInt aRadius ) 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 } 00039 00040 // ----------------------------------------------------------------------------- 00041 // TCircle::TCircle() 00042 // C++ default constructor can NOT contain any code, that might leave. 00043 // ----------------------------------------------------------------------------- 00044 // 00045 EXPORT_C TCircle::TCircle() : TShape( KCircle, TPoint( 0,0 ) ), iRadius( 0 ) 00046 { 00047 // Create an instance of TCircle. 00048 // No implementation required 00049 } 00050 00051 00052 // ----------------------------------------------------------------------------- 00053 // TCircle::Draw() 00054 // Virtual method that draws the shape to the specified graphics context. 00055 // ----------------------------------------------------------------------------- 00056 // 00057 EXPORT_C void TCircle::Draw ( CWindowGc& aActiveGraphicsContext ) const 00058 { 00059 aActiveGraphicsContext.DrawEllipse( GetRect() ); 00060 } 00061 00062 00063 // ----------------------------------------------------------------------------- 00064 // TCircle::GetRect() 00065 // Return the smallest bounding rectangle that entirely contains the shape. 00066 // ----------------------------------------------------------------------------- 00067 // 00068 EXPORT_C TRect TCircle::GetRect() const 00069 { 00070 return TRect( iOrigin, TSize( iRadius * 2, iRadius * 2 ) ); 00071 } 00072 00073 // ----------------------------------------------------------------------------- 00074 // TCircle::ExternalizeL() 00075 // Virtual method that writes the shape to the specified write stream. 00076 // ----------------------------------------------------------------------------- 00077 // 00078 EXPORT_C void TCircle::ExternalizeL( RWriteStream& aStream ) const 00079 { 00080 TShape::ExternalizeL( aStream ); 00081 aStream.WriteInt32L( iRadius ); 00082 } 00083 00084 // ----------------------------------------------------------------------------- 00085 // TCircle::InternalizeL() 00086 // Virtual method that reads the shape from the specified read stream. 00087 // ----------------------------------------------------------------------------- 00088 // 00089 EXPORT_C void TCircle::InternalizeL( RReadStream& aStream ) 00090 { 00091 TShape::InternalizeL( aStream ); 00092 iRadius = aStream.ReadInt32L(); 00093 } 00094 00095 // End of File
|
© Nokia 2009 |