|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-A399508A-DE6A-490D-9BFB-4FCF56FF9D4C" xml:lang="en"><title>Derive |
|
13 a class from the MCoeView class</title><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
14 <context> <p>Derive a class from the <codeph>MCoeView</codeph> class |
|
15 and provide the definition for each of the following functions:</p><ul> |
|
16 <li><p><codeblock xml:space="preserve">TVwsViewId ViewId() const</codeblock></p><p>This function |
|
17 defines the unique identifier of the view within the given application.</p></li> |
|
18 </ul><ul> |
|
19 <li><p><codeblock xml:space="preserve">void ViewActivatedL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage)</codeblock></p><p>This is the function is called by the operating system when a view is activated. |
|
20 The call gets several arguments: the view ID of the previous view that was |
|
21 displayed (in case a switch back to it is desired), and the identifier and |
|
22 text of a message that comes from the process that is activating the view. |
|
23 This message can convey specialized information, such as information on what |
|
24 to display, from the activating process.</p></li> |
|
25 </ul><ul> |
|
26 <li><p><codeblock xml:space="preserve">void ViewDeactivated()</codeblock></p><p>This function is |
|
27 called by the operating system when a view is deactivated. </p></li> |
|
28 </ul><ul> |
|
29 <li><p><codeblock xml:space="preserve">TVwsViewIdAndMessage ViewScreenDeviceChangedL()</codeblock></p><p>This |
|
30 function has a default implementation. It handles a change to the screen device |
|
31 returning the value of the <codeph>TVwsViewIdAndMessage</codeph> object. By |
|
32 default, returns the ID of the active view.</p><p>Cone provides a default |
|
33 screen device change handler <codeph>CCoeScreenDeviceChangeDefaultHandler</codeph>. <codeph>CCoeScreenDeviceChangeDefaultHandler</codeph> handles |
|
34 any screen device changes that occur while a view is active. It is used to |
|
35 activate a default view when a screen flip (changing the screen orientation, |
|
36 for example, landscape to portrait) occurs, if the currently active view does |
|
37 not implement <codeph>MCoeView::ViewScreenDeviceChangedL()</codeph>.</p></li> |
|
38 </ul><p>The following code snippet shows deriving a class from <codeph>MCoeView</codeph> and |
|
39 implementing the required functions:</p><codeblock xml:space="preserve">class CNewView : public MCoeView |
|
40 { |
|
41 public: |
|
42 //construction |
|
43 CNewView( const TVwsViewId& aViewId, CCoeAppUi& aAppUi ); |
|
44 void ConstructL(); |
|
45 ~CNewView(); |
|
46 private: |
|
47 // From MCoeView class |
|
48 void ViewActivatedL( const TVwsViewId& aPrevViewId, |
|
49 TUid aCustomMessageId, |
|
50 const TDesC8& aCustomMessage ); |
|
51 void ViewDeactivated(); |
|
52 TVwsViewIdAndMessage ViewScreenDeviceChangedL(); |
|
53 void ViewConstructL(); |
|
54 private: |
|
55 CCoeAppUi& iCCoeAppUi; |
|
56 TVwsViewId& iViewId; |
|
57 }; |
|
58 </codeblock></context> |
|
59 </taskbody></task> |