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