uifw/uiklaf/src/lafsrv.cpp
changeset 0 2f259fa3e83a
child 19 aecbbf00d063
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 1997-1999 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <lafpanic.h>
       
    20 #include "LAFSTD.H"
       
    21 #include <coemain.h>
       
    22 #include <uiklaf/private/lafsrv.h>
       
    23 
       
    24 const TInt KLafSrvNumPointerCursors=0;
       
    25 //_LIT(KLafSrvAppUIBaseMbmFile,"Z:\\system\\data\\lafcurs.mbm");
       
    26 
       
    27 // local functions
       
    28 
       
    29 //LOCAL_C void PointerCleanup(TAny* aPtr)
       
    30 //	{REINTERPRET_CAST(RWsPointerCursor*,aPtr)->Close();}
       
    31 
       
    32 //LOCAL_C RWsPointerCursor* AddCursorL(CFbsBitmap* /*aBitmap*/, CFbsBitmap* /*aMaskBitmap*/, const TPoint &/*aHotSpot*/, TSpriteMember& /*aSpriteMember*/, TInt /*aCursorNumber*/, CCoeEnv& /*aEnv*/)
       
    33 /*	{
       
    34 	RWsSession& session = aEnv.WsSession();
       
    35 	RWsPointerCursor* pointerCursor = new(ELeave) RWsPointerCursor(session);
       
    36 	CleanupStack::PushL(pointerCursor);
       
    37 	User::LeaveIfError(pointerCursor->Construct(0));
       
    38 	CleanupStack::PushL(TCleanupItem(PointerCleanup,pointerCursor));
       
    39 	aSpriteMember.iBitmap = aBitmap;
       
    40 	aSpriteMember.iMaskBitmap = aMaskBitmap;
       
    41 	aSpriteMember.iInvertMask = EFalse;
       
    42 	aSpriteMember.iOffset = aHotSpot;
       
    43 	aSpriteMember.iInterval = TTimeIntervalMicroSeconds32 (0);
       
    44 	aSpriteMember.iDrawMode = CGraphicsContext::EDrawModePEN;
       
    45 	User::LeaveIfError(pointerCursor->AppendMember(aSpriteMember));
       
    46 	User::LeaveIfError(pointerCursor->Activate());
       
    47 	session.SetSystemPointerCursor(*pointerCursor, aCursorNumber);
       
    48 	CleanupStack::Pop(2); // pointerCursor - handle & ptr
       
    49 	return pointerCursor;
       
    50 	}
       
    51 */
       
    52 //LOCAL_C RWsPointerCursor* LoadCursorL(TInt32 /*aBitmapId*/,TInt32 /*aBitmapMaskId*/, const TPoint &/*aHotSpot*/, TSpriteMember& /*aSpriteMember*/, TInt /*aCursorNumber*/, CCoeEnv& /*aEnv*/)
       
    53 //	{
       
    54     /*
       
    55 	__ASSERT_DEBUG(aCursorNumber<KLafSrvNumPointerCursors,Panic(ELafPanicPointerCursorIndexOutOfRange));
       
    56 	TBool shareIfLoaded(ETrue);
       
    57 	CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
       
    58 	CleanupStack::PushL(bitmap);
       
    59 	User::LeaveIfError(bitmap->Load(KLafSrvAppUIBaseMbmFile, aBitmapId,shareIfLoaded));
       
    60 	CFbsBitmap* bitmapMask = new (ELeave) CFbsBitmap();
       
    61 	CleanupStack::PushL(bitmapMask);
       
    62 	User::LeaveIfError(bitmapMask->Load(KLafSrvAppUIBaseMbmFile, aBitmapMaskId,shareIfLoaded));
       
    63 	RWsPointerCursor* cursor=AddCursorL(bitmap,bitmapMask,aHotSpot,aSpriteMember,aCursorNumber,aEnv);
       
    64 	CleanupStack::PopAndDestroy(2); // bitmap, bitmapMask
       
    65 	return cursor;
       
    66     */
       
    67 //	}
       
    68 
       
    69 //
       
    70 // class LafServAppUiBase
       
    71 //
       
    72 
       
    73 /**
       
    74  * This method returns the number of pointer cursors supplied by the laf.
       
    75  * It may be zero for some devices.
       
    76  *
       
    77  */
       
    78 EXPORT_C TInt LafServAppUiBase::NumberOfCursorsInSystemCursorList()
       
    79 	{//static
       
    80 	return KLafSrvNumPointerCursors;
       
    81 	}
       
    82 
       
    83 /**
       
    84  * Called by EikServAppUiBase. Claims the pointer cursor list if this
       
    85  * device has a global pointer cursor list, does nothing otherwise.
       
    86  *
       
    87  */
       
    88 EXPORT_C TInt LafServAppUiBase::ClaimPointerCursorListIfNeeded(CCoeEnv& aEnv)
       
    89 	{//static
       
    90 	RWsSession& session=aEnv.WsSession();
       
    91 	TBool ret=session.ClaimSystemPointerCursorList();
       
    92 	if(ret==KErrNone)
       
    93 		session.SetDefaultSystemPointerCursor(1); //pointer cursor
       
    94 	return ret;
       
    95 	}
       
    96 
       
    97 /**
       
    98  * Called by EikServAppUiBase. Frees the pointer cursor list if this
       
    99  * device has a global pointer cursor list, does nothing otherwise.
       
   100  *
       
   101  */
       
   102 EXPORT_C void LafServAppUiBase::FreePointerCursorListIfNeeded(CCoeEnv& aEnv)
       
   103 	{//static
       
   104 	aEnv.WsSession().FreeSystemPointerCursorList();
       
   105 	}
       
   106 
       
   107 /**
       
   108  * Constructs the TSpriteMember a member corresponding to the pointer cursor with index
       
   109  * aCursorNumber. Does nothing for devices with no system pointer cursors.
       
   110  * The numeric values used in the LoadCursorL() function call are for the position of
       
   111  * the cursors hotspot.
       
   112  *
       
   113  */
       
   114 EXPORT_C RWsPointerCursor* LafServAppUiBase::ConstructPointerCursorL(TInt aCursorNumber, TSpriteMember& /*aSpriteMember*/, CCoeEnv& /*aEnv*/)
       
   115 	{//static
       
   116 
       
   117 	__ASSERT_DEBUG(aCursorNumber<KLafSrvNumPointerCursors,Panic(ELafPanicPointerCursorIndexOutOfRange));
       
   118 	aCursorNumber = aCursorNumber; // just for fixing warning
       
   119 	RWsPointerCursor* cursor=NULL;
       
   120 	return cursor;
       
   121 	}