calendarui/controller/inc/calenstatemachine.h
changeset 0 f979ecb2b13e
child 18 c198609911f9
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 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:  Calendar state machine
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CALENSTATEMACHINE_H
       
    20 #define CALENSTATEMACHINE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <e32hashtab.h>
       
    25 #include <calencommandhandler.h>
       
    26 #include <calennotificationhandler.h>
       
    27 #include "calenhashfunctions.inl"       // HashFunctions 
       
    28 
       
    29 class CCalenState;
       
    30 class CCalenController;
       
    31 
       
    32 // CLASS DEFINITIONS
       
    33 /**
       
    34  * 
       
    35  */
       
    36 class CCalenStateMachine : public CBase,
       
    37                            public MCalenNotificationHandler
       
    38     {
       
    39 	public:  // Enumerations
       
    40 	    enum TCalenStateIndex
       
    41             {
       
    42             // If you change the array order or add/remove items,
       
    43             // update CCalenStateMachine::ConstructL too.
       
    44 	        ECalenIdleState,
       
    45 	        ECalenPopulationState,
       
    46 	        ECalenBackgroundState,
       
    47 	        ECalenViewingState,
       
    48 	        ECalenEditingState,
       
    49 	        ECalenDeletingState,
       
    50 	        ECalenPrintingState,
       
    51 	        ECalenSendingState,
       
    52 	        ECalenSettingsState,
       
    53 	        ECalenHelpState,
       
    54 	        ECalenExitingState,
       
    55 	        ECalenMapState,
       
    56 	        ECalenAttachmentState,
       
    57 			ECalenAlarmState,
       
    58 	        KCalenLastState  // Must be last
       
    59 	        };
       
    60 
       
    61     public:  // Construction and destruction
       
    62         /**
       
    63          * Symbian 1st phase constructor
       
    64          */
       
    65         static CCalenStateMachine* NewL( CCalenController& aController );
       
    66         
       
    67         /**
       
    68          * Destructor
       
    69          */
       
    70         virtual ~CCalenStateMachine();
       
    71 
       
    72         TBool HandleCommandL( const TCalenCommand& aCommand );
       
    73 	
       
    74 	public: // from MCalenNotificationHandler
       
    75 		
       
    76 		/**
       
    77 		 * Handles Notifications 
       
    78  		 */
       
    79         void HandleNotification(const TCalenNotification aNotification );
       
    80 
       
    81     private:  // Construction and destruction
       
    82         
       
    83         /**
       
    84          * C++ constructor
       
    85          */
       
    86         CCalenStateMachine( CCalenController& aController );
       
    87         
       
    88         /**
       
    89          * Symbian 2nd phase constructor
       
    90          */
       
    91         void ConstructL();
       
    92 	
       
    93 	private: 
       
    94 	
       
    95 		/**
       
    96          * Interface to cancel the previous command
       
    97          */
       
    98 		void CancelPreviousCmd();
       
    99 		
       
   100 		/**
       
   101          * Interface to get the current state
       
   102          */
       
   103 		TCalenStateIndex GetCurrentState();
       
   104 		
       
   105 		/**
       
   106          * Interface to set the current state
       
   107          */
       
   108 		void SetCurrentState(const TCalenStateIndex& aState);
       
   109 		
       
   110 		/**
       
   111          * Interface to set the previous state
       
   112          */
       
   113 		void SetCurrentPreviousState(const TCalenStateIndex& aState);
       
   114 		
       
   115 		/**
       
   116 		 * Interface for activating the current state
       
   117 		 */
       
   118 		void ActivateCurrentStateL();
       
   119     
       
   120     private:
       
   121     	
       
   122     	friend class CCalenState;
       
   123         CCalenController& iController;
       
   124         RPointerArray<CCalenState> iStates;
       
   125         TCalenStateIndex iCurrentState;
       
   126         RHashSet<TCalenNotification> iOutstandingNotifications;
       
   127     };
       
   128 
       
   129 #endif // CALENSTATEMACHINE_H
       
   130 
       
   131 // End of file