|
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: Interface to visual list |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 * @internal reviewed 04/07/2007 by M Byrne |
|
23 */ |
|
24 |
|
25 #ifndef M_GLXVISUALLIST_H |
|
26 #define M_GLXVISUALLIST_H |
|
27 |
|
28 #include <glxid.h> |
|
29 #include <glxlistdefs.h> |
|
30 #include "glxiconmgrdefs.h" |
|
31 |
|
32 class CGlxVisualObject; |
|
33 class MGlxLayout; |
|
34 class MGlxVisualListObserver; |
|
35 class CAlfControlGroup; |
|
36 class CAlfTexture; |
|
37 class CAlfVisual; |
|
38 |
|
39 class TGlxVisualListIdBase {}; |
|
40 typedef TGlxId<TGlxVisualListIdBase> TGlxVisualListId; |
|
41 |
|
42 /** |
|
43 * View Context id |
|
44 */ |
|
45 class TGlxIdViewContextBase {}; // Don't use this. This is just to make TGlxId concrete |
|
46 typedef TGlxId<TGlxIdViewContextBase> TGlxViewContextId; // Use this |
|
47 |
|
48 |
|
49 |
|
50 /** |
|
51 * MGlxVisualList |
|
52 * |
|
53 * Interface to a visual list. |
|
54 * Used to separate the data model from layout and key handling controls. |
|
55 * |
|
56 * @author Aki Vanhatalo |
|
57 */ |
|
58 class MGlxVisualList |
|
59 { |
|
60 public: |
|
61 /** |
|
62 * @returns the id of the list |
|
63 */ |
|
64 virtual TGlxVisualListId Id() const = 0; |
|
65 |
|
66 /** |
|
67 * @returns a visual by list index |
|
68 */ |
|
69 virtual CAlfVisual* Visual(TInt aListIndex) = 0; |
|
70 |
|
71 /** |
|
72 * @returns a visual item by list index |
|
73 */ |
|
74 virtual CGlxVisualObject* Item(TInt aListIndex) = 0; |
|
75 |
|
76 /** |
|
77 * @returns the count of visuals in window |
|
78 */ |
|
79 virtual TInt ItemCount(NGlxListDefs::TCountType aType = NGlxListDefs::ECountAll) const = 0; |
|
80 |
|
81 /** |
|
82 * @returns the focus index |
|
83 */ |
|
84 virtual TInt FocusIndex() const = 0; |
|
85 |
|
86 /** |
|
87 * @returns the control group for the visual list |
|
88 * The layout/eventhandler controls should add themselved |
|
89 * to this same group. View should show this group when |
|
90 * it is activated and hide it when it is deactivated. |
|
91 */ |
|
92 virtual CAlfControlGroup* ControlGroup() const = 0; |
|
93 |
|
94 /** |
|
95 * Add/remove an observer |
|
96 */ |
|
97 virtual void AddObserverL(MGlxVisualListObserver* aObserver) = 0; |
|
98 virtual void RemoveObserver(MGlxVisualListObserver* aObserver) = 0; |
|
99 |
|
100 /** |
|
101 * Add a layout |
|
102 * The layout is used when layout out the visuals owned by the |
|
103 * MViuVisualOwner-derived class (or its helper) |
|
104 */ |
|
105 virtual void AddLayoutL(MGlxLayout* aLayout) = 0; |
|
106 |
|
107 /** |
|
108 * Remove an existing layout |
|
109 */ |
|
110 virtual void RemoveLayout(const MGlxLayout* aLayout) = 0; |
|
111 |
|
112 /** |
|
113 * Defines a context in terms of range offsets |
|
114 * |
|
115 * @param aFrontVisibleRangeOffset The front offset to focus for items that are |
|
116 * visible in the UI. Must be less or equal to 0. |
|
117 * @param aRearVisibleRangeOffset The front offset to focus for items that are |
|
118 * visible in the UI. Must be greater or equal to 0. |
|
119 * @returns Unique id of the context |
|
120 */ |
|
121 virtual TGlxViewContextId AddContextL(TInt aFrontVisibleRangeOffset, |
|
122 TInt aRearVisibleRangeOffset) = 0; |
|
123 |
|
124 /** |
|
125 * Removes an existing view context. Forwards the request to List Reader. |
|
126 * If you are relying on the visual owner control, use this function to |
|
127 * remove a context instead of calling the list reader directly. |
|
128 * |
|
129 * @param aContextId Id of the context to be removed |
|
130 */ |
|
131 virtual void RemoveContext(const TGlxViewContextId& aContextId) = 0; |
|
132 |
|
133 /** |
|
134 * Navigate either forward or backward |
|
135 * @param aIndexCount amount of indexes to navigate |
|
136 * if positive, navigates forward |
|
137 * if negative, navigates backward |
|
138 */ |
|
139 virtual void NavigateL(TInt aIndexCount) = 0; |
|
140 |
|
141 /** |
|
142 * @returns size of the control area |
|
143 */ |
|
144 virtual TSize Size() const = 0; |
|
145 |
|
146 /** |
|
147 * Brings the visuals to the front of the display |
|
148 */ |
|
149 virtual void BringVisualsToFront() = 0; |
|
150 |
|
151 /** |
|
152 * Start or stop animation of given item, if animation available |
|
153 * @param aAnimate If true, starts the animation if availble; if false, stops it |
|
154 * @param aIndex Index of the item to animate |
|
155 */ |
|
156 virtual void EnableAnimationL(TBool aAnimate, TInt aIndex) = 0; |
|
157 |
|
158 /** |
|
159 * Specifies whether the visual list shows default icons or not |
|
160 * @param aEnable true to show the default icons, false to not show |
|
161 */ |
|
162 virtual void SetDefaultIconBehaviourL( TBool aEnable ) = 0; |
|
163 |
|
164 /** |
|
165 * Add icon to specified visual |
|
166 * @param aListIndex position in list |
|
167 * @param aTexture texture of icon to apply |
|
168 * @param aIconPos position of icon (centred or relative to a specific corner) |
|
169 * @param aForeground foreground or background icon |
|
170 * @param aStretch ETrue if icon is scaled to visual, EFalse if texture is fixed size |
|
171 * @param aBorderMargin margin from specified corner |
|
172 * @param aWidth width for anchor when icon is stretched |
|
173 * @param aHeight height for anchor when icon is stretched |
|
174 */ |
|
175 virtual void AddIconL( TInt aListIndex, const CAlfTexture& aTexture, |
|
176 NGlxIconMgrDefs::TGlxIconPosition aIconPos, |
|
177 TBool aForeground, TBool aStretch, TInt aBorderMargin, |
|
178 TReal32 aWidth = 1.0, TReal32 aHeight = 1.0 ) = 0; |
|
179 |
|
180 /** |
|
181 * Remove icon from specified visual |
|
182 * @param aListIndex position in list |
|
183 * @param aTexture texture of icon to remove |
|
184 * @return ETrue if texture was present |
|
185 */ |
|
186 virtual TBool RemoveIcon( TInt aListIndex, const CAlfTexture& aTexture ) = 0; |
|
187 |
|
188 /** |
|
189 * Hide or show icon if required |
|
190 * @param aListIndex position in list |
|
191 * @param aTexture texture of icon |
|
192 * @param aVisible Set hidden or show |
|
193 */ |
|
194 virtual void SetIconVisibility( TInt aListIndex, const CAlfTexture& aTexture, |
|
195 TBool aVisible ) = 0; |
|
196 }; |
|
197 |
|
198 |
|
199 #endif // M_GLXVISUALLIST_H |