63
|
1 |
/*
|
|
2 |
* Copyright (c) 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: Plugin IF for Avkon based plugin views
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CCAPPVIEWPLUGINAKNVIEW_H
|
|
19 |
#define CCAPPVIEWPLUGINAKNVIEW_H
|
|
20 |
|
|
21 |
#ifndef __CCAPPUTILUNITTESTMODE
|
|
22 |
#include <aknview.h>
|
|
23 |
#include <ConeResLoader.h>
|
|
24 |
#endif //__CCAPPUTILUNITTESTMODE
|
|
25 |
|
|
26 |
class CCCAppViewPluginAknContainer;
|
|
27 |
|
|
28 |
/**
|
|
29 |
* CAknView tailored for the needs of CCApp plugins.
|
|
30 |
*
|
|
31 |
* @code
|
|
32 |
* Derive from CCCAppViewPluginBase, which is inherited from CCCAppViewPluginAknView.
|
|
33 |
*
|
|
34 |
* class CCCAppMyPlugin : public CCCAppViewPluginBase
|
|
35 |
* {
|
|
36 |
* ...
|
|
37 |
*
|
|
38 |
* CCCAppViewPluginBase is inherited from CAknView. CAknView has pure
|
|
39 |
* virtual method for view id. With plugin views, this method is used
|
|
40 |
* to return the implementation Id. This helps to identify the views and
|
|
41 |
* the plugins with each other.
|
|
42 |
*
|
|
43 |
* TUid CCCAppMyPlugin::Id()const
|
|
44 |
* {
|
|
45 |
* return TUid::Uid( KCCAMyPluginImplmentationUid );
|
|
46 |
* }
|
|
47 |
*
|
|
48 |
* During the preparations CCCAppViewPluginBase's PreparePluginViewL() is called. It is called
|
|
49 |
* only once in plugin's lifespan. Use it to load resource-file containing the resources your
|
|
50 |
* plugin needs. Actual loading of menus / soft keys can be left to base-class via calling
|
|
51 |
* BaseConstructL() and id of AVKON_VIEW -resource struct.
|
|
52 |
*
|
|
53 |
* void CCCAppMyPlugin::PreparePluginViewL( MCCAppPluginParameter& aPluginParameter )
|
|
54 |
* {
|
|
55 |
* // preparing resources for use
|
|
56 |
* TFileName fileName( KCCAppCommLauncherResourceFileName );
|
|
57 |
* BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName );
|
|
58 |
* iResourceLoader.OpenL( fileName );
|
|
59 |
* // calling base-class to let it do the rest of loading
|
|
60 |
* BaseConstructL( R_COMMLAUNCHER_VIEW );
|
|
61 |
*
|
|
62 |
* // other plugin preparation work...
|
|
63 |
* }
|
|
64 |
*
|
|
65 |
* When plugin view is going to be activated to the display, DoActivateL()
|
|
66 |
* is called. Base-class DoActivateL should be called.
|
|
67 |
*
|
|
68 |
* void CCCAppMyPlugin::DoActivateL(
|
|
69 |
* const TVwsViewId& aPrevViewId,
|
|
70 |
* TUid aCustomMessageId,
|
|
71 |
* const TDesC8& aCustomMessage )
|
|
72 |
* {
|
|
73 |
* // Forward the activation-call to base-class
|
|
74 |
* CCCAppViewPluginAknView::DoActivateL(
|
|
75 |
* aPrevViewId, aCustomMessageId, aCustomMessage );
|
|
76 |
* // other plugin activation work ...
|
|
77 |
*
|
|
78 |
* During the activation of plugin view NewContainerL() is called. Use it to
|
|
79 |
* construct your container-class inherited from CCCAppViewPluginAknContainer.
|
|
80 |
*
|
|
81 |
* void CCCAppMyPlugin::NewContainerL()
|
|
82 |
* {
|
|
83 |
* iContainer = new (ELeave) CCCAppMyContainer();
|
|
84 |
* }
|
|
85 |
*
|
|
86 |
* When plugin view is going to be deactivated from the display,
|
|
87 |
* DoDeactivate() is called. Base-class DoDeactivate should be called.
|
|
88 |
* Plugin view is deleted during the deactivation process, but container
|
|
89 |
* is.
|
|
90 |
*
|
|
91 |
* void CCCAppMyPlugin::DoDeactivate()
|
|
92 |
* {
|
|
93 |
* // Forward the deactivation-call to base-class
|
|
94 |
* CCCAppViewPluginAknView::DoDeactivate();
|
|
95 |
* // other plugin deactivation work ...
|
|
96 |
* }
|
|
97 |
*
|
|
98 |
* Each plugin view should show its own title in the titlePane.
|
|
99 |
* To Facilitate this, the Plugin View base-Class provides SetTitleL(aTitle) API.
|
|
100 |
* Base-class SetTitleL should be called.
|
|
101 |
* The new title 'aTitle' gets updated in the TitlePane of the View
|
|
102 |
*
|
|
103 |
* void CCCAppMyPlugin::SetTitleL()
|
|
104 |
* {
|
|
105 |
* // Forward the SetTitleL-call to base-class
|
|
106 |
* CCCAppViewPluginAknView::SetTitleL( _LIT("My Title") );
|
|
107 |
}
|
|
108 |
*
|
|
109 |
* @endcode
|
|
110 |
*
|
|
111 |
* @lib ccapputil.dll
|
|
112 |
* @since S60 v5.0
|
|
113 |
*/
|
|
114 |
class CCCAppViewPluginAknView : public CAknView
|
|
115 |
{
|
|
116 |
|
|
117 |
public: // Constructors & destructors
|
|
118 |
|
|
119 |
/**
|
|
120 |
* C++ constructor.
|
|
121 |
*/
|
|
122 |
IMPORT_C CCCAppViewPluginAknView();
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Destructor
|
|
126 |
*/
|
|
127 |
IMPORT_C virtual ~CCCAppViewPluginAknView();
|
|
128 |
|
|
129 |
protected: // From CAknView
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Creates needed container through NewContainerL() and adds it
|
|
133 |
* to stack.
|
|
134 |
*
|
|
135 |
* This should be called from the sub-class.
|
|
136 |
*
|
|
137 |
* See more details from CAknView.
|
|
138 |
*
|
|
139 |
* @since S60 v5.0
|
|
140 |
*/
|
|
141 |
IMPORT_C virtual void DoActivateL(
|
|
142 |
const TVwsViewId& aPrevViewId,
|
|
143 |
TUid aCustomMessageId,
|
|
144 |
const TDesC8& aCustomMessage );
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Deletes used container.
|
|
148 |
*
|
|
149 |
* This should be called from the sub-class.
|
|
150 |
*
|
|
151 |
* See more details from CAknView.
|
|
152 |
*
|
|
153 |
* @since S60 v5.0
|
|
154 |
*/
|
|
155 |
IMPORT_C virtual void DoDeactivate();
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Calls CCApplication's HandleCommandL() which takes care of
|
|
159 |
* following events: EEikCmdExit, EAknSoftkeyBack, EAknSoftkeyExit
|
|
160 |
* and EAknCmdHelp (will call container classes GetHelpContext-callback).
|
|
161 |
*
|
|
162 |
* This should be called from the sub-class.
|
|
163 |
*
|
|
164 |
* See more details from CAknView.
|
|
165 |
*
|
|
166 |
* @since S60 v5.0
|
|
167 |
*/
|
|
168 |
IMPORT_C virtual void HandleCommandL( TInt aCommand );
|
|
169 |
|
|
170 |
protected: // New
|
|
171 |
|
|
172 |
/**
|
|
173 |
* Creates container,
|
|
174 |
*
|
|
175 |
* @since S60 v5.0
|
|
176 |
*/
|
|
177 |
void CreateContainerL();
|
|
178 |
|
|
179 |
/**
|
|
180 |
* This is meant for sub-class to create a container. Called during DoActivateL.
|
|
181 |
*
|
|
182 |
* @since S60 v5.0
|
|
183 |
*/
|
|
184 |
virtual void NewContainerL() = 0;
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Deletes container if exists.
|
|
188 |
*
|
|
189 |
* @since S60 v5.0
|
|
190 |
*/
|
|
191 |
void DeleteContainerIfExists();
|
|
192 |
|
|
193 |
public:
|
|
194 |
/**
|
|
195 |
* Sets the title of the View Plugin
|
|
196 |
* @param aTitle - the title to be set for the Plugin View
|
|
197 |
*
|
|
198 |
* @since S60 v5.0
|
|
199 |
*
|
|
200 |
*/
|
|
201 |
IMPORT_C void SetTitleL( const TDesC& aTitle );
|
|
202 |
protected: // Data
|
|
203 |
|
|
204 |
/**
|
|
205 |
* Container.
|
|
206 |
* Owned.
|
|
207 |
*/
|
|
208 |
CCCAppViewPluginAknContainer* iContainer;
|
|
209 |
/**
|
|
210 |
* Resourceloader.
|
|
211 |
* Owned.
|
|
212 |
*/
|
|
213 |
RConeResourceLoader iResourceLoader;
|
|
214 |
};
|
|
215 |
|
|
216 |
#endif // CCAPPVIEWPLUGINAKNVIEW_H
|
|
217 |
//End of file
|