basiclocationinfodisplay/blid/ui/inc/CHtkNavigationControl.h
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 2005-2008 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:  Blid application compass view's compass control class definition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CHTKNAVIGATIONCONTROL_H__
       
    21 #define __CHTKNAVIGATIONCONTROL_H__
       
    22 
       
    23 // SYSTEM INCLUDES
       
    24 #include <lbspositioninfo.h>
       
    25 #include <EPos_CPosLandmark.h>
       
    26 #include <alf/alfcontrol.h>
       
    27 
       
    28 //#ifdef RD_SCALABLE_UI_V2
       
    29 #include <barsread.h>
       
    30 #include <StringLoader.h>
       
    31 #include <aknstyluspopupmenu.h>
       
    32 //#endif // RD_SCALABLE_UI_V2
       
    33 
       
    34 // USER INCLUDE
       
    35 #include "CBlidBaseView.h"
       
    36 
       
    37 //FORWARD DCLERATION
       
    38 class MBlidLocation;
       
    39 class MBlidRouter;
       
    40 class MBlidEngObserver;
       
    41 class MBlidSettings;
       
    42 class CBlidEng;
       
    43 class CEikonEnv;
       
    44 class MKeyProcessor;
       
    45 class CAlfEnv;
       
    46 class CAlfImageVisual;
       
    47 class CAlfTextVisual;
       
    48 class CAlfBorderBrush;
       
    49 class CAlfAnchorLayout;
       
    50 class CAlfLayout;
       
    51 class CAlfCurvePath;
       
    52 class CAlfCurvePathLayout;
       
    53 class CAlfDeckLayout;
       
    54 class CAlfTextStyle;
       
    55 class CBlidArrivedTonePlayerUtility;
       
    56 class CAlfFrameBrush;
       
    57 class CAlfImageLoaderUtil;
       
    58 class CAlfTexture;
       
    59 
       
    60 const TInt KNumTexts = 3;
       
    61 
       
    62 /*! 
       
    63   @class CHtkNavigationControl
       
    64   
       
    65   @discussion 
       
    66   */
       
    67 class CHtkNavigationControl : public CAlfControl
       
    68     {
       
    69 	public:
       
    70 		 /*!
       
    71 		  @function NewL
       
    72 		   
       
    73 		  @discussion Create a CHtkNavigationControl object, which will draw itself to aRect
       
    74 		  @param aRect the rectangle this view will be drawn to
       
    75 		  @result a pointer to the created instance of CHtkNavigationControl
       
    76 		  */
       
    77 		    static CHtkNavigationControl* NewL(CAlfEnv& aEnv,
       
    78 					                           MObjectProvider* aParent,
       
    79 							                   const TRect& aRect,
       
    80 					                           MBlidLocation& aLocation,
       
    81 					                           MBlidRouter& aRouter,
       
    82 					                           CBlidEng& aEngine,
       
    83 					                           CBlidBaseView& aView);
       
    84 
       
    85 		 /*!
       
    86 		  @function NewLC
       
    87 		   
       
    88 		  @discussion Create a CHtkNavigationControl object, which will draw itself to aRect
       
    89 		  @param aRect the rectangle this view will be drawn to
       
    90 		  @result a pointer to the created instance of CHtkNavigationControl
       
    91 		  */
       
    92 		    static CHtkNavigationControl* NewLC(CAlfEnv& aEnv,
       
    93 					                            MObjectProvider* aParent,
       
    94 							                    const TRect& aRect,
       
    95 					                            MBlidLocation& aLocation,
       
    96 					                            MBlidRouter& aRouter,
       
    97 					                            CBlidEng& aEngine,
       
    98 					                            CBlidBaseView& aView);
       
    99 
       
   100 
       
   101 		 /*!
       
   102 		  @function ~CHtkNavigationControl
       
   103 		  
       
   104 		  @discussion Destroy the object and release all memory objects
       
   105 		  */
       
   106 		     ~CHtkNavigationControl();
       
   107 
       
   108 	  
       
   109 	private:
       
   110 		 /*!
       
   111 		  @function CHtkNavigationControl
       
   112 		  
       
   113 		  @discussion Perform the first phase of two phase construction 
       
   114 		  */
       
   115 		    CHtkNavigationControl(CAlfEnv& aEnv,
       
   116                                   MBlidLocation& aLocation,
       
   117                                   CBlidBaseView& aView,
       
   118                                   CBlidEng& aEngine );
       
   119 
       
   120 		 /*!
       
   121 		  @function ConstructL
       
   122 		  
       
   123 		  @discussion  Perform the second phase construction of a CHtkNavigationControl object
       
   124 		  */
       
   125 		    void ConstructL(CAlfEnv& aEnv,
       
   126 		                    const TRect& aRect,
       
   127                             MBlidRouter& aRouter,
       
   128                             CBlidEng& aEngine);
       
   129 
       
   130 	private:    
       
   131         /** 
       
   132          * Add new tabs to tabgroup
       
   133          * @param aTabGroup
       
   134          */
       
   135         void AddTabsL(CAknTabGroup& aTabGroup);
       
   136         
       
   137         /**
       
   138          * Appui's status pane getter
       
   139          * @return Statuspane pointer
       
   140          */
       
   141         CEikStatusPane* StatusPane();
       
   142         /**
       
   143          * Creates navigation visuals
       
   144          */
       
   145         void CreateNavigationVisualsL( );
       
   146         /**
       
   147          * Creates navigation text visuals
       
   148          */						     
       
   149 		void CreateNavigationTextVisualsL( CAlfTextStyle* aStyle1 );
       
   150 		/**
       
   151          * Creates disstance visuals
       
   152          */
       
   153 		void CreateDistanceVisualL( CAlfTextStyle* aStyle1 );
       
   154 		/**
       
   155          * Play arrived tone
       
   156          */
       
   157 		void PlayArrivedToneL();
       
   158 		/**
       
   159          * Calculate if user has arrived to destination
       
   160          */
       
   161 		void CalculateIfArrivedL();
       
   162 		/**
       
   163          * Creates application strings
       
   164          */
       
   165 		void CreateApplicationStringsL( );
       
   166 		/**
       
   167          * Converts durtion into descriptor
       
   168          */
       
   169 		void DurationFormat( TDes& aDurationString );
       
   170 		/**
       
   171          * Converts distance unit into descriptor
       
   172          */
       
   173 		void DistanceUnit( TDes& aUnitString );
       
   174 		/**
       
   175          * Converts distance into descriptor
       
   176          */
       
   177 		void DistanceFormat( TDes& aDistanceString );
       
   178 		/**
       
   179          * Calculates durtion
       
   180          */
       
   181 		void CalculateDurationL( TCourse aCourse );
       
   182 		/**
       
   183          * Calculates distance
       
   184          */
       
   185 		void CalculateDistanceL( TPosition aPosition );
       
   186 		/**
       
   187          * Converts speed format into descriptor
       
   188          */
       
   189 		void SpeedFormat( TDes& aSpeedString, TDes& aSpeedFormatString);
       
   190 		/**
       
   191          * Creates speed visuals
       
   192          */
       
   193 		void CreateSpeedVisualL( CAlfTextStyle* aStyle1 );
       
   194 		/**
       
   195          * Prepares for dynamic move
       
   196          */
       
   197 		void PrepareDynamicMoveL( );
       
   198 		/**
       
   199          * Sets the landmark name
       
   200          */                             
       
   201 		void SetLandMarksNameL();
       
   202 		/**
       
   203          * Displays the current signal strength
       
   204          */
       
   205 		void DisplaySatelliteSignalStrength( TInt aSatCount );
       
   206 		/**
       
   207          * Creates textures for signal images
       
   208          */
       
   209 		void CreateSignalTexturesL();
       
   210 		/**
       
   211          * Create popup image texture
       
   212          */
       
   213 		void CreatePopupImgTextureL();
       
   214 		/**
       
   215          * Creates accuracy ring texture
       
   216          */
       
   217 		void CreateAccTextureL();
       
   218 
       
   219        /*
       
   220         * This function checks wheather
       
   221         * distance to destination is less than 10 meter
       
   222         * and return ETrue or EFalse depends upon the condition.
       
   223         */        
       
   224         TBool IsInArrivedZone();
       
   225 		/**
       
   226          * Creates indicator visual
       
   227          */      
       
   228         void CreateIndicatorVisualL();
       
   229         /**
       
   230          * Launches device not available note
       
   231          */
       
   232         void LaunchDeviceNotAvlNoteL();
       
   233         /**
       
   234          * Launches infor query dialog
       
   235          */
       
   236         void LaunchInfoQueryDlgL();
       
   237 		/**
       
   238          * Creates animation
       
   239          */
       
   240         void CreateAnimationL();
       
   241         /**
       
   242          * Creates popup visuals
       
   243          */
       
   244         void CreatePopUpVisualL();
       
   245         /**
       
   246          * Updates visual image when timer is expired
       
   247          */
       
   248         void UpdateVisualImage();
       
   249         /**
       
   250          * Called when timer is expired
       
   251          */
       
   252         static TInt Tick(TAny* aObject); // functions for TCallBack protocol
       
   253         /**
       
   254          * Launches stylus activated popup
       
   255          */
       
   256         void LaunchStylusPopupMenuL( TPointerEvent aPointerEvent );
       
   257         /**
       
   258          * Calculate the Layout Rects
       
   259          */
       
   260         void CalculateRects();
       
   261         /**
       
   262          * Set Anchors for Visuals
       
   263          */
       
   264         void SetAnchors();
       
   265         
       
   266 	public:	    //from CAlfControl
       
   267 		/**
       
   268          * Handles the key events
       
   269          */
       
   270 		TBool OfferEventL( const TAlfEvent& aEvent );
       
   271 		/**
       
   272          * Notify about control visibility
       
   273          */
       
   274 		void NotifyControlVisibility( TBool aIsVisible, 
       
   275 		       						  CAlfDisplay& aDisplay );
       
   276 					
       
   277 		
       
   278 	public:
       
   279         /**
       
   280          * Update controls
       
   281          */ 
       
   282         void UpdateL();
       
   283         /**
       
   284          * Clears the navigation info
       
   285          */
       
   286         void ClearNavigationInfoL();
       
   287 		/**
       
   288          * Set update option
       
   289          */
       
   290 		void SetUpdateOptionL( TBool aIsDestSet );        
       
   291 		/**
       
   292          * Draw curves
       
   293          */
       
   294 		void DrawCurvesL( );
       
   295 		/**
       
   296          * Sets the flag visual
       
   297          */
       
   298 		void SetFlagVisualL();
       
   299 		/**
       
   300          * Sets the accuracy visual
       
   301          */
       
   302 		void SetAccRacyVisualL();
       
   303 
       
   304         /**
       
   305          * Create CAknNavigationDecorator, ownership passed to caller.
       
   306          * @param aDefaultNaviPane, ETrue if default, EFalse if tabgroup
       
   307          * @return new instance of object. NULL, if something fails
       
   308          */
       
   309         void CreateNaviPaneL( TBool aDefaultNaviPane );
       
   310 
       
   311 
       
   312         /**
       
   313          * Activate navigation decorator.
       
   314          * Method can called if tab needs to be refreshed.
       
   315          * @param aNaviDecorator    navigation decorator
       
   316          * @param aTabId            activated tabulator id             
       
   317          */
       
   318         void ActivateTabL( CAknNavigationDecorator& aNaviDecorator, 
       
   319                             TInt aTabId );
       
   320 		/**
       
   321          * Retruns the navi decorator
       
   322          */
       
   323 		CAknNavigationDecorator* GetNiviDecorator( );
       
   324 		/**
       
   325          * Change the flag visual image when reaching destination
       
   326          */
       
   327         void ChangeFlagVisualImageL();
       
   328         /**
       
   329          * Check if user has arrived to the destination
       
   330          */
       
   331         TBool HasArrivedDestination();        
       
   332         /**
       
   333          * Make title
       
   334          * @param aResourceText resource to create title
       
   335          */
       
   336         void MakeTitleL( TInt aResourceText );
       
   337         /**
       
   338          * Stop the arrrival tone player
       
   339          */
       
   340         void StopPlayerL(  ); 
       
   341         /**
       
   342          * Update the layout
       
   343          */
       
   344         void UpdateLayoutL();
       
   345         /**
       
   346          * Displays the info popup msg
       
   347          */
       
   348         void DisplayInfoPopUpMsgL();
       
   349         
       
   350 	private:
       
   351 		
       
   352         /// Ref: A reference to MBlidLocation model
       
   353         MBlidLocation& iLocationModel;
       
   354 
       
   355         /// Ref: A pointer to MBlidRouter model
       
   356         MBlidRouter* iRouter;
       
   357 
       
   358         /// Reference to the view to handle resource change
       
   359         CBlidBaseView& iView;
       
   360         
       
   361         /// Reference to the engine
       
   362         CBlidEng& iEngine;
       
   363 
       
   364         /// Own: Decorator class for navigation pane controls.
       
   365         CAknNavigationDecorator* iDecoratedTabGroup;        
       
   366         
       
   367 		//Own: Layout for all the visuals.
       
   368 		CAlfAnchorLayout* iLayout;
       
   369 
       
   370 		//Own: Text visuals. 
       
   371 		CAlfTextVisual* iLabel;
       
   372 		
       
   373 		//Own: Text visuals. 
       
   374 		CAlfTextVisual* iDistanceLabel;
       
   375 
       
   376 		//Own: Text visuals. 
       
   377 		CAlfTextVisual* iSpeedLabel;
       
   378 
       
   379 		//Own: Text visuals. 
       
   380 		CAlfTextVisual* iSpeedFormatLabel;
       
   381 
       
   382 		CAlfEnv& iEnv;
       
   383 		
       
   384 		CAlfImageVisual* iImageVisual;
       
   385 		
       
   386         TInt iIndex;
       
   387         
       
   388         /// Own: Position information 
       
   389         TPosition iPositionInfo;
       
   390 
       
   391         /// Own: Course information
       
   392         TCourse iCourse;
       
   393         
       
   394         /// Ref: A pointer to MBlidSettings model
       
   395         MBlidSettings* iSettings;        
       
   396         
       
   397         // To determine if user has arrived to destination
       
   398         static TBool iHasArrived;
       
   399         
       
   400         //variable to check wheather user arrived to destination
       
   401         TBool iTimeFirstArrived;
       
   402         
       
   403         //Boolean to determine whether the arrived tone has palyed/not         
       
   404         static TBool       iHasToPlayArrivedTone;
       
   405 
       
   406         /// Own: Metric distance functionality text string 
       
   407         HBufC* iDistanceFormatKm;
       
   408 
       
   409         /// Own: Metric distance functionality text string 
       
   410         HBufC* iDistanceFormatM;
       
   411 
       
   412         /// Own: Imperial distance functionality text string 
       
   413         HBufC* iDistanceFormatMiles;
       
   414 
       
   415         /// Own: Imperial distance functionality text string 
       
   416         HBufC* iDistanceFormatFt;
       
   417 
       
   418         /// Own: Duration functionality text string 
       
   419         HBufC* iDurationFormatLong;
       
   420 
       
   421         /// Distance variable
       
   422         TReal32 iDistance;
       
   423 
       
   424         /// Duration variable
       
   425         TTime iDuration;
       
   426 
       
   427         /// Duration in days
       
   428         TInt iDurationInDays;
       
   429 
       
   430         /// Duration in seconds
       
   431         TReal64 iDurationInSeconds;
       
   432 
       
   433         /// Own: Speed's title text string
       
   434         HBufC* iBlidSpeed;
       
   435         
       
   436         /// Speed variable
       
   437         TReal iSpeed;
       
   438 
       
   439         /// Is speed data available
       
   440         TBool iIsSpeed;
       
   441 
       
   442         /// Own: Metric speed's format text string
       
   443         HBufC* iSpeedFormatKmph;
       
   444 
       
   445         /// Own: Imperial speed's format text string
       
   446         HBufC* iSpeedFormatMph;
       
   447 
       
   448         // Own: No Data indicator
       
   449         HBufC* iDataBeingCalculated;
       
   450 
       
   451        // Own: No Data indicator
       
   452         HBufC* iDataBlank;
       
   453         
       
   454 		
       
   455 		TBool iIsDestinationSet;
       
   456 		
       
   457 		CAlfCurvePath* iCurvePath;		
       
   458 		
       
   459 		CAlfCurvePathLayout* iCurveLayout;
       
   460 		
       
   461 		HBufC8* iFlagText;
       
   462 		HBufC8* iAccText;
       
   463 		
       
   464 		CAlfImageVisual*  iFlagVisual;
       
   465 		
       
   466 		CAlfImageVisual*  iAccVisual;		
       
   467 		
       
   468 		CAlfImageVisual*  iNorthVisual;
       
   469 		
       
   470 		CAlfDeckLayout*  idecLayout;
       
   471 		
       
   472 		CAlfDeckLayout*  iNdecLayout;
       
   473 		
       
   474 		TReal iHeading;
       
   475 		
       
   476 		TRect iAccuracyRingRect;
       
   477 		
       
   478 		TPoint* iCharPoint;
       
   479 		
       
   480 		CAlfDeckLayout* iAccLayout;
       
   481 		
       
   482         CPeriodic* iTimer;
       
   483         
       
   484         TInt iIsFirstDistance;
       
   485         TReal32 iFirstDistance;
       
   486     	HBufC*	iImagePath;
       
   487     	TSize iCurveSize;
       
   488     	TSize iFlagSize;
       
   489     	TSize iAccuracyringcurveSize;   
       
   490         
       
   491         CAlfDeckLayout* iCurveDecLyt;
       
   492         
       
   493         CAlfAnchorLayout* iIndiAccAnchor;
       
   494         
       
   495         CAlfImageVisual* iIndicatorVisual;
       
   496         
       
   497         CAlfDeckLayout* iFlagdeck;
       
   498         
       
   499         CAlfDeckLayout* iActualNdeck;
       
   500 		
       
   501 		CBlidArrivedTonePlayerUtility* iToneUtility;
       
   502 		
       
   503 		TBool isStopUpdate;
       
   504 		
       
   505 		CAlfAnchorLayout* iPopUpLayout;
       
   506 		
       
   507 		CAlfTextVisual* iPopUpMsg;
       
   508 		
       
   509 		CAlfImageVisual* iPopImage;
       
   510 		
       
   511 		TBool isSatelliteInfoLaunch;
       
   512 		
       
   513 		CAlfDeckLayout* iPopupDeck;
       
   514 		
       
   515 		CAlfFrameBrush* iFrameBrush;
       
   516 		
       
   517 		CAlfAnchorLayout* iPopUpAnchor;
       
   518 
       
   519 		TRgb	iVisualColor;
       
   520 		
       
   521 		TBool iMskInfoVisible;
       
   522 		
       
   523 		CAlfImageVisual* iNavigationRing;
       
   524 
       
   525 	    CPeriodic* iPeriodic; // periodic timer active object
       
   526         TInt iDisplayIcon;    // Current svg animation icon
       
   527 	    RPointerArray<CAlfTexture> iTextures;
       
   528 	    RPointerArray<CAlfTexture> iPopupTextures;
       
   529 	    RPointerArray<CAlfTexture> iSignalTextures;
       
   530 	    CAlfTexture* iAccTexture;
       
   531 	    CAlfTexture* iPopupImgTexture;
       
   532 				
       
   533 		MAlfBitmapProvider* iProvider;
       
   534 		
       
   535 		TRect iSignalStrengthRect;
       
   536 		
       
   537 		TRect iLmkNameRect;
       
   538 		
       
   539 		TRect iDistanceRect;
       
   540 		
       
   541 		TRect iSpeedBgRect;
       
   542 		
       
   543 		TRect iSpeedRect;
       
   544 		
       
   545 		TRect iSpdFormatRect;
       
   546 		
       
   547 		TRect iNavRingBgRect;
       
   548 		
       
   549 		TRect iAccRingRect;
       
   550 		
       
   551 		TRect iDirectionIndRect;
       
   552 		
       
   553 		TRect iNorthRect;
       
   554 
       
   555 		TRect iFlagRect;
       
   556 
       
   557 		CAknStylusPopUpMenu* iMenu;
       
   558 		
       
   559 		TBool isDeviceUnavailableDisplayed;
       
   560     public:        
       
   561         TBool iTimerComplete;
       
   562         static TBool       iInArrivedZone;
       
   563         TBool iIsDownPressed;
       
   564     };
       
   565 
       
   566 #endif // __CHTKNAVIGATIONCONTROL_H__