|
1 /* |
|
2 * Copyright (c) 2002-2007 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: |
|
15 * Declaration of class CBrowserBookmarksGotoPane. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef BROWSER_BOOKMARKS_GOTO_PANE_H |
|
22 #define BROWSER_BOOKMARKS_GOTO_PANE_H |
|
23 |
|
24 // INCLUDE FILES |
|
25 |
|
26 #include <coecntrl.h> |
|
27 #include "BrowserAdaptiveListPopup.h" |
|
28 // FORWARD DECLARATION |
|
29 |
|
30 class CEikEdwin; |
|
31 class CAknInputFrame; |
|
32 class CBrowserBookmarksGotoPane; |
|
33 class CAknsListBoxBackgroundControlContext; |
|
34 class CAknsFrameBackgroundControlContext; |
|
35 class CBrowserFavouritesView; |
|
36 |
|
37 // class CBrowserAdaptiveListPopup; |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * Mixin class for handling Bookmark Goto Pane events. |
|
42 */ |
|
43 class MBookmarksGotoPaneObserver |
|
44 { |
|
45 |
|
46 public: // types |
|
47 |
|
48 enum TEvent /// Goto Pane events. |
|
49 { |
|
50 EEventEditingModeChanged, ///< Editing mode changed. |
|
51 EEventEnterKeyPressed ///< Enter key pressed during editing. |
|
52 }; |
|
53 |
|
54 public: // new methods |
|
55 |
|
56 /** |
|
57 * Handle Goto Pane event. Derived classes must implement. |
|
58 * @param aGotoPane The Goto Pane in which the event occurred. |
|
59 * @param aEvent Goto Pane event. |
|
60 */ |
|
61 virtual void HandleBookmarksGotoPaneEventL |
|
62 ( CBrowserBookmarksGotoPane* aGotoPane, TEvent aEvent ) = 0; |
|
63 }; |
|
64 |
|
65 /** |
|
66 * Goto Pane for the WML Browser. It looks just like a search field. |
|
67 * It has two modes, Editing and Non-editing. In editing mode the user can edit |
|
68 * text and move the cursor. In non-editing mode any key/other event which |
|
69 * normally means editing enters editing mode automatically. When editing mode |
|
70 * is entered, existing text is replaced with a default text. |
|
71 * (Editing in fact corresponds to being focused or not; the two things go |
|
72 * together.) |
|
73 */ |
|
74 class CBrowserBookmarksGotoPane: public CCoeControl |
|
75 { |
|
76 public: // Construct / destruct |
|
77 |
|
78 /** |
|
79 * Two-phased constructor. Leaves on failure. |
|
80 * @param aParent Parent control. |
|
81 * @param aIcon Icon to display. If NULL, a default is used. |
|
82 * @param aTextLimit Maximum length of text. |
|
83 * @return The constructed Goto Pane control. |
|
84 */ |
|
85 static CBrowserBookmarksGotoPane* NewL |
|
86 ( const CCoeControl& aParent, CBrowserFavouritesView* aView ); |
|
87 |
|
88 /** |
|
89 * Destructor. |
|
90 */ |
|
91 virtual ~CBrowserBookmarksGotoPane(); |
|
92 |
|
93 /** |
|
94 * SetupSkinContext Sets up the skin |
|
95 * return None |
|
96 */ |
|
97 void SetupSkinContextL(); |
|
98 |
|
99 public: // new methods (editing) |
|
100 |
|
101 /** |
|
102 * Check if we are editing. |
|
103 * @since 1.2 |
|
104 * @return ETrue if editing, EFalse otherwise. |
|
105 */ |
|
106 inline TBool IsEditing() const; |
|
107 |
|
108 /** |
|
109 * Begin editing the pane. Sets up the visibility, etc for editing |
|
110 */ |
|
111 void BeginEditingL(); |
|
112 |
|
113 |
|
114 /** |
|
115 * Cancel editing, but leave the text in place. |
|
116 * @since 1.2 |
|
117 */ |
|
118 void CancelEditingL(); |
|
119 |
|
120 /** |
|
121 * Set text. If editing, it is now cancelled. |
|
122 * @since 1.2 |
|
123 * @param aText Text to set. |
|
124 * @param aClipToFit If ETrue, text is clipped "..." if doesn't fit. |
|
125 * @param aCancelEditing If EFalse, editing is not cancelled |
|
126 */ |
|
127 void SetTextL( const TDesC& aText, TBool aClipToFit = ETrue, TBool aCancelEditing = ETrue ); |
|
128 |
|
129 /** |
|
130 * Get text; ownership passed. The returned buffer is zero-terminated. |
|
131 * @since 1.2 |
|
132 * @return Text in a buffer or NULL. Owner is the caller. |
|
133 */ |
|
134 HBufC* GetTextL(); |
|
135 |
|
136 /** |
|
137 * Freeze / unfreeze. If frozen, setting text by calling SetTextL or |
|
138 * Cancelling is disallowed. Use with caution, don't let frozen state |
|
139 * "stay in" due to some leave! |
|
140 * (This is used when during dowload we want to protect Goto Pane from |
|
141 * being updated if some notification kicks in). |
|
142 * @since 1.2 |
|
143 * @param aFreeze ETrue for freeze, EFalse to unfreeze. |
|
144 */ |
|
145 inline void Freeze( TBool aFreeze ); |
|
146 |
|
147 public: // observer support |
|
148 |
|
149 /** |
|
150 * Set observer. Pass NULL pointer to unset. Panics if already set. |
|
151 * @since 1.2 |
|
152 * @param aObserver The observer to be notified about Goto Pane events. |
|
153 */ |
|
154 void SetGPObserver( MBookmarksGotoPaneObserver* aObserver ); |
|
155 |
|
156 public: // Showing / hiding extra line |
|
157 |
|
158 /** |
|
159 * Set line state (show or hide line). Ugly stuff. |
|
160 * @since 1.2 |
|
161 * @param aLineVisible ETrue for showing line, EFalse for hiding. |
|
162 */ |
|
163 void SetLineState( TBool aLineVisible ); |
|
164 |
|
165 void HandleResourceChange( TInt aType ); |
|
166 public: // from CCoeControl |
|
167 |
|
168 /** |
|
169 * Handle key event. |
|
170 * @param aKeyEvent The key event. |
|
171 * @param aType Key event type. |
|
172 * @return Response (was the key event consumed?). |
|
173 */ |
|
174 virtual TKeyResponse OfferKeyEventL |
|
175 ( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
176 |
|
177 /** |
|
178 * Count component controls. |
|
179 * @return Number of component controls. |
|
180 */ |
|
181 virtual TInt CountComponentControls() const; |
|
182 |
|
183 /** |
|
184 * Get a component control by index. |
|
185 * @param aIndex Index of component control to be returned. |
|
186 * @return Component control or NULL. |
|
187 */ |
|
188 virtual CCoeControl* ComponentControl( TInt aIndex ) const; |
|
189 |
|
190 /** |
|
191 * Handle focus change. |
|
192 * @param aDrawNow Draw now? |
|
193 */ |
|
194 virtual void FocusChanged( TDrawNow aDrawNow ); |
|
195 |
|
196 /** |
|
197 * Gives back a pointer to adaptivepopuplist |
|
198 */ |
|
199 CBrowserAdaptiveListPopup* PopupList(); |
|
200 |
|
201 /** |
|
202 * Mop supply |
|
203 * @param TTypeUid aId |
|
204 */ |
|
205 TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); |
|
206 |
|
207 /** |
|
208 * Returns editor control of goto pane. |
|
209 * @since Series60 1.2 |
|
210 * @return editor control of goto pane |
|
211 */ |
|
212 CEikEdwin* Editor() const; |
|
213 |
|
214 /** |
|
215 * HandlePointerEventL |
|
216 * From CCoeControl |
|
217 * |
|
218 */ |
|
219 void HandlePointerEventL(const TPointerEvent& /*aPointerEvent*/); |
|
220 |
|
221 protected: // Construct / destruct |
|
222 |
|
223 /** |
|
224 * Constructor. |
|
225 */ |
|
226 CBrowserBookmarksGotoPane(CBrowserFavouritesView* aView); |
|
227 |
|
228 /** |
|
229 * Second-phase constructor. Leaves on failure. |
|
230 * @param aParent Parent control. |
|
231 */ |
|
232 void ConstructL |
|
233 ( const CCoeControl& aParent ); |
|
234 |
|
235 protected: // from CCoeControl |
|
236 |
|
237 /** |
|
238 * Handle size change, lay out components. |
|
239 */ |
|
240 virtual void SizeChanged(); |
|
241 |
|
242 private: // new methods |
|
243 |
|
244 /** |
|
245 * Change editing mode. |
|
246 * @param aEditing ETrue for editing mode. |
|
247 */ |
|
248 inline void SetEditingL( TBool aEditing ); |
|
249 |
|
250 void ActivateVKB(); |
|
251 |
|
252 private: // data |
|
253 CBrowserFavouritesView* iView; //Not owned. |
|
254 /// Editor. Owned. |
|
255 CEikEdwin* iEditor; |
|
256 /// Input frame. Owned. |
|
257 CAknInputFrame* iInputFrame; |
|
258 /// Editing mode. |
|
259 TBool iEditing; |
|
260 /// Observer or NULL. Not owned. |
|
261 MBookmarksGotoPaneObserver* iGPObserver; |
|
262 /// ETrue if frozen. |
|
263 TBool iFrozen; |
|
264 /// ETrue if initial focusing was done |
|
265 ///(needed for permanent selection to be working) |
|
266 TBool iEverFocused; |
|
267 /// adaptive popuplist |
|
268 CBrowserAdaptiveListPopup* iBAdaptiveListPopup; |
|
269 CAknsListBoxBackgroundControlContext* iSkinContext; |
|
270 CAknsFrameBackgroundControlContext* iInputContext; |
|
271 }; |
|
272 |
|
273 #include "BrowserBookmarksGotoPane.inl" |
|
274 |
|
275 #endif |
|
276 // End of File |