|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Container control class that will contain a Bio Control. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef _BVACONTAINER_H_ |
|
22 #define _BVACONTAINER_H_ |
|
23 |
|
24 // INCLUDES |
|
25 #include <coecntrl.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CMsgBioControl; |
|
29 class CMsgBioControlFactory; |
|
30 class CEikStatusPane; |
|
31 class CAknsBasicBackgroundControlContext; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * Container control class that will contain a Bio Control. |
|
37 */ |
|
38 NONSHARABLE_CLASS( CBvaContainer ) : public CCoeControl, |
|
39 public MEikScrollBarObserver |
|
40 { |
|
41 public: // Construction & destruction |
|
42 |
|
43 /** |
|
44 * Symbian OS second phase constructor. |
|
45 * @param aRect Frame rectangle for container. |
|
46 */ |
|
47 void ConstructL(const TRect& aRect); |
|
48 |
|
49 /// Destructor. |
|
50 ~CBvaContainer(); |
|
51 |
|
52 public: // new functions |
|
53 |
|
54 /** |
|
55 * Loads the Bio Control. |
|
56 * @param aFile The data file handle. The Bio Control will read data |
|
57 * directly from the file. |
|
58 */ |
|
59 void LoadBioControlL( const RFile& aFile ); |
|
60 |
|
61 /** |
|
62 * Accessor for iBioControl. |
|
63 * @return BioControl. |
|
64 */ |
|
65 CMsgBioControl& BioControl(); |
|
66 |
|
67 /** |
|
68 * The header and icon of the application is set using an icon and |
|
69 * descriptor obtained from the Bio Control. |
|
70 * @param statusPane The status pane. |
|
71 */ |
|
72 void UpdateHeaderAndIconFromBioControlL(CEikStatusPane& statusPane); |
|
73 |
|
74 /** |
|
75 * Queries the container if it has a valid BIO control set |
|
76 * |
|
77 * @since S60 3.1 |
|
78 * @return ETrue if container has BIO control |
|
79 * EFalse if not |
|
80 */ |
|
81 TBool IsBioControl(); |
|
82 |
|
83 public: // from CCoeControl |
|
84 |
|
85 /** |
|
86 * A CCoeControl virtual for handling key events. |
|
87 * @param aKeyEvent The key event. |
|
88 * @param aType TEventCode |
|
89 * @return EKeyWasConsumed or EKeyWasNotConsumed |
|
90 */ |
|
91 TKeyResponse OfferKeyEventL( |
|
92 const TKeyEvent& aKeyEvent, |
|
93 TEventCode aType); |
|
94 |
|
95 void Draw(const TRect& aRect) const; |
|
96 |
|
97 private: // from CCoeControl |
|
98 |
|
99 /// Called when the size has changed. |
|
100 void SizeChanged(); |
|
101 |
|
102 /** |
|
103 * Number of component controls. |
|
104 * @return Number of component controls. |
|
105 */ |
|
106 TInt CountComponentControls() const; |
|
107 |
|
108 /** |
|
109 * Returns a component control. |
|
110 * @param aIndex Index of the component control. |
|
111 * @return The component control. |
|
112 */ |
|
113 CCoeControl* ComponentControl(TInt aIndex) const; |
|
114 |
|
115 // From CCoeControl |
|
116 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
117 |
|
118 /** |
|
119 * React to skin, dynamic layout and other resource changes |
|
120 * @param aType The type of change |
|
121 */ |
|
122 void HandleResourceChange(TInt aType); |
|
123 |
|
124 public: // from MEikScrollBarObserver |
|
125 |
|
126 void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType); |
|
127 |
|
128 private: // new functions |
|
129 |
|
130 /** |
|
131 * Returns the Bio Uid which identifies the type of Smart Message. |
|
132 * This function just looks at the file suffix. |
|
133 * @param aFileName File name. |
|
134 * @param aFs Handle to file server |
|
135 * @return Bio Uid. |
|
136 */ |
|
137 static TUid BioUidL(const TFileName& aFileName, RFs& aFs ); |
|
138 |
|
139 /** |
|
140 * Returns the Bio Uid which identifies the type of Smart Message. |
|
141 * This function just looks at the file suffix. |
|
142 * @param aFile File handle. |
|
143 * @return Bio Uid. |
|
144 */ |
|
145 static TUid BioUidL(const RFile& aFile ); |
|
146 |
|
147 /** |
|
148 * Creates the scroll bar. |
|
149 */ |
|
150 void CreateScrollBarL(); |
|
151 |
|
152 /** |
|
153 * Updates the scroll bar. |
|
154 */ |
|
155 void UpdateScrollBarL(); |
|
156 |
|
157 /** |
|
158 * Return virtual height and virtual Y position of the form. |
|
159 * @param aHeight |
|
160 * @param aPos |
|
161 */ |
|
162 void GetVirtualFormHeightAndPos( TInt& aHeight, TInt& aPos ); |
|
163 |
|
164 /** |
|
165 * Performs view scrolling to given direction. |
|
166 * |
|
167 * @param aPixelsToScroll Amount of pixels wanted to be scrolled. |
|
168 * @param aDirection Scrolling direction. |
|
169 * @param aMoveThumb If ETrue scroll thumb is moved at the end of scrolling. |
|
170 */ |
|
171 void ScrollViewL( TInt aPixelsToScroll, |
|
172 TMsgScrollDirection aDirection, |
|
173 TBool aMoveThumb ); |
|
174 |
|
175 /** |
|
176 * Convenience function for casting the scroll bar model. |
|
177 */ |
|
178 const TAknDoubleSpanScrollBarModel* AknScrollBarModel() const; |
|
179 |
|
180 /** |
|
181 * Panic wrapper. |
|
182 * @param aCode The panic code. |
|
183 */ |
|
184 void Panic(TInt aCode) const; |
|
185 |
|
186 private: |
|
187 |
|
188 enum TPanicCodes |
|
189 { |
|
190 EBioControlNotExist, |
|
191 EGeneral, |
|
192 EFileExtension |
|
193 }; |
|
194 |
|
195 private: //data |
|
196 |
|
197 /** |
|
198 * Own: Message specific controller |
|
199 */ |
|
200 CMsgBioControl* iBioControl; |
|
201 |
|
202 /** |
|
203 * Own: Biocontrol factory |
|
204 */ |
|
205 CMsgBioControlFactory* iFactory; |
|
206 |
|
207 /** |
|
208 * Own: Background Skin |
|
209 */ |
|
210 CAknsBasicBackgroundControlContext* iBgContext; |
|
211 |
|
212 /** |
|
213 * Own: The scroll bar |
|
214 */ |
|
215 CEikScrollBarFrame* iScrollBar; |
|
216 |
|
217 /** |
|
218 *From MsgEditorCommons::MsgBaseLineDelta(); |
|
219 */ |
|
220 TInt iLineHeight; |
|
221 |
|
222 /** |
|
223 *From MsgEditorCommons::MsgBaseLineOffset(); |
|
224 */ |
|
225 TInt iBaseLineOffset; |
|
226 }; |
|
227 |
|
228 #endif // _BVACONTAINER_H_ |
|
229 |
|
230 // End of File |