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 |
// graphicsresourcewrapper.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#ifndef __GRAPHICSRESOURCEWRAPPER_H__
|
sl@0
|
19 |
#define __GRAPHICSRESOURCEWRAPPER_H__
|
sl@0
|
20 |
|
sl@0
|
21 |
#include <e32base.h>
|
sl@0
|
22 |
#include <graphics/sgresource.h>
|
sl@0
|
23 |
|
sl@0
|
24 |
class CGraphicsResourceWrapper;
|
sl@0
|
25 |
|
sl@0
|
26 |
_LIT(KGraphicsResourceWrapperDll, "graphicsresourcewrapper.dll");
|
sl@0
|
27 |
|
sl@0
|
28 |
|
sl@0
|
29 |
/**
|
sl@0
|
30 |
@internalComponent
|
sl@0
|
31 |
*/
|
sl@0
|
32 |
class CGraphicsResourceWrapperFactory : public CBase
|
sl@0
|
33 |
{
|
sl@0
|
34 |
public:
|
sl@0
|
35 |
inline ~CGraphicsResourceWrapperFactory();
|
sl@0
|
36 |
inline CGraphicsResourceWrapper* NewGraphicsResourceWrapper();
|
sl@0
|
37 |
|
sl@0
|
38 |
private:
|
sl@0
|
39 |
enum { EFactoryMethod = 1 };
|
sl@0
|
40 |
RLibrary iLibrary;
|
sl@0
|
41 |
TBool iLoaded;
|
sl@0
|
42 |
};
|
sl@0
|
43 |
|
sl@0
|
44 |
inline CGraphicsResourceWrapperFactory::~CGraphicsResourceWrapperFactory()
|
sl@0
|
45 |
{
|
sl@0
|
46 |
if (iLoaded)
|
sl@0
|
47 |
iLibrary.Close();
|
sl@0
|
48 |
}
|
sl@0
|
49 |
|
sl@0
|
50 |
inline CGraphicsResourceWrapper* CGraphicsResourceWrapperFactory::NewGraphicsResourceWrapper()
|
sl@0
|
51 |
{
|
sl@0
|
52 |
if (!iLoaded)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
if (KErrNone == iLibrary.Load(KGraphicsResourceWrapperDll))
|
sl@0
|
55 |
iLoaded = ETrue;
|
sl@0
|
56 |
else
|
sl@0
|
57 |
return NULL;
|
sl@0
|
58 |
}
|
sl@0
|
59 |
|
sl@0
|
60 |
typedef CGraphicsResourceWrapper*(* TFactoryMethod)();
|
sl@0
|
61 |
TFactoryMethod f = reinterpret_cast<TFactoryMethod>(iLibrary.Lookup(EFactoryMethod));
|
sl@0
|
62 |
if (f)
|
sl@0
|
63 |
return f();
|
sl@0
|
64 |
|
sl@0
|
65 |
return NULL;
|
sl@0
|
66 |
}
|
sl@0
|
67 |
|
sl@0
|
68 |
/**
|
sl@0
|
69 |
A wrapper class around Graphics Resource so that Wserv doesn't need to link
|
sl@0
|
70 |
against graphics resource.
|
sl@0
|
71 |
|
sl@0
|
72 |
@internalComponent
|
sl@0
|
73 |
*/
|
sl@0
|
74 |
class CGraphicsResourceWrapper : public CBase
|
sl@0
|
75 |
{
|
sl@0
|
76 |
public:
|
sl@0
|
77 |
virtual RSgDrawable* NewDrawableL() = 0;
|
sl@0
|
78 |
virtual TInt Open(RSgDrawable& aDrawable, const TSgDrawableId& aDrawableId) = 0;
|
sl@0
|
79 |
virtual void Close(RSgDrawable& aDrawable) = 0;
|
sl@0
|
80 |
virtual TBool IsNull(const RSgDrawable& aDrawable) = 0;
|
sl@0
|
81 |
virtual TSgDrawableId Id(const RSgDrawable& aDrawable) = 0;
|
sl@0
|
82 |
};
|
sl@0
|
83 |
|
sl@0
|
84 |
#endif //__GRAPHICSRESOURCEWRAPPER_H__
|