|
1 // Copyright (c) 2010 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 // This file is intended for use by EGL implementations only. It |
|
15 // provides a standardised mechanism for interfacing with window |
|
16 // objects that are passed to EGL. |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @publishedPartner |
|
22 @prototype |
|
23 */ |
|
24 |
|
25 |
|
26 #ifndef __EGLWINDOWINTERFACE_H__ |
|
27 #define __EGLWINDOWINTERFACE_H__ |
|
28 |
|
29 |
|
30 #include <graphics/eglwindowcommon.h> |
|
31 #include <EGL/egltypes.h> |
|
32 |
|
33 |
|
34 /** |
|
35 Forward declarations. |
|
36 */ |
|
37 class REglWindowBase; |
|
38 |
|
39 |
|
40 /** |
|
41 TEglWindowInterface exposes a proxy interface that forwards actions |
|
42 to the NativeWindow that the instance is constructed from. The |
|
43 interface consists of all the functionality that an EGL |
|
44 implementation requires to implement EGL window surfaces. |
|
45 */ |
|
46 NONSHARABLE_CLASS(TEglWindowInterface) |
|
47 { |
|
48 public: |
|
49 /** |
|
50 Constructs a TEglWindowInterface to provide an interface to the |
|
51 EGLNativeWindowType handle passed in. |
|
52 |
|
53 @param aNativeWindow Pointer to the native window. |
|
54 |
|
55 @pre aNativeWindow is either an initialised RWindow or an |
|
56 initialised REglWindowBase derived type. |
|
57 |
|
58 @error If aNativeWindow is not an RWindow or an REglWindowBase |
|
59 derived type, behaviour is undefined. |
|
60 */ |
|
61 IMPORT_C TEglWindowInterface(EGLNativeWindowType aNativeWindow); |
|
62 |
|
63 /** |
|
64 If the native window that is wrapped by the instance of |
|
65 TEglWindowInterface is valid, this function returns ETrue, else |
|
66 EFalse is returned. |
|
67 */ |
|
68 IMPORT_C TBool IsValid() const; |
|
69 |
|
70 /** |
|
71 Returns the size in pixels of the native window. |
|
72 */ |
|
73 IMPORT_C TSize SizeInPixels() const; |
|
74 |
|
75 /** |
|
76 Returns the size in twips of the native window. This can be used |
|
77 in conjunction with SizeInPixels() to work out the dot pitch and |
|
78 pixel aspect ratio of the EGL surface attached to this window. |
|
79 These attributes are queryable by an EGL client. |
|
80 */ |
|
81 IMPORT_C TSize SizeInTwips() const; |
|
82 |
|
83 /** |
|
84 Returns the screen number that the native window is displayed on |
|
85 or KAllScreens to indicate that the window must be displayable on |
|
86 all screens in the system. |
|
87 */ |
|
88 IMPORT_C TInt ScreenNumber() const; |
|
89 |
|
90 /** |
|
91 Sets the window's background color. This is the area of the |
|
92 window not covered by a background surface, either because it |
|
93 has no background surface, or because the surface configuration |
|
94 specifies that the surface does not cover the whole of the |
|
95 window's area. |
|
96 |
|
97 @param aColor The color that the window's background |
|
98 will be set to. |
|
99 |
|
100 @param aTriggerRedraw If set causes any affected portions of |
|
101 the display to be redrawn. |
|
102 |
|
103 @note The appearance on screen may not change until the window |
|
104 is redrawn and the next refresh occurs. The |
|
105 aTriggerRedraw parameter can be set to trigger this |
|
106 redrawing. |
|
107 */ |
|
108 IMPORT_C void SetBackgroundColor(TRgb aColor, TBool aTriggerRedraw); |
|
109 |
|
110 /** |
|
111 This sets a surface to appear in front of the native window's |
|
112 background within a given area of that window. The |
|
113 TSurfaceConfiguration object contains the Surface ID and allows |
|
114 various surface presentation attributes to be specified. This |
|
115 describes the mapping from surface co-ordinates to screen |
|
116 co-ordinates, allowing for scaling, cropping, and rotation. |
|
117 |
|
118 @param aConfiguration The set of configuration that applies to |
|
119 the surface. |
|
120 |
|
121 @param aTriggerRedraw If set causes any affected portions of |
|
122 the display to be redrawn. |
|
123 |
|
124 @pre The surface is opaque; otherwise results are not defined. |
|
125 |
|
126 @pre The surface must not be the null surface ID; otherwise |
|
127 the client is panicked with code ENWPanicInvalidSurface. |
|
128 |
|
129 @note If the same surface ID is already set as the window |
|
130 background surface, then only the configuration |
|
131 parameters will be updated. |
|
132 |
|
133 @note If the window already has a background surface (that is |
|
134 not same as the new surface) then that surface will be |
|
135 removed and the new background surface will be set. The |
|
136 Surface ID will be registered while attached to this |
|
137 window, incrementing the registration count by one. |
|
138 |
|
139 @post The window has a new background surface set to be within |
|
140 the given area. |
|
141 |
|
142 @return KErrNone on success or any system-wide error code. |
|
143 */ |
|
144 IMPORT_C TInt SetBackgroundSurface(const TSurfaceConfiguration &aConfiguration, TBool aTriggerRedraw); |
|
145 |
|
146 /** |
|
147 This removes any background surface that has previously been set |
|
148 to the window. The surface ID registration associated with the |
|
149 window will be released. The aTriggerRedraw parameter triggers a |
|
150 redraw of at least the affected areas of the window at the end of |
|
151 this method. |
|
152 |
|
153 @param aTriggerRedraw If set causes any affected portions of |
|
154 the display to be redrawn. |
|
155 |
|
156 @post Any background surface associated with this window has |
|
157 been removed. The appearance on screen may not change |
|
158 until the window is redrawn and the next refresh occurs. |
|
159 The aTriggerRedraw parameter can be set to trigger this |
|
160 redrawing. |
|
161 */ |
|
162 IMPORT_C void RemoveBackgroundSurface(TBool aTriggerRedraw); |
|
163 |
|
164 private: |
|
165 REglWindowBase* iEglWindow; |
|
166 }; |
|
167 |
|
168 |
|
169 #endif //__EGLWINDOWINTERFACE_H__ |