|
1 /* |
|
2 * Copyright (c) 2006 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: List control unit test |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INTERNAL INCLUDES |
|
22 |
|
23 #include <mglxvisuallist.h> |
|
24 #include <glxvisuallistmanager.h> |
|
25 |
|
26 |
|
27 #include <Alf/AlfImageVisual.h> |
|
28 #include <Alf/AlfControl.h> |
|
29 |
|
30 #include <glxuiutility.h> |
|
31 |
|
32 // test control |
|
33 class CTestControl : public CAlfControl |
|
34 { |
|
35 public: |
|
36 static CTestControl* NewL( CAlfEnv& aEnv ) |
|
37 { |
|
38 return new (ELeave) CTestControl( aEnv ); |
|
39 } |
|
40 CTestControl( CAlfEnv& aEnv ) |
|
41 // : CAlfControl( aEnv ) |
|
42 { |
|
43 } |
|
44 }; |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 |
|
48 class CGlxDummyVisualList : public MGlxVisualList |
|
49 { |
|
50 public: |
|
51 |
|
52 static CGlxDummyVisualList* NewL(); |
|
53 ~CGlxDummyVisualList(); |
|
54 |
|
55 private: // From MGlxVisualList |
|
56 void ConstructL(); |
|
57 |
|
58 TGlxVisualListId Id() const { return TGlxVisualListId(1); } |
|
59 CAlfVisual* Visual(TInt aListIndex) |
|
60 { |
|
61 if( aListIndex == 0 ) |
|
62 { |
|
63 return NULL; |
|
64 } |
|
65 else |
|
66 { |
|
67 return iVisual; |
|
68 } |
|
69 } |
|
70 CGlxVisualObject* Item(TInt /*aListIndex*/) { return NULL; } |
|
71 TInt ItemCount(NGlxListDefs::TCountType aType = NGlxListDefs::ECountAll) const { return 0; } |
|
72 TInt FocusIndex() const { return 0; } |
|
73 CAlfControlGroup* ControlGroup() const { return NULL; } |
|
74 void AddObserverL(MGlxVisualListObserver* /*aObserver*/) { } |
|
75 void RemoveObserver(MGlxVisualListObserver* /*aObserver*/) { } |
|
76 void AddLayoutL(MGlxLayout* /*aLayout*/) { } |
|
77 void RemoveLayout(const MGlxLayout* /*aLayout*/) { } |
|
78 TGlxViewContextId AddContextL(TInt /*aFrontVisibleRangeOffset*/, |
|
79 TInt /*aRearVisibleRangeOffset*/) { return TGlxViewContextId(1); } |
|
80 void RemoveContext(const TGlxViewContextId& /*aContextId*/) { } |
|
81 void NavigateL(TInt /*aIndexCount*/) { } |
|
82 TSize Size() const { return TSize(); } |
|
83 void BringVisualsToFront() { } |
|
84 void EnableAnimationL(TBool /*aAnimate*/, TInt /*aIndex*/) { } |
|
85 /// @ref MGlxVisualList::SetDefaultIconBehaviour |
|
86 void SetDefaultIconBehaviourL( TBool /*aEnable*/ ) { } |
|
87 |
|
88 void AddIconL( TInt , const CAlfTexture& , |
|
89 NGlxIconMgrDefs::TGlxIconPosition , |
|
90 TBool , TBool , TInt, TReal32, TReal32 ) { } |
|
91 |
|
92 TBool RemoveIcon( TInt , const CAlfTexture& ) { return ETrue; } |
|
93 |
|
94 void SetIconVisibility( TInt , const CAlfTexture&, TBool ) { } |
|
95 |
|
96 private: |
|
97 CGlxUiUtility* iUiUtility; |
|
98 CTestControl* iTestControl; |
|
99 CAlfImageVisual* iVisual; |
|
100 }; |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // NewL |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 CGlxDummyVisualList* CGlxDummyVisualList::NewL() |
|
107 { |
|
108 CGlxDummyVisualList* self = new(ELeave)CGlxDummyVisualList(); |
|
109 CleanupStack::PushL(self); |
|
110 self->ConstructL(); |
|
111 CleanupStack::Pop(self); |
|
112 return self; |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // Destructor |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 CGlxDummyVisualList::~CGlxDummyVisualList() |
|
120 { |
|
121 delete iTestControl; |
|
122 |
|
123 if ( iUiUtility ) |
|
124 { |
|
125 iUiUtility->Close(); |
|
126 } |
|
127 } |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // ConstructL |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 void CGlxDummyVisualList::ConstructL() |
|
134 { |
|
135 iUiUtility = CGlxUiUtility::UtilityL(); |
|
136 |
|
137 iTestControl = CTestControl::NewL( *iUiUtility->Env() ); |
|
138 |
|
139 // create the visual, ownership goes to iControl |
|
140 iVisual = CAlfImageVisual::AddNewL( *iTestControl ); |
|
141 } |
|
142 |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // ManagerL |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 EXPORT_C CGlxVisualListManager* CGlxVisualListManager::ManagerL() |
|
149 { |
|
150 return NULL; |
|
151 } |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // Close |
|
155 // ----------------------------------------------------------------------------- |
|
156 // |
|
157 EXPORT_C void CGlxVisualListManager::Close() |
|
158 { |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // AllocListL |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 EXPORT_C MGlxVisualList* CGlxVisualListManager::AllocListL( |
|
166 MGlxMediaList& /*aMediaList*/, CAlfEnv& /*aEnv*/, |
|
167 CAlfDisplay& /*aDisplay*/, |
|
168 CAlfImageVisual::TScaleMode /*aThumbnailScaleMode*/ ) |
|
169 { |
|
170 return CGlxDummyVisualList::NewL(); |
|
171 } |
|
172 |
|
173 // ----------------------------------------------------------------------------- |
|
174 // ListL |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 EXPORT_C MGlxVisualList* CGlxVisualListManager::ListL( |
|
178 MGlxMediaList& /*aMediaList*/, CAlfEnv& /*aEnv*/, |
|
179 CAlfDisplay& /*aDisplay*/, |
|
180 CAlfImageVisual::TScaleMode /*aThumbnailScaleMode*/ ) |
|
181 { |
|
182 return CGlxDummyVisualList::NewL(); |
|
183 } |
|
184 |
|
185 // ----------------------------------------------------------------------------- |
|
186 // Removes a reference to the list, an deletes it if no more references remain |
|
187 // ----------------------------------------------------------------------------- |
|
188 // |
|
189 EXPORT_C void CGlxVisualListManager::ReleaseList(MGlxVisualList* aList) |
|
190 { |
|
191 delete static_cast<CGlxDummyVisualList*>(aList); |
|
192 } |
|
193 |
|
194 // END OF FILE |