Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
This page was last modified 13:22, 9 October 2008.

CS001139 - Rotating images with AIW

From Forum Nokia Wiki



ID CS001139 Creation date October 9, 2008
Platform S60 3rd Edition Tested on devices Nokia N95
Category Symbian C++ Subcategory AIW


Keywords (APIs, classes, methods, functions):

Overview

This code snippet shows how to rotate an image 90/180/270 degrees with the AIW (Application Interworking Framework) handler.

This snippet can be self-signed.

Preconditions

Note!
This API is not part of the public SDK. It can be found in the SDK API Plug-in.



MMP file

The following library is required:

LIBRARY servicehandler.lib

In the resource file

Add the following headers:

#include <AiwCommon.hrh>
 #include <AiwCommon.rh>

Then define a submenu item as follows in the MENU_PANE resource:

MENU_ITEM
 {
 command=ERotateSub;
 cascade=r_rotate_menu;	
 txt = "Rotate";
 }

Then define the actual submenu item as follows:

RESOURCE MENU_PANE r_rotate_menu
     {
     items =
         { 
 	MENU_ITEM
                {
                 command=EAIWPlaceHolder1;
                 txt = "Rotate";
                 }
         };
     }


After this, you can define the AIW menu interest item as follows:

RESOURCE AIW_INTEREST r_aiwmenutst_ROTATE
 {     
  items =
   {
    AIW_CRITERIA_ITEM
     {
      id = EAIWPlaceHolder1;
       serviceCmd = KAiwCmdRotate;   //from aiwcommon.hrh  
        serviceClass = KAiwClassMenu;   //from aiwcommon.hrh
         contentType = "image/*";            
      }
  };
 }


Source file

Add the following header:

#include <AiwServiceHandler.h>

Construct the CAiwServiceHandler and attach the menu:

iServiceHandler = CAiwServiceHandler::NewL();
 iServiceHandler->AttachMenuL(R_ROTATE_MENU, R_AIWMENUTST_ROTATE);

Because the menu items for rotating were defined as submenus, you can handle adding the menu with the following code inside the DynInitMenuPaneL implementation:

if ( iServiceHandler->HandleSubmenuL( *aMenuPane ) )
  {
   return;
  }
 if(iImageFileName.Length()
 && BaflUtils::Parse(iImageFileName) == KErrNone)
  {
         CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
         
          TAiwVariant varFile(iImageFileName);
         TAiwGenericParam paramFile( EGenericParamFile, varFile );
         paramList.AppendL( paramFile );
 
         TAiwVariant varMime(_L("image/jpeg"));
         TAiwGenericParam paramMime( EGenericParamMIMEType, varMime );
         paramList.AppendL( paramMime );
 
          iServiceHandler->InitializeMenuPaneL(
     	    *aMenuPane, 
         	aResourceId, 
         	EAIWExampleCmdLast1, 
         	paramList);    
         	
 }
 else if(aResourceId == your Menu id goes here)
 {
 // Use aMenuPane->SetItemDimmed to dim out the menu item.
 }

And when the user selects the menu item, you just need to forward the command to CAiwServiceHandler in your command handler’s default block as follows:

CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
 
 TAiwGenericParam filePath( EGenericParamFile, iImageFileName );
 paramList->AppendL( filePath );
 
 TAiwVariant varMime(_L("image/jpeg"));
 TAiwGenericParam paramMime( EGenericParamMIMEType, varMime );
 paramList->AppendL( paramMime );
 
 iServiceHandler->ExecuteMenuCmdL(
 	aCommand,
     *paramList,     
 	NULL,   
 	0,                                 
 	this);                                
 
 CleanupStack::PopAndDestroy(paramList);
Related Discussions
Thread Thread Starter Forum Replies Last Post
read images from phone gallery piyush.kh Mobile Java General 12 2008-01-03 19:33
Sending images using bluetooth sulakshana General Symbian C++ 1 2007-07-04 07:53
UI designer question jurekr Symbian User Interface 2 2008-01-05 17:32
CAknFileSelectionDialog problems. sergeborenko General Symbian C++ 2 2008-05-21 09:51
Rotating playing video by 90 degrees preethi81 Graphics & Video & Streaming 4 2006-09-01 06:51
 
Powered by MediaWiki
RDF Facets: qfnZtypeQUqfnTypeZCommunityContentQ qfnZtypeQUqfnTypeZWebpageQ qfnZtypeQUqfnTypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX