1999-07-29 05:11:30 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: font.h
|
|
|
|
// Purpose: wxFont class
|
1999-10-07 04:44:22 +00:00
|
|
|
// Author: David Webster
|
1999-07-29 05:11:30 +00:00
|
|
|
// Modified by:
|
1999-10-07 04:44:22 +00:00
|
|
|
// Created: 10/06/99
|
1999-07-29 05:11:30 +00:00
|
|
|
// RCS-ID: $Id$
|
1999-10-07 04:44:22 +00:00
|
|
|
// Copyright: (c) David Webster
|
|
|
|
// Licence: wxWindows licence
|
1999-07-29 05:11:30 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_FONT_H_
|
|
|
|
#define _WX_FONT_H_
|
|
|
|
|
|
|
|
#include "wx/gdiobj.h"
|
2000-12-11 04:36:46 +00:00
|
|
|
#include "wx/os2/private.h"
|
2000-12-21 04:25:07 +00:00
|
|
|
#include "wx/fontutil.h"
|
1999-07-29 05:11:30 +00:00
|
|
|
|
1999-10-07 04:44:22 +00:00
|
|
|
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxFont
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-07-29 05:11:30 +00:00
|
|
|
|
1999-10-07 04:44:22 +00:00
|
|
|
class WXDLLEXPORT wxFont : public wxFontBase
|
1999-07-29 05:11:30 +00:00
|
|
|
{
|
|
|
|
public:
|
1999-10-07 04:44:22 +00:00
|
|
|
// ctors and such
|
|
|
|
wxFont() { Init(); }
|
2000-12-11 04:36:46 +00: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 04:44:22 +00:00
|
|
|
{
|
|
|
|
Init();
|
|
|
|
|
2000-12-11 04:36:46 +00:00
|
|
|
(void)Create(nSize, nFamily, nStyle, nWeight, bUnderlined, rsFace, vEncoding);
|
1999-10-07 04:44:22 +00:00
|
|
|
}
|
|
|
|
|
2001-10-17 22:25:56 +00:00
|
|
|
wxFont(const wxNativeFontInfo& rInfo);
|
2000-12-18 20:04:50 +00:00
|
|
|
|
2000-12-11 04:36:46 +00: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 04:44:22 +00:00
|
|
|
|
|
|
|
virtual ~wxFont();
|
|
|
|
|
2000-12-11 04:36:46 +00: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 04:44:22 +00:00
|
|
|
// -------------------------------
|
2000-12-11 04:36:46 +00: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 05:11:30 +00:00
|
|
|
|
2001-04-23 18:33:05 +00:00
|
|
|
WXHFONT GetHFONT(void) const;
|
1999-10-07 04:44:22 +00:00
|
|
|
protected:
|
2000-12-11 04:36:46 +00:00
|
|
|
//
|
|
|
|
// Common part of all ctors
|
|
|
|
//
|
|
|
|
void Init(void);
|
|
|
|
void Unshare(void);
|
1999-07-29 05:11:30 +00:00
|
|
|
|
1999-10-07 04:44:22 +00:00
|
|
|
private:
|
2000-12-11 04:36:46 +00:00
|
|
|
void OS2SelectMatchingFontByName(void);
|
|
|
|
|
1999-10-07 04:44:22 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxFont)
|
2000-12-11 04:36:46 +00:00
|
|
|
}; // end of wxFont
|
1999-07-29 05:11:30 +00:00
|
|
|
|
2000-12-11 04:36:46 +00:00
|
|
|
#endif // _WX_FONT_H_
|