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 /** |
|
95 * Sets the current error and updates the label text and cba |
|
96 * @since 5.1 |
|
97 */ |
|
98 void SetStandbyErrorL( TInt aError ); |
|
99 |
|
100 private: |
|
101 /** |
|
102 * Symbian OS 2nd phase constructor. |
|
103 * @since 2.8 |
|
104 * @param aRect Frame rectangle for container. |
|
105 * @param aError associated error code |
|
106 */ |
|
107 void ConstructL( const TRect& aRect, TInt aError ); |
|
108 |
|
109 /** |
|
110 * C++ constructor |
|
111 * @since 2.8 |
|
112 * @param aController reference to CCamAppControllerBase instance |
|
113 * @param aView Reference to the view containing this container |
|
114 * @param aError associated error code |
|
115 */ |
|
116 CCamStandbyContainer( CCamAppController& aController, |
|
117 CAknView& aView, TInt aError ); |
|
118 |
|
119 protected: // Functions from base classes |
|
120 /** |
|
121 * From CoeControl |
|
122 * @since 2.8 |
|
123 * @return number of contained controls |
|
124 */ |
|
125 TInt CountComponentControls() const; |
|
126 |
|
127 /** |
|
128 * From CoeControl |
|
129 * @since 2.8 |
|
130 * @param aIndex The index of the control required |
|
131 * @return The requested control |
|
132 */ |
|
133 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
134 |
|
135 /** |
|
136 * From CCoeControl |
|
137 * @since 2.8 |
|
138 * @param aRect area where to draw |
|
139 */ |
|
140 void Draw( const TRect& aRect ) const; |
|
141 |
|
142 /** |
|
143 * Static callback function for foreground timer timeout. |
|
144 * @since 2.8 |
|
145 * @param aPtr Pointer to an instance of the CCamStandbyContainer |
|
146 * @return TInt to indicate if function should be called again |
|
147 */ |
|
148 static TInt ForegroundTimeout( TAny* aPtr ); |
|
149 |
|
150 /** |
|
151 * Foreground timeout expiry - invoke exit from standby mode |
|
152 * after foreground event has occurred |
|
153 * @since 2.8 |
|
154 * @return TInt to indicate if function should be called again |
|
155 */ |
|
156 TInt DoForegroundTimeout(); |
|
157 |
|
158 /** |
|
159 * Create background context (iBgContext). |
|
160 * @since S60 v5.0 |
|
161 */ |
|
162 void CreateBackgroundContextL(); |
|
163 |
|
164 private: // data |
|
165 // text to display in container - loaded from resource |
|
166 CEikLabel *iText; |
|
167 |
|
168 // associated error code |
|
169 TInt iStandbyError; |
|
170 |
|
171 // timer used after gaining foreground |
|
172 CCamTimerBase* iForegroundTimer; |
|
173 |
|
174 // label text, wrapped over two lines if required |
|
175 HBufC* iWrappedLabelText; // owned |
|
176 |
|
177 }; |
|
178 |
|
179 #endif // CAMSTANDBYCONTAINER_H |
|
180 |
|
181 // End of File |
|