|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * CResolutionUtil provides functions to query current screen dimensions. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #ifndef RESOLUTIONUTIL_H |
|
23 #define RESOLUTIONUTIL_H |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <coemain.h> |
|
27 |
|
28 /** |
|
29 * The class provides functions to query current screen dimensions. |
|
30 * The class is used through CCoeEnv::Static() |
|
31 * |
|
32 * @code |
|
33 * ?good_class_usage_example(s) |
|
34 * @endcode |
|
35 * |
|
36 * @lib ImageEditorUtils.lib |
|
37 * @since S60 v5.0 |
|
38 */ |
|
39 class CResolutionUtil : public CCoeStatic |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 /** Screen modes */ |
|
45 enum TScreenModes |
|
46 { |
|
47 EUnknown, |
|
48 EStandard, |
|
49 EStandardFullScreen, |
|
50 EStandardLandscape, |
|
51 EStandardLandscapeFullScreen, |
|
52 ESquare, |
|
53 ESquareFullScreen, |
|
54 ESquareRotated, |
|
55 ESquareRotatedFullScreen, |
|
56 EQVGA, |
|
57 EQVGAFullScreen, |
|
58 EQVGALandscape, |
|
59 EQVGALandscapeFullScreen, |
|
60 EDouble, |
|
61 EDoubleFullScreen, |
|
62 EDoubleLandscape, |
|
63 EDoubleLandscapeFullScreen, |
|
64 EHVGA, |
|
65 EHVGAFullScreen, |
|
66 EHVGALandscape, |
|
67 EHVGALandscapeFullScreen, |
|
68 EVGA, |
|
69 EVGAFullScreen, |
|
70 EVGALandscape, |
|
71 EVGALandscapeFullScreen, |
|
72 EQHD, |
|
73 EQHDFullScreen, |
|
74 EQHDLandscape, |
|
75 EQHDLandscapeFullScreen |
|
76 }; |
|
77 |
|
78 /** |
|
79 * Returns the singleton instance of this CCoeStatic. |
|
80 * If the instance does not exist, panics the tread. |
|
81 * |
|
82 * @since S60 v5.0 |
|
83 * @param - |
|
84 * @return the singleton instance of CResolutionUtil |
|
85 */ |
|
86 IMPORT_C static CResolutionUtil* Self(); |
|
87 |
|
88 /** |
|
89 * Returns the singleton instance of this CCoeStatic. |
|
90 * If the instance does not exist, a new one is created. |
|
91 * |
|
92 * @since S60 v5.0 |
|
93 * @param - |
|
94 * @return the singleton instance of CResolutionUtil |
|
95 */ |
|
96 IMPORT_C static CResolutionUtil* InitializeL(); |
|
97 |
|
98 /** |
|
99 * Destructor. |
|
100 */ |
|
101 IMPORT_C virtual ~CResolutionUtil(); |
|
102 |
|
103 /** |
|
104 * Returns the screen mode. |
|
105 * |
|
106 * @since S60 v5.0 |
|
107 * @param - |
|
108 * @return screen mode, see TScreenModes |
|
109 */ |
|
110 IMPORT_C TInt ScreenMode() const; |
|
111 |
|
112 /** |
|
113 * Returns the screen mode. Return the real screen mode i.e. Image Editor |
|
114 * flagging has no effect on return value. |
|
115 * |
|
116 * @since S60 v5.0 |
|
117 * @param - |
|
118 * @return screen mode, see TScreenModes |
|
119 */ |
|
120 IMPORT_C TInt GetScreenMode() const; |
|
121 |
|
122 /** |
|
123 * Returns the screen rect for the current screen mode. |
|
124 * |
|
125 * @since S60 v5.0 |
|
126 * @param aRect screen rect for specified screen mode |
|
127 * @return - |
|
128 */ |
|
129 IMPORT_C void GetScreenRect(TRect& aRect) const; |
|
130 |
|
131 /** |
|
132 * Sets the screen rect for the current screen mode. |
|
133 * |
|
134 * @since S60 v5.0 |
|
135 * @param aRect screen rect for specified screen mode |
|
136 * @return - |
|
137 */ |
|
138 IMPORT_C void SetScreenRect(const TRect& aRect); |
|
139 |
|
140 /** |
|
141 * Gets the client rect for the current screen mode. |
|
142 * |
|
143 * @since S60 v5.0 |
|
144 * @param aRect client rect for specified screen mode |
|
145 * @return - |
|
146 */ |
|
147 IMPORT_C void GetClientRect(TRect& aRect) const; |
|
148 |
|
149 /** |
|
150 * Sets the client rect for the current screen mode. |
|
151 * |
|
152 * @since S60 v5.0 |
|
153 * @param aRect client rect for specified screen mode |
|
154 * @return - |
|
155 */ |
|
156 IMPORT_C void SetClientRect(const TRect& aRect); |
|
157 |
|
158 /** |
|
159 * Determines the current screen size and updates rect. |
|
160 * |
|
161 * @since S60 v5.0 |
|
162 * @param - |
|
163 * @return - |
|
164 */ |
|
165 IMPORT_C void UpdateScreenMode(); |
|
166 |
|
167 /** |
|
168 * Sets Full Screen mode to true or false. |
|
169 * |
|
170 * @since S60 v5.0 |
|
171 * @param aFullScreen ETrue if full screen, otherwise EFalse |
|
172 * @return - |
|
173 */ |
|
174 IMPORT_C void SetFullScreen(TBool aFullScreen); |
|
175 |
|
176 /** |
|
177 * Gets the Full Screen state. |
|
178 * |
|
179 * @since S60 v5.0 |
|
180 * @param aFullScreen ETrue if full screen, otherwise EFalse |
|
181 * @return - |
|
182 */ |
|
183 IMPORT_C TBool GetFullScreen() const; |
|
184 |
|
185 /** |
|
186 * Sets the landscape mode to true or false. |
|
187 * |
|
188 * @since S60 v5.0 |
|
189 * @param aLandscape ETrue if landscape, otherwise EFalse |
|
190 * @return - |
|
191 */ |
|
192 IMPORT_C void SetLandscape(TBool aLandscape); |
|
193 |
|
194 /** |
|
195 * Gets the landscape mode to true or false. |
|
196 * |
|
197 * @since S60 v5.0 |
|
198 * @param aLandscape ETrue if landscape, otherwise EFalse |
|
199 * @return - |
|
200 */ |
|
201 IMPORT_C TBool GetLandscape() const; |
|
202 |
|
203 private: |
|
204 |
|
205 CResolutionUtil( const TUid& aUid ); |
|
206 |
|
207 private: |
|
208 |
|
209 /** |
|
210 * Screen rect |
|
211 */ |
|
212 TRect iScreenRect; |
|
213 |
|
214 /** |
|
215 * Client rect |
|
216 */ |
|
217 TRect iClientRect; |
|
218 |
|
219 /** |
|
220 * Landscape mode |
|
221 */ |
|
222 TBool iLandscape; |
|
223 |
|
224 /** |
|
225 * Full Screen mode |
|
226 */ |
|
227 TBool iFullScreen; |
|
228 |
|
229 }; |
|
230 |
|
231 #endif // RESUTIL_H |