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