camerauis/cameraapp/generic/inc/CamStandbyContainer.h
changeset 19 d9aefe59d544
parent 3 8b2d6d0384b0
child 21 fa6d9f75d6a6
child 28 3075d9b614e6
equal deleted inserted replaced
3:8b2d6d0384b0 19:d9aefe59d544
     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:  Container for standby mode*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 #ifndef CAMSTANDBYCONTAINER_H
       
    20 #define CAMSTANDBYCONTAINER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <AknUtils.h>
       
    24 #include "CamContainerBase.h"
       
    25 #include "CamAppController.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CAknView;
       
    29 class CCamTimerBase;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 * Container for standby mode
       
    35 */
       
    36 class CCamStandbyContainer : public CCamContainerBase
       
    37     {
       
    38     public: // Constructors and destructor
       
    39         
       
    40         /**
       
    41         * Symbian OS two-phased constructor
       
    42         * @since 2.8
       
    43         * @param aRect Frame rectangle for container.
       
    44         * @param aView Reference to the view containing this container
       
    45         * @param aController reference to CCamAppControllerBase instance
       
    46         * @param aError associated error code
       
    47         */
       
    48         static CCamStandbyContainer* NewL( const TRect& aRect, 
       
    49                                                  CAknView& aView,
       
    50                                                  CCamAppController& aController,
       
    51                                                  TInt aError );
       
    52         /**
       
    53         * Destructor.
       
    54         * @since 2.8
       
    55         */
       
    56         virtual ~CCamStandbyContainer();
       
    57     
       
    58     public: // Functions from base classes
       
    59 
       
    60         /**
       
    61         * From CamContainerBase 
       
    62         * @since 2.8
       
    63         * @param aKeyEvent the key event
       
    64         * @param aType the type of the event
       
    65         * @return TKeyResponse key event was used by this control or not
       
    66         */
       
    67         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
    68                                      TEventCode aType );
       
    69 
       
    70         /**
       
    71   	    * From CCamContainerBase
       
    72         * Handles the foreground/background event
       
    73         * @since 2.8
       
    74         * @param aForeground ETrue if this coming to foreground, else EFalse.
       
    75         */
       
    76         void HandleForegroundEventL( TBool aForeground );
       
    77 
       
    78         /**
       
    79          * From CCoeControl
       
    80          * Handles pointer events
       
    81          * @since S60 5.0
       
    82          * @param aPointerEvent containing pointer event information
       
    83          */
       
    84         void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
    85         
       
    86     public: // New functions
       
    87     
       
    88         /**
       
    89         * Gets the current error
       
    90         * @since 2.8
       
    91         */
       
    92         TInt GetStandbyError() const;
       
    93 
       
    94     private:
       
    95         /**
       
    96         * Symbian OS 2nd phase constructor.
       
    97         * @since 2.8
       
    98         * @param aRect Frame rectangle for container.
       
    99         * @param aError associated error code
       
   100         */
       
   101         void ConstructL( const TRect& aRect, TInt aError );
       
   102 
       
   103         /**
       
   104         * C++ constructor
       
   105         * @since 2.8
       
   106         * @param aController reference to CCamAppControllerBase instance
       
   107         * @param aView Reference to the view containing this container
       
   108         * @param aError associated error code
       
   109         */
       
   110         CCamStandbyContainer( CCamAppController& aController,
       
   111                                     CAknView& aView, TInt aError );
       
   112 
       
   113     protected: // Functions from base classes
       
   114         /**
       
   115         * From CoeControl
       
   116         * @since 2.8
       
   117         * @return number of contained controls
       
   118         */
       
   119         TInt CountComponentControls() const;
       
   120 
       
   121         /**
       
   122         * From CoeControl
       
   123         * @since 2.8
       
   124         * @param aIndex The index of the control required
       
   125         * @return The requested control
       
   126         */
       
   127         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   128 
       
   129         /**
       
   130         * From CCoeControl
       
   131         * @since 2.8
       
   132         * @param aRect area where to draw
       
   133         */
       
   134         void Draw( const TRect& aRect ) const;
       
   135 
       
   136         /**
       
   137         * Static callback function for foreground timer timeout.
       
   138         * @since 2.8
       
   139         * @param aPtr Pointer to an instance of the CCamStandbyContainer
       
   140         * @return TInt to indicate if function should be called again
       
   141         */
       
   142         static TInt ForegroundTimeout( TAny* aPtr );
       
   143 
       
   144         /**
       
   145         * Foreground timeout expiry - invoke exit from standby mode
       
   146         * after foreground event has occurred
       
   147         * @since 2.8
       
   148         * @return TInt to indicate if function should be called again
       
   149         */
       
   150         TInt DoForegroundTimeout();
       
   151 
       
   152         /**
       
   153         * Create background context (iBgContext).
       
   154         * @since S60 v5.0
       
   155         */
       
   156         void CreateBackgroundContextL();
       
   157 
       
   158     private: // data
       
   159         // text to display in container - loaded from resource
       
   160         CEikLabel *iText;
       
   161 
       
   162         // associated error code
       
   163         TInt iStandbyError;
       
   164 
       
   165         // timer used after gaining foreground
       
   166         CCamTimerBase* iForegroundTimer;
       
   167 
       
   168         // label text, wrapped over two lines if required
       
   169         HBufC* iWrappedLabelText; // owned
       
   170 
       
   171     };
       
   172 
       
   173 #endif      // CAMSTANDBYCONTAINER_H
       
   174 
       
   175 // End of File