graphicsdeviceinterface/directgdi/src/directgdifont.cpp
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 //
       
    15 
       
    16 #include "directgdifont.h"
       
    17 
       
    18 /**
       
    19 Construct calls the constructor for the base class CFbsFont and sets default
       
    20 value of iCopy as EFalse.
       
    21 */
       
    22 EXPORT_C CDirectGdiFont::CDirectGdiFont():
       
    23 	CFbsFont(),
       
    24 	iCopy(EFalse)
       
    25 	{}
       
    26 
       
    27 /**
       
    28 Default destructor. 
       
    29 */
       
    30 EXPORT_C CDirectGdiFont::~CDirectGdiFont()
       
    31 	{}
       
    32 
       
    33 /**
       
    34 On return contains iAddress pointer for the CBitmapFont.
       
    35 @return	A pointer to the font.
       
    36 @see	CFbsFont::Address();
       
    37 */
       
    38 EXPORT_C CBitmapFont* CDirectGdiFont::Address() const
       
    39 	{
       
    40 	return CFbsFont::Address();
       
    41 	}
       
    42 
       
    43 /**
       
    44 Calls reset on the object (sets iHandle to zero) and carries out related 
       
    45 messenger housekeeping and then duplicates it using the base class method.
       
    46 @param	aHandle The integer handler for the font.
       
    47 @return	KErrNone if successful, otherwise a system-wide error code.
       
    48 @see	CFbsFont::Duplicate(TInt)
       
    49 */
       
    50 EXPORT_C TInt CDirectGdiFont::Duplicate(TInt aHandle)
       
    51 	{
       
    52 	Reset();
       
    53 
       
    54 	return CFbsFont::Duplicate(aHandle);
       
    55 	}
       
    56 
       
    57 /**
       
    58 Resets the font to its default settings.
       
    59 */
       
    60 EXPORT_C void CDirectGdiFont::Reset()
       
    61 	{
       
    62 	if (!iCopy)
       
    63 		{
       
    64 		CFbsFont::Reset();
       
    65 		}
       
    66 	else
       
    67 		{
       
    68 		iAddressPointer = NULL;
       
    69 		iHandle = 0;
       
    70 		iServerHandle = 0;
       
    71 		iCopy = EFalse;
       
    72 		}
       
    73 	}
       
    74 
       
    75 /**
       
    76 Defines the meaning of the equals operator when acting on a CDirectGdiFont
       
    77 object. It allows these objects to be set as being equal to one another.
       
    78 @param	aFont The font to be copied.
       
    79 */
       
    80 EXPORT_C void CDirectGdiFont::operator=(const CDirectGdiFont& aFont)
       
    81 	{
       
    82 	if (this != &aFont)
       
    83 		{
       
    84 		Reset();
       
    85 		iAddressPointer = aFont.iAddressPointer;
       
    86 		iHandle = aFont.iHandle;
       
    87 		iServerHandle = aFont.iServerHandle;
       
    88 		iCopy = ETrue;
       
    89 		}
       
    90 	}
       
    91