66
|
1 |
/*******************************************************************************
|
|
2 |
* Copyright (c) 2005, 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved. This program and the accompanying materials
|
|
4 |
* are made available under the terms of the Eclipse Public License v1.0
|
|
5 |
* which accompanies this distribution, and is available at
|
|
6 |
* http://www.eclipse.org/legal/epl-v10.html
|
|
7 |
*
|
|
8 |
* Contributors:
|
|
9 |
* Nokia Corporation - S60 implementation
|
|
10 |
*******************************************************************************/
|
|
11 |
|
|
12 |
|
|
13 |
#ifndef SWTSORTEDLIST_H
|
|
14 |
#define SWTSORTEDLIST_H
|
|
15 |
|
|
16 |
|
|
17 |
#include <aknsfld.h>
|
|
18 |
#include "eswtmobileextensions.h"
|
|
19 |
#include "swtlistbase.h"
|
|
20 |
|
|
21 |
|
|
22 |
class CAknSearchField;
|
|
23 |
class CAknListBoxFilterItems;
|
|
24 |
|
|
25 |
|
|
26 |
/**
|
|
27 |
* CSwtSortedList
|
|
28 |
* @lib eswt.dll
|
|
29 |
*/
|
|
30 |
NONSHARABLE_CLASS(CSwtSortedList)
|
|
31 |
: public CSwtListBase
|
|
32 |
, public MSwtSortedList
|
|
33 |
, public MEikEdwinObserver
|
|
34 |
, public MAdaptiveSearchTextObserver
|
|
35 |
{
|
|
36 |
public:
|
|
37 |
/**
|
|
38 |
* Two phase constructor
|
|
39 |
* @param aDisplay parent display
|
|
40 |
* @param aPeer java peer of this class
|
|
41 |
* @param aParent composite parent
|
|
42 |
* @param aStyle control style
|
|
43 |
* @return pointer to an object of this class
|
|
44 |
*/
|
|
45 |
static CSwtSortedList* NewL(MSwtDisplay& aDisplay, TSwtPeer aPeer,
|
|
46 |
MSwtComposite& aParent, TInt aStyle);
|
|
47 |
|
|
48 |
protected:
|
|
49 |
/**
|
|
50 |
* First phase constructor.
|
|
51 |
* @param aDisplay parent display
|
|
52 |
* @param aPeer java peer of this class
|
|
53 |
* @param aParent composite parent
|
|
54 |
* @param aStyle control style
|
|
55 |
*/
|
|
56 |
CSwtSortedList(MSwtDisplay& aDisplay, TSwtPeer aPeer,
|
|
57 |
MSwtComposite& aParent, TInt aStyle);
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Second phase constructor.
|
|
61 |
*/
|
|
62 |
void ConstructL();
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Destructor
|
|
66 |
*/
|
|
67 |
~CSwtSortedList();
|
|
68 |
|
|
69 |
/**
|
|
70 |
* Get the filter.
|
|
71 |
* @return pointer to the filter.
|
|
72 |
*/
|
|
73 |
CAknListBoxFilterItems* Filter() const;
|
|
74 |
|
|
75 |
/**
|
|
76 |
* The item text aPtr is inserted in the data member iTextItems.
|
|
77 |
* The item text aPtr is also inserted in an array passed on parameter
|
|
78 |
* after being modified to include the tab separators required by a column list box.
|
|
79 |
* The insertion respects the sorted order (up or down).
|
|
80 |
* @param aPtr the string to insert.
|
|
81 |
* @param aItemArray array where the string will be inserted.
|
|
82 |
* @param aTextComparisonType comparison type.
|
|
83 |
*/
|
|
84 |
void InsertItemL(const TDesC &aPtr, CDesCArray* aItemArray,
|
|
85 |
TKeyCmpText aTextComparisonType = ECmpCollated);
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Get the strings of selected items.
|
|
89 |
* @return pointer to the array containing the strings of selected items.
|
|
90 |
*/
|
|
91 |
CPtrCArray* GetSelectionLC() const;
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Handles an item addition.
|
|
95 |
* @param aNewFocusIndex The new focus index.
|
|
96 |
*/
|
|
97 |
void HandleItemAdditionL(TInt aNewFocusIndex);
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Handles an item removal.
|
|
101 |
* @param aRemovedItemIndices The removed item indices.
|
|
102 |
* @param aOldFocusIndex The old focus index.
|
|
103 |
*/
|
|
104 |
void HandleItemRemovalL(const RArray<TInt>& aRemovedItemIndices,
|
|
105 |
TInt aOldFocusIndex);
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Handles an item removal.
|
|
109 |
*/
|
|
110 |
void HandleOfferKeyEventL();
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Get the search field height.
|
|
114 |
* @return the search field height.
|
|
115 |
*/
|
|
116 |
TInt SearchFieldHeight() const;
|
|
117 |
|
|
118 |
/**
|
|
119 |
* Get position of the search field.
|
|
120 |
*/
|
|
121 |
void GetSearchFieldPosition(TPoint& aPosition);
|
|
122 |
|
|
123 |
/**
|
|
124 |
* Get size of the search field.
|
|
125 |
*/
|
|
126 |
void GetSearchFieldSize(TSize& aSize);
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Update the text view rect of the search field.
|
|
130 |
* @param aSearchField the search field.
|
|
131 |
*/
|
|
132 |
void UpdateSearchTextViewRect(const CAknSearchField* aSearchField);
|
|
133 |
|
|
134 |
/**
|
|
135 |
* Rebound the filter.
|
|
136 |
*/
|
|
137 |
void UpdateSearchFieldBounds();
|
|
138 |
|
|
139 |
// From CSwtListBase
|
|
140 |
public:
|
|
141 |
void UpdateSize();
|
|
142 |
|
|
143 |
// From CCoeControl
|
|
144 |
public:
|
|
145 |
TInt CountComponentControls() const;
|
|
146 |
CCoeControl* ComponentControl(TInt aIndex) const;
|
|
147 |
void SetDimmed(TBool aDimmed);
|
|
148 |
void MakeVisible(TBool aVisible);
|
|
149 |
void HandleResourceChange(TInt aType);
|
|
150 |
#ifdef RD_SCALABLE_UI_V2
|
|
151 |
void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
|
152 |
#endif //RD_SCALABLE_UI_V2
|
|
153 |
|
|
154 |
protected:
|
|
155 |
void PositionChanged();
|
|
156 |
void FocusChanged(TDrawNow aDrawNow);
|
|
157 |
|
|
158 |
// From MSwtControl
|
|
159 |
public:
|
|
160 |
TRect ClientRect() const;
|
|
161 |
TSize ComputeSizeL(TInt aWHint, TInt aHHint);
|
|
162 |
void ProcessKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
|
|
163 |
#ifdef RD_JAVA_S60_RELEASE_9_2
|
|
164 |
void EnableFocusHighlight(TBool aEnable);
|
|
165 |
#endif //RD_JAVA_S60_RELEASE_9_2
|
|
166 |
protected:
|
|
167 |
void DoPaint(const TRect& aRect) const;
|
|
168 |
|
|
169 |
// From MSwtScrollable
|
|
170 |
public:
|
|
171 |
void ComputeTrim(TRect& aRect) const;
|
|
172 |
|
|
173 |
// From MSwtSortedList
|
|
174 |
public:
|
|
175 |
void AppendL(const TDesC& aPtr);
|
|
176 |
void GetFocusedItem(TPtrC& aItem) const;
|
|
177 |
TInt GetItemHeight() const;
|
|
178 |
TInt GetSelectionCount() const;
|
|
179 |
CPtrCArray* GetSelectionL() const;
|
|
180 |
void RemoveAllL();
|
|
181 |
TBool RemoveL(const HBufC& aPtr);
|
|
182 |
MSwtScrollable* Scrollable();
|
|
183 |
TBool SelectItemL(const TDesC* aString);
|
|
184 |
void SetItemsL(MDesCArray* aStringArray);
|
|
185 |
void SetModeStyleL(TInt aModeStyle);
|
|
186 |
void SetSelectionL(MDesCArray* aStringArray);
|
|
187 |
void ShowSelection();
|
|
188 |
|
|
189 |
// From MEikEdwinObserver
|
|
190 |
public:
|
|
191 |
void HandleEdwinEventL(CEikEdwin *aEdwin, TEdwinEvent aEventType);
|
|
192 |
|
|
193 |
// From MAdaptiveSearchTextObserver
|
|
194 |
public:
|
|
195 |
void AdaptiveSearchTextChanged(CAknSearchField* aSearchField);
|
|
196 |
|
|
197 |
// Data
|
|
198 |
private:
|
|
199 |
/**
|
|
200 |
* The search field with will be used to filter the list.
|
|
201 |
* Own.
|
|
202 |
*/
|
|
203 |
CAknSearchField* iSearchField;
|
|
204 |
|
|
205 |
/**
|
|
206 |
* SortedList mode style. Possible values: FILTER, UP, DOWN.
|
|
207 |
*/
|
|
208 |
TInt iModeStyle;
|
|
209 |
|
|
210 |
/**
|
|
211 |
* ETrue if the sort should be in down order (from higher
|
|
212 |
* to lower number). EFalse by default.
|
|
213 |
*/
|
|
214 |
TBool iIsOrderDown;
|
|
215 |
|
|
216 |
/**
|
|
217 |
* Deliver all pointer event to the filter when this on.
|
|
218 |
*/
|
|
219 |
TBool iFilterGrabsPointerEvents;
|
|
220 |
};
|
|
221 |
|
|
222 |
|
|
223 |
#endif // SWTSORTEDLIST_H
|