Nokia N97 SDK
Example Applications Guide

CTactileExampleCircle Class Reference

#include <tactileexamplecircle.h>

Inheritance diagram for CTactileExampleCircle:

List of all members.

Detailed Description

CTactileExampleCircle control class.

Definition at line 27 of file tactileexamplecircle.h.


Public Member Functions

virtual  ~CTactileExampleCircle ()
void  EnableFeedback (TBool aEnabled)
void  Draw (const TRect &aRect) const
void  HandlePointerEventL (const TPointerEvent &aPointerEvent)
TBool  HitRegionContains (const TPoint &aPoint, const CCoeControl &) const

Static Public Member Functions

static CTactileExampleCircle *  NewL (const TRect &aRect, const CCoeControl *aParent)

Private Member Functions

  CTactileExampleCircle ()
void  ConstructL (const TRect &aRect, const CCoeControl *aParent)


Constructor & Destructor Documentation

CTactileExampleCircle::~CTactileExampleCircle (   )  [virtual]
 

Destructor.

Definition at line 44 of file tactileexamplecircle.cpp.

00045     {
00046     }


Member Function Documentation

CTactileExampleCircle * CTactileExampleCircle::NewL (  const TRect &  aRect,
const CCoeControl *  aParent
)  [static]
 

First phase of two-phased constructor

Definition at line 29 of file tactileexamplecircle.cpp.

References ConstructL().

Referenced by CTactileExampleAppView::ConstructL().

00031     {
00032     CTactileExampleCircle* self = new ( ELeave ) CTactileExampleCircle;
00033     CleanupStack::PushL( self );
00034     self->ConstructL( aRect, aParent );
00035     CleanupStack::Pop( self );
00036     return self;
00037     }

void CTactileExampleCircle::EnableFeedback (  TBool  aEnabled  ) 
 

Enables/disables tactile feedback for this control

Parameters:
aEnabled  Use ETrue to enable feedback and EFalse to disable feedback

Definition at line 53 of file tactileexamplecircle.cpp.

Referenced by CTactileExampleAppView::HandleControlEventL(), and CTactileExampleAppView::HandleResourceChange().

00054     {
00055     MTouchFeedback* feedback = MTouchFeedback::Instance();
00056     if ( feedback )
00057         {
00058         feedback->EnableFeedbackForControl( this, aEnabled );
00059         }
00060     }

void CTactileExampleCircle::Draw (  const TRect &  aRect  )  const
 

From CCoeControl. Draw this CTactileExampleCircle control to the screen.

Parameters:
aRect  the rectangle of this control that needs updating

Definition at line 68 of file tactileexamplecircle.cpp.

00069     {
00070     CWindowGc& gc = SystemGc();
00071     gc.SetPenStyle( CGraphicsContext::ENullPen );
00072     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
00073     gc.SetBrushColor( KRgbBlue );
00074     gc.DrawEllipse( Rect() );
00075     }

void CTactileExampleCircle::HandlePointerEventL (  const TPointerEvent &  aPointerEvent  ) 
 

From CCoeControl.

Parameters:
aPointerEvent  The pointer event.

Definition at line 84 of file tactileexamplecircle.cpp.

00085     {
00086     if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
00087         {
00088         MTouchFeedback* feedback = MTouchFeedback::Instance();
00089         if ( feedback )
00090             {
00091             feedback->InstantFeedback( this, ETouchFeedbackBasic );
00092             }
00093         }
00094     CCoeControl::HandlePointerEventL( aPointerEvent );
00095     }

TBool CTactileExampleCircle::HitRegionContains (  const TPoint &  aPoint,
const CCoeControl & 
)  const
 

From MCoeControlHitTest. Tests whether a pointer event occurred inside the control's hit region

Parameters:
aPoint  The position of the pointer event
aControl 

Definition at line 105 of file tactileexamplecircle.cpp.

Referenced by CTactileExampleAppView::HandlePointerEventL().

00107     {
00108     TBool hit;
00109 
00110     if ( this->IsVisible() )
00111         {
00112         TReal distance; // aPoint's distance from center of the circle
00113         TReal pow1;
00114         TReal pow2;
00115         TPoint offSet = Rect().Center() - aPoint;
00116         Math::Pow( pow1, offSet.iX, 2 );
00117         Math::Pow( pow2, offSet.iY, 2 );
00118         Math::Sqrt( distance,  pow1 + pow2 );
00119 
00120         hit = ( distance > ( Rect().Width()/2 )) ? EFalse : ETrue;
00121         }
00122     else
00123         {
00124         hit = EFalse;
00125         }
00126 
00127     return hit;
00128     }

void CTactileExampleCircle::ConstructL (  const TRect &  aRect,
const CCoeControl *  aParent
)  [private]
 

Second phase of constructor.

Definition at line 145 of file tactileexamplecircle.cpp.

Referenced by NewL().

00146     {
00147     SetContainerWindowL( *aParent );
00148     SetRect( aRect );
00149 
00150     // Set hit tester to be object itself
00151     SetHitTest( this );
00152 
00153     ActivateL();
00154     }


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

© Nokia 2009

Back to top