sl@0
|
1 |
// Copyright (c) 2007-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 |
// Graphics Resource - general functionality
|
sl@0
|
15 |
//
|
sl@0
|
16 |
|
sl@0
|
17 |
#ifndef SGRESOURCE_H
|
sl@0
|
18 |
#define SGRESOURCE_H
|
sl@0
|
19 |
|
sl@0
|
20 |
#include <e32std.h>
|
sl@0
|
21 |
#include <sgresource/sgconst.h>
|
sl@0
|
22 |
|
sl@0
|
23 |
/**
|
sl@0
|
24 |
Panic codes defined for use by the Graphics Resource API.
|
sl@0
|
25 |
*/
|
sl@0
|
26 |
enum TSgResourcePanicReason
|
sl@0
|
27 |
{
|
sl@0
|
28 |
ESgPanicNoDriver = 1,
|
sl@0
|
29 |
ESgPanicUnclosedResources = 2,
|
sl@0
|
30 |
ESgPanicBadDrawableHandle = 3,
|
sl@0
|
31 |
ESgPanicBadAttributeArrayIndex = 4
|
sl@0
|
32 |
};
|
sl@0
|
33 |
|
sl@0
|
34 |
/**
|
sl@0
|
35 |
Panics the calling thread with category “SGRES” and the given panic code.
|
sl@0
|
36 |
@param aReason The panic code.
|
sl@0
|
37 |
*/
|
sl@0
|
38 |
inline void Panic(TSgResourcePanicReason aReason);
|
sl@0
|
39 |
|
sl@0
|
40 |
/**
|
sl@0
|
41 |
A handle to the implementation of the Graphics Resource API
|
sl@0
|
42 |
initialised in the context of a process. It groups miscellaneous functions that
|
sl@0
|
43 |
do not apply to individual drawable resources.
|
sl@0
|
44 |
|
sl@0
|
45 |
At least one thread in the process must call RSgDriver::Open() before the
|
sl@0
|
46 |
Graphics Resource API can be used in the context of the process.
|
sl@0
|
47 |
When the Graphics Resource API is no longer needed RSgDriver::Close() should be
|
sl@0
|
48 |
called to release unused resources. Note that it is possible to call RSgDriver::Open()
|
sl@0
|
49 |
and RSgDriver::Close() from different threads.
|
sl@0
|
50 |
*/
|
sl@0
|
51 |
NONSHARABLE_CLASS(RSgDriver)
|
sl@0
|
52 |
{
|
sl@0
|
53 |
public:
|
sl@0
|
54 |
/**
|
sl@0
|
55 |
Default constructor.
|
sl@0
|
56 |
@post The instance of RSgDriver is a null handle.
|
sl@0
|
57 |
*/
|
sl@0
|
58 |
inline RSgDriver();
|
sl@0
|
59 |
|
sl@0
|
60 |
/**
|
sl@0
|
61 |
Initialises the implementation of the Graphics Resource API in the context
|
sl@0
|
62 |
of a process if it is not initialised already, updates the implementation
|
sl@0
|
63 |
opening count in the process and returns KErrNone if successful.
|
sl@0
|
64 |
Each successful call to RSgDriver::Open() in a process should be balanced
|
sl@0
|
65 |
by a corresponding call to RSgDriver::Close() in the same process, but not
|
sl@0
|
66 |
necessarily from the same thread.
|
sl@0
|
67 |
|
sl@0
|
68 |
Note that an RSgDriver handle should never be bitwise-copied into another
|
sl@0
|
69 |
but this function should be used instead in all cases, since it is the only
|
sl@0
|
70 |
way to ensure that the implementation opening count is kept up to date.
|
sl@0
|
71 |
Failure to keep the implementation opening count up to date may result in
|
sl@0
|
72 |
the implementation of the Graphics Resource API becoming unexpectedly
|
sl@0
|
73 |
unavailable and, as a consequence, in an abnormal termination of the process.
|
sl@0
|
74 |
|
sl@0
|
75 |
@pre The instance of RSgDriver is a null handle.
|
sl@0
|
76 |
@post The instance of RSgDriver references the implementation of the Graphics
|
sl@0
|
77 |
Resource API initialised in the context of the process.
|
sl@0
|
78 |
@return KErrNone if successful;
|
sl@0
|
79 |
KErrInUse if the instance of RSgDriver is not a null handle;
|
sl@0
|
80 |
KErrNoMemory if there is not enough system memory to initialise the
|
sl@0
|
81 |
implementation of the Graphics Resource API;
|
sl@0
|
82 |
KErrNoGraphicsMemory if there is not enough specialised graphics memory
|
sl@0
|
83 |
to initialise the implementation of the Graphics Resource API.
|
sl@0
|
84 |
*/
|
sl@0
|
85 |
IMPORT_C TInt Open();
|
sl@0
|
86 |
|
sl@0
|
87 |
/**
|
sl@0
|
88 |
Decrements the implementation opening count in the process.
|
sl@0
|
89 |
When the count reaches zero, checks whether there are still open handles to
|
sl@0
|
90 |
drawable resources in the process and carries out termination tasks to
|
sl@0
|
91 |
release the internal resources used by the implementation of the Graphics
|
sl@0
|
92 |
Resource API.
|
sl@0
|
93 |
|
sl@0
|
94 |
An attempt to carry out these termination tasks will panic with category
|
sl@0
|
95 |
“SGRES” and code 2 in debug builds if there still are any open handles to
|
sl@0
|
96 |
drawable resources in the process. In release builds all the open handles
|
sl@0
|
97 |
to drawable resources in the process are silently closed at this point.
|
sl@0
|
98 |
Calling this function on a null handle has no effect.
|
sl@0
|
99 |
|
sl@0
|
100 |
@post The instance of RSgDriver is a null handle.
|
sl@0
|
101 |
@panic SGRES 2 Debug builds only. There are open handles to drawable resources
|
sl@0
|
102 |
in the process during termination.
|
sl@0
|
103 |
*/
|
sl@0
|
104 |
IMPORT_C void Close();
|
sl@0
|
105 |
|
sl@0
|
106 |
/**
|
sl@0
|
107 |
Makes the extension interface specified by the type of the parameter
|
sl@0
|
108 |
aInterfacePtr available in the context of the process.
|
sl@0
|
109 |
This function stores a pointer to the extension interface in the variable
|
sl@0
|
110 |
referenced by the parameter aInterfacePtr and returns KErrNone if successful.
|
sl@0
|
111 |
|
sl@0
|
112 |
@pre An RSgDriver has been opened in the context of the process.
|
sl@0
|
113 |
@param[out] aInterfacePtr Reference to a pointer to the interface class that on return points
|
sl@0
|
114 |
to the extension interface or, in case of error, is set to NULL.
|
sl@0
|
115 |
@return KErrNone if successful;
|
sl@0
|
116 |
KErrBadHandle if the instance of RSgDriver is a null handle;
|
sl@0
|
117 |
KErrExtensionNotSupported if the requested extension interface is not supported.
|
sl@0
|
118 |
*/
|
sl@0
|
119 |
template<class M> inline TInt GetInterface(M*& aInterfacePtr) const;
|
sl@0
|
120 |
|
sl@0
|
121 |
/**
|
sl@0
|
122 |
Returns the version of the implementation of the Graphics Resource API.
|
sl@0
|
123 |
The version comprises 3 numbers: major version number, minor version number
|
sl@0
|
124 |
and build number.
|
sl@0
|
125 |
|
sl@0
|
126 |
Major revisions mean incompatible changes in the API.
|
sl@0
|
127 |
Minor revisions mean forward-compatible changes in the API.
|
sl@0
|
128 |
Build numbers are unrelated to API changes.
|
sl@0
|
129 |
|
sl@0
|
130 |
@return The version of the implementation of the Graphics Resource API.
|
sl@0
|
131 |
*/
|
sl@0
|
132 |
IMPORT_C static TVersion Version();
|
sl@0
|
133 |
private:
|
sl@0
|
134 |
/**
|
sl@0
|
135 |
Copy constructor.
|
sl@0
|
136 |
Implementation not provided. Declared private to prevent bit-wise copying
|
sl@0
|
137 |
of handles.
|
sl@0
|
138 |
*/
|
sl@0
|
139 |
RSgDriver(const RSgDriver&);
|
sl@0
|
140 |
|
sl@0
|
141 |
/**
|
sl@0
|
142 |
Assignment operator.
|
sl@0
|
143 |
Implementation not provided. Declared private to prevent bit-wise copying
|
sl@0
|
144 |
of handles.
|
sl@0
|
145 |
*/
|
sl@0
|
146 |
const RSgDriver& operator =(const RSgDriver&);
|
sl@0
|
147 |
|
sl@0
|
148 |
/**
|
sl@0
|
149 |
Makes the extension interface with the given UID available in the context
|
sl@0
|
150 |
of the process.
|
sl@0
|
151 |
This function stores a pointer to the extension interface in the variable
|
sl@0
|
152 |
referenced by the parameter aInterfacePtr and returns KErrNone if successful.
|
sl@0
|
153 |
|
sl@0
|
154 |
@pre An RSgDriver has been opened in the context of the process.
|
sl@0
|
155 |
@param[in] aInterfaceUid The UID of the extension interface.
|
sl@0
|
156 |
@param[out] aInterfacePtr Reference to an untyped pointer that on return points
|
sl@0
|
157 |
to the extension interface or, in case of error, is set to NULL.
|
sl@0
|
158 |
@return KErrNone if successful;
|
sl@0
|
159 |
KErrBadHandle if the instance of RSgDriver is a null handle;
|
sl@0
|
160 |
KErrArgument if aInterfaceUid is the null UID;
|
sl@0
|
161 |
KErrExtensionNotSupported if the requested extension interface is not supported.
|
sl@0
|
162 |
*/
|
sl@0
|
163 |
IMPORT_C TInt GetInterface(TUid aInterfaceUid, TAny*& aInterfacePtr) const;
|
sl@0
|
164 |
private:
|
sl@0
|
165 |
/** A pointer to an implementation-defined object initially set to NULL by the constructor.*/
|
sl@0
|
166 |
TAny* iImpl;
|
sl@0
|
167 |
};
|
sl@0
|
168 |
|
sl@0
|
169 |
/**
|
sl@0
|
170 |
An extension attribute.
|
sl@0
|
171 |
*/
|
sl@0
|
172 |
NONSHARABLE_CLASS(TSgAttribute)
|
sl@0
|
173 |
{
|
sl@0
|
174 |
public:
|
sl@0
|
175 |
/**
|
sl@0
|
176 |
Default constructor.
|
sl@0
|
177 |
Data members remain uninitialised.
|
sl@0
|
178 |
*/
|
sl@0
|
179 |
inline TSgAttribute();
|
sl@0
|
180 |
|
sl@0
|
181 |
/**
|
sl@0
|
182 |
Constructor which initialises data members to the given values.
|
sl@0
|
183 |
*/
|
sl@0
|
184 |
inline TSgAttribute(TUid aUid, TInt aValue);
|
sl@0
|
185 |
public:
|
sl@0
|
186 |
/** A UID that identifies the type of extension attribute.*/
|
sl@0
|
187 |
TUid iUid;
|
sl@0
|
188 |
/** The value of the extension attribute.*/
|
sl@0
|
189 |
TInt iValue;
|
sl@0
|
190 |
};
|
sl@0
|
191 |
|
sl@0
|
192 |
/**
|
sl@0
|
193 |
Base class of all attribute array classes.
|
sl@0
|
194 |
It defines functions for bounds-checked access to extension attributes.
|
sl@0
|
195 |
*/
|
sl@0
|
196 |
NONSHARABLE_CLASS(TSgAttributeArrayBase)
|
sl@0
|
197 |
{
|
sl@0
|
198 |
public:
|
sl@0
|
199 |
/**
|
sl@0
|
200 |
Returns the number of extension attributes in the array.
|
sl@0
|
201 |
@return The number of extension attributes in the array.
|
sl@0
|
202 |
*/
|
sl@0
|
203 |
inline TInt Count() const;
|
sl@0
|
204 |
|
sl@0
|
205 |
/**
|
sl@0
|
206 |
Returns a reference to the extension attribute located in the array at the
|
sl@0
|
207 |
given position.
|
sl@0
|
208 |
|
sl@0
|
209 |
@pre aIndex is equal to or greater than zero and less than the number of
|
sl@0
|
210 |
extension attributes in the array.
|
sl@0
|
211 |
@param aIndex The position of the extension attribute in the array.
|
sl@0
|
212 |
@return A reference to the extension attribute located in the array at the
|
sl@0
|
213 |
given position.
|
sl@0
|
214 |
@panic SGRES 4 Debug builds only. aIndex is out of bounds.
|
sl@0
|
215 |
*/
|
sl@0
|
216 |
inline TSgAttribute& operator [](TInt aIndex);
|
sl@0
|
217 |
|
sl@0
|
218 |
/**
|
sl@0
|
219 |
Returns a const-qualified reference to the extension attribute located in
|
sl@0
|
220 |
the array at the given position.
|
sl@0
|
221 |
|
sl@0
|
222 |
@pre aIndex is equal to or greater than zero and less than the number of
|
sl@0
|
223 |
extension attributes in the array.
|
sl@0
|
224 |
@param aIndex The position of the extension attribute in the array.
|
sl@0
|
225 |
@return A reference to the extension attribute located in the array at the
|
sl@0
|
226 |
given position.
|
sl@0
|
227 |
@panic SGRES 4 Debug builds only. aIndex is out of bounds.
|
sl@0
|
228 |
*/
|
sl@0
|
229 |
inline const TSgAttribute& operator [](TInt aIndex) const;
|
sl@0
|
230 |
protected:
|
sl@0
|
231 |
/**
|
sl@0
|
232 |
Constructor used by constructors of derived classes to initialise the
|
sl@0
|
233 |
attribute count.
|
sl@0
|
234 |
@param aCount The number of extension attributes.
|
sl@0
|
235 |
*/
|
sl@0
|
236 |
inline TSgAttributeArrayBase(TInt aCount);
|
sl@0
|
237 |
|
sl@0
|
238 |
/**
|
sl@0
|
239 |
Assignment operator.
|
sl@0
|
240 |
No operation is performed. Allows the compiler to generate assignment
|
sl@0
|
241 |
operators for derived classes automatically.
|
sl@0
|
242 |
*/
|
sl@0
|
243 |
inline void operator =(const TSgAttributeArrayBase&);
|
sl@0
|
244 |
private:
|
sl@0
|
245 |
const TInt iCount;
|
sl@0
|
246 |
};
|
sl@0
|
247 |
|
sl@0
|
248 |
/**
|
sl@0
|
249 |
A fixed-size array of extension attributes.
|
sl@0
|
250 |
It is a thin wrapper with bounds checking for arrays of TSgAttribute.
|
sl@0
|
251 |
*/
|
sl@0
|
252 |
template<TInt S>
|
sl@0
|
253 |
NONSHARABLE_CLASS(TSgAttributeArray): public TSgAttributeArrayBase
|
sl@0
|
254 |
{
|
sl@0
|
255 |
public:
|
sl@0
|
256 |
/**
|
sl@0
|
257 |
Default constructor.
|
sl@0
|
258 |
Data members remain uninitialised.
|
sl@0
|
259 |
*/
|
sl@0
|
260 |
inline TSgAttributeArray();
|
sl@0
|
261 |
private:
|
sl@0
|
262 |
TSgAttribute iAttributes[S];
|
sl@0
|
263 |
};
|
sl@0
|
264 |
|
sl@0
|
265 |
/**
|
sl@0
|
266 |
A system-wide unique 64-bit identifier that can be used to share a drawable
|
sl@0
|
267 |
resource between processes.
|
sl@0
|
268 |
|
sl@0
|
269 |
The actual value of a drawable resource identifier has no meaning to the user
|
sl@0
|
270 |
of the Graphics Resource API, except that 64 zero bits represent the null
|
sl@0
|
271 |
drawable resource identifier, which explicitly identifies no drawable resource.
|
sl@0
|
272 |
As a convenience, the constant KSgNullDrawableId is defined as the null drawable
|
sl@0
|
273 |
resource identifier.
|
sl@0
|
274 |
*/
|
sl@0
|
275 |
NONSHARABLE_CLASS(TSgDrawableId)
|
sl@0
|
276 |
{
|
sl@0
|
277 |
public:
|
sl@0
|
278 |
/**
|
sl@0
|
279 |
Equality operator.
|
sl@0
|
280 |
Tests whether the given drawable resource identifier is the same as this.
|
sl@0
|
281 |
|
sl@0
|
282 |
@param aId The drawable resource identifier to compare with this.
|
sl@0
|
283 |
@return ETrue if the 64-bit identifiers are the same, EFalse if not.
|
sl@0
|
284 |
*/
|
sl@0
|
285 |
inline TBool operator ==(TSgDrawableId aId) const;
|
sl@0
|
286 |
|
sl@0
|
287 |
/**
|
sl@0
|
288 |
Inequality operator.
|
sl@0
|
289 |
Tests whether the given drawable resource identifier is different from this.
|
sl@0
|
290 |
|
sl@0
|
291 |
@param aId The drawable resource identifier to compare with this.
|
sl@0
|
292 |
@return ETrue if the 64-bit identifiers are different, EFalse if they are the same.
|
sl@0
|
293 |
*/
|
sl@0
|
294 |
inline TBool operator !=(TSgDrawableId aId) const;
|
sl@0
|
295 |
public:
|
sl@0
|
296 |
/** The 64-bit identifier.*/
|
sl@0
|
297 |
TUint64 iId;
|
sl@0
|
298 |
};
|
sl@0
|
299 |
|
sl@0
|
300 |
/**
|
sl@0
|
301 |
The null drawable resource identifier.
|
sl@0
|
302 |
*/
|
sl@0
|
303 |
const TSgDrawableId KSgNullDrawableId = {0};
|
sl@0
|
304 |
|
sl@0
|
305 |
/**
|
sl@0
|
306 |
The UID identifying a RSgDrawable handle.
|
sl@0
|
307 |
This must never be changed.
|
sl@0
|
308 |
*/
|
sl@0
|
309 |
const TUid KSgDrawableTypeUid = {0x102858EB};
|
sl@0
|
310 |
|
sl@0
|
311 |
/**
|
sl@0
|
312 |
A drawable resource handle.
|
sl@0
|
313 |
A null handle is a handle that explicitly does not reference any drawable resource.
|
sl@0
|
314 |
An open handle is a handle that references an existing drawable resource.
|
sl@0
|
315 |
An invalid handle is a handle that is not null but does not reference any
|
sl@0
|
316 |
existing drawable resource.
|
sl@0
|
317 |
Drawable resources are reference-counted so that a drawable resource is not
|
sl@0
|
318 |
destroyed while there still are open handles to it in any process in the system.
|
sl@0
|
319 |
|
sl@0
|
320 |
RSgDrawable is not an abstract class, that is, it can be instantiated,
|
sl@0
|
321 |
but it can also be derived from to define subclasses representing types of
|
sl@0
|
322 |
handles that refer only to concrete types of drawable resources, for example,
|
sl@0
|
323 |
image handles. RSgImage is the only subclass of RSgDrawable defined in version
|
sl@0
|
324 |
1.1 of the Graphics Resource API.
|
sl@0
|
325 |
Instances of RSgDrawable are useful when drawable resources created in a
|
sl@0
|
326 |
component have to be passed to another component through a third component that
|
sl@0
|
327 |
cannot depend on the concrete type of the drawable resources being passed.
|
sl@0
|
328 |
@see RSgImage
|
sl@0
|
329 |
*/
|
sl@0
|
330 |
NONSHARABLE_CLASS(RSgDrawable)
|
sl@0
|
331 |
{
|
sl@0
|
332 |
public:
|
sl@0
|
333 |
/**
|
sl@0
|
334 |
Default constructor.
|
sl@0
|
335 |
@post The instance of RSgDrawable is a null handle.
|
sl@0
|
336 |
*/
|
sl@0
|
337 |
inline RSgDrawable();
|
sl@0
|
338 |
|
sl@0
|
339 |
/**
|
sl@0
|
340 |
Opens a new handle to the drawable resource with the given drawable resource
|
sl@0
|
341 |
identifier.
|
sl@0
|
342 |
The drawable resource may have been created in the same process or in a
|
sl@0
|
343 |
different one. This function does not allocate any specialised graphics memory.
|
sl@0
|
344 |
|
sl@0
|
345 |
Note that an RSgDrawable handle should never be bitwise-copied into another
|
sl@0
|
346 |
but this function should be used instead in all cases, since it is the only
|
sl@0
|
347 |
way to ensure that the reference count of the drawable resource is kept up
|
sl@0
|
348 |
to date. Failure to keep the reference count of the resource up to date may
|
sl@0
|
349 |
result in invalid handles.
|
sl@0
|
350 |
|
sl@0
|
351 |
@pre An RSgDriver handle has been opened in the context of the process.
|
sl@0
|
352 |
@pre The instance of RSgDrawable is a null handle.
|
sl@0
|
353 |
@post The specified drawable resource has its reference count incremented by one.
|
sl@0
|
354 |
@param aId The identifier of the drawable resource.
|
sl@0
|
355 |
@param aAttributes A pointer to an array of extension attributes,
|
sl@0
|
356 |
if allowed by any extension of the Graphics Resource API, or NULL otherwise.
|
sl@0
|
357 |
@return KErrNone if successful;
|
sl@0
|
358 |
KErrInUse if the instance of RSgDrawable is an open handle;
|
sl@0
|
359 |
KErrArgument if the parameter aId is the null drawable resource identifier;
|
sl@0
|
360 |
KErrNotSupported if the parameter aAttributes is not NULL and one or more
|
sl@0
|
361 |
of the extension attributes in the array is not defined by any extension
|
sl@0
|
362 |
of the Graphics Resource API;
|
sl@0
|
363 |
KErrNotFound if the parameter aId cannot be found to refer to an existing
|
sl@0
|
364 |
drawable resource;
|
sl@0
|
365 |
KErrNoMemory if it fails due to lack of system memory.
|
sl@0
|
366 |
@panic SGRES 1 No RSgDriver handle has been opened in the context of the process.
|
sl@0
|
367 |
*/
|
sl@0
|
368 |
IMPORT_C TInt Open(TSgDrawableId aId, const TSgAttributeArrayBase* aAttributes = NULL);
|
sl@0
|
369 |
|
sl@0
|
370 |
/**
|
sl@0
|
371 |
Closes a handle to a drawable resource.
|
sl@0
|
372 |
It decrements the reference count of the drawable resource and, if it reaches
|
sl@0
|
373 |
zero, destroys the drawable resource.
|
sl@0
|
374 |
Calling this function on a null handle has no effect.
|
sl@0
|
375 |
|
sl@0
|
376 |
@pre If the instance of RSgDrawable is not a null handle then an RSgDriver
|
sl@0
|
377 |
handle has been opened in the context of the process.
|
sl@0
|
378 |
@post The instance of RSgDrawable is a null handle.
|
sl@0
|
379 |
@panic SGRES 1 The instance of RSgDrawable is not a null handle and no
|
sl@0
|
380 |
RSgDriver handle has been opened in the context of the process.
|
sl@0
|
381 |
@panic SGRES 3 The instance of RSgDrawable is an invalid handle.
|
sl@0
|
382 |
*/
|
sl@0
|
383 |
IMPORT_C void Close();
|
sl@0
|
384 |
|
sl@0
|
385 |
/**
|
sl@0
|
386 |
Returns the identifier of the drawable resource.
|
sl@0
|
387 |
This identifier can be used to open another handle to the drawable resource
|
sl@0
|
388 |
in the same process or in a different process.
|
sl@0
|
389 |
Calling this function on a null handle returns the null drawable resource
|
sl@0
|
390 |
identifier.
|
sl@0
|
391 |
|
sl@0
|
392 |
@pre If the instance of RSgDrawable is not a null handle then an RSgDriver
|
sl@0
|
393 |
handle has been opened in the context of the process.
|
sl@0
|
394 |
@return The identifier of the drawable resource.
|
sl@0
|
395 |
@panic SGRES 1 The instance of RSgDrawable is not a null handle and no
|
sl@0
|
396 |
RSgDriver handle has been opened in the context of the process.
|
sl@0
|
397 |
@panic SGRES 3 The instance of RSgDrawable is an invalid handle.
|
sl@0
|
398 |
*/
|
sl@0
|
399 |
IMPORT_C TSgDrawableId Id() const;
|
sl@0
|
400 |
|
sl@0
|
401 |
/**
|
sl@0
|
402 |
Tests whether a handle is null.
|
sl@0
|
403 |
@return ETrue if the instance of RSgDrawable is a null handle; EFalse otherwise.
|
sl@0
|
404 |
*/
|
sl@0
|
405 |
inline TBool IsNull() const;
|
sl@0
|
406 |
|
sl@0
|
407 |
/**
|
sl@0
|
408 |
Returns the UID corresponding to the concrete type of the drawable resource
|
sl@0
|
409 |
referenced by a handle at run-time.
|
sl@0
|
410 |
Calling this function on a null handle returns the null UID.
|
sl@0
|
411 |
In version 1.1 of the Graphics Resource API every drawable resource is an image,
|
sl@0
|
412 |
so this function always returns KSgImageTypeUid when called on an open handle.
|
sl@0
|
413 |
|
sl@0
|
414 |
@pre If the instance of RSgDrawable is not a null handle then an RSgDriver
|
sl@0
|
415 |
handle has been opened in the context of the process.
|
sl@0
|
416 |
@return The UID corresponding to the concrete type of the drawable resource.
|
sl@0
|
417 |
@panic SGRES 1 The instance of RSgDrawable is not a null handle and no
|
sl@0
|
418 |
RSgDriver handle has been opened in the context of the process.
|
sl@0
|
419 |
@panic SGRES 3 The instance of RSgDrawable is an invalid handle.
|
sl@0
|
420 |
*/
|
sl@0
|
421 |
IMPORT_C TUid DrawableType() const;
|
sl@0
|
422 |
|
sl@0
|
423 |
/**
|
sl@0
|
424 |
Makes the extension interface specified by the type of the parameter
|
sl@0
|
425 |
aInterfacePtr available on a drawable resource.
|
sl@0
|
426 |
This function stores a pointer to the extension interface in the variable
|
sl@0
|
427 |
referenced by the parameter aInterfacePtr and returns KErrNone if successful.
|
sl@0
|
428 |
The returned extension interface is tied to the drawable resource, that is,
|
sl@0
|
429 |
calls to functions in the returned extension interface operate on the
|
sl@0
|
430 |
drawable resource.
|
sl@0
|
431 |
|
sl@0
|
432 |
@pre An RSgDriver handle has been opened in the context of the process.
|
sl@0
|
433 |
@pre The instance of RSgDrawable is an open handle.
|
sl@0
|
434 |
@param[out] aInterfacePtr Reference to a pointer to the interface class. that on return points
|
sl@0
|
435 |
to the extension interface or, in case of error, is set to NULL.
|
sl@0
|
436 |
@return KErrNone if successful;
|
sl@0
|
437 |
KErrBadHandle if the instance of RSgDrawable is a null handle;
|
sl@0
|
438 |
KErrExtensionNotSupported if the requested extension interface is not supported.
|
sl@0
|
439 |
@panic SGRES 1 No RSgDriver handle has been opened in the context of the process.
|
sl@0
|
440 |
@panic SGRES 3 The instance of RSgDrawable is an invalid handle.
|
sl@0
|
441 |
*/
|
sl@0
|
442 |
template<class M> inline TInt GetInterface(M*& aInterfacePtr) const;
|
sl@0
|
443 |
protected:
|
sl@0
|
444 |
/**
|
sl@0
|
445 |
Handle base constructor.
|
sl@0
|
446 |
Used by constructors of derived classes to initialise the handle type.
|
sl@0
|
447 |
@post The instance of RSgDrawable is a null handle.
|
sl@0
|
448 |
@param aHandleType The UID identifying the handle type.
|
sl@0
|
449 |
*/
|
sl@0
|
450 |
inline RSgDrawable(TUid aHandleType);
|
sl@0
|
451 |
private:
|
sl@0
|
452 |
/**
|
sl@0
|
453 |
Copy constructor.
|
sl@0
|
454 |
Implementation not provided. Declared private to prevent bit-wise copying
|
sl@0
|
455 |
of handles.
|
sl@0
|
456 |
*/
|
sl@0
|
457 |
RSgDrawable(const RSgDrawable&);
|
sl@0
|
458 |
|
sl@0
|
459 |
/**
|
sl@0
|
460 |
Assignment operator.
|
sl@0
|
461 |
Implementation not provided. Declared private to prevent bit-wise copying
|
sl@0
|
462 |
of handles.
|
sl@0
|
463 |
*/
|
sl@0
|
464 |
const RSgDrawable& operator =(const RSgDrawable&);
|
sl@0
|
465 |
|
sl@0
|
466 |
/**
|
sl@0
|
467 |
Makes the extension interface with the given UID available on a drawable
|
sl@0
|
468 |
resource.
|
sl@0
|
469 |
This function stores a pointer to the extension interface in the variable
|
sl@0
|
470 |
referenced by the parameter aInterfacePtr and returns KErrNone if successful.
|
sl@0
|
471 |
The returned extension interface is tied to the drawable resource, that is,
|
sl@0
|
472 |
calls to functions in the returned extension interface operate on the
|
sl@0
|
473 |
drawable resource.
|
sl@0
|
474 |
|
sl@0
|
475 |
@pre An RSgDriver handle has been opened in the context of the process.
|
sl@0
|
476 |
@pre The instance of RSgDrawable is an open handle.
|
sl@0
|
477 |
@param[in] aInterfaceUid The UID of the extension interface.
|
sl@0
|
478 |
@param[out] aInterfacePtr Reference to an untyped pointer that on return points
|
sl@0
|
479 |
to the extension interface or, in case of error, is set to NULL.
|
sl@0
|
480 |
@return KErrNone if successful;
|
sl@0
|
481 |
KErrBadHandle if the instance of RSgDrawable is a null handle;
|
sl@0
|
482 |
KErrArgument if aInterfaceUid is the null UID;
|
sl@0
|
483 |
KErrExtensionNotSupported if the requested extension interface is not supported.
|
sl@0
|
484 |
@panic SGRES 1 No RSgDriver handle has been opened in the context of the process.
|
sl@0
|
485 |
@panic SGRES 3 The instance of RSgDrawable is an invalid handle.
|
sl@0
|
486 |
*/
|
sl@0
|
487 |
IMPORT_C TInt GetInterface(TUid aInterfaceUid, TAny*& aInterfacePtr) const;
|
sl@0
|
488 |
protected:
|
sl@0
|
489 |
/**
|
sl@0
|
490 |
A UID permanently set by the constructor to the constant
|
sl@0
|
491 |
KSgDrawableTypeUid, except for subclasses of RSgDrawable, in which case it
|
sl@0
|
492 |
is permanently set by the constructor to the UID corresponding to the
|
sl@0
|
493 |
concrete type of drawable resource referenced by instances of the subclass.
|
sl@0
|
494 |
*/
|
sl@0
|
495 |
const TUid iHandleType;
|
sl@0
|
496 |
|
sl@0
|
497 |
/** A pointer to an implementation-defined object initially set to NULL by the constructor.*/
|
sl@0
|
498 |
TAny* iImpl;
|
sl@0
|
499 |
};
|
sl@0
|
500 |
|
sl@0
|
501 |
#include <sgresource/sgresource.inl>
|
sl@0
|
502 |
|
sl@0
|
503 |
#endif // SGRESOURCE_H
|