mpx/tsrc/public/basic/common/testviewframework/inc/consolemain.h
changeset 62 b276843a15ba
equal deleted inserted replaced
58:c76ea6caa649 62:b276843a15ba
       
     1 /*
       
     2 * Copyright (c) 2002 - 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:  console manipulation
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CCONSOLEMAIN_H
       
    19 #define CCONSOLEMAIN_H
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <aknlists.h>
       
    23 #include <e32cons.h>
       
    24 #include <apaflrec.h>
       
    25 #include <e32base.h>
       
    26 #include <e32def.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CTestBaseView;
       
    30 class CScrollerTimer;
       
    31 class CConsoleReader;
       
    32 
       
    33 /**
       
    34 *  console manipulation class 
       
    35 *
       
    36 *  @lib TestViewFramework.lib
       
    37 */
       
    38 class CConsoleMain :public CBase
       
    39     {
       
    40     public:  
       
    41 
       
    42         /**
       
    43         * Two-phased constructor
       
    44         * @return object of CConsoleMain
       
    45         */
       
    46         IMPORT_C static CConsoleMain* NewL(CActiveScheduler* aScheduler);
       
    47 
       
    48         /**
       
    49         * Destructor of CConsoleMain
       
    50         */
       
    51         virtual ~CConsoleMain();
       
    52         
       
    53         /**
       
    54         * Start
       
    55         * @param aView, activate a root view in console
       
    56         */
       
    57         IMPORT_C void ActivateL( CTestBaseView* aRootView );
       
    58 
       
    59         /**
       
    60         * Stop ScrollerTimer and ConsoleReader
       
    61         */
       
    62         IMPORT_C void Stop();
       
    63 
       
    64         /**
       
    65         * Reads user input into the start of the descriptor aDes
       
    66         * @param aDes, descriptor to store input string
       
    67         */
       
    68         IMPORT_C void ReadString( TDes& aDes );
       
    69 
       
    70         
       
    71 
       
    72     public: // New functions
       
    73 		
       
    74         /**
       
    75         * Return current menu
       
    76         * @return reference of current shown menu
       
    77         */
       
    78         CTestBaseView* CurrentView();
       
    79     
       
    80         /**
       
    81         * Return pointer to console
       
    82         * @return reference to console
       
    83         */
       
    84         CConsoleBase* GetConsole();
       
    85 
       
    86         /**
       
    87         * Called from timer to perform scrolling
       
    88         */
       
    89         void TimerUpdate();
       
    90 
       
    91         /**
       
    92         * Process keystokes.
       
    93         */
       
    94         void KeyPressedL();
       
    95 
       
    96     private:  //Friend class
       
    97         friend class CTestBaseView;
       
    98 
       
    99     private:
       
   100 
       
   101         /** 
       
   102         * C++ default constructor.
       
   103         */
       
   104         CConsoleMain(CActiveScheduler* aScheduler);
       
   105 
       
   106         /**
       
   107         * the second phase constructor ConstructL to safely construct things 
       
   108         * that can leave 
       
   109         */
       
   110         void ConstructL();
       
   111         
       
   112         /**
       
   113         * Call by CTestBaseView
       
   114         * Actiavte the child view
       
   115         * @param aChild, a new child view 
       
   116         */
       
   117         void NextViewL(CTestBaseView* aChild);
       
   118         
       
   119         /**
       
   120         * Call by CTestBaseView
       
   121         * Indicate the current is done, go back parent view
       
   122         */
       
   123         void CurrentViewDoneL();
       
   124         
       
   125     private:    // Data
       
   126         CConsoleBase*       iConsole;       // Pointer to console
       
   127 
       
   128         CTestBaseView*      iCurrentView;   // Current view
       
   129 
       
   130         CScrollerTimer*     iScroller;      // Scroll text
       
   131         
       
   132         CConsoleReader*     iReader;        // Console reader
       
   133         
       
   134         CActiveScheduler*   iScheduler;     // Uses an active scheduler   
       
   135     
       
   136     	TBool				iSchedulerStarted;
       
   137     };
       
   138 
       
   139 #endif