|
1 /* |
|
2 * Copyright (c) 2002-2008 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: Defines a public class CAknsBasicBackgroundControlContext. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "AknsCppPreface.h" |
|
21 #include <AknsBasicBackgroundControlContext.h> |
|
22 #include "AknsBackgroundLayout.h" |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // C++ constructor can NOT contain any code, that |
|
28 // might leave. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 CAknsBasicBackgroundControlContext::CAknsBasicBackgroundControlContext() |
|
32 // CBase initializes: iLayout(NULL), iParentContext(NULL) |
|
33 { |
|
34 } |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // Symbian 2nd phase constructor can leave. |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 void CAknsBasicBackgroundControlContext::ConstructL( |
|
41 const TRect& aRect, TBool aParentAbsolute, const TAknsItemID& aImageID ) |
|
42 { |
|
43 iLayout = new (ELeave) TAknsBackground; |
|
44 iLayout->iParentAbsolute = aParentAbsolute; |
|
45 iLayout->iParentPos = TPoint(0,0); |
|
46 iLayout->iRect = aRect; |
|
47 iLayout->iImageID = aImageID; |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // Two-phased constructor. |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 AKNS_EXPORTED_METHOD(CAknsBasicBackgroundControlContext::NewL) |
|
55 EXPORT_C CAknsBasicBackgroundControlContext* |
|
56 CAknsBasicBackgroundControlContext::NewL( |
|
57 const TAknsItemID& aImageID, |
|
58 const TRect& aRect, |
|
59 TBool aParentAbsolute ) |
|
60 { |
|
61 CAknsBasicBackgroundControlContext* self = |
|
62 new( ELeave ) CAknsBasicBackgroundControlContext(); |
|
63 |
|
64 CleanupStack::PushL( self ); |
|
65 self->ConstructL( aRect, aParentAbsolute, aImageID ); |
|
66 CleanupStack::Pop( self ); |
|
67 |
|
68 return self; |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // Destructor. |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 CAknsBasicBackgroundControlContext::~CAknsBasicBackgroundControlContext() |
|
76 { |
|
77 delete iLayout; |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CAknsBasicBackgroundControlContext::SetBitmap |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 AKNS_EXPORTED_METHOD(CAknsBasicBackgroundControlContext::SetBitmap) |
|
85 EXPORT_C void CAknsBasicBackgroundControlContext::SetBitmap( |
|
86 const TAknsItemID& aID ) |
|
87 { |
|
88 iLayout->iImageID = aID; |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CAknsBasicBackgroundControlContext::SetRect |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 AKNS_EXPORTED_METHOD(CAknsBasicBackgroundControlContext::SetRect) |
|
96 EXPORT_C void CAknsBasicBackgroundControlContext::SetRect( const TRect& aRect ) |
|
97 { |
|
98 iLayout->iRect = aRect; |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CAknsBasicBackgroundControlContext::SetParentPos |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 AKNS_EXPORTED_METHOD(CAknsBasicBackgroundControlContext::SetParentPos) |
|
106 EXPORT_C void CAknsBasicBackgroundControlContext::SetParentPos( |
|
107 const TPoint& aPos ) |
|
108 { |
|
109 if( iLayout->iParentAbsolute ) |
|
110 { |
|
111 iLayout->iParentPos = aPos; |
|
112 } |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CAknsBasicBackgroundControlContext::SetParentContext |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 AKNS_EXPORTED_METHOD(CAknsBasicBackgroundControlContext::SetParentContext) |
|
120 EXPORT_C void CAknsBasicBackgroundControlContext::SetParentContext( |
|
121 MAknsControlContext* aParentContext ) |
|
122 { |
|
123 iParentContext = aParentContext; |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CAknsBasicBackgroundControlContext::SupplySkinParameter |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 TInt CAknsBasicBackgroundControlContext::SupplySkinParameter( |
|
131 TAknsCCParameter /*aParam*/ ) |
|
132 { |
|
133 return 0; |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CAknsBasicBackgroundControlContext::SupplySkinObject |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 TAny* CAknsBasicBackgroundControlContext::SupplySkinObject( |
|
141 TAknsCCObject aObject ) |
|
142 { |
|
143 switch( aObject ) |
|
144 { |
|
145 case EAknsCCOBackground: |
|
146 return iLayout; |
|
147 case EAknsCCOParentContext: |
|
148 return iParentContext; |
|
149 default: |
|
150 break; |
|
151 } |
|
152 |
|
153 return NULL; |
|
154 } |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // CAknsBasicBackgroundControlContext::IsCompatibleWithType |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 TBool CAknsBasicBackgroundControlContext::IsCompatibleWithType( |
|
161 const TAknsControlContextType aType ) const |
|
162 { |
|
163 switch( aType ) |
|
164 { |
|
165 case EAknsControlContextTypeUnknown: |
|
166 case EAknsControlContextTypeBasic: |
|
167 return ETrue; |
|
168 |
|
169 #ifdef RD_FULLSCREEN_WALLPAPER |
|
170 case EAknsControlContextTypeCombined: |
|
171 #endif //RD_FULLSCREEN_WALLPAPER |
|
172 case EAknsControlContextTypeLayered: |
|
173 case EAknsControlContextTypeListBox: |
|
174 case EAknsControlContextTypeFrame: |
|
175 break; |
|
176 } |
|
177 |
|
178 return EFalse; |
|
179 } |
|
180 |
|
181 // End of File |