|
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: Interface to product layout configuration data, |
|
15 * which is independent of the source of the configuration data. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef AKNLAYOUTCONFIG_H |
|
21 #define AKNLAYOUTCONFIG_H |
|
22 |
|
23 #include <w32std.h> |
|
24 #include <AknPriv.hrh> |
|
25 #include <AknScreenMode.h> |
|
26 |
|
27 class CResourceFile; |
|
28 struct SHardwareStateInfo; |
|
29 |
|
30 /** |
|
31 * Layout configuration data |
|
32 * |
|
33 * @since Series 60 3.0 |
|
34 */ |
|
35 NONSHARABLE_CLASS(CAknLayoutConfig) : public CBase |
|
36 { |
|
37 public: |
|
38 // Forward declared structures and T-class wrappers gives |
|
39 // a handle body pattern that should allow maximum extensibility |
|
40 // of the layout configuration data. |
|
41 // Note: never add member data directly to these T-classes. |
|
42 // if new member data is required, add it to the coresponding |
|
43 // structs. |
|
44 |
|
45 /** |
|
46 * Information about a screen mode |
|
47 */ |
|
48 class TScreenMode : public TAknScreenMode |
|
49 { |
|
50 public: |
|
51 /** |
|
52 * Gets the Pixels, Twips and Rotation for this screen mode. |
|
53 * @return The Pixels, Twips and Rotation. |
|
54 */ |
|
55 IMPORT_C const TPixelsTwipsAndRotation& PixelsTwipsAndRotation() const; |
|
56 /** |
|
57 * The location of the softkeys relative to the screen |
|
58 * in this screen mode. |
|
59 * @return the softkey location |
|
60 */ |
|
61 IMPORT_C TAknPrivSoftkeyLocation SoftkeyLocation() const; |
|
62 /** |
|
63 * A number identifying the screen style for this screen mode. |
|
64 * @return a hash of the screen style string |
|
65 */ |
|
66 IMPORT_C TInt ScreenStyleHash() const; |
|
67 public: |
|
68 /** |
|
69 * Constructor. |
|
70 */ |
|
71 TScreenMode(const SAknScreenModeInfo& aInfo); |
|
72 }; |
|
73 |
|
74 /** |
|
75 * An array of all available screen modes. |
|
76 */ |
|
77 class TScreenModeArray : public TAknScreenModes |
|
78 { |
|
79 public: |
|
80 /** |
|
81 * Get a screen mode by index |
|
82 * @param aIndex the array index number |
|
83 * @return The screen mode. |
|
84 */ |
|
85 IMPORT_C TScreenMode At(TInt aIndex) const; |
|
86 /** |
|
87 * Get a screen mode by mode number |
|
88 * @param aModeNumber the mode number of the screen mode to find |
|
89 * @return The screen mode with that mode number, |
|
90 * or the first screen mode if none is found. |
|
91 */ |
|
92 IMPORT_C TScreenMode Find(TInt aModeNumber) const; |
|
93 public: |
|
94 /** |
|
95 * Constructor. |
|
96 */ |
|
97 TScreenModeArray(const SAknLayoutConfig& aInfo); |
|
98 }; |
|
99 |
|
100 /** |
|
101 * Information about a hardware state. |
|
102 */ |
|
103 class THardwareState |
|
104 { |
|
105 public: |
|
106 /** |
|
107 * The state number of the hardware state. |
|
108 * @return The state number. |
|
109 */ |
|
110 IMPORT_C TInt StateNumber() const; |
|
111 /** |
|
112 * The keycode which identifies activation of this hardware state. |
|
113 * @return the keycode value. |
|
114 */ |
|
115 IMPORT_C TInt KeyCode() const; |
|
116 /** |
|
117 * The screen mode number that should be used in this hardware state. |
|
118 * @return The screen mode number. |
|
119 */ |
|
120 IMPORT_C TInt ScreenMode() const; |
|
121 /** |
|
122 * The screen mode number to use for applications that need the |
|
123 * other orientation than provided by @c ScreenMode(). |
|
124 * @return The alternate screen mode number. |
|
125 */ |
|
126 IMPORT_C TInt AlternateScreenMode() const; |
|
127 public: |
|
128 /** |
|
129 * Constructor. |
|
130 */ |
|
131 THardwareState(const SHardwareStateInfo& aInfo); |
|
132 private: |
|
133 const SHardwareStateInfo& iInfo; |
|
134 }; |
|
135 |
|
136 /** |
|
137 * An array of available hardware states. |
|
138 */ |
|
139 class THardwareStateArray |
|
140 { |
|
141 public: |
|
142 /** |
|
143 * @return The number of hardware states in the array. |
|
144 */ |
|
145 IMPORT_C TInt Count() const; |
|
146 /** |
|
147 * Get a hardware state by index |
|
148 * @param aIndex the array index number |
|
149 * @return The hardware state. |
|
150 */ |
|
151 IMPORT_C THardwareState At(TInt aIndex) const; |
|
152 /** |
|
153 * Get a hardware state by state number |
|
154 * @param aStateNumber the state number of the hardware state to find |
|
155 * @return The hardware state with that state number, |
|
156 * or the first hardware state if none is found. |
|
157 */ |
|
158 IMPORT_C THardwareState Find(TInt aStateNumber) const; |
|
159 public: |
|
160 /** |
|
161 * Constructor. |
|
162 */ |
|
163 THardwareStateArray(const SAknLayoutConfig& aInfo); |
|
164 private: |
|
165 const SAknLayoutConfig& iInfo; |
|
166 }; |
|
167 |
|
168 public: |
|
169 /** |
|
170 * Factory Function |
|
171 * |
|
172 * This factory function should only be used in non-UI processes. |
|
173 * In a process, such as an app, where the Avkon environment exists, an instance of |
|
174 * CAknLayoutConfig can be obtained from CAknSgcClient::LayoutConfig(). |
|
175 * |
|
176 * @return a new instance of CAknLayoutConfig. |
|
177 */ |
|
178 IMPORT_C static CAknLayoutConfig* NewL(); |
|
179 |
|
180 public: |
|
181 /** |
|
182 * @return An array of the available hardware states. |
|
183 */ |
|
184 IMPORT_C THardwareStateArray HardwareStates() const; |
|
185 /** |
|
186 * @return An array of the available screen modes. |
|
187 */ |
|
188 IMPORT_C TScreenModeArray ScreenModes() const; |
|
189 |
|
190 public: |
|
191 // Non-exported framework only API |
|
192 /** |
|
193 * Constructor. |
|
194 */ |
|
195 CAknLayoutConfig(); |
|
196 /** |
|
197 * Destructor. |
|
198 */ |
|
199 ~CAknLayoutConfig(); |
|
200 /** |
|
201 * Second stage constructor. |
|
202 * @param aBuf a descriptor of containing packed layout configuration data. |
|
203 * Ownership of aBuf is transferred immediately when called, so caller |
|
204 * should release ownership of aBuf before calling. |
|
205 */ |
|
206 void ConstructL(HBufC8* aBuf); // takes ownership of aBuf immediately |
|
207 /** |
|
208 * Create a descriptor containing packed layout configuration data. |
|
209 * @return a descriptor containing packed layout configuration data. |
|
210 */ |
|
211 HBufC8* CreatePackedBufL(); |
|
212 |
|
213 private: |
|
214 void GetConfigL(SAknLayoutConfig& aConfig, |
|
215 RArray<SAknScreenModeInfo>& aScreenInfoArray, |
|
216 RArray<SHardwareStateInfo>& aHardwareStateArray); |
|
217 void GetScreenMapFromAknPrivL(CResourceFile* aResFile, |
|
218 RArray<SAknScreenModeInfo>& aScreenInfoArray, |
|
219 RArray<SHardwareStateInfo>& aHardwareStateArray); |
|
220 void GetKeyMapFromAknPrivL(CResourceFile* aResFile, |
|
221 RArray<SHardwareStateInfo>& aHardwareStateArray); |
|
222 TAknPrivSoftkeyLocation GetLandscapeSoftkeyLocationFromAknPrivL(CResourceFile* aResFile); |
|
223 void GetScreenModesFromWservL(SAknLayoutConfig& aConfig, |
|
224 RArray<SAknScreenModeInfo>& aScreenInfoArray, |
|
225 TAknPrivSoftkeyLocation aLandscapeSoftkeyLocation); |
|
226 private: |
|
227 HBufC8* iBuf; // owned |
|
228 SAknLayoutConfig* iData; // not owned |
|
229 }; |
|
230 |
|
231 #endif |