svgtviewer/SvgtViewerPlugin/UIControlInc/SvgtController.h
changeset 0 632761c941a7
equal deleted inserted replaced
-1:000000000000 0:632761c941a7
       
     1 /*
       
     2 * Copyright (c) 2005 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:  SVGT Controller implements the active objects for the 
       
    15 *                progressive rendering feature(Redraw, Thread Exit)
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 //SvgtController.h
       
    21 
       
    22 #ifndef SVGTCONTROLLER_H
       
    23 #define SVGTCONTROLLER_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <f32file.h>
       
    27 
       
    28 const TInt KAnimationLength = 10;
       
    29 const TInt KAnimatioBufferLength = 20;
       
    30 class CSVGTCustControl;
       
    31 class CAknNavigationDecorator;
       
    32 class CEikonEnv;
       
    33 
       
    34 /**
       
    35 *  CSvgtThreadController is a Active Object (CActive) used to
       
    36 *  notify thread death event to the main thread to do the post load operations
       
    37 *
       
    38 *  @lib SVGTUIControl.lib
       
    39 *  @since 3.1
       
    40 */
       
    41 
       
    42 class CSvgtThreadController : public CActive
       
    43     {
       
    44     public:
       
    45         /**
       
    46         * Two phase constructor
       
    47         * @since 3.1
       
    48         * @param aEngine Engine object 
       
    49         * @param aCustControl
       
    50         * @return CSvgtThreadController*
       
    51         */
       
    52         static CSvgtThreadController* NewL(CSVGTCustControl* aCustControl);
       
    53 
       
    54         /**
       
    55         * Two phase constructor which pushes the object on cleanup stack
       
    56         * @since 3.1
       
    57         * @param aEngine Engine object 
       
    58         * @param aCustControl
       
    59         * @return CSvgtThreadController*
       
    60         */
       
    61         static CSvgtThreadController* NewLC(CSVGTCustControl* aCustControl);
       
    62 
       
    63         /**
       
    64         * Destructor
       
    65         * @since 3.1
       
    66         */
       
    67         ~CSvgtThreadController();
       
    68         
       
    69         /**
       
    70         * Makes it active to get notify on thread death
       
    71         * @since 3.1
       
    72         * @param aThread Main thread object 
       
    73         */
       
    74         void IssueThreadMonitorRequest(const RThread& aThread);
       
    75 
       
    76         /**
       
    77         * Stops the thread execution
       
    78         * @since 3.1
       
    79         * @param aThread Main thread object 
       
    80         */
       
    81         void StopThreadExecution(const RThread& aThread);
       
    82         
       
    83     private:
       
    84         /**
       
    85         * Cancels all the request
       
    86         * @since 3.1
       
    87         * @see CActive
       
    88         */
       
    89         void DoCancel();
       
    90 
       
    91         /**
       
    92         * Handles an active object's request completion event.
       
    93         * @since 3.1
       
    94         * @see CActive
       
    95         */
       
    96         void RunL();
       
    97 
       
    98        /**
       
    99         * Parameterized constructor
       
   100         * @since 3.1
       
   101         * @param aEngine Engine object 
       
   102         * @param aCustControl
       
   103         * @param aMainThread
       
   104         */
       
   105         CSvgtThreadController(CSVGTCustControl* aCustControl);
       
   106         /**
       
   107         * Two phase constructor
       
   108         * @since 3.1
       
   109         */
       
   110         void ConstructL();
       
   111 
       
   112         /**
       
   113         * This fuction does the loading animation
       
   114         * @since 3.1
       
   115         */
       
   116         void DoLoadAnimationL();
       
   117         
       
   118         /**
       
   119         * Callback fuction for loading animation
       
   120         * @since 3.1
       
   121         * @param aThreadController Stores the object of type CSvgtThreadController
       
   122         */
       
   123         static TInt LoadAnimationCallBack(TAny* aThreadController);
       
   124         
       
   125         /**
       
   126         * Clears the navi pane indicator when the loading animation gets over
       
   127         * @since 3.1
       
   128         * @param aThreadController Stores the object of type CSvgtThreadController
       
   129         */
       
   130         void ClearNaviPaneDecorator();
       
   131         
       
   132     private:    //data members
       
   133         // Custom control object
       
   134         CSVGTCustControl* iCustControl;
       
   135         
       
   136         // Periodic timer to do loading animation
       
   137         CPeriodic* iLoadAnimator;
       
   138         
       
   139         // Counts the number steps in the animation
       
   140         TInt iCount;
       
   141         
       
   142         // Stores the text to display in the context bar while loading animation
       
   143         TBuf<KAnimatioBufferLength> iAnimationText;
       
   144         
       
   145         // Stores the the navigation pane decorator
       
   146         CAknNavigationDecorator* iNaviDecorator;
       
   147         
       
   148         // Stores the main thread id
       
   149         TThreadId iMainThread;
       
   150        
       
   151         // Application enviornment
       
   152         CEikonEnv* iEikEnv;
       
   153     };
       
   154 
       
   155 #endif //SVGTCONTROLLER_H
       
   156 
       
   157 // End of File
       
   158