|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: Browser Goto pane. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef WML_GOTO_PANE_BASE_H |
|
20 #define WML_GOTO_PANE_BASE_H |
|
21 |
|
22 // DEFINES |
|
23 #ifndef GOTOPANE_POPUPLIST_DISABLE |
|
24 #define GOTOPANE_POPUPLIST_DISABLE EFalse |
|
25 #endif |
|
26 |
|
27 #ifndef GOTOPANE_POPUPLIST_ENABLE |
|
28 #define GOTOPANE_POPUPLIST_ENABLE ETrue |
|
29 #endif |
|
30 |
|
31 // INCLUDE FILES |
|
32 #include <coecntrl.h> |
|
33 #include <eikedwin.h> |
|
34 #include <Avkon.mbg> |
|
35 |
|
36 // FORWARD DECLARATION |
|
37 class CAknInputFrame; |
|
38 class CBrowserGotoPane; |
|
39 class CBrowserAdaptiveListPopup; |
|
40 class CBrowserContentView; |
|
41 |
|
42 // CLASS DECLARATION |
|
43 /** |
|
44 * Mixin class for handling Goto Pane events. |
|
45 * |
|
46 * @lib Browser.app |
|
47 * @since Series60 1.2 |
|
48 */ |
|
49 class MGotoPaneObserver |
|
50 { |
|
51 |
|
52 public: // types |
|
53 |
|
54 enum TEvent /// Goto Pane events. |
|
55 { |
|
56 EEventEnterKeyPressed ///< Enter (OK) key pressed. |
|
57 }; |
|
58 |
|
59 public: // new methods |
|
60 |
|
61 /** |
|
62 * Handle Goto Pane event. Derived classes must implement. |
|
63 * @since Series60 1.2 |
|
64 * @param aGotoPane The Goto Pane in which the event occurred |
|
65 * @param aEvent Goto Pane event |
|
66 */ |
|
67 virtual void HandleGotoPaneEventL( CBrowserGotoPane* aGotoPane, TEvent aEvent ) = 0; |
|
68 }; |
|
69 |
|
70 |
|
71 /** |
|
72 * Key event handled. Has higher priority than FEP, |
|
73 * to be able to catch up/down key event and forward |
|
74 * them to goto pane's editor. |
|
75 * |
|
76 * @lib Browser.app |
|
77 * @since Series 60 1.2 |
|
78 */ |
|
79 class CBrowserKeyEventHandled : public CCoeControl, public MEikEdwinObserver |
|
80 { |
|
81 public: |
|
82 |
|
83 /** |
|
84 * public constructor |
|
85 * @param aGotoPane pointer to goto pane that key events are controled |
|
86 */ |
|
87 CBrowserKeyEventHandled( CBrowserGotoPane& aGotoPane ); |
|
88 |
|
89 /** |
|
90 * Catches key events before FEP could do it. |
|
91 * @since Series60 1.2 |
|
92 * @param aKeyEvent |
|
93 * @param aType |
|
94 * @return |
|
95 */ |
|
96 virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
97 |
|
98 /** |
|
99 * Catches EEventTextUpdate event. |
|
100 * @since Series60 1.2 |
|
101 * @param aKeyEvent |
|
102 * @param aType |
|
103 * @return |
|
104 */ |
|
105 virtual void HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType); |
|
106 |
|
107 /** |
|
108 * Put control to control stack or remove it from there. |
|
109 * @since Series60 1.2 |
|
110 * @param aEnable ETrue puts control to the control stack with higher |
|
111 * priority than FEP has. EFalse removes control from the stack. |
|
112 */ |
|
113 void EnableL( TBool aEnable ); |
|
114 |
|
115 /** |
|
116 * Set iFirstKeyEvent to TRUE. |
|
117 * @since Series60 1.2 |
|
118 */ |
|
119 void Reset(); |
|
120 |
|
121 /** |
|
122 * Get LeftRightEvent. |
|
123 * @since Series60 1.2 |
|
124 */ |
|
125 |
|
126 TBool IsLeftRightEvent() { return iLeftRightEvent; } |
|
127 |
|
128 /** |
|
129 * SetFirstKey. |
|
130 * @since Series60 3.2 |
|
131 */ |
|
132 void SetFirstKeyEvent(TBool aFirstKeyEvent) {iFirstKeyEvent = aFirstKeyEvent;} |
|
133 |
|
134 |
|
135 protected: |
|
136 |
|
137 // key event catching enable flag |
|
138 TBool iEnabled; |
|
139 |
|
140 // only first key event is catched |
|
141 TBool iFirstKeyEvent; |
|
142 |
|
143 // |
|
144 TBool iLeftRightEvent; |
|
145 |
|
146 // goto pane control of which key events are catched |
|
147 CBrowserGotoPane& iGotoPane; |
|
148 }; |
|
149 |
|
150 /** |
|
151 * Goto Pane Base for the WML Browser & Bookmarks. |
|
152 * It looks just like a search field. |
|
153 * |
|
154 * @lib Browser.app |
|
155 * @since Series 60 1.2 |
|
156 */ |
|
157 class CBrowserGotoPane: |
|
158 public CCoeControl, public MCoeControlObserver, public MCoeFepObserver |
|
159 { |
|
160 public: |
|
161 /** |
|
162 * Two-phased constructor. Leaves on failure. |
|
163 * @since Series60 1.2 |
|
164 * @param aParent Parent control |
|
165 * @param aIconBitmapId Id of the icon to display |
|
166 * @param aIconMaskId Id of the icon`s mask |
|
167 * @param aPopupListStatus True if the pane uses popuplist, |
|
168 * otherwise false. |
|
169 * @param aContentView Pointer to content view |
|
170 * @param aFindKeywordMode Set true if the pane is a find keyword pane. |
|
171 * @return The constructed Goto Pane control |
|
172 */ |
|
173 static CBrowserGotoPane* NewL |
|
174 ( |
|
175 const CCoeControl* aParent, |
|
176 TInt aIconBitmapId = EMbmAvkonQgn_indi_find_goto, |
|
177 TInt aIconMaskId = EMbmAvkonQgn_indi_find_goto_mask, |
|
178 TBool aPopupListStatus = GOTOPANE_POPUPLIST_ENABLE, |
|
179 CBrowserContentView* aContentView = NULL, |
|
180 TBool aFindKeywordMode = EFalse |
|
181 ); |
|
182 |
|
183 /** |
|
184 * Destructor. |
|
185 */ |
|
186 virtual ~CBrowserGotoPane(); |
|
187 |
|
188 /** |
|
189 * Makes goto pane (un)visible. |
|
190 * @since Series60 1.2 |
|
191 * @param ETrue to set visible |
|
192 */ |
|
193 virtual void MakeVisibleL( TBool aVisible ); |
|
194 |
|
195 /** |
|
196 * Non-leaving version of MakeVisibleL. |
|
197 * @since Series60 1.2 |
|
198 * @param ETrue to set visible |
|
199 */ |
|
200 virtual void MakeVisible( TBool aVisible ); |
|
201 |
|
202 /** |
|
203 * See description in calslbs.h. |
|
204 */ |
|
205 void HandleFindSizeChanged(); |
|
206 |
|
207 /** |
|
208 * Enable key event handler. |
|
209 * @since Series60 1.2 |
|
210 * @param aEnable TRUE to enable |
|
211 */ |
|
212 void EnableKeyEventHandlerL( TBool aEnable ); |
|
213 |
|
214 /** |
|
215 * Activate GoTo Pane. |
|
216 */ |
|
217 void SetGotoPaneActiveL(); |
|
218 |
|
219 /** |
|
220 * Activate Search Pane. |
|
221 */ |
|
222 void SetSearchPaneActiveL(); |
|
223 |
|
224 /** |
|
225 * Check if we are in Goto Mode |
|
226 * @return ETrue if we are in Goto Mode; EFalse otherwise. |
|
227 */ |
|
228 inline TBool GotoPaneActive() const { return iGotoPaneActive; } |
|
229 |
|
230 /** |
|
231 * Check if we are in Search Mode |
|
232 * @return ETrue if we are in Search Mode; EFalse otherwise. |
|
233 */ |
|
234 inline TBool SearchPaneActive() const { return iSearchPaneActive; } |
|
235 |
|
236 public: // from MCoeControlObserver |
|
237 |
|
238 /** |
|
239 * Handle control event. |
|
240 * @since Series60 1.2 |
|
241 * @param aControl The control |
|
242 * @param aEventType Event type |
|
243 */ |
|
244 void HandleControlEventL |
|
245 ( CCoeControl* aControl, TCoeEvent aEventType ); |
|
246 |
|
247 public: // from CCoeControl |
|
248 |
|
249 /** |
|
250 * Handle key event. |
|
251 * @since Series60 1.2 |
|
252 * @param aKeyEvent The key event |
|
253 * @param aType Key event type |
|
254 * @return Response (was the key event consumed?) |
|
255 */ |
|
256 virtual TKeyResponse OfferKeyEventL |
|
257 ( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
258 |
|
259 /** |
|
260 * HandlePointerEventL |
|
261 * From CCoeControl |
|
262 * |
|
263 */ |
|
264 void HandlePointerEventL(const TPointerEvent& /*aPointerEvent*/); |
|
265 |
|
266 /** |
|
267 * HandleResourceChange |
|
268 * From CCoeControl |
|
269 */ |
|
270 void HandleResourceChange(TInt aType); |
|
271 |
|
272 |
|
273 public: // from CCoeControl |
|
274 |
|
275 /** |
|
276 * Count component controls. |
|
277 * @since Series60 1.2 |
|
278 * @return Number of component controls |
|
279 */ |
|
280 virtual TInt CountComponentControls() const; |
|
281 |
|
282 /** |
|
283 * Get a component control by index. |
|
284 * @since Series60 1.2 |
|
285 * @param aIndex Index of component control to be returned |
|
286 * @return Component control or NULL |
|
287 */ |
|
288 virtual CCoeControl* ComponentControl( TInt aIndex ) const; |
|
289 |
|
290 /** |
|
291 * Sets the OrdinalPosition of GotoPane |
|
292 * @param aPos The OrdinalPosition |
|
293 */ |
|
294 void SetOrdinalPosition( TInt aPos ); |
|
295 |
|
296 public: // Text manipulation |
|
297 |
|
298 /** |
|
299 * Length of the Search text in the editor. |
|
300 * @return The text length |
|
301 */ |
|
302 TInt SearchTextLength() const; |
|
303 |
|
304 /** |
|
305 * Length of the text in the editor. |
|
306 * @since Series60 1.2 |
|
307 * @return The text length |
|
308 */ |
|
309 TInt TextLength() const; |
|
310 |
|
311 /** |
|
312 * Get text from the editor. |
|
313 * @since Series60 1.2 |
|
314 * @return text from the editor |
|
315 */ |
|
316 HBufC* GetTextL() const; |
|
317 |
|
318 /** |
|
319 * Set text. |
|
320 * @since Series60 1.2 |
|
321 * @param aTxt Text to set |
|
322 * appended if needed. |
|
323 */ |
|
324 virtual void SetTextL( const TDesC& aTxt ); |
|
325 |
|
326 /** |
|
327 * Set Editor Font Posture to Italic. |
|
328 */ |
|
329 void SetTextModeItalicL( ); |
|
330 |
|
331 /** |
|
332 * Set Search text. |
|
333 * @param aTxt Text to set |
|
334 * appended if needed. |
|
335 */ |
|
336 void SetSearchTextL( const TDesC& aTxt ); |
|
337 |
|
338 /** |
|
339 * Selects all text in the editor. |
|
340 * See CEikEdwin's SelectAllL(); |
|
341 * @since Series60 1.2 |
|
342 */ |
|
343 void SelectAllL(); |
|
344 |
|
345 /** |
|
346 * Set info text. |
|
347 * @since Series60 1.2 |
|
348 * @param aText Text to be displayed as info |
|
349 */ |
|
350 void SetInfoTextL( const TDesC& aText ); |
|
351 |
|
352 /** |
|
353 * Perform clipboard functionality. |
|
354 * @since Series60 1.2 |
|
355 * @param aClipboardFunc Function to perform |
|
356 */ |
|
357 void ClipboardL( CEikEdwin::TClipboardFunc aClipboardFunc ); |
|
358 |
|
359 /** |
|
360 * Returns editor control of goto pane. |
|
361 * @since Series60 1.2 |
|
362 * @return editor control of goto pane |
|
363 */ |
|
364 CEikEdwin* Editor() const; |
|
365 |
|
366 void ResetPrevText(); |
|
367 |
|
368 public: // observer support |
|
369 |
|
370 /** |
|
371 * Set observer. Pass NULL pointer to unset. Panics if already set. |
|
372 * @since Series60 1.2 |
|
373 */ |
|
374 void SetGPObserver( MGotoPaneObserver* aObserver ); |
|
375 |
|
376 /** |
|
377 * Gives back a pointer to adaptivepopuplist |
|
378 */ |
|
379 CBrowserAdaptiveListPopup* PopupList(); |
|
380 |
|
381 /** |
|
382 * Handles the completion of a FEP transaction |
|
383 */ |
|
384 void HandleCompletionOfTransactionL(); |
|
385 |
|
386 /** |
|
387 * Handles the start of a FEP transaction |
|
388 */ |
|
389 void HandleStartOfTransactionL(); |
|
390 |
|
391 protected: // Construct / destruct |
|
392 /** |
|
393 * Constructor. |
|
394 * @param |
|
395 */ |
|
396 CBrowserGotoPane( CBrowserContentView* aContentView, TBool aFindKeywordMode ); |
|
397 |
|
398 /** |
|
399 * Second-phase constructor. Leaves on failure. |
|
400 * @param aParent Parent control |
|
401 */ |
|
402 void ConstructL( const CCoeControl* aParent, TInt aIconBitmapId, TInt aIconMaskId, TBool aPopupListStatus ); |
|
403 |
|
404 /** |
|
405 * Constructs Search Pane. |
|
406 */ |
|
407 void ConstructSearchPaneL(); |
|
408 |
|
409 protected: // from CCoeControl |
|
410 |
|
411 /** |
|
412 * Handle size change, lay out and draw components. |
|
413 */ |
|
414 virtual void SizeChanged(); |
|
415 |
|
416 /** |
|
417 * Handle focus change. |
|
418 * @since Series60 1.2 |
|
419 * @param aDrawNow Draw now? |
|
420 */ |
|
421 virtual void FocusChanged( TDrawNow aDrawNow ); |
|
422 |
|
423 private: |
|
424 |
|
425 /** |
|
426 * Set the text and redraw. |
|
427 * @since Series60 1.2 |
|
428 */ |
|
429 void DoSetTextL( const TDesC& aTxt ); |
|
430 |
|
431 void ActivateVKB(); |
|
432 |
|
433 |
|
434 protected: // data |
|
435 |
|
436 CBrowserContentView* iContentView; //Not owned. |
|
437 |
|
438 // If the control is in find keyword pane mode. |
|
439 TBool iFindKeywordMode; |
|
440 |
|
441 // HandleFEPFind |
|
442 TBool iHandleFEPFind; |
|
443 |
|
444 // The previously typed text into iEditor |
|
445 HBufC* iPrevKeyword; |
|
446 |
|
447 // Editor. Owned. |
|
448 CEikEdwin* iEditor; |
|
449 |
|
450 // Input frame. Owned. |
|
451 CAknInputFrame* iInputFrame; |
|
452 |
|
453 // Search Editor. Owned. |
|
454 CEikEdwin* iSearchEditor; |
|
455 |
|
456 // Search Input frame. Owned. |
|
457 CAknInputFrame* iSearchInputFrame; |
|
458 |
|
459 // Observer (may be NULL). Not owned. |
|
460 MGotoPaneObserver* iGPObserver; |
|
461 |
|
462 |
|
463 CBrowserKeyEventHandled *iGotoKeyHandled; |
|
464 |
|
465 /// adaptive popuplist |
|
466 CBrowserAdaptiveListPopup* iBAdaptiveListPopup; |
|
467 |
|
468 // Represents Active Editors |
|
469 TBool iGotoPaneActive; |
|
470 TBool iSearchPaneActive; |
|
471 |
|
472 // Default text in Search Editor.Owned. |
|
473 HBufC* iDefaultSearchText; |
|
474 |
|
475 // Search Input Frame Icon Id, used for tracking the Search Icon Changes. |
|
476 TInt iSearchIconId; |
|
477 |
|
478 // Stores the Search Icon File Path. |
|
479 TFileName iSearchIconFilePath; |
|
480 }; |
|
481 |
|
482 #endif |