os/graphics/windowing/windowserver/graphicsresourcewrapper/graphicsresourcewrapper.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/graphicsresourcewrapper/graphicsresourcewrapper.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,84 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// graphicsresourcewrapper.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +#ifndef __GRAPHICSRESOURCEWRAPPER_H__
1.22 +#define __GRAPHICSRESOURCEWRAPPER_H__
1.23 +
1.24 +#include <e32base.h>
1.25 +#include <graphics/sgresource.h>
1.26 +
1.27 +class CGraphicsResourceWrapper;
1.28 +
1.29 +_LIT(KGraphicsResourceWrapperDll, "graphicsresourcewrapper.dll");
1.30 +
1.31 +
1.32 +/**
1.33 +@internalComponent
1.34 +*/
1.35 +class CGraphicsResourceWrapperFactory : public CBase
1.36 + {
1.37 +public:
1.38 + inline ~CGraphicsResourceWrapperFactory();
1.39 + inline CGraphicsResourceWrapper* NewGraphicsResourceWrapper();
1.40 +
1.41 +private:
1.42 + enum { EFactoryMethod = 1 };
1.43 + RLibrary iLibrary;
1.44 + TBool iLoaded;
1.45 + };
1.46 +
1.47 +inline CGraphicsResourceWrapperFactory::~CGraphicsResourceWrapperFactory()
1.48 + {
1.49 + if (iLoaded)
1.50 + iLibrary.Close();
1.51 + }
1.52 +
1.53 +inline CGraphicsResourceWrapper* CGraphicsResourceWrapperFactory::NewGraphicsResourceWrapper()
1.54 + {
1.55 + if (!iLoaded)
1.56 + {
1.57 + if (KErrNone == iLibrary.Load(KGraphicsResourceWrapperDll))
1.58 + iLoaded = ETrue;
1.59 + else
1.60 + return NULL;
1.61 + }
1.62 +
1.63 + typedef CGraphicsResourceWrapper*(* TFactoryMethod)();
1.64 + TFactoryMethod f = reinterpret_cast<TFactoryMethod>(iLibrary.Lookup(EFactoryMethod));
1.65 + if (f)
1.66 + return f();
1.67 +
1.68 + return NULL;
1.69 + }
1.70 +
1.71 +/**
1.72 +A wrapper class around Graphics Resource so that Wserv doesn't need to link
1.73 +against graphics resource.
1.74 +
1.75 +@internalComponent
1.76 +*/
1.77 +class CGraphicsResourceWrapper : public CBase
1.78 + {
1.79 +public:
1.80 + virtual RSgDrawable* NewDrawableL() = 0;
1.81 + virtual TInt Open(RSgDrawable& aDrawable, const TSgDrawableId& aDrawableId) = 0;
1.82 + virtual void Close(RSgDrawable& aDrawable) = 0;
1.83 + virtual TBool IsNull(const RSgDrawable& aDrawable) = 0;
1.84 + virtual TSgDrawableId Id(const RSgDrawable& aDrawable) = 0;
1.85 + };
1.86 +
1.87 +#endif //__GRAPHICSRESOURCEWRAPPER_H__