os/graphics/graphicsutils/commongraphicsheaders/inc/displaycontrolbase.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
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
 @file
sl@0
    18
 @publishedPartner
sl@0
    19
 @prototype
sl@0
    20
*/
sl@0
    21
sl@0
    22
#ifndef DISPLAYCONTROLBASE__INCLUDED_
sl@0
    23
#define DISPLAYCONTROLBASE__INCLUDED_
sl@0
    24
#include <graphics/displayconfiguration.h>
sl@0
    25
/** Common base interface for display control facilities.
sl@0
    26
sl@0
    27
*/
sl@0
    28
class MDisplayControlBase
sl@0
    29
	{
sl@0
    30
public:
sl@0
    31
	enum	
sl@0
    32
		{
sl@0
    33
		KUidDisplayControlBase =  0x10286496,
sl@0
    34
		ETypeId=	 KUidDisplayControlBase 
sl@0
    35
		};
sl@0
    36
	
sl@0
    37
	class TResolution
sl@0
    38
		{	//Kernel mode makes use of agregate constructors
sl@0
    39
	public:
sl@0
    40
		enum
sl@0
    41
			{
sl@0
    42
			ERotationNormalSupported = 0,
sl@0
    43
			ERotation90Supported = 1,
sl@0
    44
			ERotation180Supported = 2,
sl@0
    45
			ERotation270Supported = 3,
sl@0
    46
			EIsVirtual = 4,
sl@0
    47
			};
sl@0
    48
		inline TResolution(TSize aPixelSize, TSize aTwipsSize, TBitFlags32 aFlags = ERotationNormalSupported);
sl@0
    49
//		inline TResolution(const TResolution& aSrc);
sl@0
    50
sl@0
    51
	public:
sl@0
    52
		/** The physical display size in pixels with no rotation (i.e. ERotationNormal).
sl@0
    53
		    See SetConfiguration().
sl@0
    54
		*/
sl@0
    55
		TSize iPixelSize;
sl@0
    56
		/** The physical display size in twips with no rotation (i.e. ERotationNormal).
sl@0
    57
		    See SetConfiguration().
sl@0
    58
		*/
sl@0
    59
		TSize iTwipsSize;
sl@0
    60
		/** A bitwise combination of TDisplayConfiguration1::TGraphicsOrientation values.
sl@0
    61
		*/
sl@0
    62
		TBitFlags32 iFlags;
sl@0
    63
sl@0
    64
	private:
sl@0
    65
		/** Reserved for extension and alignment.
sl@0
    66
		*/
sl@0
    67
		TUint32 iReservedAlignmentSpare_0;
sl@0
    68
		};
sl@0
    69
public:
sl@0
    70
	/** Returns the number of discrete resolutions that can be retrieved using
sl@0
    71
		GetResolutions().
sl@0
    72
		
sl@0
    73
		If the display is disconnected, the return value shall be KErrDisconnected. Implicitly, 
sl@0
    74
		there are no resolutions available. When initially connected, the number of resolutions 
sl@0
    75
		may be limited, possibly zero, only increasing when the display has reported 
sl@0
    76
		which resolutions it supports.
sl@0
    77
		
sl@0
    78
		@return Number of resolutions available, or KErrDisconnected.
sl@0
    79
	*/
sl@0
    80
	virtual TInt NumberOfResolutions()const =0;
sl@0
    81
	/** Retrieves the set of available display resolutions and supported rotations per resolution.
sl@0
    82
		
sl@0
    83
		If a display can be disabled, the list shall include a resolution with the size (0,0). If the 
sl@0
    84
		display is connected but disabled, the list may also include other supported resolutions. 
sl@0
    85
		If a display cannot be disabled, the list shall not include (0,0).
sl@0
    86
sl@0
    87
		The flags field in each entry shall contain the set of rotations supported for the given 
sl@0
    88
		resolution. The size fields shall always give the resolution with no rotation applied (ERotationNormal), 
sl@0
    89
		whether or not that rotation is supported.
sl@0
    90
sl@0
    91
		If the EIsVirtual flags is set, the resolution will be simulated by scaling the output. Scaling 
sl@0
    92
		quality varies between platfoms, and in general the best quality will be achieved using a 
sl@0
    93
		physical resolution, where the EIsVirtual flag is not set.
sl@0
    94
sl@0
    95
		The size in twips may be an estimate for some displays, but can be used to determine the pixel aspect 
sl@0
    96
		ratio in combination with the size in pixels.
sl@0
    97
sl@0
    98
		The array shall be reset and the contents replaced by the available resolutions. If an error is returned, 
sl@0
    99
		the contents of the array shall be undefined.
sl@0
   100
sl@0
   101
		If no display is connected, the return value shall be KErrDisconnected. When initially connected, the 
sl@0
   102
		set of resolutions available may be limited, possibly zero, increasing when the display has reported 
sl@0
   103
		which resolutions it supports.
sl@0
   104
sl@0
   105
		If the array is not large enough to retrieve the set of resolutions initially, it will be expanded once, 
sl@0
   106
		or fail with KErrNoMemory. If the number of resolutions increases again after this expansion, the 
sl@0
   107
		function will fail with KErrOverflow. The caller may re-try the operation.
sl@0
   108
sl@0
   109
		@see TResolutionFlags
sl@0
   110
		
sl@0
   111
		@param aResolutions Buffer to receive resolutions.
sl@0
   112
		
sl@0
   113
		@return KErrNone on success, KErrDisconnected if no display is connected, KErrNoMemory if a memory allocation 
sl@0
   114
		failure occurs or KErrOverflow if the number of elements increased.
sl@0
   115
	*/	
sl@0
   116
	virtual TInt GetResolutions(RArray<TResolution>& aResolutions)const =0;
sl@0
   117
	/** Gets the current display configuration.
sl@0
   118
sl@0
   119
		Note that some entries in the configuration may be undefined if they are unknown, so their validity should 
sl@0
   120
		either be checked using the accessor return code, or using the IsDefined() function before reading them.
sl@0
   121
sl@0
   122
		If the display is not connected, the resolution shall be set as undefined. If the display is connected, but 
sl@0
   123
		disabled, the resolution shall be (0,0). Other attributes may or may not be defined in these states.
sl@0
   124
sl@0
   125
		@see TDisplayConfiguration::IsDefined
sl@0
   126
		@see SetConfiguration
sl@0
   127
sl@0
   128
		@param aConfig Receives the display configuration.
sl@0
   129
	*/	
sl@0
   130
	virtual void GetConfiguration(TDisplayConfiguration& aConfig)const =0;
sl@0
   131
	/** Sets the new display configuration.
sl@0
   132
sl@0
   133
		It is valid to leave settings undefined to let the implementer determine the optimal combination. If a defined 
sl@0
   134
		setting cannot be achieved, the function shall fail with KErrArgument.
sl@0
   135
	
sl@0
   136
		Note that the new configuration will be in use when the function returns, but the change may not appear on screen 
sl@0
   137
		immediately. It may be deferred due to rendering, composition and display synchronization taking place, but will 
sl@0
   138
		generally become apparent in the next frame update.
sl@0
   139
	
sl@0
   140
		Whether a given configuration is valid or not shall be platform dependent, and may depend on the current screen 
sl@0
   141
		size mode. Some platforms may restrict resolutions to those listed in the resolution list, while others may be 
sl@0
   142
		more flexible. Where the resolution does not match a physical resolution from the list, display quality may be
sl@0
   143
		reduced.
sl@0
   144
	
sl@0
   145
		Setting a resolution of (0,0), if allowed, shall disable display output. Otherwise the pixel resolution shall 
sl@0
   146
		define the maximum number of pixels that can be rendered using CWindowGc, and this area shall fill the display. 
sl@0
   147
		Alternative means of rendering may be displayed at the physical resolution, irrespective of the current 
sl@0
   148
		configuration.
sl@0
   149
	
sl@0
   150
		@see CWsScreenDevice::SetScreenMode
sl@0
   151
		@see CWindowGc
sl@0
   152
sl@0
   153
		@param aConfig Display configuration to set, and receive the complete configuration that will be used.
sl@0
   154
sl@0
   155
		@capability WriteDeviceData
sl@0
   156
sl@0
   157
		@return A system-wide error code.
sl@0
   158
	*/	
sl@0
   159
	virtual TInt SetConfiguration(const TDisplayConfiguration& aConfig) =0;
sl@0
   160
	/** Returns the preferred version of the TDisplayConfiguration object.
sl@0
   161
sl@0
   162
		GetConfiguration() and SetConfiguration() may be passed any version of the TDisplayConfiguration class, as returned 
sl@0
   163
		by TDisplayConfiguration::Version(). If an earlier version is presented, the implementation will treat later 
sl@0
   164
		attributes as undefined. If a later structure is presented, then the additional attributes will be ignored.
sl@0
   165
sl@0
   166
		This method may be used to fine-tune use of the interface, by avoiding the generation of attribute data that will not 
sl@0
   167
		be used, or by reducing the options presented to users.
sl@0
   168
sl@0
   169
		@return The optimum version of TDisplayConfiguration to pass to SetConfiguration() and GetConfiguration().
sl@0
   170
	*/	
sl@0
   171
	virtual TInt PreferredDisplayVersion()const =0;
sl@0
   172
	};
sl@0
   173
sl@0
   174
inline MDisplayControlBase::TResolution::TResolution(TSize aPixelSize, TSize aTwipsSize, TBitFlags32 aFlags)
sl@0
   175
	:	iPixelSize(aPixelSize),iTwipsSize(aTwipsSize),iFlags(aFlags),iReservedAlignmentSpare_0(0)
sl@0
   176
	{	}
sl@0
   177
//inline MDisplayControlBase::TResolution::TResolution(const TResolution& aSrc)
sl@0
   178
//:	iSize(aSrc.iSize),iRotations(aSrc.iRotations),iReservedAlignmentSpare_0(0)
sl@0
   179
//	{	}
sl@0
   180
sl@0
   181
#endif // DISPLAYCONTROLBASE__INCLUDED_