windowing/windowserver/nonnga/SERVER/wsfont.h
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2007-2009 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 // FONT related classes and font cache
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __WSFONT_H__
       
    19 #define __WSFONT_H__
       
    20 
       
    21 #include <e32std.h>
       
    22 #include <w32std.h>
       
    23 #include "w32cmd.h"
       
    24 #include <bitstd.h>
       
    25 #include <bitdev.h>
       
    26 #include <e32svr.h>
       
    27 #include "OBJECT.H"
       
    28 #include "CLIENT.H"
       
    29 #include "server.h"
       
    30 
       
    31 class CWsAnim;
       
    32 
       
    33 class CAnimFbsFont : public CFbsBitGcFont
       
    34 	{
       
    35 	friend class CWsAnim;
       
    36 public:
       
    37 	static CAnimFbsFont* NewL(TInt aHandle,TInt& aError);
       
    38 	void Open();
       
    39 	void Close();
       
    40 	inline TInt Duplicate(TInt aHandle);
       
    41 private:
       
    42 	CAnimFbsFont();
       
    43 	~CAnimFbsFont();
       
    44 private:
       
    45 	TInt iAccessCount;
       
    46 	};
       
    47 
       
    48 class CWsFontCache;
       
    49 
       
    50 class CWsFbsFont : public CFbsBitGcFont
       
    51 	{
       
    52 public:
       
    53 	~CWsFbsFont();
       
    54 	CWsFbsFont();
       
    55 	inline TInt Duplicate(TInt aHandle);
       
    56 	inline TInt Handle() const;
       
    57 	inline void Reset();
       
    58 public:
       
    59 	TDblQueLink iLink;
       
    60 	TInt iCount;
       
    61 	};
       
    62 
       
    63 class CWsFontCache : public CBase
       
    64 	{
       
    65 	enum {EFontCacheSize=128};
       
    66 public:
       
    67 	static void CreateInstanceL();
       
    68 	static void DestroyInstance();
       
    69 	static CWsFontCache * Instance() { return iSelf; }
       
    70 	TBool UseFont(CWsFbsFont *&aFont, TInt aHandle);
       
    71 	void ReleaseFont(CWsFbsFont *&aFont);
       
    72 	static TDblQue<CWsFbsFont>& List();
       
    73 private:
       
    74 	CWsFontCache();
       
    75 	~CWsFontCache();
       
    76 private:
       
    77 	static CWsFontCache * iSelf;
       
    78 	static TDblQue<CWsFbsFont> * iList;
       
    79 	CWsFbsFont iFont[EFontCacheSize];
       
    80 	};
       
    81 
       
    82 inline TInt CWsFbsFont::Duplicate(TInt aHandle)
       
    83 	{return(CFbsBitGcFont::Duplicate(aHandle));}
       
    84 inline TInt CWsFbsFont::Handle() const
       
    85 	{return(CFbsBitGcFont::Handle());}
       
    86 inline void CWsFbsFont::Reset()
       
    87 	{CFbsBitGcFont::Reset();}
       
    88 //
       
    89 inline TInt CAnimFbsFont::Duplicate(TInt aHandle)
       
    90 	{return(CFbsFont::Duplicate(aHandle));}
       
    91 
       
    92 #endif