|
1 /* |
|
2 * Copyright (c) 2008-2009 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: Generic fetch context to retrieve attributes |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_GLXATTRIBUTECONTEXT_H |
|
22 #define C_GLXATTRIBUTECONTEXT_H |
|
23 |
|
24 #include <e32std.h> |
|
25 #include "mglxfetchcontext.h" |
|
26 #include "glxmedialistiterator.h" // for TGlxSequentialIterator |
|
27 |
|
28 // Forward declarations |
|
29 class MGlxMediaList; |
|
30 class TMPXAttribute; |
|
31 class T_CGlxAttributeContext; // For E-unit only |
|
32 |
|
33 /** |
|
34 * CGlxAttributeContext |
|
35 * |
|
36 * Fetch context to retrieve thumbnails |
|
37 * |
|
38 * @lib glxmedialists.lib |
|
39 */ |
|
40 class CGlxAttributeContext : public CBase, public MGlxFetchContext |
|
41 { |
|
42 public: |
|
43 /** |
|
44 * Constructor |
|
45 * @param aIterator Iterator that determines the order of attribute |
|
46 * retrieval and for which items attributes are and are not retrieved |
|
47 */ |
|
48 IMPORT_C CGlxAttributeContext(MGlxMediaListIterator* aIterator); |
|
49 IMPORT_C ~CGlxAttributeContext(); |
|
50 |
|
51 /** |
|
52 * Adds an attribute to be retrieved for all items |
|
53 * @param aAttribute The attribute to be retrieved |
|
54 */ |
|
55 IMPORT_C void AddAttributeL(const TMPXAttribute& aAttribute); |
|
56 |
|
57 /** |
|
58 * Removes an attribute from the "retrieval instructions" |
|
59 * @param aAttribute The attribute to be removed |
|
60 */ |
|
61 IMPORT_C void RemoveAttribute(const TMPXAttribute& aAttribute); |
|
62 |
|
63 /** |
|
64 * Returns the count of the attributes to be retrieved |
|
65 * @return the count of the attribtues to be retrieved |
|
66 */ |
|
67 IMPORT_C TInt AttributeCount(); |
|
68 |
|
69 /** |
|
70 * Sets granularity of the item index array returned from AttributeRequestL |
|
71 */ |
|
72 IMPORT_C void SetGranularity(TUint aGranularity); |
|
73 |
|
74 /** |
|
75 * Sets the default fetch specification. |
|
76 * @param aWidth the width of required bitmap. |
|
77 * @param aHeight the heigth of required bitmap. |
|
78 */ |
|
79 IMPORT_C void SetDefaultSpec(TInt aWidth, TInt aHeight); |
|
80 |
|
81 public: // From MGlxFetchContext |
|
82 /// See @ref MGlxFetchContext::AttributeRequestL |
|
83 TInt AttributeRequestL(const MGlxMediaList* aList, RArray<TInt>& aItemIndices, |
|
84 RArray<TMPXAttribute>& aAttributes, CMPXAttributeSpecs*& aDetailedSpecs) const; |
|
85 |
|
86 /// See @ref MGlxFetchContext::AllAttributesL |
|
87 void AllAttributesL(const MGlxMediaList* aList, TInt aListIndex, |
|
88 RArray<TMPXAttribute>& aAttributes) const; |
|
89 |
|
90 /// See @ref MGlxFetchContext::RequestCountL |
|
91 TInt RequestCountL(const MGlxMediaList* aList) const; |
|
92 |
|
93 private: |
|
94 /** |
|
95 * Determine attributes to request for an item |
|
96 * @param aIndexInList item index in media list |
|
97 * @param aList media list |
|
98 * @param aAttributes requested attributes |
|
99 * @return ETrue if attributes to be requested, otherwise EFalse |
|
100 */ |
|
101 TBool AddItemAttributesL(TInt aIndexInList, const MGlxMediaList* aList, RArray<TMPXAttribute>& aAttributes, |
|
102 TInt& aError, TBool aFirstItem) const; |
|
103 |
|
104 /** |
|
105 * Append attribute to array, no duplicates |
|
106 * @param aAttributes requested attributes |
|
107 * @param aAttribute attribute to be added |
|
108 */ |
|
109 void AddItemAttributeL(RArray<TMPXAttribute>& aAttributes, const TMPXAttribute& aAttribute) const; |
|
110 |
|
111 private: |
|
112 /** Attributes to be requested for all items */ |
|
113 RArray<TMPXAttribute> iAttributes; |
|
114 |
|
115 /** |
|
116 * Iterator for traversing the list |
|
117 */ |
|
118 MGlxMediaListIterator* iIterator; |
|
119 |
|
120 /** |
|
121 * Granularity of the item index array returned from AttributeRequestL |
|
122 */ |
|
123 TUint iGranularity; |
|
124 |
|
125 /** Size of the default spec */ |
|
126 TSize iDefaultSpecSize; |
|
127 |
|
128 /** Tester class */ |
|
129 friend class T_CGlxAttributeContext; |
|
130 }; |
|
131 |
|
132 /** |
|
133 * CGlxDefaultAttributeContext |
|
134 * |
|
135 * Fetch context to retrieve MPX attributes starting from focus outward |
|
136 * |
|
137 * @lib glxmedialists.lib |
|
138 */ |
|
139 class CGlxDefaultAttributeContext : public CGlxAttributeContext |
|
140 { |
|
141 public: |
|
142 IMPORT_C static CGlxDefaultAttributeContext* NewL(); |
|
143 IMPORT_C ~CGlxDefaultAttributeContext(); |
|
144 |
|
145 /** |
|
146 * Set the range offsets. These determine the outer limits |
|
147 * of attributes to be retrieved, compared to current focus in |
|
148 * the list |
|
149 * If ranges not defined, retrieves the attributes for focused item only |
|
150 */ |
|
151 IMPORT_C void SetRangeOffsets(TInt aFrontOffset, TInt aRearOffset); |
|
152 |
|
153 private: |
|
154 CGlxDefaultAttributeContext(); |
|
155 |
|
156 private: |
|
157 TGlxFromFocusOutwardIterator iFromFocusIterator; |
|
158 }; |
|
159 |
|
160 #endif // C_GLXATTRIBUTECONTEXT_H |
|
161 |