|
79
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2005 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: PostcardController declaration
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
#ifndef POSTCARDCONTROLLER
|
|
|
20 |
#define POSTCARDCONTROLLER
|
|
|
21 |
|
|
|
22 |
#include <e32base.h>
|
|
|
23 |
#include <coecntrl.h>
|
|
|
24 |
#include <AknsItemID.h>
|
|
|
25 |
#include "PostcardDocument.h"
|
|
|
26 |
#ifdef RD_SCALABLE_UI_V2
|
|
|
27 |
#include "PostcardPointerObserver.h"
|
|
|
28 |
#endif
|
|
|
29 |
|
|
|
30 |
// FOWARD DECLARTIONS
|
|
|
31 |
class CGulIcon;
|
|
|
32 |
class CAknsBasicBackgroundControlContext;
|
|
|
33 |
|
|
|
34 |
// CLASS DECLARATION
|
|
|
35 |
/**
|
|
|
36 |
* Container control class.
|
|
|
37 |
*
|
|
|
38 |
*/
|
|
|
39 |
class CPostcardController : public CCoeControl
|
|
|
40 |
{
|
|
|
41 |
public: // Constructors and destructor
|
|
|
42 |
/**
|
|
|
43 |
* Constructor.
|
|
|
44 |
* @return pointer to the object
|
|
|
45 |
*/
|
|
|
46 |
static CPostcardController* NewL( CPostcardDocument& aDocument
|
|
|
47 |
#ifdef RD_SCALABLE_UI_V2
|
|
|
48 |
, MPocaPointerEventObserver& aObserver
|
|
|
49 |
#endif
|
|
|
50 |
);
|
|
|
51 |
|
|
|
52 |
/**
|
|
|
53 |
* Destructor.
|
|
|
54 |
*/
|
|
|
55 |
~CPostcardController();
|
|
|
56 |
|
|
|
57 |
public: // New functions
|
|
|
58 |
|
|
|
59 |
/**
|
|
|
60 |
* Returns ETrue if front page is focused.
|
|
|
61 |
*/
|
|
|
62 |
TBool Frontpage( );
|
|
|
63 |
|
|
|
64 |
/**
|
|
|
65 |
* Returns ETrue if aPart is focused
|
|
|
66 |
*/
|
|
|
67 |
TBool IsFocused( TPostcardPart& aPart );
|
|
|
68 |
|
|
|
69 |
/**
|
|
|
70 |
* Returns the focused part
|
|
|
71 |
*/
|
|
|
72 |
TPostcardPart Focused( );
|
|
|
73 |
|
|
|
74 |
/**
|
|
|
75 |
* Sets aPart as focused item
|
|
|
76 |
*/
|
|
|
77 |
void SetFocused( TPostcardPart aPart );
|
|
|
78 |
|
|
|
79 |
/**
|
|
|
80 |
* Sets the bitmap of part aPart. Takes the ownership.
|
|
|
81 |
* Deletes the previous one.
|
|
|
82 |
*/
|
|
|
83 |
void SetBitmap( TPostcardPart aPart, CGulIcon* aIcon );
|
|
|
84 |
|
|
|
85 |
/**
|
|
|
86 |
* Removes and deletes bitmap aPart
|
|
|
87 |
*/
|
|
|
88 |
void RemoveBitmap( TPostcardPart aPart );
|
|
|
89 |
|
|
|
90 |
/**
|
|
|
91 |
* Reloads icons. Called from AppUi, if skin has changed.
|
|
|
92 |
*/
|
|
|
93 |
void ReLoadIconsL();
|
|
|
94 |
|
|
|
95 |
/**
|
|
|
96 |
* Rereads the coordinates of bitmaps from LAF
|
|
|
97 |
*/
|
|
|
98 |
void RefreshCoordinates( );
|
|
|
99 |
|
|
|
100 |
/**
|
|
|
101 |
* Calls MoveHorizontally or MoveVertically according to aKeyEvent
|
|
|
102 |
*/
|
|
|
103 |
void Move( TInt aScanCode );
|
|
|
104 |
|
|
|
105 |
/**
|
|
|
106 |
* Changes the focus in the back side if possible
|
|
|
107 |
*/
|
|
|
108 |
void MoveHorizontally( TBool aRight );
|
|
|
109 |
|
|
|
110 |
/**
|
|
|
111 |
* Changes the focus from back to front or vice versa if possible
|
|
|
112 |
*/
|
|
|
113 |
void MoveVertically( TBool aUp );
|
|
|
114 |
|
|
|
115 |
/**
|
|
|
116 |
* Makes itself focused, visible and active.
|
|
|
117 |
*/
|
|
|
118 |
void ActivateL( );
|
|
|
119 |
|
|
|
120 |
/**
|
|
|
121 |
* Gets an array of TRects and sets them as greeting field lines
|
|
|
122 |
*/
|
|
|
123 |
void SetGreetingLines( CArrayPtrFlat<TRect>& aGreetingLines );
|
|
|
124 |
|
|
|
125 |
/**
|
|
|
126 |
* Gets an array of TRects and sets them as recipient field lines
|
|
|
127 |
*/
|
|
|
128 |
void SetRecipientLines( CArrayPtrFlat<TRect>& aRecipientLines );
|
|
|
129 |
|
|
|
130 |
private: // New functions
|
|
|
131 |
|
|
|
132 |
/**
|
|
|
133 |
* Default C++ constructor.
|
|
|
134 |
*/
|
|
|
135 |
CPostcardController( CPostcardDocument& aDocument
|
|
|
136 |
#ifdef RD_SCALABLE_UI_V2
|
|
|
137 |
, MPocaPointerEventObserver& aObserver
|
|
|
138 |
#endif
|
|
|
139 |
);
|
|
|
140 |
|
|
|
141 |
/**
|
|
|
142 |
* 2nd phase Constructor.
|
|
|
143 |
*/
|
|
|
144 |
void ConstructL( );
|
|
|
145 |
|
|
|
146 |
private: // Functions from base classes
|
|
|
147 |
|
|
|
148 |
/**
|
|
|
149 |
* From CoeControl,CountComponentControls. Returns always 0.
|
|
|
150 |
*/
|
|
|
151 |
TInt CountComponentControls( ) const;
|
|
|
152 |
|
|
|
153 |
/**
|
|
|
154 |
* From CCoeControl,ComponentControl. Returns always NULL.
|
|
|
155 |
*/
|
|
|
156 |
CCoeControl* ComponentControl( TInt aIndex ) const;
|
|
|
157 |
|
|
|
158 |
/**
|
|
|
159 |
* Calls DrawBackground.
|
|
|
160 |
* Also calls DrawIcons for the objects we have on top of the background
|
|
|
161 |
*/
|
|
|
162 |
void Draw( const TRect& aRect ) const;
|
|
|
163 |
|
|
|
164 |
/**
|
|
|
165 |
* Draws possible skin background.
|
|
|
166 |
* Draws the background icons.
|
|
|
167 |
*/
|
|
|
168 |
void DrawBackground( ) const;
|
|
|
169 |
|
|
|
170 |
/**
|
|
|
171 |
* Draws the image side.
|
|
|
172 |
*/
|
|
|
173 |
void DrawImageSide( ) const;
|
|
|
174 |
|
|
|
175 |
/**
|
|
|
176 |
* Draws the text side.
|
|
|
177 |
*/
|
|
|
178 |
void DrawTextSide( ) const;
|
|
|
179 |
|
|
|
180 |
/**
|
|
|
181 |
* Draws icon aIcon in rect aRect. Called by DrawImageSide or DrawTextSide.
|
|
|
182 |
*/
|
|
|
183 |
void DrawIcon( const CGulIcon& aIcon, const TRect& aRect ) const;
|
|
|
184 |
|
|
|
185 |
/**
|
|
|
186 |
* Draws arrow down or up icon based on the side and whether in editor or
|
|
|
187 |
* in viewer mode.
|
|
|
188 |
*/
|
|
|
189 |
void DrawScrollArrows() const;
|
|
|
190 |
|
|
|
191 |
/**
|
|
|
192 |
* Draws focus lines. Called by DrawTextSide.
|
|
|
193 |
*/
|
|
|
194 |
void DrawFocus( ) const;
|
|
|
195 |
|
|
|
196 |
protected: // From CCoeControl
|
|
|
197 |
|
|
|
198 |
/**
|
|
|
199 |
* Returns the Mop supply object for skin drawing
|
|
|
200 |
*/
|
|
|
201 |
TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
|
|
|
202 |
|
|
|
203 |
#ifdef RD_SCALABLE_UI_V2
|
|
|
204 |
/**
|
|
|
205 |
* Handle pointer event
|
|
|
206 |
*/
|
|
|
207 |
void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
|
|
208 |
#endif
|
|
|
209 |
|
|
|
210 |
private:
|
|
|
211 |
|
|
|
212 |
/**
|
|
|
213 |
* LoadIconsL
|
|
|
214 |
* Calls DoLoadIconL to load icons needed by controller
|
|
|
215 |
*/
|
|
|
216 |
void LoadIconsL();
|
|
|
217 |
|
|
|
218 |
/**
|
|
|
219 |
* DoLoadIconL
|
|
|
220 |
* Calls AknsUtils::CreateIconL to load icons defined by parameters.
|
|
|
221 |
* Param IN aId - the id of the icon in AknsConstants.h
|
|
|
222 |
* aFileName - the name of the file where icons are loaded
|
|
|
223 |
* aFileBitmapId - the id of the bitmap file
|
|
|
224 |
* Returns - icon created by the function
|
|
|
225 |
*/
|
|
|
226 |
CGulIcon* DoLoadIconL( const TAknsItemID& aId,
|
|
|
227 |
const TDesC& aFileName,
|
|
|
228 |
const TInt aFileBitmapId,
|
|
|
229 |
const TInt aFileMaskId = -1 );
|
|
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
|
233 |
/**
|
|
|
234 |
* DoLoadIconforUpandDownarrowL
|
|
|
235 |
* Calls AknsUtils::CreateColorIconLC to load icons defined by parameters.
|
|
|
236 |
* Param IN aId - the id of the icon in AknsConstants.h
|
|
|
237 |
* aFileName - the name of the file where icons are loaded
|
|
|
238 |
* aFileBitmapId - the id of the bitmap file
|
|
|
239 |
* Returns - icon created by the function
|
|
|
240 |
*/
|
|
|
241 |
CGulIcon* DoLoadIconforUpandDownarrowL( const TAknsItemID& aId,
|
|
|
242 |
const TDesC& aFileName,
|
|
|
243 |
const TInt aFileBitmapId,
|
|
|
244 |
const TInt aFileMaskId = -1 );
|
|
|
245 |
|
|
|
246 |
|
|
|
247 |
|
|
|
248 |
private: //Data
|
|
|
249 |
|
|
|
250 |
// Reference to AppUi
|
|
|
251 |
CPostcardDocument& iDocument;
|
|
|
252 |
|
|
|
253 |
// Related to frontside
|
|
|
254 |
CGulIcon* iFrontBg;
|
|
|
255 |
CGulIcon* iImage;
|
|
|
256 |
CGulIcon* iInsertImage;
|
|
|
257 |
CGulIcon* iInsertImageBg;
|
|
|
258 |
|
|
|
259 |
// Related to backside
|
|
|
260 |
CGulIcon* iBgBg;
|
|
|
261 |
CGulIcon* iStamp;
|
|
|
262 |
CGulIcon* iEmptyGreetingFocused;
|
|
|
263 |
CGulIcon* iEmptyGreeting;
|
|
|
264 |
CGulIcon* iGreeting;
|
|
|
265 |
CGulIcon* iEmptyAddressFocused;
|
|
|
266 |
CGulIcon* iEmptyAddress;
|
|
|
267 |
CGulIcon* iAddress;
|
|
|
268 |
|
|
|
269 |
// Focus lines are here
|
|
|
270 |
CArrayPtrFlat<TRect>* iGreetingLines;
|
|
|
271 |
CArrayPtrFlat<TRect>* iRecipientLines;
|
|
|
272 |
|
|
|
273 |
// Related to arrows
|
|
|
274 |
CGulIcon* iUpperArrow;
|
|
|
275 |
CGulIcon* iLowerArrow;
|
|
|
276 |
|
|
|
277 |
// Related to frontside
|
|
|
278 |
TRect iFrontBgC;
|
|
|
279 |
TRect iImageC;
|
|
|
280 |
TRect iInsertImageC;
|
|
|
281 |
TRect iInsertImageBgC;
|
|
|
282 |
|
|
|
283 |
// Related to backside
|
|
|
284 |
TRect iBgBgC;
|
|
|
285 |
TRect iStampC;
|
|
|
286 |
TRect iGreetingC;
|
|
|
287 |
TRect iAddressC;
|
|
|
288 |
|
|
|
289 |
// Related to arrows
|
|
|
290 |
TRect iUpperArrowC;
|
|
|
291 |
TRect iLowerArrowC;
|
|
|
292 |
|
|
|
293 |
TPostcardPart iFocusedItem;
|
|
|
294 |
|
|
|
295 |
CAknsBasicBackgroundControlContext* iBgContext; // Skin background control context
|
|
|
296 |
|
|
|
297 |
#ifdef RD_SCALABLE_UI_V2
|
|
|
298 |
TBool iPenEnabled;
|
|
|
299 |
MPocaPointerEventObserver& iEventObserver;
|
|
|
300 |
#endif
|
|
|
301 |
};
|
|
|
302 |
|
|
|
303 |
#endif // POSTCARDCONTROLLER_H
|
|
|
304 |
|
|
|
305 |
// End of File
|