|
1 /* |
|
2 * Copyright (c) 2005 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __AKNADAPTIVESEARCH_H__ |
|
20 #define __AKNADAPTIVESEARCH_H__ |
|
21 |
|
22 // INCLUDES |
|
23 #include "AknAdaptiveSearchGrid.h" |
|
24 #include "AknAdaptiveSearchGridObserver.h" |
|
25 #include <cenrepnotifyhandler.h> // CenRep for AS |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CAknSearchField; |
|
29 class MAdaptiveSearchTextObserver; |
|
30 class CRepository; |
|
31 //class CCenRepNotifyHandler; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * The class to provide adaptive search for the application |
|
37 * |
|
38 * @lib avkon.lib |
|
39 * @since Series 60 5.0 |
|
40 */ |
|
41 |
|
42 class CAknAdaptiveSearch : public CBase, |
|
43 public MAknAdaptiveSearchGridObserver, |
|
44 public MCenRepNotifyHandlerCallback, |
|
45 public MCoeControlObserver |
|
46 { |
|
47 public: // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 * |
|
52 * @param aTextLimit The limit length of search field |
|
53 * @param aFieldStyle The same flag as search fi1eld |
|
54 * @return Pointer to the created adaptive search grid object |
|
55 */ |
|
56 static CAknAdaptiveSearch* NewL( const TInt aTextLimit, TInt aFieldStyle); |
|
57 |
|
58 /** |
|
59 * Two-phased constructor. |
|
60 * |
|
61 * @param aTextLimit The limit length of search field |
|
62 * @param aFieldStyle The same flag as search field. |
|
63 * @return Pointer to the created adaptive search grid object |
|
64 */ |
|
65 static CAknAdaptiveSearch* NewLC( const TInt aTextLimit, TInt aFieldStyle ); |
|
66 |
|
67 /** |
|
68 * Destructor. |
|
69 */ |
|
70 ~CAknAdaptiveSearch(); |
|
71 |
|
72 public: // From MAknAdaptiveSearchGridObserver |
|
73 |
|
74 /** |
|
75 * Handles an event from an observed adaptive search grid |
|
76 * |
|
77 * @param aCommand The control which sent the event |
|
78 */ |
|
79 void ProcessCommandL( TInt aCommand ); |
|
80 |
|
81 public: // From MCoeControlObserver |
|
82 |
|
83 /** |
|
84 * From MCoeControlObserver. Handles an event from an observed control. |
|
85 * If this component has observer, then a EEventStateChanged is sent |
|
86 * to it when a item is selected from the grid |
|
87 * |
|
88 * @param aControl The control that sent the event. |
|
89 * @param aEventType The event type. |
|
90 */ |
|
91 void HandleControlEventL( CCoeControl *aControl, TCoeEvent aEventType ); |
|
92 |
|
93 public: // from MCenRepNotifyHandlerCallback |
|
94 void HandleNotifyInt( TUint32 aId, TInt aNewValue ); |
|
95 |
|
96 public: // New functions |
|
97 |
|
98 /** |
|
99 * Shows adaptive search grid. |
|
100 */ |
|
101 void ShowAdaptiveSearchGridL(); |
|
102 |
|
103 /** |
|
104 * Hides adaptive search grid. |
|
105 */ |
|
106 void HideAdaptiveSearchGridL(); |
|
107 |
|
108 /** |
|
109 * Invert adaptive search grid. |
|
110 * @param aSelectAll If true, select all content in adaptive search editor. |
|
111 */ |
|
112 void InvertAdaptiveSearchGridVisibilityL( TBool aSelectAll = EFalse ); |
|
113 |
|
114 /** |
|
115 * Set characters for buttons to adaptive search grid |
|
116 * |
|
117 * @param aGridChars The characters for adaptive search grid. |
|
118 */ |
|
119 void SetButtonCharsL( const TDesC& aGridChars ); |
|
120 |
|
121 |
|
122 /** |
|
123 * Sets a search field for this control. |
|
124 * |
|
125 * @param aSearchField A pointer to a search field object. |
|
126 */ |
|
127 void SetSearchField( CAknSearchField *aSearchField ); |
|
128 |
|
129 /** |
|
130 * Adds an adaptive search text observer. Duplicates are not checked |
|
131 * (i.e. adding the same observer multiple times is not prevented). |
|
132 * |
|
133 * @since 5.0 |
|
134 * @param aObserver Must be non-NULL. |
|
135 */ |
|
136 void AddAdaptiveSearchTextObserverL( MAdaptiveSearchTextObserver* aObserver ); |
|
137 |
|
138 /** |
|
139 * Removes an adaptive search text observer. |
|
140 * |
|
141 * @since 5.0 |
|
142 * @param aObserver The observer to be removed. |
|
143 * @return ETrue if removal ok, EFalse if observer was not removed (not |
|
144 * found from the list of observers). |
|
145 */ |
|
146 TBool RemoveAdaptiveSearchTextObserver( MAdaptiveSearchTextObserver* aObserver ); |
|
147 |
|
148 /** |
|
149 * Update adaptive search grid skin. |
|
150 */ |
|
151 void UpdateGridSkinL(); |
|
152 |
|
153 public: |
|
154 |
|
155 /** |
|
156 * When the rect of find pane is set, this functions will be notified |
|
157 * to record the size of it. |
|
158 */ |
|
159 void SaveFindPaneRect( const TRect &aRect ); |
|
160 |
|
161 private: // Constructors |
|
162 |
|
163 /** |
|
164 * C++ default constructor. |
|
165 */ |
|
166 CAknAdaptiveSearch(); |
|
167 |
|
168 /** |
|
169 * Symbian 2nd phase constructor. |
|
170 * |
|
171 * @param aTextLimit The limit length of search field |
|
172 * @param aFieldStyle The same flag as search field |
|
173 */ |
|
174 void ConstructL( const TInt aTextLimit, TInt aFieldStyle ); |
|
175 |
|
176 private: // Member variables |
|
177 |
|
178 // Observer to report adaptive search text changes, not owned |
|
179 MAdaptiveSearchTextObserver* iAdaptiveSearchTextObserver; |
|
180 |
|
181 CAknAdaptiveSearchGrid* iAdaptiveSearchGrid; |
|
182 |
|
183 CAknSearchField* iSearchField; // not owned |
|
184 |
|
185 // Chars of grid from filtered items |
|
186 HBufC* iGridChars; |
|
187 |
|
188 // Limit length of search field |
|
189 TInt iTextLimit; |
|
190 |
|
191 TBool iBlockFlag; |
|
192 |
|
193 // Handle to Central Repository. |
|
194 CRepository* iCenRep; |
|
195 |
|
196 // For CenRep value change notifications. |
|
197 CCenRepNotifyHandler* iCenRepNotifyHandlerChinese; |
|
198 CCenRepNotifyHandler* iCenRepNotifyHandlerPRC; |
|
199 CCenRepNotifyHandler* iCenRepNotifyHandlerTW; |
|
200 CCenRepNotifyHandler* iCenRepNotifyHandlerHongkong; |
|
201 }; |
|
202 |
|
203 #endif // __AKNADAPTIVESEARCH_H__ |
|
204 |
|
205 // End of File |
|
206 |