idlefw/plugins/shortcutplugin/inc/cpopupeventhandler.h
branchRCL_3
changeset 8 d0529222e3f0
parent 4 1a2a00e78665
child 11 bd874ee5e5e2
equal deleted inserted replaced
4:1a2a00e78665 8:d0529222e3f0
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Shortcut plug-in Popup event handler class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPOPUPEVENTHANDLER_H
       
    20 #define CPOPUPEVENTHANDLER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <badesca.h>
       
    24 
       
    25 #include "PopupFSM.h"
       
    26 #include "MPopupFSMActions.h"
       
    27 
       
    28 class MPopupEventHandlerActions;
       
    29 
       
    30 /**
       
    31  *
       
    32  *  The class handles Popup events (set, reset, gain/lost focus, etc.) by
       
    33  *  delegating them to automatically generated state machine class which in 
       
    34  *  turn decides what actions the events cause in different states.
       
    35  *
       
    36  *  This class has bi-directional friend relationship to CAiScutShortcutExt
       
    37  *  in order to establish concrete actions while decoupling state machine
       
    38  *  related functions out of CAiScutShortcutExt.
       
    39  *
       
    40  *  @since S60 v3.2
       
    41  */
       
    42 class CPopupEventHandler : public CActive, 
       
    43     public MPopupFSMActions
       
    44     {
       
    45     public:
       
    46         /**
       
    47          * Factory function
       
    48          * @param aPopupEventHandlerActions actions interface
       
    49          * @since S60 v3.2
       
    50          */
       
    51         static CPopupEventHandler* NewL( 
       
    52             MPopupEventHandlerActions& aPopupEventHandlerActions );
       
    53 
       
    54         /**
       
    55          * Factory function
       
    56          * @param aPopupEventHandlerActions actions interface
       
    57          * @since S60 v3.2
       
    58          */
       
    59         static CPopupEventHandler* NewLC( 
       
    60             MPopupEventHandlerActions& aPopupEventHandlerActions );
       
    61 
       
    62         /**
       
    63          * Destructor
       
    64          * @since S60 v3.2
       
    65          */
       
    66         ~CPopupEventHandler();
       
    67 
       
    68     private:
       
    69 
       
    70         /**
       
    71          * Constructor
       
    72          * @param aPopupEventHandlerActions actions interface
       
    73          * @since S60 v3.2
       
    74          */
       
    75         CPopupEventHandler( 
       
    76             MPopupEventHandlerActions& aPopupEventHandlerActions );
       
    77 
       
    78         void ConstructL();
       
    79 
       
    80     public:  // New functions
       
    81         /**
       
    82          * Accessor for state machine
       
    83          * @return Reference to state machine instance
       
    84          * @since S60 v3.2
       
    85          */
       
    86         TPopupFSM& PopupFSM();
       
    87 
       
    88         TBool PublishPopup() const;
       
    89         TBool PopupVisible() const;
       
    90         
       
    91         /**
       
    92          * @return Is publishing needed
       
    93          */
       
    94         TBool PublishCaption() const;
       
    95 
       
    96         /**
       
    97          * @return Is caption visible
       
    98          */
       
    99         TBool CaptionVisible() const;
       
   100         
       
   101     private:    // From CActive
       
   102         void DoCancel();
       
   103         void RunL();
       
   104 
       
   105     private: // From MPopupFSMActions
       
   106         void CompleteSelf();
       
   107         void CancelRequest();
       
   108         void StartShortTimer();
       
   109         void StartLongTimer();
       
   110         void IssuePublishPopup();
       
   111         void IssueCleanPopup();
       
   112         void IssuePublishCaption();
       
   113         void IssueCleanCaption();
       
   114 
       
   115     private: // data
       
   116         /**
       
   117          * Actions interface
       
   118          * Ref.
       
   119          */
       
   120         MPopupEventHandlerActions& iPopupEventHandlerActions;
       
   121 
       
   122         /**
       
   123          * State machine instance
       
   124          * Own.
       
   125          */
       
   126         TPopupFSM iPopupFSM;
       
   127 
       
   128         /**
       
   129          * Timeout timer
       
   130          * Own.
       
   131          */
       
   132         RTimer iTimer;
       
   133 
       
   134         TBool iPublishPopup;
       
   135         TBool iPopupVisible;
       
   136 
       
   137         TBool iPublishCaption;
       
   138         TBool iCaptionVisible;
       
   139     };
       
   140 
       
   141 #endif // CPOPUPEVENTHANDLER_H
       
   142 
       
   143 // End of File.