|
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: This file defines class CFsLayoutManager. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_FSLAYOUTMANAGER_H |
|
21 #define C_FSLAYOUTMANAGER_H |
|
22 |
|
23 #include <gdi.h> |
|
24 |
|
25 // <cmail> S60 UID update |
|
26 const TInt KFsMessageLayoutChange( 0x2001E278 ); |
|
27 // </cmail> S60 UID update |
|
28 |
|
29 //<cmail> |
|
30 //A lot of stuff removed, dependencies to FSLayout REMOVED!! |
|
31 //</cmail> |
|
32 |
|
33 /** |
|
34 * This class knows the specification's coordinate data format and ensures |
|
35 * that different types of controls are positioned and setup correctly. |
|
36 * Methods in this class are designed to be called from your control's |
|
37 * SizeChanged() method! |
|
38 * |
|
39 * @code |
|
40 * |
|
41 * TRect parentRect; |
|
42 * TRect layoutRect; |
|
43 * // Request screen size from layout manager. |
|
44 * // When requesting screen size parentRect is only needed by the |
|
45 * // interface. |
|
46 * CFsLayoutManager::LayoutMetricsRect( parentRect, |
|
47 * CFsLayoutManager::EFsLmScreen, layoutRect ); |
|
48 * // Set parentRect to be the requested screen rect. |
|
49 * parentRect = layoutRect; |
|
50 * // Request position and size of application window. |
|
51 * CFsLayoutManager::LayoutMetricsRect( parentRect, |
|
52 * CFsLayoutManager::EFsLmApplicationWindow, layoutRect ); |
|
53 * // Corresponding value need to be set in parentRect when requesting it's |
|
54 * // child pane. |
|
55 * parentRect = layoutRect; |
|
56 * // Request area top pane layout data. |
|
57 * // Assume that landscape mode is in use. Check the variety values from |
|
58 * // layout documents. |
|
59 * CFsLayoutManager::LayoutMetricsRect( parentRect, |
|
60 * CFsLayoutManager::EFsLmAreaTopPane, layoutRect, 1 ); |
|
61 * |
|
62 * @endcode |
|
63 * |
|
64 * @lib ?library |
|
65 * @since S60 ?S60_version *** for example, S60 v3.0 |
|
66 */ |
|
67 class CFsLayoutManager : public CBase |
|
68 { |
|
69 |
|
70 public: |
|
71 |
|
72 /** Layout Metrics. */ |
|
73 enum TFsLayoutMetrics |
|
74 { |
|
75 //<CMAIL> |
|
76 EFsLmApplicationWindow, |
|
77 EFsLmAreaTopPane, |
|
78 EFsLmBgSpFsCtrlbarPane, |
|
79 EFsLmFolderListMediumLineG1, // Folder view layout |
|
80 EFsLmFolderListMediumLineT1, // Folder view layout |
|
81 EFsLmListMediumLineG1, |
|
82 EFsLmListMediumLineG2G1, |
|
83 EFsLmListMediumLineG2G2, |
|
84 EFsLmListMediumLineG2T1, |
|
85 EFsLmListMediumLineG3G1, |
|
86 EFsLmListMediumLineG3G2, |
|
87 EFsLmListMediumLineG3G3, |
|
88 EFsLmListMediumLineG3T1, |
|
89 EFsLmListMediumLinePlainT1, |
|
90 EFsLmListMediumLinePlainT2T1, |
|
91 EFsLmListMediumLinePlainT2T2, |
|
92 EFsLmListMediumLinePlainT3T1, |
|
93 EFsLmListMediumLinePlainT3T2, |
|
94 EFsLmListMediumLinePlainT3T3, |
|
95 EFsLmListMediumLineRightIconG1, |
|
96 EFsLmListMediumLineRightIconT1, |
|
97 EFsLmListMediumLineRightIconx2G1, |
|
98 EFsLmListMediumLineRightIconx2G2, |
|
99 EFsLmListMediumLineRightIconx2T1, |
|
100 EFsLmListMediumLineT1, |
|
101 EFsLmListMediumLineT2G1, |
|
102 EFsLmListMediumLineT2G2G1, |
|
103 EFsLmListMediumLineT2G2G2, |
|
104 EFsLmListMediumLineT2G2T1, |
|
105 EFsLmListMediumLineT2G2T2, |
|
106 EFsLmListMediumLineT2G3G1, |
|
107 EFsLmListMediumLineT2G3G2, |
|
108 EFsLmListMediumLineT2G3G3, |
|
109 EFsLmListMediumLineT2G3T1, |
|
110 EFsLmListMediumLineT2G3T2, |
|
111 EFsLmListMediumLineT2RightIconG1, |
|
112 EFsLmListMediumLineT2RightIconT1, |
|
113 EFsLmListMediumLineT2RightIconT2, |
|
114 EFsLmListMediumLineT2RightIconx2G1, |
|
115 EFsLmListMediumLineT2RightIconx2G2, |
|
116 EFsLmListMediumLineT2RightIconx2T1, |
|
117 EFsLmListMediumLineT2RightIconx2T2, |
|
118 EFsLmListMediumLineT2T1, |
|
119 EFsLmListMediumLineT2T2, |
|
120 EFsLmListMediumLineT32RightIconT2, |
|
121 EFsLmListMediumLineT3G1, |
|
122 EFsLmListMediumLineT3G2G1, |
|
123 EFsLmListMediumLineT3G2G2, |
|
124 EFsLmListMediumLineT3G2T1, |
|
125 EFsLmListMediumLineT3G2T2, |
|
126 EFsLmListMediumLineT3G2T3, |
|
127 EFsLmListMediumLineT3G3G1, |
|
128 EFsLmListMediumLineT3G3G2, |
|
129 EFsLmListMediumLineT3G3G3, |
|
130 EFsLmListMediumLineT3G3T1, |
|
131 EFsLmListMediumLineT3G3T2, |
|
132 EFsLmListMediumLineT3G3T3, |
|
133 EFsLmListMediumLineT3RightIconG1, |
|
134 EFsLmListMediumLineT3RightIconT1, |
|
135 EFsLmListMediumLineT3RightIconT2, |
|
136 EFsLmListMediumLineT3RightIconx2G1, |
|
137 EFsLmListMediumLineT3RightIconx2G2, |
|
138 EFsLmListMediumLineT3RightIconx2T1, |
|
139 EFsLmListMediumLineT3RightIconx2T2, |
|
140 EFsLmListMediumLineT3RightIconx2T3, |
|
141 EFsLmListMediumLineT3T1, |
|
142 EFsLmListMediumLineT3T2, |
|
143 EFsLmListMediumLineT3T3, |
|
144 EFsLmListMediumLineT4G4T3, |
|
145 EFsLmListMediumLineX2, |
|
146 EFsLmListMediumLineX2G1, |
|
147 EFsLmListMediumLineX2T2G2T1, |
|
148 EFsLmListMediumLineX2T2G3T1, |
|
149 EFsLmListMediumLineX2T2G4T1, |
|
150 EFsLmListMediumLineX2T3G2T1, |
|
151 EFsLmListMediumLineX2T3G2T2, |
|
152 EFsLmListMediumLineX2T3G3G1, |
|
153 EFsLmListMediumLineX2T3G3G2, |
|
154 EFsLmListMediumLineX2T3G3G3, |
|
155 EFsLmListMediumLineX2T3G3T1, |
|
156 EFsLmListMediumLineX2T3G3T2, |
|
157 EFsLmListMediumLineX2T3G4G1, |
|
158 EFsLmListMediumLineX2T3G4G2, |
|
159 EFsLmListMediumLineX2T3G4G3, |
|
160 EFsLmListMediumLineX2T3G4T1, |
|
161 EFsLmListMediumLineX2T3G4T2, |
|
162 EFsLmListMediumLineX2T3G4T3, |
|
163 EFsLmListMediumLineX2T3T3, |
|
164 EFsLmListMediumLineX2T4G4G4, |
|
165 EFsLmListMediumLineX3, |
|
166 EFsLmListMediumLineX3T4G4G4, |
|
167 EFsLmListMediumLineX3T4G4T2, |
|
168 EFsLmListMediumLineX3T4G4T3, |
|
169 EFsLmListMediumLineX3T4G4T4, |
|
170 EFsLmListSingleDycRowPane, |
|
171 EFsLmListSingleDycRowPaneG1, |
|
172 EFsLmListSingleDycRowPaneG2, |
|
173 EFsLmListSingleDycRowPaneG3, |
|
174 EFsLmListSingleDycRowPaneG4, |
|
175 EFsLmListSingleDycRowTextPane, |
|
176 EFsLmListSingleDycRowTextPaneT1, |
|
177 EFsLmListSingleDycRowTextPaneT2, |
|
178 EFsLmListSingleDycRowTextPaneT3, |
|
179 EFsLmListSingleFsDycPane, |
|
180 EFsLmMainPane, |
|
181 EFsLmMainSpFsCtrlbarButtonPaneCp01, |
|
182 EFsLmMainSpFsCtrlbarDdmenuPane, |
|
183 EFsLmMainSpFsCtrlbarDdmenuPaneG1, |
|
184 EFsLmMainSpFsCtrlbarDdmenuPaneG2, |
|
185 EFsLmMainSpFsCtrlbarDdmenuPaneT1, |
|
186 EFsLmMainSpFsCtrlbarPane, |
|
187 EFsLmMainSpFsCtrlbarPaneG1, |
|
188 EFsLmMainSpFsCtrlbarPaneG2, |
|
189 EFsLmMainSpFsListPane, |
|
190 EFsLmMainSpFsListscrollPaneTe, |
|
191 EFsLmPopupSpFsActionMenuPane, |
|
192 EFsLmScreen, |
|
193 EFsLmSpFsScrollPane, |
|
194 EFsLmSpFsActionMenuListGenePaneG1, |
|
195 EFsLmSpFsActionMenuListGenePaneT1 |
|
196 //</CMAIL> |
|
197 }; |
|
198 |
|
199 /** Collection of data of text position and font. */ |
|
200 struct TFsText |
|
201 { |
|
202 TRect iTextRect; |
|
203 const CFont *iFont; // not owned |
|
204 //TRgb iColor; |
|
205 TInt iOffset; |
|
206 CGraphicsContext::TTextAlign iAlign; |
|
207 }; |
|
208 |
|
209 IMPORT_C CFsLayoutManager(); |
|
210 |
|
211 /** |
|
212 * Determine if the mirroring is in use. |
|
213 * |
|
214 * @return ETrue If mirroring is in use. EFalse Otherwise. |
|
215 */ |
|
216 IMPORT_C static TBool IsMirrored(); |
|
217 |
|
218 /** |
|
219 * Fills given TRect with rectangle for given layout component. Returns |
|
220 * EFalse for status pane descendants if requested layout component is not |
|
221 * available in current layout. For other components returns always ETrue |
|
222 * (returned rectangle is from layout definition). |
|
223 * |
|
224 * @param aParent Rect of the parent layout. |
|
225 * @param aParam Layout component to be queried. |
|
226 * @param aRect Resulting rectangle. |
|
227 * @param aVariety Defines items variety value. Check this from layout |
|
228 * documents. |
|
229 * @param aRow Possible row value for queried item. |
|
230 * @param aCol Possible column value for queried item. |
|
231 * @return ETrue If requested value was available. EFalse Otherwise. |
|
232 */ |
|
233 IMPORT_C static TBool LayoutMetricsRect( |
|
234 const TRect &aParent, TFsLayoutMetrics aParam, TRect& aRect, |
|
235 TInt aVariety = 0, TInt aRow = 0, TInt aCol = 0 ); |
|
236 |
|
237 /** |
|
238 * This method returns size of rectangle for given layout component. |
|
239 * Returns EFalse for status pane descendants if requested layout |
|
240 * component is not available in current layout. For other components |
|
241 * returns always ETrue (returned size is from layout definition). |
|
242 * |
|
243 * @param aParent Rect of the parent layout. |
|
244 * @param aParam Layout component to be queried. |
|
245 * @param aSize Resulting size. |
|
246 * @param aVariety Defines items variety value. Check this from layout |
|
247 * documents. |
|
248 * @param aRow Possible row value for queried item. |
|
249 * @param aCol Possible column value for queried item. |
|
250 * @return ETrue If requested value was available. EFalse Otherwise. |
|
251 */ |
|
252 IMPORT_C static TBool LayoutMetricsSize( |
|
253 const TRect &aParent, TFsLayoutMetrics aParam, TSize& aSize, |
|
254 TInt aVariety = 0, TInt aRow = 0, TInt aCol = 0 ); |
|
255 |
|
256 /** |
|
257 * This method returns position of top left corner for given layout |
|
258 * component. Returns EFalse for status pane descendants if requested |
|
259 * layout component is not available in current layout. For other |
|
260 * components returns always ETrue (returned position is from layout |
|
261 * definition). |
|
262 * |
|
263 * @param aParent Rect of the parent layout. |
|
264 * @param aParam Layout component to be queried. |
|
265 * @param aPos Resulting position. |
|
266 * @param aVariety Defines items variety value. Check this from layout |
|
267 * documents. |
|
268 * @param aRow Possible row value for queried item. |
|
269 * @param aCol Possible column value for queried item. |
|
270 * @return ETrue If requested value was available. EFalse Otherwise. |
|
271 */ |
|
272 IMPORT_C static TBool LayoutMetricsPosition( |
|
273 const TRect &aParent, TFsLayoutMetrics aParan, TPoint& aPos, |
|
274 TInt aVariety = 0, TInt aRow = 0, TInt aCol = 0 ); |
|
275 |
|
276 /** |
|
277 * This method returns text position and font information of given layout |
|
278 * component. Returns EFalse for status pane descendants if requested |
|
279 * layout component is not available in current layout. For other |
|
280 * components returns always ETrue (returned position is from layout |
|
281 * definition). |
|
282 * |
|
283 * @param aParent Rect of the parent layout. |
|
284 * @param aParam Layout component to be queried. |
|
285 * @param aText Resulting text information. |
|
286 * @param aVariety Defines items variety value. Check this from layout |
|
287 * documents. |
|
288 * @param aRow Possible row value for queried item. |
|
289 * @return ETrue If requested value was available. EFalse Otherwise. |
|
290 */ |
|
291 IMPORT_C static TBool LayoutMetricsText( |
|
292 const TRect &aParent, TFsLayoutMetrics aParam, TFsText& aText, |
|
293 TInt aVariety = 0, TInt aRow = 0 ); |
|
294 |
|
295 private: // data |
|
296 |
|
297 }; |
|
298 |
|
299 |
|
300 #endif // C_FSLAYOUTMANAGER_H |