1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: font.h
|
|
|
|
// Purpose: wxFont class
|
1999-10-07 00:44:22 -04:00
|
|
|
// Author: David Webster
|
1999-07-29 01:11:30 -04:00
|
|
|
// Modified by:
|
1999-10-07 00:44:22 -04:00
|
|
|
// Created: 10/06/99
|
1999-07-29 01:11:30 -04:00
|
|
|
// RCS-ID: $Id$
|
1999-10-07 00:44:22 -04:00
|
|
|
// Copyright: (c) David Webster
|
|
|
|
// Licence: wxWindows licence
|
1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_FONT_H_
|
|
|
|
#define _WX_FONT_H_
|
|
|
|
|
|
|
|
#include "wx/gdiobj.h"
|
2000-12-10 23:36:46 -05:00
|
|
|
#include "wx/os2/private.h"
|
2000-12-20 23:25:07 -05:00
|
|
|
#include "wx/fontutil.h"
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-07 00:44:22 -04:00
|
|
|
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxFont
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-07 00:44:22 -04:00
|
|
|
class WXDLLEXPORT wxFont : public wxFontBase
|
1999-07-29 01:11:30 -04:00
|
|
|
{
|
|
|
|
public:
|
1999-10-07 00:44:22 -04:00
|
|
|
// ctors and such
|
|
|
|
wxFont() { Init(); }
|
2000-12-10 23:36:46 -05:00
|
|
|
wxFont(const wxFont& rFont) { Init(); Ref(rFont); }
|
|
|
|
|
|
|
|
wxFont( int nSize
|
|
|
|
,int nFamily
|
|
|
|
,int nStyle
|
|
|
|
,int nWeight
|
|
|
|
,bool bUnderlined = FALSE
|
|
|
|
,const wxString& rsFace = wxEmptyString
|
|
|
|
,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT
|
|
|
|
)
|
1999-10-07 00:44:22 -04:00
|
|
|
{
|
|
|
|
Init();
|
|
|
|
|
2000-12-10 23:36:46 -05:00
|
|
|
(void)Create(nSize, nFamily, nStyle, nWeight, bUnderlined, rsFace, vEncoding);
|
1999-10-07 00:44:22 -04:00
|
|
|
}
|
|
|
|
|
2000-12-18 15:04:50 -05:00
|
|
|
wxFont(const wxNativeFontInfo& rInfo)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
|
|
|
|
(void)Create( rInfo.pointSize
|
|
|
|
,rInfo.family
|
|
|
|
,rInfo.style
|
|
|
|
,rInfo.weight
|
|
|
|
,rInfo.underlined
|
|
|
|
,rInfo.faceName
|
|
|
|
,rInfo.encoding
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2000-12-10 23:36:46 -05:00
|
|
|
bool Create( int nSize
|
|
|
|
,int nFamily
|
|
|
|
,int nStyle
|
|
|
|
,int nWeight
|
|
|
|
,bool bUnderlined = FALSE
|
|
|
|
,const wxString& rsFace = wxEmptyString
|
|
|
|
,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT
|
|
|
|
);
|
1999-10-07 00:44:22 -04:00
|
|
|
|
|
|
|
virtual ~wxFont();
|
|
|
|
|
2000-12-10 23:36:46 -05:00
|
|
|
//
|
|
|
|
// Assignment
|
|
|
|
//
|
|
|
|
wxFont& operator=(const wxFont& rFont);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Implement base class pure virtuals
|
|
|
|
//
|
|
|
|
virtual int GetPointSize(void) const;
|
|
|
|
virtual int GetFamily(void) const;
|
|
|
|
virtual int GetStyle(void) const;
|
|
|
|
virtual int GetWeight(void) const;
|
|
|
|
virtual bool GetUnderlined(void) const;
|
|
|
|
virtual wxString GetFaceName(void) const;
|
|
|
|
virtual wxFontEncoding GetEncoding(void) const;
|
|
|
|
virtual HPS GetPS(void) const;
|
|
|
|
|
|
|
|
virtual void SetPointSize(int nPointSize);
|
|
|
|
virtual void SetFamily(int nFamily);
|
|
|
|
virtual void SetStyle(int nStyle);
|
|
|
|
virtual void SetWeight(int nWeight);
|
|
|
|
virtual void SetFaceName(const wxString& rsFaceName);
|
|
|
|
virtual void SetUnderlined(bool bUnderlined);
|
|
|
|
virtual void SetEncoding(wxFontEncoding vEncoding);
|
|
|
|
virtual void SetPS(HPS hPS);
|
|
|
|
virtual void SetFM( PFONTMETRICS pFM
|
|
|
|
,int nNumFonts
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Implementation only from now on
|
1999-10-07 00:44:22 -04:00
|
|
|
// -------------------------------
|
2000-12-10 23:36:46 -05:00
|
|
|
//
|
|
|
|
int GetFontId(void) const;
|
|
|
|
virtual bool IsFree(void) const;
|
|
|
|
virtual bool RealizeResource(void);
|
|
|
|
virtual WXHANDLE GetResourceHandle(void);
|
|
|
|
virtual bool FreeResource(bool bForce = FALSE);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2001-04-23 14:33:05 -04:00
|
|
|
WXHFONT GetHFONT(void) const;
|
1999-10-07 00:44:22 -04:00
|
|
|
protected:
|
2000-12-10 23:36:46 -05:00
|
|
|
//
|
|
|
|
// Common part of all ctors
|
|
|
|
//
|
|
|
|
void Init(void);
|
|
|
|
void Unshare(void);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-07 00:44:22 -04:00
|
|
|
private:
|
2000-12-10 23:36:46 -05:00
|
|
|
void OS2SelectMatchingFontByName(void);
|
|
|
|
|
1999-10-07 00:44:22 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxFont)
|
2000-12-10 23:36:46 -05:00
|
|
|
}; // end of wxFont
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2000-12-10 23:36:46 -05:00
|
|
|
#endif // _WX_FONT_H_
|