|
1 /* |
|
2 * Copyright (c) 2007-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: Interface for model accessor |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef I_MULMODELACCESSOR_H |
|
20 #define I_MULMODELACCESSOR_H |
|
21 |
|
22 //Includes |
|
23 #include <alf/ialfmodel.h> |
|
24 #include <mul/imulwidgetdef.h> |
|
25 #include <mul/imulwidget.h> |
|
26 |
|
27 #include <vector> |
|
28 |
|
29 namespace osncore |
|
30 { |
|
31 class UString; |
|
32 } |
|
33 using namespace osncore; |
|
34 |
|
35 namespace Alf |
|
36 { |
|
37 |
|
38 /* Forward declarations*/ |
|
39 class MulVisualItem; |
|
40 class IMulModelObserver; |
|
41 |
|
42 /** |
|
43 * An interface for accessing data model. Widgets use this interface to interact with Model. |
|
44 * Data model implements this interface. |
|
45 * @lib |
|
46 */ |
|
47 class IMulModelAccessor : public IAlfModel |
|
48 { |
|
49 public: |
|
50 |
|
51 /** |
|
52 * The function to set a particular item as highlighted. |
|
53 * |
|
54 * @param aIndex Index of the item to be highlighted. |
|
55 * @throws Invalid_argument Throws this exception if index is not a valid index. |
|
56 */ |
|
57 virtual void SetHighlight( int aItemIndex ) = 0; |
|
58 |
|
59 /** |
|
60 * Scroll Window to mention item index |
|
61 * it will check that data window needs to be updated or not |
|
62 * and if required it update data window |
|
63 * |
|
64 * @aItemIndex item index |
|
65 * @throws invaid_argument exception |
|
66 */ |
|
67 virtual void ScrollWindow( int aItemIndex ) = 0; |
|
68 |
|
69 /** |
|
70 * Function to get the highlighted item index. |
|
71 * |
|
72 * @return Index of the highlighted index. |
|
73 */ |
|
74 virtual int Highlight() = 0; |
|
75 |
|
76 /** |
|
77 * Function to get the count of items currently present in the model. |
|
78 * This includes hidden items. |
|
79 * |
|
80 * @return Count of items existing in the model. |
|
81 */ |
|
82 virtual int CurrentItemCount() = 0; |
|
83 |
|
84 /** |
|
85 * Set visible data window for model. |
|
86 * |
|
87 * @param aVisibleWindow No of visuals that widget can display at a time on screen. |
|
88 */ |
|
89 virtual void SetVisibleWindow( int aWindowSize, int aPageTopIndex = -1 ) = 0; |
|
90 |
|
91 /** |
|
92 * Returns relative index from absolute index. |
|
93 * |
|
94 * @param aAbsoluteIndex Abosulte index |
|
95 * @return Returns relative index from absolute index. |
|
96 */ |
|
97 virtual int RelativeIndex( int aAbsoluteIndex ) const = 0; |
|
98 |
|
99 /** |
|
100 * Return visible window top offset |
|
101 * |
|
102 * @return Current window top offset |
|
103 */ |
|
104 virtual int TopWindowOffset() const= 0; |
|
105 |
|
106 /** |
|
107 * Return visible window bottom offset |
|
108 * |
|
109 * @return Current window bottom offset |
|
110 */ |
|
111 virtual int BottomWindowOffset() const = 0; |
|
112 |
|
113 /** |
|
114 * Return visible window top offset |
|
115 * |
|
116 * @return Current window top offset |
|
117 */ |
|
118 virtual int TopOffset() const= 0; |
|
119 |
|
120 /** |
|
121 * Return visible window bottom offset |
|
122 * |
|
123 * @return Current window bottom offset |
|
124 */ |
|
125 virtual int BottomOffset() const = 0; |
|
126 |
|
127 /** |
|
128 * Return rear buffer top offset |
|
129 * |
|
130 * @return Current window top offset |
|
131 */ |
|
132 virtual int RearTopOffset() const = 0; |
|
133 |
|
134 /** |
|
135 * Return rear buffer bottom offset |
|
136 * |
|
137 * @return Current window top offset |
|
138 */ |
|
139 virtual int RearBottomOffset() const = 0; |
|
140 |
|
141 /** |
|
142 * Check weather item at specified index is marked or not. |
|
143 * |
|
144 * @param aIndex Absolute index of item |
|
145 * @return true if seleccted else otherwise |
|
146 */ |
|
147 virtual bool IsItemMarked( int aIndex ) = 0; |
|
148 |
|
149 /** |
|
150 * Function for setting the item Marked or Unmarked. For mark and |
|
151 * unmark operations, index of item should be provided. |
|
152 * |
|
153 * @param aType Type of marking operation to be performed. |
|
154 * @param aItemsIndex Indices of the items to be changed |
|
155 * @throw Invalid Argument, if type is specified as mark-all and unmark-all. |
|
156 */ |
|
157 virtual void SetMarkedIndex( MulWidgetDef::TMulWidgetMarkingType aType, int aIndex ) = 0; |
|
158 |
|
159 /** |
|
160 * Returns the visual item at the specified absolute index |
|
161 * |
|
162 * @param aIndex Absolute index of item |
|
163 */ |
|
164 virtual const MulVisualItem& Item( int aAbsoluteIndex ) = 0; |
|
165 |
|
166 /** |
|
167 * Returns Absolute index from relative index |
|
168 * |
|
169 * @param aRelativeIndex Relative index |
|
170 * @return Absolute index |
|
171 */ |
|
172 virtual int AbsoluteIndex( int aRelativeIndex ) = 0; |
|
173 |
|
174 /** |
|
175 * Return whather currently looping is on or not |
|
176 * |
|
177 * @return true if looping is on false otherwise |
|
178 */ |
|
179 virtual bool IsLoopingOn() = 0; |
|
180 |
|
181 /** |
|
182 * Add model state change observer. |
|
183 * |
|
184 * @param aObserver Observer- ownserhip is not transferred |
|
185 */ |
|
186 virtual void AddModelObserver( IMulModelObserver* aObserver ) = 0; |
|
187 |
|
188 /** |
|
189 * Eemove model state change observer. |
|
190 * |
|
191 * @param aObserver Observer- ownserhip is not transferred |
|
192 */ |
|
193 virtual void RemoveModelObserver( IMulModelObserver* aObserver )= 0; |
|
194 |
|
195 /** |
|
196 * Return default template |
|
197 * |
|
198 * @return Default template |
|
199 */ |
|
200 virtual mulwidget::TLogicalTemplate Template( ) = 0; |
|
201 |
|
202 }; |
|
203 |
|
204 |
|
205 } // namespace Alf |
|
206 |
|
207 #endif // I_MULMODELACCESSOR_H |