|
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: VT UI component state definition. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef T_VTUIBLOCKLISTS_H |
|
20 #define T_VTUIBLOCKLISTS_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "mvtuicomponent.h" |
|
25 |
|
26 /** |
|
27 * CVtUiBlockListIterator |
|
28 * |
|
29 * Class for iterating through component's block list. |
|
30 * |
|
31 * @since S60 v3.2 |
|
32 */ |
|
33 NONSHARABLE_CLASS( CVtUiBlockListIterator ) : public CBase |
|
34 { |
|
35 |
|
36 public: // public abstract methods |
|
37 |
|
38 /** |
|
39 * Returns ETrue if there is more component Ids left in the iterator. |
|
40 * |
|
41 * @return ETrue if there is more Ids left, EFalse otherwise. |
|
42 */ |
|
43 virtual TBool HasNext() const = 0; |
|
44 |
|
45 /** |
|
46 * Returns next component id. |
|
47 * |
|
48 * @return Next component Id. |
|
49 */ |
|
50 virtual MVtUiComponent::TComponentId Next() = 0; |
|
51 |
|
52 }; |
|
53 |
|
54 /** |
|
55 * TVtUiBlockList |
|
56 * |
|
57 * Base class for component block lists. |
|
58 * |
|
59 * @since S60 v3.2 |
|
60 */ |
|
61 NONSHARABLE_CLASS( TVtUiBlockList ) |
|
62 { |
|
63 |
|
64 public: // public methods |
|
65 |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 virtual ~TVtUiBlockList(); |
|
70 |
|
71 public: // public abstract methods |
|
72 |
|
73 /** |
|
74 * Returns ETrue if block list is empty. |
|
75 * |
|
76 * @return ETrue if this block list is empty, EFalse otherwise. |
|
77 */ |
|
78 virtual TBool IsEmpty() const = 0; |
|
79 |
|
80 /** |
|
81 * Returns ETrue if block list contains given component id. |
|
82 * |
|
83 * @param aId Component Id to check. |
|
84 * @return ETrue if this block list contains given component Id, EFalse |
|
85 * otherwise. |
|
86 */ |
|
87 virtual TBool Contains( MVtUiComponent::TComponentId aId ) const = 0; |
|
88 |
|
89 /** |
|
90 * Merges this block list with given block list. |
|
91 * |
|
92 * @param aBlockList List to merge into this block list. |
|
93 */ |
|
94 virtual void Union( const TVtUiBlockList& aBlockList ) = 0; |
|
95 |
|
96 /** |
|
97 * Returns new instance of block list iterator. Instance is owned by the |
|
98 * caller, but it is also pushed to cleanupstack. |
|
99 * |
|
100 * @return Instance to block list iterator. Iterator is for this block |
|
101 * list instance. |
|
102 */ |
|
103 virtual CVtUiBlockListIterator* IteratorLC() const = 0; |
|
104 |
|
105 protected: // protected methods |
|
106 |
|
107 /** |
|
108 * Constructor. |
|
109 */ |
|
110 TVtUiBlockList(); |
|
111 |
|
112 }; |
|
113 |
|
114 /** |
|
115 * TVtUiBlockListBitField |
|
116 * |
|
117 * Component block list in which component IDs are defined as bits (i.e. |
|
118 * only single bit is set per ID). |
|
119 * |
|
120 * @since S60 v3.2 |
|
121 */ |
|
122 NONSHARABLE_CLASS( TVtUiBlockListBitField ) : public TVtUiBlockList |
|
123 { |
|
124 |
|
125 public: // public methods |
|
126 |
|
127 /** |
|
128 * Default construct, initialized block list as empty. |
|
129 */ |
|
130 TVtUiBlockListBitField(); |
|
131 |
|
132 /** |
|
133 * Constructor that initializes block list. |
|
134 * |
|
135 * @param aBlockMask Component Ids that will be added to block list. |
|
136 */ |
|
137 TVtUiBlockListBitField( TUint aBlockMask ); |
|
138 |
|
139 public: // from |
|
140 |
|
141 /** |
|
142 * @see TVtUiBlockList::IsEmpty |
|
143 */ |
|
144 TBool IsEmpty() const; |
|
145 |
|
146 /** |
|
147 * @see TVtUiBlockList::Contains |
|
148 */ |
|
149 TBool Contains( MVtUiComponent::TComponentId aId ) const; |
|
150 |
|
151 /** |
|
152 * @see TVtUiBlockList::Union |
|
153 */ |
|
154 void Union( const TVtUiBlockList& aBlockList ); |
|
155 |
|
156 /** |
|
157 * @see TVtUiBlockList::IteratorLC |
|
158 */ |
|
159 CVtUiBlockListIterator* IteratorLC() const; |
|
160 |
|
161 private: // inner classes |
|
162 |
|
163 /** |
|
164 * CVtUiBListIteratorBF |
|
165 * |
|
166 * @since S60 v3.2 |
|
167 */ |
|
168 class CVtUiBListIteratorBF : public CVtUiBlockListIterator |
|
169 { |
|
170 |
|
171 public: // public methods |
|
172 |
|
173 /** |
|
174 * Static constructor |
|
175 * |
|
176 * @param aBlockMask Components Ids. |
|
177 */ |
|
178 static CVtUiBListIteratorBF* NewLC( const TUint& aBlockMask ); |
|
179 |
|
180 private: // private methods |
|
181 |
|
182 /** |
|
183 * Constructor |
|
184 */ |
|
185 CVtUiBListIteratorBF( const TUint& aBlockMask ); |
|
186 |
|
187 private: // from CVtUiBlockListIterator |
|
188 |
|
189 /** |
|
190 * @see CVtUiBlockListIterator::HasNext |
|
191 */ |
|
192 TBool HasNext() const; |
|
193 |
|
194 /** |
|
195 * @see CVtUiBlockListIterator::Next |
|
196 */ |
|
197 MVtUiComponent::TComponentId Next(); |
|
198 |
|
199 private: // data |
|
200 |
|
201 // Blockmask from TVtUiBlockListBitField |
|
202 const TUint iBlockMask; |
|
203 |
|
204 // Current id |
|
205 TUint iCurrent; |
|
206 |
|
207 }; |
|
208 |
|
209 private: // data |
|
210 |
|
211 // Block list as bit field, this requires that component ids are defined |
|
212 // as bitfields. |
|
213 TUint iBlockMask; |
|
214 |
|
215 }; |
|
216 |
|
217 #endif // T_VTUIBLOCKLISTS_H |