|
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: |
|
15 * Declaration of class CBrowserFavouritesContainer. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef BROWSER_FAVOURITES_CONTAINER_H |
|
22 #define BROWSER_FAVOURITES_CONTAINER_H |
|
23 |
|
24 // INCLUDE FILES |
|
25 #include <coecntrl.h> |
|
26 #include <akntabobserver.h> |
|
27 #include "BrowserFavouritesListboxCursorObserver.h" |
|
28 #include <aknnavidecoratorobserver.h> |
|
29 |
|
30 // FORWARD DECLARATION |
|
31 class CBrowserFavouritesView; |
|
32 class CBrowserFavouritesListbox; |
|
33 class CAknNavigationDecorator; |
|
34 class CAknSearchField; |
|
35 class MBrowserFavouritesListboxIconHandler; |
|
36 class CAknsListBoxBackgroundControlContext; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * Top-level control, which contains all component controls in the favourites |
|
42 * view. |
|
43 * Manages (destroys/creates) component controls. |
|
44 * Handles key events and forwards them to the appropriate component control. |
|
45 * Pure virtual. |
|
46 */ |
|
47 class CBrowserFavouritesContainer: |
|
48 public CCoeControl, |
|
49 public MBrowserFavouritesListboxCursorObserver, |
|
50 public MAknNaviDecoratorObserver |
|
51 { |
|
52 public : // construction, destruction |
|
53 |
|
54 /** |
|
55 * Default destructor. |
|
56 */ |
|
57 virtual ~CBrowserFavouritesContainer(); |
|
58 |
|
59 public: // new methods |
|
60 |
|
61 |
|
62 /** |
|
63 * Show the tabs in the navi pane. |
|
64 * @since 1.2 |
|
65 */ |
|
66 void ShowRootNaviPane(); |
|
67 |
|
68 /** |
|
69 * Show folder info in navi pane. |
|
70 * @since 1.2 |
|
71 * @param aFolderIndex Index of the current folder. |
|
72 * @param aFolderCount Total number of folders. |
|
73 */ |
|
74 void ShowFolderNaviPaneL( TInt aFolderIndex, TInt aFolderCount ); |
|
75 |
|
76 /** |
|
77 * Get tab index belonging to this view. |
|
78 * Derived classes must provide this method. |
|
79 * @since 1.2 |
|
80 * @return The tab index. |
|
81 */ |
|
82 virtual TInt TabIndex() = 0; |
|
83 |
|
84 /** |
|
85 * Get resource id for text to be displayed in the empty listbox. |
|
86 * Derived classes must provide this method. |
|
87 * @since 1.2 |
|
88 * @return Listbox empty text resource id. |
|
89 */ |
|
90 virtual TInt ListboxEmptyTextResourceId() = 0; |
|
91 |
|
92 /** |
|
93 * Get resource id for text to be displayed in the title. |
|
94 * Derived classes must provide this method. |
|
95 * @since 1.2 |
|
96 * @return Listbox empty text resource id. |
|
97 */ |
|
98 virtual TInt TitleResourceId() = 0; |
|
99 |
|
100 |
|
101 public: // access to components |
|
102 |
|
103 /** |
|
104 * Get the creating view. |
|
105 * @since 1.2 |
|
106 * @return The creating view. |
|
107 */ |
|
108 inline CBrowserFavouritesView& View() const; |
|
109 |
|
110 /** |
|
111 * Get the browsing listbox. |
|
112 * @since 1.2 |
|
113 * @return The browsing listbox. |
|
114 */ |
|
115 inline CBrowserFavouritesListbox* Listbox() const; |
|
116 |
|
117 |
|
118 public: // from CCoeControl |
|
119 |
|
120 /** |
|
121 * Handle resource change. |
|
122 * @param aType Event type. |
|
123 */ |
|
124 void HandleResourceChange( TInt aType ); |
|
125 |
|
126 /** |
|
127 * Count component controls. |
|
128 * @return Number of component controls. |
|
129 */ |
|
130 TInt CountComponentControls() const; |
|
131 |
|
132 /** |
|
133 * Get a component control by index. |
|
134 * @param aIndex Index of component control to be returned. |
|
135 * @return Component control or NULL. |
|
136 */ |
|
137 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
138 |
|
139 /** |
|
140 * Handle size change, lay out and draw components. |
|
141 */ |
|
142 void SizeChanged(); |
|
143 |
|
144 /** |
|
145 * Handle key event. Forwards all key events to the listbox, if present. |
|
146 * @param aKeyEvent The key event. |
|
147 * @param aType Key event type. |
|
148 * @return Response (was the key event consumed?). |
|
149 */ |
|
150 TKeyResponse OfferKeyEventL |
|
151 ( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
152 |
|
153 /** |
|
154 * Handles focus changing |
|
155 * @param aDrawNow |
|
156 */ |
|
157 void FocusChanged( TDrawNow aDrawNow ); |
|
158 |
|
159 public: // from MWmlBrowserFavouritesListboxCursorObserver |
|
160 |
|
161 /** |
|
162 * Handle cursor change. |
|
163 * @param aListBox Listbox in which the cursor has changed. |
|
164 */ |
|
165 virtual void HandleCursorChangedL( CEikListBox* aListBox ); |
|
166 |
|
167 public: // from MAknNaviDecoratorObserver |
|
168 virtual void HandleNaviDecoratorEventL( TInt aEventID ); |
|
169 |
|
170 protected: // construction |
|
171 |
|
172 /** |
|
173 * Called by ConstructL. Leaves on failure. |
|
174 * Derived classes can override this to add more controls. |
|
175 * @param aRect Rectangle of the control (available client rect). |
|
176 * @param aView The view to which this container belongs. |
|
177 */ |
|
178 virtual void ConstructComponentControlsL |
|
179 ( |
|
180 const TRect& aRect, |
|
181 CBrowserFavouritesView& aView |
|
182 ); |
|
183 |
|
184 /** |
|
185 * Second phase constructor. Leaves on failure. |
|
186 * Do not override this method in derived classes. Use this one, |
|
187 * and override ConstructComponentControlsL. |
|
188 * @param aRect Rectangle of the control (available client rect). |
|
189 * @param aView The view to which this container belongs. |
|
190 */ |
|
191 void ConstructL |
|
192 ( |
|
193 const TRect& aRect, |
|
194 CBrowserFavouritesView& aView |
|
195 ); |
|
196 |
|
197 /** |
|
198 * Called by ConstructComponentControlsL. Leaves on failure. |
|
199 * Derived classes must provide this to create own icon handler. |
|
200 * @return Icon handler for the listbox. |
|
201 */ |
|
202 virtual MBrowserFavouritesListboxIconHandler* |
|
203 CreateListboxIconHandlerL() = 0; |
|
204 |
|
205 private: // from MObjectProvider |
|
206 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
207 |
|
208 |
|
209 private: // data |
|
210 |
|
211 /// The creating view. Not owned. |
|
212 CBrowserFavouritesView* iView; |
|
213 /// Browsing listbox. Owned. |
|
214 CBrowserFavouritesListbox* iListbox; |
|
215 |
|
216 /// Navi Pane tabgroup. Owned. |
|
217 CAknNavigationDecorator* iNaviPaneTabsRoot; |
|
218 |
|
219 /// Navi Pane text. Owned. |
|
220 CAknNavigationDecorator* iNaviPaneTabsFolder; |
|
221 /// Icon handler. Owned. |
|
222 MBrowserFavouritesListboxIconHandler* iIconHandler; |
|
223 CAknsListBoxBackgroundControlContext* iSkinContext; |
|
224 |
|
225 }; |
|
226 |
|
227 #include "BrowserFavouritesContainer.inl" |
|
228 |
|
229 #endif |
|
230 |
|
231 // End of file |