home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 October
/
Chip_1997-10_cd.bin
/
tema
/
sybase
/
powerj
/
hpp.z
/
WOLEFONT.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-18
|
8KB
|
265 lines
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) 1994, by WATCOM International Inc. All rights %
% reserved. No part of this software may be reproduced or %
% used in any form or by any means - graphic, electronic or %
% mechanical, including photocopying, recording, taping or %
% information storage and retrieval systems - except with the %
% written permission of WATCOM International Inc. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
#ifndef _WOLEFONT_HPP_INCLUDED
#define _WOLEFONT_HPP_INCLUDED
#ifndef _WNO_PRAGMA_PUSH
#pragma pack(push,8);
#pragma enum int;
#endif
#ifndef _WOLEAUTO_HPP_INCLUDED
# include "woleauto.hpp"
#endif
#ifndef _WDSPHLPR_HPP_INCLUDED
# include "wdsphlpr.hpp"
#endif
#ifndef _WFONT_HPP_INCLUDED
# include "wfont.hpp"
#endif
#ifndef _WIN16
#undef CreateFont
#undef CreateFontIndirect
#ifdef _UNICODE
#define CreateFont CreateFontW
#define CreateFontIndirect CreateFontIndirectW
#else
#define CreateFont CreateFontA
#define CreateFontIndirect CreateFontIndirectA
#endif
#endif
/* tmPitchAndFamily flags */
#define WTMPF_FIXED_PITCH 0x01
#define WTMPF_VECTOR 0x02
#define WTMPF_DEVICE 0x08
#define WTMPF_TRUETYPE 0x04
typedef struct WTextMetricOLE {
WLong tmHeight;
WLong tmAscent;
WLong tmDescent;
WLong tmInternalLeading;
WLong tmExternalLeading;
WLong tmAveCharWidth;
WLong tmMaxCharWidth;
WLong tmWeight;
WLong tmOverhang;
WLong tmDigitizedAspectX;
WLong tmDigitizedAspectY;
long char tmFirstChar;
long char tmLastChar;
long char tmDefaultChar;
long char tmBreakChar;
WByte tmItalic;
WByte tmUnderlined;
WByte tmStruckOut;
WByte tmPitchAndFamily;
WByte tmCharSet;
} WTextMetricOLE;
typedef struct WOleFontDesc {
WString name;
WCurrency size;
WShort weight;
WShort charset;
WBool italic;
WBool underline;
WBool strikethrough;
} WOleFontDesc;
/*************************************************************************
*
* WFontDisp -- Standard OLE Font type dispatch helper
*
*
* Events:
*
*
*************************************************************************/
class WCMCLASS WFontDisp : public WOleDispatchHelper {
public:
/**********************************************************
* Constructors and Destructors
*********************************************************/
WFontDisp( WPIDispatch pIDispatch=NULL, WBool release=TRUE,
WBool initMembers=TRUE );
WFontDisp( const WFontDisp & fontDisp );
~WFontDisp();
public:
/**********************************************************
* Properties
*********************************************************/
// Name
WString GetName( void );
WBool SetName( const WString & name );
// Size
WCurrency GetSize( void );
WBool SetSize( const WCurrency & size );
// Bold
WVARIANT_BOOL GetBold( void );
WBool SetBold( WVARIANT_BOOL bold );
// Italic
WVARIANT_BOOL GetItalic( void );
WBool SetItalic( WVARIANT_BOOL italic );
// Underline
WVARIANT_BOOL GetUnderline( void );
WBool SetUnderline( WVARIANT_BOOL underline );
// Strikethrough
WVARIANT_BOOL GetStrikethrough( void );
WBool SetStrikethrough( WVARIANT_BOOL strikethrough );
// Weight
WShort GetWeight( void );
WBool SetWeight( WShort weight );
WShort GetCharset( void );
WBool SetCharset( WShort charset );
/**************************************************************
* Operators
**************************************************************/
WFontDisp & operator=( const WFontDisp & fontDisp );
/**********************************************************
* Data
*********************************************************/
};
/*************************************************************************
*
* WIFont -- Standard OLE Font type
*
*
* Events:
*
*
*************************************************************************/
class WCMCLASS WIFont : public WObject {
WDeclareSubclass( WIFont, WObject );
public:
/**********************************************************
* Constructors and Destructors
*********************************************************/
WIFont();
WIFont( WPIFont ifont );
WIFont( const WIFont & ifont );
WIFont( const WOleFontDesc & fd );
WIFont( const WFont & font );
virtual ~WIFont();
public:
/**************************************************************
* Properties
**************************************************************/
// Name
WString GetName( void ) const;
WBool SetName( const WString & name);
// Size
WCurrency GetSize( void ) const;
WBool SetSize( const WCurrency & size );
// Bold
WBool GetBold( void ) const;
WBool SetBold( WBool bold );
// Italic
WBool GetItalic( void ) const;
WBool SetItalic( WBool italic );
// Underline
WBool GetUnderline( void ) const;
WBool SetUnderline( WBool underline );
// Strikethrough
WBool GetStrikethrough( void ) const;
WBool SetStrikethrough( WBool strikethrough );
// Weight
WShort GetWeight( void ) const;
WBool SetWeight( WShort weight );
// Charset
WShort GetCharset( void ) const;
WBool SetCharset( WShort charset );
// Hdc
WBool SetHdc( WDeviceHandle hdc);
WPIFont GetIFont( void ) const;
WPIDispatch GetIDispatch( void ) const;
WFontDisp GetFontDisp( void ) const;
/**********************************************************
* Methods
*********************************************************/
static WIFont *CreateFont( void );
static WIFont *CreateFontIndirect( const WOleFontDesc & fd );
// IFont Methods
WBool Clone( WIFont & newFont );
WBool IsEqual( const WIFont & otherFont );
WBool QueryTextMetrics( WTextMetricOLE & ptm );
WBool AddRefHfont( WFontHandle hfont );
WBool ReleaseHfont( WFontHandle hfont );
/**********************************************************
* Item Properties
*********************************************************/
WBool GethFont( WFontHandle & phfont );
WBool SetRatio( WLong cyLogical, WLong cyHimetric );
/**************************************************************
* Operators
**************************************************************/
WIFont & operator=( const WIFont & font );
/**********************************************************
* Data Members
*********************************************************/
private:
WPIFont _ifont;
};
#ifndef _WNO_PRAGMA_PUSH
#pragma enum pop;
#pragma pack(pop);
#endif
#endif // _WOLEFONT_HPP_INCLUDED