1 /* |
|
2 * ============================================================================ |
|
3 * Name : hgteleportappview.h |
|
4 * Part of : Hg Teleport |
|
5 * Description : appui |
|
6 * Version : %version: sa1spcx1#32 % |
|
7 * |
|
8 * Copyright © 2008 Nokia. All rights reserved. |
|
9 * This material, including documentation and any related computer |
|
10 * programs, is protected by copyright controlled by Nokia. All |
|
11 * rights are reserved. Copying, including reproducing, storing, |
|
12 * adapting or translating, any or all of this material requires the |
|
13 * prior written consent of Nokia. This material also contains |
|
14 * confidential information which may not be disclosed to others |
|
15 * without the prior written consent of Nokia. |
|
16 * ============================================================================ |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef HGTELEPORTAPPVIEW_H |
|
21 #define HGTELEPORTAPPVIEW_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <coecntrl.h> |
|
25 #include <AknPopupFader.h> |
|
26 #include "hgteleportdevicestate.h" |
|
27 #include "hgteleportdatachangeobserver.h" |
|
28 #include "hgteleporteventcontrolerobserver.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CAknsFrameBackgroundControlContext; |
|
32 class CHgTeleportFastSwapArea; |
|
33 class CHgTeleportDialog; |
|
34 class CAknPopupHeadingPane; |
|
35 class CHgTeleportEventControler; |
|
36 |
|
37 /** |
|
38 * Teleport applicatio view class. |
|
39 */ |
|
40 class CHgTeleportAppView : public CCoeControl, public MCoeControlObserver, |
|
41 public MHgDeviceStateObserver, |
|
42 public MAknFadedComponent, |
|
43 public MHgTeleportDataChangeObserver, |
|
44 public MHgTeleportEventControlerObserver |
|
45 { |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Two-phase constructor. |
|
50 * |
|
51 * @param aRect Area where view should draw itself. |
|
52 */ |
|
53 static CHgTeleportAppView* NewL(const TRect& aRect, |
|
54 CHgTeleportDeviceState& aDeviceState); |
|
55 |
|
56 /** |
|
57 * @copydoc NewL |
|
58 */ |
|
59 static CHgTeleportAppView* NewLC(const TRect& aRect, |
|
60 CHgTeleportDeviceState& aDeviceState); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 ~CHgTeleportAppView(); |
|
66 |
|
67 /** |
|
68 * Called from appui if the app came to foreground. |
|
69 */ |
|
70 void HandleSwitchToForegroundEvent(); |
|
71 |
|
72 /** |
|
73 * Called from appui if the app went to background. |
|
74 */ |
|
75 void HandleSwitchToBackgroundEvent(); |
|
76 |
|
77 /** |
|
78 * From CCoeControl Method handling the pointer events while the fsw is used. |
|
79 * |
|
80 * @param aPointerEvent Information about the event. |
|
81 */ |
|
82 void HandlePointerEventL( const TPointerEvent &aPointerEvent ); |
|
83 |
|
84 public: |
|
85 // from CCoeControl |
|
86 void Draw( const TRect& aRect ) const; |
|
87 TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); |
|
88 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
89 TInt CountComponentControls() const; |
|
90 CCoeControl* ComponentControl(TInt aIndex) const; |
|
91 void SizeChanged(); |
|
92 |
|
93 //Own |
|
94 /* |
|
95 * Forward app key handling to fasswaparea control. |
|
96 */ |
|
97 void HandleAppKey(TInt aType); |
|
98 |
|
99 protected: |
|
100 // from MCoeControlObserver |
|
101 void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); |
|
102 |
|
103 // from MHgDeviceStateObserver |
|
104 void HandleDeviceStateChanged( TChangeType aChangeType ); |
|
105 |
|
106 protected: // from MAknFadedComponent |
|
107 TInt CountFadedComponents(); |
|
108 CCoeControl* FadedComponent( TInt aIndex ); |
|
109 |
|
110 protected: // from MHgCenrepChangeObserver |
|
111 void CenrepChanged( TUint32 aKey, TInt aNewValue ); |
|
112 |
|
113 protected: // from MHgTeleportDataChangeObserver |
|
114 void DataChanged( CCoeControl* aWhere, TInt aNewCount ); |
|
115 |
|
116 private: |
|
117 |
|
118 /** |
|
119 * @copydoc NewL |
|
120 */ |
|
121 void ConstructL( const TRect& aRect ); |
|
122 |
|
123 /** |
|
124 * C++ constructor. |
|
125 */ |
|
126 CHgTeleportAppView( CHgTeleportDeviceState& aDeviceState ); |
|
127 |
|
128 /** |
|
129 * Updates the internal state for currently focused control. |
|
130 * @param aNewFocusedControl ptr to new focused control, ownership not taken |
|
131 */ |
|
132 void ChangeFocus( CCoeControl* aNewFocusedControl ); |
|
133 |
|
134 /** |
|
135 * Creates components. |
|
136 */ |
|
137 void CreateControlsL(); |
|
138 |
|
139 /** |
|
140 * Appends component rects to the given array. |
|
141 * @param aRects array |
|
142 */ |
|
143 void GetRects( RArray<TRect>& aRects ); |
|
144 |
|
145 /** |
|
146 * Adds the ptr to the list of dialog pointers. |
|
147 * @param aDlg dialog ptr, ownership not taken |
|
148 */ |
|
149 void AddDlgSelfPtrL( CHgTeleportDialog* aDlg ); |
|
150 |
|
151 /** |
|
152 * Handles key event according to the portrait-style (vertical) layout. |
|
153 */ |
|
154 TKeyResponse OfferKeyEventPortraitStyleL( const TKeyEvent& aKeyEvent, TEventCode aType); |
|
155 |
|
156 /** |
|
157 * Calculates and returns the following: |
|
158 * - the rectangle for main_tport_pane |
|
159 * - the outer rectangle for the frame |
|
160 * - the inner rectangle for the frame |
|
161 */ |
|
162 void UpdatePopupRects( ); |
|
163 |
|
164 /** |
|
165 * Updates the text in the applications and suggestions heading panes. |
|
166 */ |
|
167 void UpdateHeadingsL(); |
|
168 |
|
169 /** |
|
170 * Disables transition animations for teleport app. |
|
171 * (the automatic effects that are applied when coming/leaving foreground) |
|
172 */ |
|
173 void DisableAppSwitchEffects(); |
|
174 |
|
175 |
|
176 public://From MHgTeleportEventControlerObserver |
|
177 /** |
|
178 * Declare drag gesture handling. |
|
179 * @param aOffset - drag distance |
|
180 */ |
|
181 virtual void MoveOffset(const TPoint& aOffset); |
|
182 |
|
183 /** |
|
184 * Declare tap gesture handling. |
|
185 * @param aPoint - tap position |
|
186 */ |
|
187 virtual void TapL(const TPoint& aPoint); |
|
188 |
|
189 /** |
|
190 * Declare long tap gesture handling. |
|
191 * @param aPoint - tap position |
|
192 */ |
|
193 virtual void LongTapL(const TPoint& aPoint); |
|
194 |
|
195 /** |
|
196 * |
|
197 */ |
|
198 virtual void Drag( |
|
199 const AknTouchGestureFw::MAknTouchGestureFwDragEvent& aEvent); |
|
200 |
|
201 /** |
|
202 * Declare animation stop handling |
|
203 */ |
|
204 virtual void Stop(); |
|
205 |
|
206 /** |
|
207 * Declare getter for view position |
|
208 */ |
|
209 virtual TPoint ViewPos() const; |
|
210 |
|
211 private: // Data |
|
212 |
|
213 // Ref to container for commonly used instances |
|
214 CHgTeleportDeviceState& iDeviceState; |
|
215 |
|
216 // Background context, owned |
|
217 CAknsFrameBackgroundControlContext* iBgContext; |
|
218 |
|
219 // Fast Swap area, owned |
|
220 CHgTeleportFastSwapArea* iFastSwapArea; |
|
221 |
|
222 /** |
|
223 * Heading pane, own |
|
224 */ |
|
225 CAknPopupHeadingPane* iAppsHeading; |
|
226 |
|
227 /** |
|
228 * Currently focused control, not own |
|
229 */ |
|
230 CCoeControl* iFocused; |
|
231 |
|
232 /** |
|
233 * Rectangle of the control. |
|
234 */ |
|
235 TRect iViewRect; |
|
236 |
|
237 /** |
|
238 * Popup fader instance. |
|
239 */ |
|
240 TAknPopupFader iPopupFader; |
|
241 |
|
242 /** |
|
243 * Pointer for background image, owned |
|
244 */ |
|
245 TRect iBgContextOuterRect; |
|
246 TRect iBgContextInnerRect; |
|
247 CHgTeleportEventControler* iEvtHandler; //own |
|
248 }; |
|
249 |
|
250 #endif // HGTELEPORTAPPVIEW_H |
|