| sl@0 |      1 | // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
 | 
| sl@0 |      2 | // All rights reserved.
 | 
| sl@0 |      3 | // This component and the accompanying materials are made available
 | 
| sl@0 |      4 | // under the terms of "Eclipse Public License v1.0"
 | 
| sl@0 |      5 | // which accompanies this distribution, and is available
 | 
| sl@0 |      6 | // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 | 
| sl@0 |      7 | //
 | 
| sl@0 |      8 | // Initial Contributors:
 | 
| sl@0 |      9 | // Nokia Corporation - initial contribution.
 | 
| sl@0 |     10 | //
 | 
| sl@0 |     11 | // Contributors:
 | 
| sl@0 |     12 | //
 | 
| sl@0 |     13 | // Description:
 | 
| sl@0 |     14 | //
 | 
| sl@0 |     15 | 
 | 
| sl@0 |     16 | /**
 | 
| sl@0 |     17 |  @publishedPartner
 | 
| sl@0 |     18 |  @prototype
 | 
| sl@0 |     19 | */
 | 
| sl@0 |     20 | 
 | 
| sl@0 |     21 | #ifndef __WSDRAWABLESOURCEPROVIDER_H__
 | 
| sl@0 |     22 | #define __WSDRAWABLESOURCEPROVIDER_H__
 | 
| sl@0 |     23 | 
 | 
| sl@0 |     24 | #include <graphics/sgresource.h>
 | 
| sl@0 |     25 | #include <graphics/wsgraphicdrawerinterface.h>
 | 
| sl@0 |     26 | 
 | 
| sl@0 |     27 | /**
 | 
| sl@0 |     28 | Window server evokes this interface from rendering stage plugin every time client 
 | 
| sl@0 |     29 | requests resource drawing operations.
 | 
| sl@0 |     30 | 
 | 
| sl@0 |     31 | @publishedPartner
 | 
| sl@0 |     32 | @prototype
 | 
| sl@0 |     33 |  */
 | 
| sl@0 |     34 | class MWsDrawableSourceProvider : public MWsObjectProvider
 | 
