systemswuis/touchscreencalib/inc/TouchScreenCalibView.h
branchRCL_3
changeset 35 5f281e37a2f5
parent 0 254040eb3b7d
equal deleted inserted replaced
34:90fe62538f66 35:5f281e37a2f5
       
     1 /*
       
     2 * Copyright (c) 2006 - 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *     This class is the container class of the CTouchScreenCalibView.
       
    16 *     Is used to show tap target animation.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef TOUCHSCREENCALIBVIEW_H
       
    23 #define TOUCHSCREENCALIBVIEW_H
       
    24 
       
    25 // SYSTEM INCLUDES
       
    26 #include <coecntrl.h>
       
    27 #include <data_caging_path_literals.hrh>
       
    28 
       
    29 #include <touchfeedback.h>
       
    30 // USER INCLUDES
       
    31 #include "TouchScreenCalibAppUi.h"
       
    32 
       
    33 // CONSTANTS
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class TCalibAnimImageRect
       
    37     {
       
    38 public:
       
    39     TRect iAnimImageRect1;
       
    40     TRect iAnimImageRect2;
       
    41     TRect iAnimImageRect3;
       
    42     TRect iAnimImageRect4;
       
    43     };
       
    44 
       
    45 class CTouchScreenCalibAppUi;
       
    46 class CAknBitmapAnimation;
       
    47 
       
    48 // CLASS DECLARATION
       
    49 
       
    50 /**
       
    51 *  This class takes care of showing welcome animatio to the user.
       
    52 */
       
    53 class CTouchScreenCalibView :  public CCoeControl , public MCoeControlObserver 
       
    54     {
       
    55     public:  // Constructors and destructor
       
    56         
       
    57         /**
       
    58         *  C++ default constructor.
       
    59         */
       
    60         CTouchScreenCalibView( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi );
       
    61 
       
    62         /**
       
    63         * Two-phased constructor.
       
    64         */
       
    65         static CTouchScreenCalibView* NewL( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi );
       
    66 
       
    67         /**
       
    68         *  Destructor
       
    69         */
       
    70         ~CTouchScreenCalibView();      
       
    71 
       
    72         /**
       
    73         *  This handles the key events in this control.
       
    74         */
       
    75         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
       
    76 
       
    77         /**
       
    78         * Update UI
       
    79         */
       
    80         void UpdateL( TAknLayoutText aTextLayout );
       
    81         
       
    82         /**
       
    83         * Prepare to draw background for ending phase
       
    84         */
       
    85         void DrawEndingBackground();
       
    86         
       
    87         /**
       
    88         * Prepare to draw background for notes
       
    89         */
       
    90         void EndTargetAnimation();
       
    91     
       
    92         /**
       
    93         *  This makes the animation module to stop showing animation.
       
    94         */
       
    95         void EndAnimation();
       
    96 
       
    97         /**
       
    98         * 
       
    99         */
       
   100         void SetTextL(TAknLayoutText aTextLayout);
       
   101 
       
   102         /**
       
   103         * 
       
   104         */
       
   105         void SetWinPriority(TInt aPriority);
       
   106 
       
   107     private:
       
   108 
       
   109         /**
       
   110         * By default EPOC constructor is private.
       
   111         */
       
   112         void ConstructL();
       
   113 
       
   114         CTouchScreenCalibView();
       
   115 
       
   116         /**
       
   117         *  Is called when size is changed.
       
   118         */
       
   119         void SizeChanged();
       
   120 
       
   121         /**
       
   122         *  Returns the count of the components in the container.
       
   123         */
       
   124         TInt CountComponentControls() const;
       
   125 
       
   126         /**
       
   127         *  Returns the component specified by aIndex parameter.
       
   128         */
       
   129         CCoeControl* ComponentControl(TInt aIndex) const;
       
   130 
       
   131         /**
       
   132         *  Handles the event of the control.
       
   133         */
       
   134         void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
       
   135 
       
   136         /**
       
   137         *  Handles key events.
       
   138         *  @param  aKeyEvent        Event to be handled
       
   139         *  @param  aType            Type of the key event 
       
   140         *  @return TKeyResponse
       
   141         */
       
   142         virtual TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
   143 
       
   144         /**
       
   145         * Handles pointer events
       
   146         */
       
   147         virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   148 
       
   149         /**
       
   150         * Checks tapped point's validity
       
   151         * @param TPoint             co-ordinates
       
   152         * @since S60 3.2
       
   153         */
       
   154         TBool Validate(TPoint aPos);
       
   155 
       
   156         /**
       
   157         * Draw white background
       
   158         * @since S60 3.2
       
   159         */
       
   160         void DrawBackground() const;
       
   161 
       
   162         /**
       
   163         * Draw texts
       
   164         * @since S60 3.2
       
   165         */
       
   166         void DrawText() const;
       
   167 
       
   168         /**
       
   169         * Draw inactive tap points
       
   170         * @since S60 3.2
       
   171         */
       
   172         void ShowImage( TRect aRect ) const;
       
   173 
       
   174     private: // Functions from base classes
       
   175 
       
   176         /**
       
   177         * From CCoeControl
       
   178         */
       
   179         void Draw( const TRect& aRect ) const;
       
   180     
       
   181     protected: // Data
       
   182 
       
   183         //Used for showing animation    
       
   184         CAknBitmapAnimation *iAnim; //owns
       
   185 
       
   186         CFbsBitmap *iBitmap;
       
   187         CFbsBitmap *iBitmapMask;
       
   188 
       
   189         CTouchScreenCalibAppUi* iTouchScreenCalibAppUi; //uses
       
   190 
       
   191         //used for telling when the animation is showing
       
   192         TBool iAnimationShowing;
       
   193 
       
   194         //used for telling if animation is cancelled by user.
       
   195         TBool iAnimationCancelled;
       
   196 
       
   197         const CFont* iFont; // not owned
       
   198 
       
   199         CArrayPtr<HBufC>* iText;
       
   200 
       
   201         
       
   202         TCalibAnimImageRect iAnimImageRect;
       
   203 
       
   204         TPoint iTextTopLeft;
       
   205         TSize iTextSize;
       
   206         TInt iTextBaselineOffset;
       
   207         TRgb iTextColor;
       
   208         CGraphicsContext::TTextAlign iTextAlignment;
       
   209         TBool iCalibrationCompleted;
       
   210         MTouchFeedback* iTouchFeedback;
       
   211     };
       
   212 
       
   213 #endif      // TOUCHSCREENCALIBVIEW_H
       
   214             
       
   215 // End of File