sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // graphicsresourcewrapper.cpp sl@0: // sl@0: // sl@0: sl@0: #ifndef __GRAPHICSRESOURCEWRAPPER_H__ sl@0: #define __GRAPHICSRESOURCEWRAPPER_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: class CGraphicsResourceWrapper; sl@0: sl@0: _LIT(KGraphicsResourceWrapperDll, "graphicsresourcewrapper.dll"); sl@0: sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: class CGraphicsResourceWrapperFactory : public CBase sl@0: { sl@0: public: sl@0: inline ~CGraphicsResourceWrapperFactory(); sl@0: inline CGraphicsResourceWrapper* NewGraphicsResourceWrapper(); sl@0: sl@0: private: sl@0: enum { EFactoryMethod = 1 }; sl@0: RLibrary iLibrary; sl@0: TBool iLoaded; sl@0: }; sl@0: sl@0: inline CGraphicsResourceWrapperFactory::~CGraphicsResourceWrapperFactory() sl@0: { sl@0: if (iLoaded) sl@0: iLibrary.Close(); sl@0: } sl@0: sl@0: inline CGraphicsResourceWrapper* CGraphicsResourceWrapperFactory::NewGraphicsResourceWrapper() sl@0: { sl@0: if (!iLoaded) sl@0: { sl@0: if (KErrNone == iLibrary.Load(KGraphicsResourceWrapperDll)) sl@0: iLoaded = ETrue; sl@0: else sl@0: return NULL; sl@0: } sl@0: sl@0: typedef CGraphicsResourceWrapper*(* TFactoryMethod)(); sl@0: TFactoryMethod f = reinterpret_cast(iLibrary.Lookup(EFactoryMethod)); sl@0: if (f) sl@0: return f(); sl@0: sl@0: return NULL; sl@0: } sl@0: sl@0: /** sl@0: A wrapper class around Graphics Resource so that Wserv doesn't need to link sl@0: against graphics resource. sl@0: sl@0: @internalComponent sl@0: */ sl@0: class CGraphicsResourceWrapper : public CBase sl@0: { sl@0: public: sl@0: virtual RSgDrawable* NewDrawableL() = 0; sl@0: virtual TInt Open(RSgDrawable& aDrawable, const TSgDrawableId& aDrawableId) = 0; sl@0: virtual void Close(RSgDrawable& aDrawable) = 0; sl@0: virtual TBool IsNull(const RSgDrawable& aDrawable) = 0; sl@0: virtual TSgDrawableId Id(const RSgDrawable& aDrawable) = 0; sl@0: }; sl@0: sl@0: #endif //__GRAPHICSRESOURCEWRAPPER_H__