|
1 /* |
|
2 * Copyright (c) 2007-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 CFsTexture. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __FSTEXTURE_H__ |
|
20 #define __FSTEXTURE_H__ |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 //<cmail> SF |
|
26 #include <alf/alftexture.h> |
|
27 //</cmail> |
|
28 #include "fstextureloader.h" |
|
29 #include "fstextureobserver.h" |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CFbsBitmap; |
|
33 class CAlfPicture; |
|
34 class CAlfTexture; |
|
35 class CFsBitmapProvider; |
|
36 |
|
37 // CONSTANTS |
|
38 #define KFsUndefined (-1) |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * CFsTexture |
|
44 * - |
|
45 */ |
|
46 class CFsTexture |
|
47 : public CBase |
|
48 { |
|
49 public: |
|
50 // Flags |
|
51 enum |
|
52 { |
|
53 EFlagNoneDefined, |
|
54 EFlagStatic = 1 << 1, |
|
55 EFlagPreserveProvider = 1 << 2 |
|
56 }; |
|
57 public: // Constructor, destructor |
|
58 |
|
59 /** |
|
60 * 2-phased constructor |
|
61 * @param aTexture |
|
62 * @param aObserver Observer reference |
|
63 * @param aProvider (Optional) Bitmap provider |
|
64 * @param aId Unique id |
|
65 * @return Instance of texture |
|
66 */ |
|
67 static CFsTexture* NewL( CAlfTexture& aTexture, |
|
68 MFsTextureLoaderObserver& aObserver, |
|
69 CFsBitmapProvider* aProvider, |
|
70 const TInt aId |
|
71 ); |
|
72 |
|
73 |
|
74 /** |
|
75 * C++ Destructor |
|
76 */ |
|
77 ~CFsTexture(); |
|
78 public: |
|
79 /** |
|
80 * Return reference of Alf/Hitchock texture |
|
81 * @return Reference |
|
82 */ |
|
83 |
|
84 CAlfTexture& Texture(); |
|
85 |
|
86 |
|
87 /** |
|
88 * Return address of provider |
|
89 * @return null, or address of bitmap provider |
|
90 */ |
|
91 CFsBitmapProvider* Provider(); |
|
92 |
|
93 /** |
|
94 * Return position of texture |
|
95 * @return Position, -1 stands for undefined position |
|
96 */ |
|
97 TInt Pos() const; |
|
98 |
|
99 /** |
|
100 * Set position |
|
101 * @param aPos New position |
|
102 */ |
|
103 void SetPos( const TInt& aPos ); |
|
104 |
|
105 /** |
|
106 * Unload bitmap, or cancel unload |
|
107 * @param aCancel, ETrue cancels possible unload procedure |
|
108 */ |
|
109 void UnloadL( const TBool& aCancel ); |
|
110 |
|
111 /** |
|
112 * Return internal size of texture |
|
113 * @return texture size, or overwritten internal size |
|
114 */ |
|
115 TSize TextSize() const; |
|
116 |
|
117 /** |
|
118 * Overwrite default size |
|
119 * @param aSize New size |
|
120 */ |
|
121 void SetTextSize( const TSize& aSize ); |
|
122 |
|
123 /** |
|
124 * Return current flag status |
|
125 * @return Flag status |
|
126 */ |
|
127 TInt TextFlags() const; |
|
128 |
|
129 /** |
|
130 * Set flag status |
|
131 * @aparam New staus |
|
132 */ |
|
133 void SetTextFlags( const TInt& aFlags ); |
|
134 |
|
135 /** |
|
136 * Return unique id of texture |
|
137 * @return Id |
|
138 */ |
|
139 TInt Id() const; |
|
140 |
|
141 public: // for Timer callback access |
|
142 /** |
|
143 * Timer callback |
|
144 */ |
|
145 void TimerExpiredL(); |
|
146 |
|
147 private: // New methods |
|
148 /** |
|
149 * Stop timer |
|
150 */ |
|
151 void StopTimer(); |
|
152 |
|
153 private: // Constructor |
|
154 |
|
155 /** |
|
156 * C++ constructor |
|
157 * @param aTexture |
|
158 * @param aObserver Observer reference |
|
159 * @param aProvider (Optional) Bitmap provider |
|
160 * @param aId Unique id |
|
161 */ |
|
162 CFsTexture( CAlfTexture& aTexture, |
|
163 MFsTextureLoaderObserver& aObserver, |
|
164 CFsBitmapProvider* aProvider, |
|
165 const TInt aId |
|
166 ); |
|
167 |
|
168 |
|
169 /** |
|
170 * 2nd phase constructor |
|
171 */ |
|
172 void ConstructL(); |
|
173 |
|
174 private: // data |
|
175 /** Texture position */ |
|
176 TInt iPos; |
|
177 |
|
178 /** Owns:*/ |
|
179 CPeriodic* iUnloadTimer; |
|
180 |
|
181 /** Texture reference */ |
|
182 |
|
183 CAlfTexture& iTexture; |
|
184 |
|
185 |
|
186 /** Observer reference */ |
|
187 MFsTextureLoaderObserver& iObserver; |
|
188 |
|
189 /** Internal text size, not related to texture size */ |
|
190 TSize iTextSize; |
|
191 |
|
192 /** Internal flags */ |
|
193 TInt iTextFlags; |
|
194 |
|
195 /** Owns: */ |
|
196 CFsBitmapProvider* iProvider; |
|
197 |
|
198 /** Texture id */ |
|
199 const TInt iId; |
|
200 }; |
|
201 |
|
202 /** |
|
203 * Timer callback |
|
204 * @aModel Address of instance, which will handle callback |
|
205 * @return Response |
|
206 */ |
|
207 TInt TimerCallbackL( TAny* aModel ); |
|
208 |
|
209 #endif // __FSTEXTURE_H__ |
|
210 |
|
211 // End of File |