|
1 /* |
|
2 * Copyright (c) 2010 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: Easy dialing listbox. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _EASYDIALINGLISTBOX_H |
|
20 #define _EASYDIALINGLISTBOX_H |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include "easydialinglistboxview.h" |
|
24 #include "easydialinglistboxitemdrawer.h" |
|
25 #include "easydialinglistboxdata.h" |
|
26 #include <aknlists.h> |
|
27 #include <aknlongtapdetector.h> |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // Easy dialing specific listbox events |
|
32 const TInt KEasyDialingContactSelected( 0x1001 ); |
|
33 const TInt KEasyDialingContactLongTapped( 0x1002 ); |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 |
|
37 class CEasyDialingListBoxItemDrawer; |
|
38 class CAknsFrameBackgroundControlContext; |
|
39 class CEasyDialingContactDataManager; |
|
40 class CAknLongTapDetector; |
|
41 class CAknPointerEventSuppressor; |
|
42 |
|
43 // CLASS DECLARATIONS |
|
44 |
|
45 /* |
|
46 * ============================================================================== |
|
47 * |
|
48 * CEasyDialingListBox |
|
49 * |
|
50 * ============================================================================== |
|
51 */ |
|
52 |
|
53 class CEasyDialingListBox : public CEikFormattedCellListBox, |
|
54 public MAknLongTapDetectorCallBack |
|
55 { |
|
56 public: |
|
57 |
|
58 /** |
|
59 * Constructor. |
|
60 */ |
|
61 CEasyDialingListBox(); |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 ~CEasyDialingListBox(); |
|
67 |
|
68 /** |
|
69 * Second phase constructor. |
|
70 * @param aFlags Listbox flags. |
|
71 * @param aContactDataManager Pointer to contact data manager |
|
72 */ |
|
73 void ConstructL( TInt aFlags, |
|
74 CEasyDialingContactDataManager* aContactDataManager ); |
|
75 |
|
76 /** |
|
77 * From CEikFormattedCellListBox. |
|
78 */ |
|
79 virtual CListBoxView* MakeViewClassInstanceL(); |
|
80 |
|
81 /** |
|
82 * From CEikFormattedCellListBox. |
|
83 */ |
|
84 CEasyDialingListBoxItemDrawer* ItemDrawer() const; |
|
85 |
|
86 /** |
|
87 * From CEikFormattedCellListBox. |
|
88 */ |
|
89 void Draw(const TRect& aRect) const; |
|
90 |
|
91 /** |
|
92 * From CEikFormattedCellListBox. |
|
93 */ |
|
94 void HandleResourceChange(TInt aType); |
|
95 |
|
96 /** |
|
97 * From CCoeControl |
|
98 */ |
|
99 void MakeVisible(TBool aVisible); |
|
100 |
|
101 /** |
|
102 * From CCoeControl |
|
103 */ |
|
104 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
105 |
|
106 /** |
|
107 * The the rectangle within which the listbox must always fit. |
|
108 * @param aMaxRect The largest allowed rect size, given in |
|
109 * screen relative coordinate system. |
|
110 */ |
|
111 void SetMaxRect( TRect aMaxRect ); |
|
112 |
|
113 /** |
|
114 * Adjusts the control rect according to amount of visible contacts. |
|
115 * @param aNumberOfNames Number of contact to which to adjust. |
|
116 */ |
|
117 void SetRectToNumberOfItems( TInt aNumberOfNames ); |
|
118 |
|
119 |
|
120 /** |
|
121 * Puts list box control into focus, and moved the focus highlight |
|
122 * to the appropriate item. |
|
123 * @param aKeyEvent key event |
|
124 * @param aType key event type |
|
125 * @return Whether the key was handled or not. |
|
126 */ |
|
127 TKeyResponse SetFocusedWithKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
128 |
|
129 |
|
130 /** |
|
131 * Gets the height of the listbox based on the number of items. |
|
132 * @param aNum Number of items. |
|
133 */ |
|
134 TInt GetHeightBasedOnNumberOfItems( TInt aNum ) const; |
|
135 |
|
136 /** |
|
137 * Gets the contact index of the currently selected contact item. |
|
138 * Contact index points to contact data object in |
|
139 * CEasyDialingContactDataManager. |
|
140 * @return Contact data manager index. |
|
141 */ |
|
142 TInt CurrentContactDataIndex(); |
|
143 |
|
144 /** |
|
145 * Return contact link of current item packaged in HBufC object. |
|
146 * @return Contact link. |
|
147 */ |
|
148 HBufC8* CurrentContactLinkLC(); |
|
149 |
|
150 public: |
|
151 /** |
|
152 * From MAknLongTapDetectorCallBack |
|
153 */ |
|
154 void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation ); |
|
155 |
|
156 protected: |
|
157 |
|
158 /** |
|
159 * From CEikFormattedCellListBox. |
|
160 */ |
|
161 virtual void FocusChanged(TDrawNow aDrawNow); |
|
162 |
|
163 /** |
|
164 * From CEikFormattedCellListBox. |
|
165 */ |
|
166 virtual void CreateItemDrawerL(); |
|
167 |
|
168 /** |
|
169 * From CEikFormattedCellListBox. |
|
170 */ |
|
171 virtual void SizeChanged(); |
|
172 |
|
173 /** |
|
174 * From CCoeControl |
|
175 */ |
|
176 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
177 |
|
178 private: |
|
179 |
|
180 /** Background control context. Owned. */ |
|
181 CAknsFrameBackgroundControlContext* iBGContext; |
|
182 |
|
183 /** Pointer to a contact data manager; Not Own. */ |
|
184 CEasyDialingContactDataManager* iContactDataManager; |
|
185 |
|
186 /** Number of matching contacts. */ |
|
187 TInt iNumberOfNames; |
|
188 |
|
189 /** Maximum size rectangle. */ |
|
190 TRect iMaxRect; |
|
191 |
|
192 /** Detector for Long Tap event; Owned. */ |
|
193 CAknLongTapDetector* iLongTapDetector; |
|
194 |
|
195 /** Flag set when long pointer press has been handled after latest pointer down event.*/ |
|
196 TBool iPointerLongPressHandled; |
|
197 }; |
|
198 |
|
199 #endif // _EASYDIALINGLISTBOX_H |
|
200 |
|
201 |
|
202 |