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();
|
|
|
|
|
2002-01-08 18:33:27 -05:00
|
|
|
(void)Create( nSize
|
|
|
|
,nFamily
|
|
|
|
,nStyle
|
|
|
|
,nWeight
|
|
|
|
,bUnderlined
|
|
|
|
,rsFace
|
|
|
|
,vEncoding
|
|
|
|
);
|
1999-10-07 00:44:22 -04:00
|
|
|
}
|
|
|
|
|
2002-01-08 18:33:27 -05:00
|
|
|
wxFont( const wxNativeFontInfo& rInfo
|
|
|
|
,WXHFONT hFont = 0
|
|
|
|
)
|
|
|
|
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
|
|
|
|
(void)Create( rInfo
|
|
|
|
,hFont
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
wxFont(const wxString& rsFontDesc);
|
2000-12-18 15:04:50 -05:00
|
|
|
|
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
|
|
|
|
);
|
2002-01-08 18:33:27 -05:00
|
|
|
bool Create( const wxNativeFontInfo& rInfo
|
|
|
|
,WXHFONT hFont = 0
|
|
|
|
);
|
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
|
|
|
|
//
|
2002-01-08 18:33:27 -05:00
|
|
|
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 wxNativeFontInfo* GetNativeFontInfo() const;
|
2000-12-10 23:36:46 -05:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2002-01-08 18:33:27 -05:00
|
|
|
//
|
|
|
|
// For internal use only!
|
|
|
|
//
|
2002-01-09 18:16:22 -05:00
|
|
|
void SetPS(HPS hPS);
|
2002-01-08 18:33:27 -05:00
|
|
|
void SetFM( PFONTMETRICS pFM
|
|
|
|
,int nNumFonts
|
|
|
|
);
|
2000-12-10 23:36:46 -05:00
|
|
|
//
|
|
|
|
// Implementation only from now on
|
1999-10-07 00:44:22 -04:00
|
|
|
// -------------------------------
|
2000-12-10 23:36:46 -05:00
|
|
|
//
|
|
|
|
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;
|
2003-02-12 10:42:27 -05:00
|
|
|
|
1999-10-07 00:44:22 -04:00
|
|
|
protected:
|
2003-02-12 10:42:27 -05:00
|
|
|
virtual void DoSetNativeFontInfo(const wxNativeFontInfo& rInfo);
|
|
|
|
|
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:
|
|
|
|
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_
|