|
1 /* |
|
2 * Copyright (c) 2006-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: Definition of CHuiS60Skin. CHuiS60Skin is a HUITK skin that uses |
|
15 * resources from the current S60 skin. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __HUIS60SKIN_H__ |
|
22 #define __HUIS60SKIN_H__ |
|
23 |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <avkon.hrh> |
|
27 #include <AknsUtils.h> |
|
28 #include <AknsBasicBackgroundControlContext.h> |
|
29 #include <uiacceltk/HuiSkin.h> |
|
30 #include <uiacceltk/huidisplaybackgrounditem.h> |
|
31 #include <AknsSrvClient.h> |
|
32 |
|
33 /** |
|
34 * An S60 skin implementation. Uses bitmaps, fonts, and layout from the |
|
35 * currently active S60 skin. |
|
36 */ |
|
37 class CHuiS60Skin : public CHuiSkin, public MAknsSkinChangeObserver |
|
38 { |
|
39 public: |
|
40 |
|
41 /* Constructors and destructor. */ |
|
42 |
|
43 /** |
|
44 * Constructor. |
|
45 */ |
|
46 IMPORT_C CHuiS60Skin(CHuiEnv& aEnv); |
|
47 |
|
48 /** |
|
49 * From CHuiSkin. Second-phase constructor. |
|
50 */ |
|
51 IMPORT_C void ConstructL(); |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 IMPORT_C ~CHuiS60Skin(); |
|
57 |
|
58 |
|
59 /* Methods from MAknsSkinChangeObserver */ |
|
60 void SkinContentChanged(); |
|
61 |
|
62 void SkinConfigurationChanged( |
|
63 const TAknsSkinStatusConfigurationChangeReason aReason ); |
|
64 |
|
65 void SkinPackageChanged( |
|
66 const TAknsSkinStatusPackageChangeReason aReason ); |
|
67 public: |
|
68 |
|
69 /** |
|
70 * From CHuiSkin. Determines the preferred location for an element of the skin. |
|
71 * The location of skin elements is determined with Avkon layout utilities. |
|
72 * |
|
73 * @param aElement Element whose location to determine. |
|
74 * |
|
75 * @return Location specifier. |
|
76 */ |
|
77 IMPORT_C THuiSkinLocation Location(THuiSkinElement aElement); |
|
78 |
|
79 /** |
|
80 * From CHuiSkin. Returns a Series60 theme specific background image when |
|
81 * parameter EHuiSkinBackgroundTexture is specified. |
|
82 */ |
|
83 IMPORT_C const CHuiTexture& TextureL(TInt aSkinTextureId); |
|
84 |
|
85 /** |
|
86 * From CHuiSkin. Release a skin texture. |
|
87 * Will free up the given texture used by the skin. |
|
88 * @param aSkinTextureResource The THuiSkinTextureResource skin texture ID to free. |
|
89 */ |
|
90 IMPORT_C void ReleaseTexture(TInt aSkinTextureResource); |
|
91 |
|
92 /** |
|
93 * From CHuiSkin. Notification received when display size has changed. |
|
94 */ |
|
95 IMPORT_C void NotifyDisplaySizeChangedL(); |
|
96 |
|
97 /** |
|
98 * From CHuiSkin. Get text color based on style and background. |
|
99 * Determines the colour to use for text, based on the current text style |
|
100 * and the background type. |
|
101 * @param aStyle The text style that is being used. |
|
102 * @param aBackgroundType The background type that is currently under the text. |
|
103 * @return The TRgb value of the text color to use. |
|
104 */ |
|
105 IMPORT_C TRgb StyleTextColor(THuiPreconfiguredTextStyle aStyle, |
|
106 THuiBackgroundType aBackgroundType) const; |
|
107 |
|
108 /** |
|
109 * From CHuiSkin. Restore content of texture. |
|
110 * Restore content of the given texture. |
|
111 * @param aTexture Texture to restore the content of. |
|
112 */ |
|
113 IMPORT_C void RestoreTextureContentL(CHuiTexture& aTexture); |
|
114 |
|
115 /** ! From CHuiSkin.*/ |
|
116 IMPORT_C THuiSkinOrientation Orientation() const; |
|
117 IMPORT_C void SetContext(CHuiGc& aGc); |
|
118 IMPORT_C CHuiGc& Context() const; |
|
119 IMPORT_C TInt GetTexture(TInt aSkinTextureResource, const CHuiTexture*& aOutTexture); |
|
120 |
|
121 /** |
|
122 * Return the skin control context. |
|
123 */ |
|
124 inline CAknsBasicBackgroundControlContext* SkinControlContext() const |
|
125 { |
|
126 return iSkinControlContext; |
|
127 } |
|
128 void UpdateBackgroundsL(const RArray<THuiDisplayBackgroundItem>& aItems); |
|
129 IMPORT_C CHuiTexture* BackgroundTexture(const TAknsItemID& aID); |
|
130 protected: // from CHuiSkin |
|
131 IMPORT_C void SkinExtension(const TUid& aExtensionUid, TAny** aExtensionParameters); |
|
132 void FreeBackgrounds(); |
|
133 CHuiTexture* CreateSkinBackgroundL(const TAknsItemID& aID); |
|
134 void ReloadBgTexturesL(); |
|
135 protected: |
|
136 |
|
137 /* Methods. */ |
|
138 |
|
139 MAknsSkinInstance* SkinInstance() const; |
|
140 |
|
141 /** |
|
142 * Copies the S60 skin background bitmap onto a texture. |
|
143 */ |
|
144 void UpdateBackgroundL(); |
|
145 |
|
146 private: |
|
147 |
|
148 /** Control context for the skin. */ |
|
149 CAknsBasicBackgroundControlContext* iSkinControlContext; |
|
150 |
|
151 /** Background texture from S60. */ |
|
152 CHuiTexture* iBackgroundTexture; |
|
153 |
|
154 /** To get CallBack from SkinServer when skin is changed */ |
|
155 RAknsSrvSession iSkinSrvSession; |
|
156 TBool iSkinSrvConnected; |
|
157 |
|
158 /** Background should be reloaded the next time it is needed. */ |
|
159 TBool iReloadBackground; |
|
160 TBool iSkinChanged; |
|
161 CFbsBitmap* iBackgroundBitmap; |
|
162 TAny* iSpare; |
|
163 }; |
|
164 |
|
165 #endif // __HUIS60SKIN_H__ |