windowing/windowserver/nga/SERVER/devicemap.h
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Class for mapping between twips and device-specific units (pixels).
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 #ifndef __DEVICEMAP_H__
       
    20 #define __DEVICEMAP_H__
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 
       
    25 class MWsScreenDevice;
       
    26 
       
    27 class CGraphicsDeviceMap : public CBase
       
    28 	{
       
    29 public:
       
    30 	static CGraphicsDeviceMap* NewL(const MWsScreenDevice& aScreenDevice);
       
    31 	
       
    32 	TPoint TwipsToPixels(const TPoint& aTwipPoint) const;
       
    33 	TRect TwipsToPixels(const TRect& aTwipRect) const;
       
    34 	TPoint PixelsToTwips(const TPoint& aPixelPoint) const;
       
    35 	TRect PixelsToTwips(const TRect& aPixelRect) const;
       
    36 	/** Converts a horizontal dimension from twips to pixels.
       
    37 		
       
    38 	@param aTwips A horizontal dimension of a device in twips. 
       
    39 	@return A horizontal dimension of a device in pixels. */
       
    40 	TInt HorizontalTwipsToPixels(TInt aTwips) const;
       
    41 
       
    42 	/** Converts a vertical dimension from twips to pixels.
       
    43 	
       
    44 	@param aTwips A vertical dimension of a device in twips. 
       
    45 	@return A vertical dimension of a device in pixels. */
       
    46 	TInt VerticalTwipsToPixels(TInt aTwips) const;
       
    47 
       
    48 	/** Converts a horizontal dimension from pixels to twips.
       
    49 	
       
    50 	@param aPixels A horizontal dimension of a device in pixels. 
       
    51 	@return A horizontal dimension of a device in twips. */
       
    52 	TInt HorizontalPixelsToTwips(TInt aPixels) const;
       
    53 
       
    54 	/** Converts a vertical dimension from pixels to twips.
       
    55 		
       
    56 	@param aPixels A vertical dimension of a device in pixels. 
       
    57 	@return A vertical dimension of a device in twips. */
       
    58 	TInt VerticalPixelsToTwips(TInt aPixels) const;
       
    59 private:
       
    60 	CGraphicsDeviceMap(const MWsScreenDevice& aScreenDevice);
       
    61 private:
       
    62 	const MWsScreenDevice* iScreenDevice;
       
    63 	};
       
    64 #endif