20
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2007 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: Phonebook 2 contact view list box.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CPBK2CONTACTVIEWLISTBOX_H
|
|
20 |
#define CPBK2CONTACTVIEWLISTBOX_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <aknlists.h>
|
|
24 |
#include <TPbk2IconId.h>
|
|
25 |
#include "MPbk2ClipListBoxText.h"
|
|
26 |
#include <MPbk2PointerEventInspector.h>
|
|
27 |
#include <MPbk2UiControlCmdItem.h>
|
|
28 |
#include <coemain.h>
|
|
29 |
#include "CPbk2ContactViewListBoxModel.h"
|
|
30 |
|
|
31 |
|
|
32 |
// FORWARD DECLARATIONS
|
|
33 |
class CPbk2ContactViewListBoxModel;
|
|
34 |
class CVPbkContactManager;
|
|
35 |
class MVPbkContactViewBase;
|
|
36 |
class MPbk2ContactNameFormatter;
|
|
37 |
class CPbk2StorePropertyArray;
|
|
38 |
class MPbk2ContactUiControlExtension;
|
|
39 |
class CPbk2ListboxModelCmdDecorator;
|
|
40 |
class CPbk2ContactViewCustomListBoxData;
|
|
41 |
class CPbk2PredictiveSearchFilter;
|
|
42 |
class CCoeControl;
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Phonebook 2 contact view list box.
|
|
46 |
*/
|
|
47 |
NONSHARABLE_CLASS(CPbk2ContactViewListBox) :
|
|
48 |
public CAknSingleGraphicStyleListBox,
|
|
49 |
public MPbk2ClipListBoxText,
|
|
50 |
public MPbk2PointerEventInspector,
|
|
51 |
private MCoeForegroundObserver
|
|
52 |
{
|
|
53 |
|
|
54 |
public:
|
|
55 |
/** CreateItemDrawerL()
|
|
56 |
*
|
|
57 |
* Chooses which itemdrawer to use.
|
|
58 |
*/
|
|
59 |
void CreateItemDrawerL();
|
|
60 |
|
|
61 |
public: // Constructors and destructor
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Creates a new instance of this class.
|
|
65 |
*
|
|
66 |
* @param aContainer The control container for this control.
|
|
67 |
* @param aResourceReader Resource reader used to construct
|
|
68 |
* this object.
|
|
69 |
* @param aManager Reference to contact manager.
|
|
70 |
* @param aView Reference to contact view.
|
|
71 |
* @param aNameFormatter Reference to the name formatter.
|
|
72 |
* @param aStoreProperties Store property array.
|
|
73 |
* @param aUiExtension UI extension.
|
|
74 |
* @param aSearchFilter PBk2 Search Filter
|
|
75 |
* @return A new instance of this class.
|
|
76 |
*/
|
|
77 |
static CPbk2ContactViewListBox* NewL(
|
|
78 |
CCoeControl& aContainer,
|
|
79 |
TResourceReader& aResourceReader,
|
|
80 |
const CVPbkContactManager& aManager,
|
|
81 |
MVPbkContactViewBase& aView,
|
|
82 |
MPbk2ContactNameFormatter& aNameFormatter,
|
|
83 |
CPbk2StorePropertyArray& aStoreProperties,
|
|
84 |
MPbk2ContactUiControlExtension* aUiExtension,
|
|
85 |
CPbk2PredictiveSearchFilter &aSearchFilter );
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Destructor.
|
|
89 |
*/
|
|
90 |
~CPbk2ContactViewListBox();
|
|
91 |
|
|
92 |
public: // Interface
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Returns the number of items in the list box currently.
|
|
96 |
*
|
|
97 |
* @return Number of items in the listbox.
|
|
98 |
*/
|
|
99 |
TInt NumberOfItems() const;
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Returns list box selection status.
|
|
103 |
*
|
|
104 |
* @return ETrue if there are items marked, EFalse otherwise.
|
|
105 |
*/
|
|
106 |
TBool ContactsMarked() const;
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Handles item addition / deletion etc
|
|
110 |
* events by updating list box data and the focus.
|
|
111 |
*
|
|
112 |
* @param aEvent contact view event
|
|
113 |
* @see MPbk2NamesListState::HandleContactViewEventL
|
|
114 |
* @param aIndex listbox index
|
|
115 |
*/
|
|
116 |
void HandleEventL(
|
|
117 |
TInt aEvent,
|
|
118 |
TInt aIndex );
|
|
119 |
|
|
120 |
/**
|
|
121 |
* Fixes the top item index of the list box.
|
|
122 |
*/
|
|
123 |
void FixTopItemIndex();
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Checks that there is focus in the list.
|
|
127 |
*/
|
|
128 |
void CheckFocusIndex();
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Handles pointer event.
|
|
132 |
*
|
|
133 |
* @see CAknSingleGraphicStyleListBox::HandlePointerEventL
|
|
134 |
*/
|
|
135 |
void HandlePointerEventL(
|
|
136 |
const TPointerEvent& aPointerEvent );
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Draws the listbox.
|
|
140 |
*
|
|
141 |
* @see CAknSingleGraphicStyleListBox::Draw
|
|
142 |
*/
|
|
143 |
void Draw( const TRect& aRect ) const;
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Returns Phonebook 2 control flags defined in Pbk2UIControls.hrh.
|
|
147 |
*
|
|
148 |
* @return Control flags.
|
|
149 |
*/
|
|
150 |
TUint Flags() const;
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Returns ETrue if the list supports selection.
|
|
154 |
*
|
|
155 |
* @return ETrue if the list supports selection.
|
|
156 |
*/
|
|
157 |
TBool IsSelectionListBox();
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Sets the scroll event observer.
|
|
161 |
*/
|
|
162 |
void SetScrollEventObserver(MEikScrollBarObserver* aObserver);
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Sets the commands that should appear at the top of the list.
|
|
166 |
* @param aCommands An array of commands. NULL may be given to
|
|
167 |
* indicate that no commands are to be shown.
|
|
168 |
*/
|
|
169 |
void SetListCommands( const RPointerArray<MPbk2UiControlCmdItem>* aCommands );
|
|
170 |
|
|
171 |
/**
|
|
172 |
* Handle showing of popupcharacter when user scrolls name list
|
|
173 |
* using scroll bar.
|
|
174 |
*
|
|
175 |
* @param CWindowGc.
|
|
176 |
* @param TRect.
|
|
177 |
*/
|
|
178 |
void HandlePopupCharacter( CWindowGc* aGc,
|
|
179 |
const TRect& aRectOfListBoxItem ) const;
|
|
180 |
|
|
181 |
/**
|
|
182 |
* Set the state of the Marking mode
|
|
183 |
*/
|
|
184 |
inline void SetMarkingModeState( TBool aActived )
|
|
185 |
{
|
|
186 |
iMarkingModeOn = aActived;
|
|
187 |
}
|
|
188 |
|
|
189 |
public: // From MPbk2ClipListBoxText
|
|
190 |
TBool ClipFromBeginning(
|
|
191 |
TDes& aBuffer,
|
|
192 |
TInt aItemIndex,
|
|
193 |
TInt aSubCellNumber );
|
|
194 |
|
|
195 |
public: // From MPbk2PointerEventInspector
|
|
196 |
TBool FocusedItemPointed();
|
|
197 |
TBool FocusableItemPointed();
|
|
198 |
TBool SearchFieldPointed();
|
|
199 |
|
|
200 |
public: // From CEikListBox
|
|
201 |
void HandleScrollEventL( CEikScrollBar* aScrollBar,
|
|
202 |
TEikScrollEvent aEventType );
|
|
203 |
|
|
204 |
private: // MCoeForegroundObserver
|
|
205 |
void HandleGainingForeground();
|
|
206 |
void HandleLosingForeground();
|
|
207 |
|
|
208 |
protected: // Implementation
|
|
209 |
CPbk2ContactViewListBox(
|
|
210 |
CCoeControl& aContainer,
|
|
211 |
MPbk2ContactUiControlExtension* aUiExtension,
|
|
212 |
CPbk2PredictiveSearchFilter &aSearchFilter );
|
|
213 |
void ConstructL(
|
|
214 |
CCoeControl& aContainer,
|
|
215 |
TResourceReader& aResourceReader,
|
|
216 |
const CVPbkContactManager& aManager,
|
|
217 |
MVPbkContactViewBase& aView,
|
|
218 |
MPbk2ContactNameFormatter& aNameFormatter,
|
|
219 |
CPbk2StorePropertyArray& aStoreProperties );
|
|
220 |
void CreateListBoxModelL(
|
|
221 |
const CVPbkContactManager& aManager,
|
|
222 |
MVPbkContactViewBase& aView,
|
|
223 |
MPbk2ContactNameFormatter& aNameFormatter,
|
|
224 |
CPbk2StorePropertyArray& aStoreProperties );
|
|
225 |
|
|
226 |
|
|
227 |
virtual CPbk2ContactViewListBoxModel* DoCreateModelL(
|
|
228 |
CPbk2ContactViewListBoxModel::TParams params );
|
|
229 |
|
|
230 |
virtual CPbk2ListboxModelCmdDecorator* DoCreateDecoratorL(
|
|
231 |
const CPbk2IconArray& aIconArray,
|
|
232 |
TPbk2IconId aEmptyIconId,
|
|
233 |
TPbk2IconId aDefaultIconId );
|
|
234 |
|
|
235 |
TBool IsContact( TInt aIndex ) const;
|
|
236 |
|
|
237 |
private:
|
|
238 |
void RecalcWidthInMarkingMode( TInt& aWidth, const CFont& aFont, TChar aChar );
|
|
239 |
|
|
240 |
private: // Data structures
|
|
241 |
/// Data loaded from resources
|
|
242 |
struct TResourceData
|
|
243 |
{
|
|
244 |
/// Own: Flags
|
|
245 |
TUint iFlags;
|
|
246 |
/// Own: Text to use for unnamed entries
|
|
247 |
HBufC* iUnnamedText;
|
|
248 |
/// Own: Empty icon id
|
|
249 |
TPbk2IconId iEmptyIconId;
|
|
250 |
/// Own: Default icon id
|
|
251 |
TPbk2IconId iDefaultIconId;
|
|
252 |
};
|
|
253 |
|
|
254 |
protected: //data
|
|
255 |
/// Own: List box model
|
|
256 |
CPbk2ContactViewListBoxModel* iModel;
|
|
257 |
/// Own: Data loaded from resources
|
|
258 |
TResourceData iResourceData;
|
|
259 |
/// Own: Indexes of the changed list items
|
|
260 |
CArrayFixFlat<TInt> iChangedIndexes;
|
|
261 |
|
|
262 |
/// Ref: UI extension
|
|
263 |
MPbk2ContactUiControlExtension* iUiExtension;
|
|
264 |
/// Own: Pointer movement indicator
|
|
265 |
TBool iFocusedContactPointed;
|
|
266 |
/// Own: Pointer movement indicator
|
|
267 |
TBool iFocusableContactPointed;
|
|
268 |
/// Ref: scroll event observer
|
|
269 |
MEikScrollBarObserver* iScrollEventObserver;
|
|
270 |
/// Own: Wraps the listbox model
|
|
271 |
CPbk2ListboxModelCmdDecorator* iListboxModelDecorator;
|
|
272 |
/// For handling of scroll bar popupcharacter
|
|
273 |
TBool iShowPopupChar;
|
|
274 |
/// Doesnt Own - Ownership Transferred to CPbk2ContactViewCustomListBoxItemDrawer
|
|
275 |
CPbk2ContactViewCustomListBoxData* iColumnData;
|
|
276 |
///Ref : Search Pane Filter
|
|
277 |
CPbk2PredictiveSearchFilter &iSearchFilter;
|
|
278 |
// ref: used fro checking command item count
|
|
279 |
CCoeControl& iContainer;
|
|
280 |
// Flag to indicate whether Marking mode is active
|
|
281 |
TBool iMarkingModeOn;
|
|
282 |
|
|
283 |
};
|
|
284 |
|
|
285 |
#endif // CPBK2CONTACTVIEWLISTBOX_H
|
|
286 |
|
|
287 |
// End of File
|