--- a/Symbian3/SDK/Source/GUID-D0F6E95B-B35A-4EA1-8CC3-D86D1E0E6DD3.dita Wed Mar 31 11:11:55 2010 +0100
+++ b/Symbian3/SDK/Source/GUID-D0F6E95B-B35A-4EA1-8CC3-D86D1E0E6DD3.dita Fri Jun 11 12:39:03 2010 +0100
@@ -1,72 +1,80 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
-<!-- This component and the accompanying materials are made available under the terms of the License
-"Eclipse Public License v1.0" which accompanies this distribution,
-and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
-<!-- Initial Contributors:
- Nokia Corporation - initial contribution.
-Contributors:
--->
-<!DOCTYPE concept
- PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
-<concept id="GUID-D0F6E95B-B35A-4EA1-8CC3-D86D1E0E6DD3" xml:lang="en"><title>Creating
-stylus pop-up menu</title><prolog><metadata><keywords/></metadata></prolog><conbody>
-<p>Construct the menu using the method <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknStylusPopUpMenu.html#9dda70f72d42d0877cbbf9ca299649af" format="application/java-archive"><codeph>NewL()</codeph></xref>in the class <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknStylusPopUpMenu.html" format="application/java-archive"><codeph>CAknStylusPopUpMenu</codeph></xref>.</p>
-<note> <p>The last parameter in the constructor is a pointer to the preview
-pop-up from which the stylus pop-up menu is launched. If you are not constructing
-a pop-up menu for a preview pop-up, set the parameter as <codeph>NULL</codeph>.</p></note>
-<p>To construct the menu from a resource, use the method <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknStylusPopUpMenu.html#75cd95c35a6ed4734b93713596bb51d5" format="application/java-archive"><codeph>CAknStylusPopUpMenu::ConstructFromResourceL()</codeph></xref>.</p>
-<p>The following example illustrates a stylus pop-up menu opened in the location
-(not a preview pop-up) where the user taps with the stylus as well as the
-resource that defines the menu items:</p>
-<note><p>The menu is constructed only once: when <codeph>HandlePointerEventL</codeph> runs
-for the first time. Later the already constructed menu is shown again.</p></note>
-<codeblock xml:space="preserve">void CMyAppView::HandlePointerEventL
- ( const TPointerEvent& aPointerEvent )
- {
- if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
- {
- if ( !iMenu )
- {
- iMenu = CAknStylusPopUpMenu::NewL(
- iMenuObserver,
- aPointerEvent.iParentPosition,
- NULL );
- TInt resourceReaderId = 0;
- resourceReaderId = R_MYAPP_STYLUS_MENU;
- TResourceReader reader;
- iCoeEnv->CreateResourceReaderLC(
- reader, resourceReaderId );
- iMenu->ConstructFromResourceL( reader );
- CleanupStack::PopAndDestroy(); // reader
- }
- iMenu->SetPosition( aPointerEvent.iParentPosition );
- iMenu->ShowMenu();
- }
- // Forward event to base class too.
- CCoeControl::HandlePointerEventL( aPointerEvent );
- }
-
-RESOURCE STYLUS_POPUP_MENU r_myapp_stylus_menu
- {
- items =
- {
- STYLUS_POPUP_MENU_ITEM
- {
- txt = "Stylus Popup Menu Item 1";
- command = EMyAppMenuItemCmd1;
- },
- STYLUS_POPUP_MENU_ITEM
- {
- txt = "Stylus Popup Menu Item 2";
- command = EMyAppMenuItemCmd2;
- },
- STYLUS_POPUP_MENU_ITEM
- {
- txt = "Stylus Popup Menu Item 3";
- command = EMyAppMenuItemCmd3;
- }
- };
- }
-</codeblock>
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
+<!-- This component and the accompanying materials are made available under the terms of the License
+"Eclipse Public License v1.0" which accompanies this distribution,
+and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
+<!-- Initial Contributors:
+ Nokia Corporation - initial contribution.
+Contributors:
+-->
+<!DOCTYPE concept
+ PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
+<concept id="GUID-D0F6E95B-B35A-4EA1-8CC3-D86D1E0E6DD3" xml:lang="en"><title>Creating
+stylus pop-up menu</title><prolog><metadata><keywords/></metadata></prolog><conbody>
+<p>Construct the menu using the method <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknStylusPopUpMenu.html#9dda70f72d42d0877cbbf9ca299649af" format="application/java-archive"><codeph>NewL()</codeph></xref>in the class <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknStylusPopUpMenu.html" format="application/java-archive"><codeph>CAknStylusPopUpMenu</codeph></xref>.</p>
+<note> <p>The last parameter in the constructor is a pointer to the preview
+pop-up from which the stylus pop-up menu is launched. If you are not constructing
+a pop-up menu for a preview pop-up, set the parameter as <codeph>NULL</codeph>.</p></note>
+<p>To construct the menu from a resource, use the method <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknStylusPopUpMenu.html#75cd95c35a6ed4734b93713596bb51d5" format="application/java-archive"><codeph>CAknStylusPopUpMenu::ConstructFromResourceL()</codeph></xref>.</p>
+<p>The following example illustrates a stylus pop-up menu opened in the location
+(not a preview pop-up) where the user taps with the stylus as well as the
+resource that defines the menu items:</p>
+<note><p>The menu is constructed only once: when <codeph>HandlePointerEventL</codeph> runs
+for the first time. Later the already constructed menu is shown again.</p></note>
+<p>The following code snippets explain how to create and display Stylus pop-up
+menu:<ul>
+<li><p><b>Creating directly:</b></p><codeblock xml:space="preserve">// member variable point to the stylus Popup menu
+CAknStylusPopUpMenu * iPopupMenu ;
+_LIT(KItem1, "Item 1");
+_LIT(KItem2, "Item 2");
+_LIT(KItem3, "Item 3");
+_LIT(KItem4, "Item 4");
+enum StylusPopupMenuCommand
+ {
+ StylusMenuCommand1 = 0 ,
+ StylusMenuCommand2,
+ StylusMenuCommand3,
+ StylusMenuCommand4
+ };
+// create object , “this” is a object implement the interface
+// MEikMenuObserver
+iPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint( 0 , 0 ) );
+// add menu item
+iPopupMenu->AddMenuItemL( KItem1 , StylusMenuCommand1 );
+iPopupMenu->AddMenuItemL( KItem2 , StylusMenuCommand2 );
+iPopupMenu->AddMenuItemL( KItem3 , StylusMenuCommand3 );
+iPopupMenu->AddMenuItemL( KItem4 , StylusMenuCommand4 );
+</codeblock></li>
+<li><p><b>Creating through resource file:</b></p><codeblock xml:space="preserve">RESOURCE STYLUS_POPUP_MENU r_stylus_popup_menu
+ {
+ items =
+ {
+ STYLUS_POPUP_MENU_ITEM
+ {
+ txt = "Menu Item 1";
+ command = EStylusPopupCommand1; },
+ STYLUS_POPUP_MENU_ITEM
+ {
+ txt = "Menu Item 2";
+ command = EStylusPopupCommand2; },
+ STYLUS_POPUP_MENU_ITEM
+ {
+ txt = "Menu Item 3";
+ command = EStylusPopupCommand3;
+ }
+ };
+ }
+// create object
+iPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint( 0 , 0 ) );
+{
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC(
+ reader ,
+ R_STYLUS_POPUP_MENU );
+ iPopupMenu->ConstructFromResourceL( reader );
+ // destroy reader
+ CleanupStack::PopAndDestroy();
+}
+</codeblock></li>
+</ul></p>
</conbody></concept>
\ No newline at end of file