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: Camera UI recording icon decoration* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CAMRECORDINGICONDECORATION_H |
|
21 #define CAMRECORDINGICONDECORATION_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "CamObservable.h" |
|
26 #include "CamControllerObservers.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class MObserver; |
|
30 class CCamObserverHandler; |
|
31 class CBitmapContext; |
|
32 class CFbsBitmap; |
|
33 class CPeriodic; |
|
34 class CCamAppController; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 class CCamRecordingIconDecoration : public CBase, |
|
38 public MCamObservable, |
|
39 public MCamControllerObserver |
|
40 { |
|
41 private: |
|
42 // The internal recording states used |
|
43 enum TCamRecordState |
|
44 { |
|
45 ECamNotRecording, |
|
46 ECamRecording, |
|
47 ECamRecordPaused |
|
48 }; |
|
49 |
|
50 public: |
|
51 /** |
|
52 * Symbian OS two-phased constructor |
|
53 * @since 2.8 |
|
54 * @param aPosition The postition of the icon |
|
55 * @param aObserver Any interested observer |
|
56 * @return New instance of class |
|
57 */ |
|
58 static CCamRecordingIconDecoration* NewL( const TRect& aPosition, |
|
59 CCamAppController& aController ); |
|
60 |
|
61 /** |
|
62 * Destructor |
|
63 */ |
|
64 ~CCamRecordingIconDecoration(); |
|
65 |
|
66 protected: |
|
67 /** |
|
68 * Constructor |
|
69 */ |
|
70 CCamRecordingIconDecoration( CCamAppController& aController ); |
|
71 |
|
72 /** |
|
73 * Second-phase constructor |
|
74 * @param aPosition The postition of the icon |
|
75 * @param aController Reference to the controller |
|
76 */ |
|
77 void ConstructL( const TRect& aPosition ); |
|
78 |
|
79 public: // New methods |
|
80 /** |
|
81 * Draws the recording icon |
|
82 * @param aGc The context to use while drawing |
|
83 * @param aDrawRect Ignored |
|
84 */ |
|
85 void Draw(CBitmapContext& aGc, const TRect& aDrawRect); |
|
86 |
|
87 /** |
|
88 * Callback for pause flash timer. |
|
89 * @since 2.8 |
|
90 * @param aVideoContainer- the CCamVideoPreCaptureContainer |
|
91 * @return KErrNone |
|
92 */ |
|
93 static TInt PauseFlashCallBack( TAny* aRecordingIconDecorator ); |
|
94 |
|
95 /** |
|
96 * Toggles the paused icon called from PauseFlashCallBack |
|
97 * @since 2.8 |
|
98 */ |
|
99 void TogglePauseIconFlash(); |
|
100 |
|
101 private: // New methods |
|
102 /** |
|
103 * Changes iRecordState, tells observers to update |
|
104 * @param aNewState The new state to change to |
|
105 */ |
|
106 void ChangeRecordState(TCamRecordState aNewState); |
|
107 |
|
108 public: // From MCamObservable |
|
109 /** |
|
110 * From MCamObservable |
|
111 * @param aObserver Observer to register |
|
112 * @since 3.0 |
|
113 */ |
|
114 void RegisterObserverL(MCamObserver* aObserver); |
|
115 |
|
116 /** |
|
117 * From MCamObservable |
|
118 * @param aObserver Observer to deregister |
|
119 * @since 3.0 |
|
120 */ |
|
121 void DeregisterObserver(MCamObserver* aObserver); |
|
122 |
|
123 /** |
|
124 * From MCamObservable |
|
125 * @param aEvent Event code to broadcast |
|
126 * @since 3.0 |
|
127 */ |
|
128 void BroadcastEvent(TCamObserverEvent aEvent); |
|
129 |
|
130 public: // From MCamControllerObserver |
|
131 /** |
|
132 * Handle an event from CCamAppControllerBase. |
|
133 * @since 2.8 |
|
134 * @param aEvent the controller event that has occurred |
|
135 * @param aError any reported error |
|
136 */ |
|
137 virtual void HandleControllerEventL( TCamControllerEvent aEvent, |
|
138 TInt aError ); |
|
139 |
|
140 private: // Data |
|
141 // Handles requests to the MCamObservable interface |
|
142 CCamObserverHandler* iObserverHandler; |
|
143 |
|
144 // Where to put the icon |
|
145 TPoint iPosition; |
|
146 TRect iSize; |
|
147 |
|
148 // Bitmap and mask for record icon |
|
149 CFbsBitmap* iRecBitmap; |
|
150 CFbsBitmap* iRecBitmapMask; |
|
151 |
|
152 // Bitmap amd mask for record paused icon |
|
153 CFbsBitmap* iRecPauseBitmap; |
|
154 CFbsBitmap* iRecPauseBitmapMask; |
|
155 |
|
156 // Current recording state |
|
157 TCamRecordState iRecordState; |
|
158 |
|
159 // Whether to show paused icon (toggled via periodic timer) |
|
160 TBool iShowPaused; |
|
161 |
|
162 // Periodic timer used to toggle paused icon |
|
163 CPeriodic* iPauseFlashPeriodic; |
|
164 |
|
165 // Pointer to the controller |
|
166 CCamAppController& iController; |
|
167 }; |
|
168 |
|
169 |
|
170 #endif // CAMRECORDINGICONDECORATION_H |
|