wvuing/IMPSConnectionUI/UISrc/CCommandAbsorbingControl.h
branchRCL_3
changeset 13 a941bc465d9f
parent 0 094583676ce7
equal deleted inserted replaced
12:6ca72c0fe49a 13:a941bc465d9f
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Command absorber to eat all key presses.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CCOMMANDABSORBINGCONTROL_H
       
    19 #define __CCOMMANDABSORBINGCONTROL_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <coecntrl.h>
       
    23 
       
    24 
       
    25 //FORWARD DECLARATION
       
    26 class CEikAppUi;
       
    27 class CEikButtonGroupContainer;
       
    28 
       
    29 
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33  * Command absorber to eat all key presses.
       
    34  *
       
    35  * Puts empty CBA on the screen and absorbs
       
    36  * all the key events.
       
    37  *
       
    38  * @lib ConnectionUi.lib
       
    39  * @since 2.1
       
    40  */
       
    41 NONSHARABLE_CLASS( CCommandAbsorbingControl ) : public CCoeControl
       
    42     {
       
    43     /**
       
    44      * UI event & command flusher.
       
    45      * @since 2.1
       
    46      */
       
    47     NONSHARABLE_CLASS( CCommandFlush ) : protected CActive
       
    48         {
       
    49 public:  // constructors and destructor
       
    50 
       
    51         /**
       
    52          * C++ default constructor.
       
    53          */
       
    54         CCommandFlush();
       
    55 
       
    56         /**
       
    57          * Destructor.
       
    58          */
       
    59         virtual ~CCommandFlush();
       
    60 
       
    61 
       
    62 public: // New functions
       
    63 
       
    64         /**
       
    65          * Executes the flush.
       
    66          * @since 2.1
       
    67          */
       
    68         void Flush();
       
    69 
       
    70 
       
    71 protected:  // From CActive
       
    72 
       
    73 
       
    74         /**
       
    75          * RunL(), RunError() and DoCancel()
       
    76          * implement the normal CActive usage protocol.
       
    77          */
       
    78         void RunL();
       
    79         TInt RunError( TInt aError );
       
    80         void DoCancel();
       
    81 
       
    82 
       
    83 
       
    84 private: // New private helper methods
       
    85 
       
    86         /**
       
    87          * Waits the started asynchronous steps
       
    88          * to complete using the CActiveSchedulerWait.
       
    89          * @since 2.1
       
    90          */
       
    91         void WaitCompletion();
       
    92 
       
    93 
       
    94         /**
       
    95          * Stops the previously started
       
    96          * CActiveSchedulerWait wait loop.
       
    97          * @since 2.1
       
    98          */
       
    99         void Completed();
       
   100 
       
   101 private:    // Data
       
   102 
       
   103         ///<Active Scheduler Wait, owned
       
   104         CActiveSchedulerWait            iWait;
       
   105         };
       
   106 
       
   107 
       
   108 public:
       
   109     /**
       
   110      * Two-phased constructor.
       
   111      */
       
   112     static CCommandAbsorbingControl* NewL();
       
   113 
       
   114     /**
       
   115      * Destructor.
       
   116      */
       
   117     virtual ~CCommandAbsorbingControl();
       
   118 
       
   119 
       
   120 public:
       
   121 
       
   122     /**
       
   123      * Starts absorbing commands.
       
   124      * Puts absorber to CleanUpstack.
       
   125      * Absorber must be released with
       
   126      * CleanupStack::PopAndDestroy();
       
   127      * @since 2.1
       
   128      */
       
   129     void AbsorbCommandsLC();
       
   130 
       
   131     /**
       
   132      * Flushes possibly buffered commands
       
   133      * from control stack. Flushing is
       
   134      * effective only if the command
       
   135      * absorber is active.
       
   136      *
       
   137      * @since 2.1
       
   138      */
       
   139     void FlushCommands();
       
   140 
       
   141 
       
   142 
       
   143 protected:
       
   144 
       
   145     /**
       
   146      * Symbian OS constructor.
       
   147      */
       
   148     void ConstructL();
       
   149 
       
   150 
       
   151     /**
       
   152      * C++ default constructor.
       
   153      */
       
   154     CCommandAbsorbingControl();
       
   155 
       
   156 
       
   157 public:  // From CCoeControl
       
   158 
       
   159     /**
       
   160      * Absorbing OfferkeyEvent() method.
       
   161      * Absorbs all offered key events (returns
       
   162      * always EKeyWasConsumed).
       
   163      *
       
   164      * @since 2.1
       
   165      * @param aKeyEvent The key event to check
       
   166      * @param aType The event type.
       
   167      */
       
   168     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   169                                  TEventCode aType );
       
   170 
       
   171 private:  // own helpers
       
   172 
       
   173 
       
   174     /**
       
   175      * Starts the command absorbing.
       
   176      *
       
   177      * @since 2.1
       
   178      */
       
   179     void StartAbsorbingL();
       
   180 
       
   181 
       
   182     /**
       
   183      * Stops command absorbing if needed.
       
   184      *
       
   185      * @since 2.1
       
   186      */
       
   187     void StopAbsorbingIfNeeded();
       
   188 
       
   189 
       
   190     /**
       
   191      * Alters CBA visibility.
       
   192      *
       
   193      * @since 2.1
       
   194      * @param aVisible If ETrue makes buttons visible. Else
       
   195      * makes them invisible.
       
   196      */
       
   197     void MakeCbaVisible( TBool aVisible ) const;
       
   198 
       
   199 
       
   200     /**
       
   201      * Helper to clear owned command absorber.
       
   202      *
       
   203      * @since 2.1
       
   204      * @param aCommandAbsorber The self pointer.
       
   205      */
       
   206     static void ClearCommandAbsorb( TAny* aCommandAbsorber );
       
   207 
       
   208 
       
   209 
       
   210 private: //data
       
   211 
       
   212     ///<Application under what this is running, not owned
       
   213     CEikAppUi*                  iAppUi;
       
   214 
       
   215     ///<Used CBA button container, not owned
       
   216     CEikButtonGroupContainer*   iCba;
       
   217 
       
   218     ///<Command flusher, owned
       
   219     CCommandFlush               iCommandFlusher;
       
   220 
       
   221     ///<Is command absorbion on, owned
       
   222     TBool                       iAbsorbOn;
       
   223 
       
   224     };
       
   225 
       
   226 #endif      // __CCOMMANDABSORBINGCONTROL_H
       
   227 // End of File
       
   228