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