25
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2008 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: Base class header for plugins containing other plugins.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef GSPARENTPLUGIN_H
|
|
20 |
#define GSPARENTPLUGIN_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include "gspluginloader.h"
|
|
24 |
#include "gsplugininterface.h"
|
|
25 |
#include "gschildviewmanager.h"
|
|
26 |
|
|
27 |
#include <data_caging_path_literals.hrh>
|
|
28 |
#include <ConeResLoader.h>
|
|
29 |
#include <babitflags.h>
|
|
30 |
|
|
31 |
// CONSTANTS
|
|
32 |
_LIT( KGSParentPluginResourceFileName, "z:GSParentPluginRsc.rsc" );
|
|
33 |
|
|
34 |
/**
|
|
35 |
* Used by CGSParentPlugin::ListBoxType(). These enumerations are used to define
|
|
36 |
* the desired type of the listbox. Enumerations here are currently implemented
|
|
37 |
* by CGSParentPlugin. Additional types can be defined later as long as the
|
|
38 |
* values for previous types are not changed.
|
|
39 |
*/
|
|
40 |
enum TGSListboxTypes
|
|
41 |
{
|
|
42 |
// CAknSingleLargeStyleListBox for
|
|
43 |
// list_single_large_pane
|
|
44 |
EGSListBoxTypeSingleLarge = 1, // Default
|
|
45 |
// CAknSettingStyleListBox for
|
|
46 |
// list_setting_pane and
|
|
47 |
// list_big_single_setting_pane
|
|
48 |
EGSListBoxTypeSettings,
|
|
49 |
// CAknDouble2LargeStyleListBox for
|
|
50 |
// list_double2_large_graphic_pane
|
|
51 |
EGSListBoxTypeDouble2Large,
|
|
52 |
// CAknDoubleLargeStyleListBox for
|
|
53 |
// list_double_large_graphic_pane
|
|
54 |
// Note: Only different layout than EGSListBoxTypeDouble2Large
|
|
55 |
EGSListBoxTypeDoubleLarge
|
|
56 |
};
|
|
57 |
|
|
58 |
/**
|
|
59 |
* Indexes to flags that are used for different customisation options for parent
|
|
60 |
* plugin. The flags define for example optimization options for loading child
|
|
61 |
* plugins.
|
|
62 |
*/
|
|
63 |
enum TGSOptionFlagIndexes
|
|
64 |
{
|
|
65 |
// On: Will load child plugins when parent plugin is activated.
|
|
66 |
// Off: Will load child plugins on initialization of the parent plugin.
|
|
67 |
EGSLoadChildrenOnActivation,
|
|
68 |
// On: Will delete child plugins when parent plugin is deactivated.
|
|
69 |
// Off: Will delete child plugins when parent plugin is destroyed.
|
|
70 |
EGSDeleteChildrenOnDeactivation // CURRENTLY NOT IMPLEMENTED!
|
|
71 |
};
|
|
72 |
|
|
73 |
// FORWARD DECLARATIONS
|
|
74 |
class CGSParentContainer;
|
|
75 |
|
|
76 |
// CLASS DECLARATION
|
|
77 |
|
|
78 |
/**
|
|
79 |
* CGSParentPlugin view class. Thus is a base class for plugins owning other
|
|
80 |
* plugins as their sub-views.
|
|
81 |
*
|
|
82 |
* @lib GSFramework.lib
|
|
83 |
* @since Series60_3.1
|
|
84 |
*/
|
|
85 |
class CGSParentPlugin : public CGSPluginInterface,
|
|
86 |
public MGSPluginLoadObserver,
|
|
87 |
public MGSChildViewManager
|
|
88 |
{
|
|
89 |
public: // Constructors and destructor
|
|
90 |
|
|
91 |
/**
|
|
92 |
* Destructor.
|
|
93 |
*/
|
|
94 |
IMPORT_C ~CGSParentPlugin();
|
|
95 |
|
|
96 |
public: // New
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Opens the nearest localized resourcefile using aResourceLoader.
|
|
100 |
* aResourceLoader should be opened only once before closing it.
|
|
101 |
* Otherwise it will raise a panic. Therefore it is better to have
|
|
102 |
* multiple resource loaders. Uses KDC_RESOURCE_FILES_DIR.
|
|
103 |
*
|
|
104 |
* @param aResourceFileName Drive and name of resource file in format
|
|
105 |
* <path>:<rsc_file_name>
|
|
106 |
* @param aResourceLoader Resource loader for the resource. The loader
|
|
107 |
* must not be opened allready or it will raise
|
|
108 |
* a panic. It is caller's responsibility to
|
|
109 |
* close the resource loader after using the
|
|
110 |
* resource.
|
|
111 |
*/
|
|
112 |
IMPORT_C void OpenLocalizedResourceFileL(
|
|
113 |
const TDesC& aResourceFileName,
|
|
114 |
RConeResourceLoader& aResourceLoader );
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Symbian OS default constructor. Call this from sub classes.
|
|
118 |
*
|
|
119 |
* @param aViewTitleRscId Id for the view's resource.
|
|
120 |
* @parem aTitleRscId Id for the view's title resource.
|
|
121 |
*/
|
|
122 |
IMPORT_C void BaseConstructL( TInt aViewRscId, TInt aTitleRscId );
|
|
123 |
|
|
124 |
/**
|
|
125 |
* @return UID of the upper level view which launched this view. Note
|
|
126 |
* that it is not always the previous view because a view can
|
|
127 |
* be activated also by returning from another view.
|
|
128 |
*/
|
|
129 |
IMPORT_C virtual TUid UpperLevelViewUid();
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Defines the type of the used listbox visualising the child plugins.
|
|
133 |
* Classes deriving from CGSParentContainer can override this function
|
|
134 |
* to define the used type of the listbox. Otherwise default value
|
|
135 |
* EGSListBoxTypeSingleLarge is used.
|
|
136 |
*
|
|
137 |
* @return Type of the listbox. See TGSListboxTypes for
|
|
138 |
* types.
|
|
139 |
*/
|
|
140 |
IMPORT_C virtual TGSListboxTypes ListBoxType();
|
|
141 |
|
|
142 |
/**
|
|
143 |
* Updates plugin's view. This can be used when child plugin's values
|
|
144 |
* are changed.
|
|
145 |
*/
|
|
146 |
IMPORT_C virtual void UpdateView();
|
|
147 |
|
|
148 |
/**
|
|
149 |
* Defines custom options for parent plugin. Use TGSOptionFlagIndexes to
|
|
150 |
* enable a combination of bit flags.
|
|
151 |
*
|
|
152 |
* @param aOptionFlags Option combination created by combining binary
|
|
153 |
* option flags.
|
|
154 |
*/
|
|
155 |
IMPORT_C virtual void SetOptionFlags( TBitFlags& aOptionFlags );
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Gets currently used option flags.
|
|
159 |
*
|
|
160 |
* @return Binary option flags used by this plugin.
|
|
161 |
*/
|
|
162 |
IMPORT_C virtual const TBitFlags& OptionFlags() const;
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Provides help context. This should be implemented by CGSParentPlugin
|
|
166 |
* sub class in case help is needed. Normally this is defined in
|
|
167 |
* CCoeControl derived class but since all parent plugin implementations
|
|
168 |
* have only CGSParentContainer class as the only CCoeControl derived
|
|
169 |
* class, and need still their own unique help contexts, this function
|
|
170 |
* is needed in view level class.
|
|
171 |
*/
|
|
172 |
IMPORT_C virtual void GetHelpContext( TCoeHelpContext& aContext );
|
|
173 |
|
|
174 |
/**
|
|
175 |
* @return Plugin which is selected in the lbx or NULL if no plugins
|
|
176 |
* or iContainer exist.
|
|
177 |
*/
|
|
178 |
IMPORT_C CGSPluginInterface* SelectedPlugin();
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Attempts to change child plugin load priority on next RunL cycle.
|
|
182 |
* Use this if parent needs to change plugin loader priority. Normally
|
|
183 |
* when parent plugin view is opened, it is advisable to increase loader
|
|
184 |
* priority to get child plugins loaded faster.
|
|
185 |
*
|
|
186 |
* @param aPriority Desired priority.
|
|
187 |
*/
|
|
188 |
void RequestPriority( CActive::TPriority aPriority );
|
|
189 |
|
|
190 |
public: // From CGSPluginInterface
|
|
191 |
|
|
192 |
/**
|
|
193 |
* See base class.
|
|
194 |
*/
|
|
195 |
IMPORT_C void ResetSelectedItemIndex();
|
|
196 |
|
|
197 |
public: // From MGSPluginLoadObserver
|
|
198 |
|
|
199 |
/**
|
|
200 |
* See base class.
|
|
201 |
*/
|
|
202 |
IMPORT_C void HandlePluginLoaded( KGSPluginLoaderStatus aStatus );
|
|
203 |
|
|
204 |
public: //New
|
|
205 |
|
|
206 |
/**
|
|
207 |
* Checks if the MSK label needs to be adjusted.
|
|
208 |
*/
|
|
209 |
void CheckMiddleSoftkeyLabelL();
|
|
210 |
|
|
211 |
/**
|
|
212 |
* Adds given resource text as MSK to CBA. Use either this or
|
|
213 |
* SetMiddleSoftKeyLabelTextL in in case text is used deirectly instead
|
|
214 |
* of resource.
|
|
215 |
*
|
|
216 |
* @param aResourceId middle softkey label.
|
|
217 |
* @param aCommandId command that should be performed when MSK
|
|
218 |
* is pressed.
|
|
219 |
* @since S60 v3.1
|
|
220 |
*/
|
|
221 |
void SetMiddleSoftKeyLabelL( const TInt aResourceId, const TInt aCommandId );
|
|
222 |
|
|
223 |
/**
|
|
224 |
* Adds given text as MSK to CBA.
|
|
225 |
*
|
|
226 |
* @param aMskLabel middle softkey label.
|
|
227 |
* @param aCommandId command that should be performed when MSK
|
|
228 |
* is pressed.
|
|
229 |
* @since S60 v3.1
|
|
230 |
*/
|
|
231 |
void SetMiddleSoftKeyLabelTextL( const TPtr aMskLabel, const TInt aCommandId );
|
|
232 |
|
|
233 |
/**
|
|
234 |
* represent the position of ListBox
|
|
235 |
*/
|
|
236 |
struct TListBoxPosition
|
|
237 |
{
|
|
238 |
/**
|
|
239 |
* The three items are all set to -1 as an initial value because their legal
|
|
240 |
* value should be no less than 0.
|
|
241 |
*/
|
|
242 |
inline void Reset()
|
|
243 |
{
|
|
244 |
iCurrentItemIndex = -1;
|
|
245 |
iItemOffsetInPixels = -1;
|
|
246 |
iTopItemIndex = -1;
|
|
247 |
}
|
|
248 |
TInt iCurrentItemIndex;
|
|
249 |
TInt iItemOffsetInPixels;
|
|
250 |
TInt iTopItemIndex;
|
|
251 |
};
|
|
252 |
|
|
253 |
public: // From MGSChildViewManager
|
|
254 |
|
|
255 |
IMPORT_C void TransferDynamicPluginL( CGSPluginInterface* aPlugin );
|
|
256 |
|
|
257 |
protected: // From CAknView
|
|
258 |
|
|
259 |
/**
|
|
260 |
* See base class.
|
|
261 |
*/
|
|
262 |
IMPORT_C void DoActivateL( const TVwsViewId& aPrevViewId,
|
|
263 |
TUid aCustomMessageId,
|
|
264 |
const TDesC8& aCustomMessage );
|
|
265 |
|
|
266 |
/**
|
|
267 |
* See base class.
|
|
268 |
*/
|
|
269 |
IMPORT_C void DoDeactivate();
|
|
270 |
|
|
271 |
/**
|
|
272 |
* See base class.
|
|
273 |
*/
|
|
274 |
IMPORT_C void HandleCommandL( TInt aCommand );
|
|
275 |
|
|
276 |
/**
|
|
277 |
* See base class.
|
|
278 |
*/
|
|
279 |
IMPORT_C CGSParentPlugin();
|
|
280 |
|
|
281 |
protected: // From MEikMenuObserver
|
|
282 |
|
|
283 |
/**
|
|
284 |
* See base class.
|
|
285 |
*/
|
|
286 |
IMPORT_C void DynInitMenuPaneL( TInt aResourceId,
|
|
287 |
CEikMenuPane* aMenuPane );
|
|
288 |
|
|
289 |
private: // New
|
|
290 |
|
|
291 |
/**
|
|
292 |
* Constructs container for this view.
|
|
293 |
*/
|
|
294 |
void ConstructContainerL();
|
|
295 |
|
|
296 |
/**
|
|
297 |
* Remove command from MSK.
|
|
298 |
* @param aMskCommandId ID of the command to be removed.
|
|
299 |
*/
|
|
300 |
void RemoveCommandFromMSK( TInt aMskCommandId );
|
|
301 |
|
|
302 |
/**
|
|
303 |
* Used in lazy loading. Starts loading the plugins.
|
|
304 |
*/
|
|
305 |
void StartAsyncPluginLoadL();
|
|
306 |
|
|
307 |
protected: // Data
|
|
308 |
|
|
309 |
// Previous view UID.
|
|
310 |
TVwsViewId iPrevViewId;
|
|
311 |
|
|
312 |
private: // Data
|
|
313 |
|
|
314 |
// Application UI.
|
|
315 |
CAknViewAppUi* iAppUi;
|
|
316 |
|
|
317 |
// Owned container.
|
|
318 |
CGSParentContainer* iContainer;
|
|
319 |
|
|
320 |
// GS plug-ins owned by this view.
|
|
321 |
// CGSPluginLoader defines the ordering of plugins.
|
|
322 |
CArrayPtrFlat<CGSPluginInterface>* iPluginArray;
|
|
323 |
|
|
324 |
// Asynchronous loader for the GS plug-ins.
|
|
325 |
CGSPluginLoader* iPluginLoader;
|
|
326 |
|
|
327 |
// Resource loader.
|
|
328 |
RConeResourceLoader iResourceLoader;
|
|
329 |
|
|
330 |
// Resource id for the title.
|
|
331 |
TInt iTitleRscId;
|
|
332 |
|
|
333 |
// UID of the selected plugin in the container's lbx. Uid is used
|
|
334 |
// instead of simple index because it is unambiguous whereas index
|
|
335 |
// could refer to wrong plugin in case plugin order or count is
|
|
336 |
// changed.
|
|
337 |
TUid iSelectedPluginUid;
|
|
338 |
|
|
339 |
// Combination of binary flags that can be set to alter parent plugin
|
|
340 |
// behaviour.
|
|
341 |
TBitFlags iOptionFlags;
|
|
342 |
|
|
343 |
// This stores the desired MSK command ID.
|
|
344 |
TInt iMskCommandId;
|
|
345 |
|
|
346 |
// UID of the top plugin in the container's lbx. Uid is used
|
|
347 |
// instead of simple index because it is unambiguous whereas index
|
|
348 |
// could refer to wrong plugin in case plugin order or count is
|
|
349 |
// changed.
|
|
350 |
TUid iTopPluginUid;
|
|
351 |
|
|
352 |
//keep the exact position of the listbox including current item index,
|
|
353 |
//ItemOffsetInPixels and TopItemindex
|
|
354 |
TListBoxPosition iPosition;
|
|
355 |
|
|
356 |
//record the screen mode, portrait/landscape
|
|
357 |
TBool iIsLandscapeOrientation;
|
|
358 |
};
|
|
359 |
|
|
360 |
|
|
361 |
#endif // GSPARENTPLUGIN_H
|
|
362 |
// End of File
|