| sl@0 |     35 | 	{
 | 
| sl@0 |     36 | public:
 | 
| sl@0 |     37 | 	DECLARE_WS_TYPE_ID(KMWsDrawableSourceProvider)
 | 
| sl@0 |     38 | public:
 | 
| sl@0 |     39 | 	/**
 | 
| sl@0 |     40 | 	 Create a source object for future drawing of the drawable resource with the specified ID.
 | 
| sl@0 |     41 | 	 @param aDrawableId The ID of the drawable resource.
 | 
| sl@0 |     42 | 	 @param aSource On output, a pointer to the new source object associated with the drawable resource,
 | 
| sl@0 |     43 | 	                which must be passed in calls to DrawResource() and CloseDrawableSource().
 | 
| sl@0 |     44 | 	      	        After the call to CloseDrawableSource() the source object is destroyed and this pointer becomes invalid.
 | 
| sl@0 |     45 | 	      	        The type of the source object is defined by the implementation of MWsDrawableSourceProvider.
 | 
| sl@0 |     46 | 	 @post If successful, a new source object is created and the associated drawable resource is ready to use.
 | 
| sl@0 |     47 | 	 @return KErrNone if successful, otherwise one of the system-wide error codes.
 | 
| sl@0 |     48 | 	 */
 | 
| sl@0 |     49 | 	virtual TInt CreateDrawableSource(const TSgDrawableId& aDrawableId, TAny*& aSource) = 0;
 | 
| sl@0 |     50 | 
 | 
| sl@0 |     51 | 	/**
 | 
| sl@0 |     52 | 	 Destroy a source object associated with a drawable resource.
 | 
| sl@0 |     53 | 	 @param aSource A pointer to a source object created by a previous call to CreateDrawableSource().
 | 
| sl@0 |     54 | 	 @post Drawing of the associated drawable resource is no longer possible.
 | 
| sl@0 |     55 | 	 @return KErrNone if successful, otherwise one of the system-wide error codes.
 | 
| sl@0 |     56 | 	 */
 | 
| sl@0 |     57 | 	virtual void CloseDrawableSource(TAny* aSource) = 0;
 | 
| sl@0 |     58 | 
 | 
| sl@0 |     59 | 	/**
 | 
| sl@0 |     60 | 	 Draw a graphics resource.
 | 
| sl@0 |     61 | 	 @param aSource A pointer to the source object associated with the drawable resource.
 | 
| sl@0 |     62 | 	 @param aPos Destination position for the top-left corner of the drawable resource.
 | 
| sl@0 |     63 | 	 @param	aRotation Rotation to be applied to the drawable resource before it is drawn.
 | 
| sl@0 |     64 | 	 @pre A source object must have been created for the drawable resource by a previous call to CreateDrawableSource().
 | 
| sl@0 |     65 | 	 */
 | 
| sl@0 |     66 | 	virtual void DrawResource(const TAny* aSource, const TPoint& aPos, CWindowGc::TGraphicsRotation aRotation = CWindowGc::EGraphicsRotationNone) = 0;
 | 
| sl@0 |     67 | 
 | 
| sl@0 |     68 | 	/**
 | 
| sl@0 |     69 | 	 Draw a graphics resource.
 | 
| sl@0 |     70 | 	 @param aSource A pointer to the source object associated with the drawable resource.
 | 
| sl@0 |     71 | 	 @param aRect Destination rectangle. The drawable resource could be scaled if its size doesn't match the destination rectangle.
 | 
| sl@0 |     72 | 	 @param	aRotation Rotation to be applied to the drawable resource before it is drawn.
 | 
| sl@0 |     73 | 	 @pre A source object must have been created for the drawable resource by a previous call to CreateDrawableSource().
 | 
| sl@0 |     74 | 	 */
 | 
| sl@0 |     75 | 	virtual void DrawResource(const TAny* aSource, const TRect& aRect, CWindowGc::TGraphicsRotation aRotation = CWindowGc::EGraphicsRotationNone) = 0;
 | 
| sl@0 |     76 | 
 | 
| sl@0 |     77 | 	/**
 | 
| sl@0 |     78 | 	 Draw a graphics resource.
 | 
| sl@0 |     79 | 	 @param aSource A pointer to the source object associated with the drawable resource.
 | 
| sl@0 |     80 | 	 @param aRectDest Destination rectangle. The drawable resource could be scaled if its size doesn't match the destination rectangle.
 | 
| sl@0 |     81 | 	 @param aRectSrc A rectangle defining the piece of the drawable resource to be drawn, in the co-ordinate system of the drawable resource.
 | 
| sl@0 |     82 | 	 @param	aRotation Rotation to be applied to the drawable resource before it is drawn.
 | 
| sl@0 |     83 | 	 @pre A source object must have been created for the drawable resource by a previous call to CreateDrawableSource().
 | 
| sl@0 |     84 | 	 */
 | 
| sl@0 |     85 | 	virtual void DrawResource(const TAny* aSource, const TRect& aRectDest, const TRect& aRectSrc, CWindowGc::TGraphicsRotation aRotation = CWindowGc::EGraphicsRotationNone) = 0;
 | 
| sl@0 |     86 | 
 | 
| sl@0 |     87 | 	/**
 | 
| sl@0 |     88 | 	 Draw a graphics resource.
 | 
| sl@0 |     89 | 	 @param aSource A pointer to the source object associated with the drawable resource.
 | 
| sl@0 |     90 | 	 @param aRect Destination rectangle. The drawable resource could be scaled if its size doesn't match the destination rectangle.
 | 
| sl@0 |     91 | 	 @param	aParam Parameters specifying how to draw the drawable resource.
 | 
| sl@0 |     92 | 	 @pre A source object must have been created for the drawable resource by a previous call to CreateDrawableSource().
 | 
| sl@0 |     93 | 	 */
 | 
| sl@0 |     94 | 	virtual void DrawResource(const TAny* aSource, const TRect& aRect, const TDesC8& aParam) = 0;
 | 
| sl@0 |     95 | 	};
 | 
| sl@0 |     96 | 
 | 
| sl@0 |     97 | #endif //__WSDRAWABLESOURCEPROVIDER_H__
 |