1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFont class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "font.h"
19 #include "wx/gdiobj.h"
21 class WXDLLEXPORT wxFont
;
23 class WXDLLEXPORT wxFontRefData
: public wxGDIRefData
25 friend class WXDLLEXPORT wxFont
;
28 wxFontRefData(const wxFontRefData
& data
);
31 bool m_temporary
; // If TRUE, the pointer to the actual font
32 // is temporary and SHOULD NOT BE DELETED by
45 #define M_FONTDATA ((wxFontRefData *)m_refData)
47 WXDLLEXPORT_DATA(extern const char*) wxEmptyString
;
50 class WXDLLEXPORT wxFont
: public wxGDIObject
52 DECLARE_DYNAMIC_CLASS(wxFont
)
55 wxFont(int PointSize
, int Family
, int Style
, int Weight
, bool underlined
= FALSE
, const wxString
& Face
= wxEmptyString
);
56 inline wxFont(const wxFont
& font
) { Ref(font
); }
57 inline wxFont(const wxFont
* font
) { if (font
) Ref(*font
); }
61 bool Create(int PointSize
, int Family
, int Style
, int Weight
, bool underlined
= FALSE
, const wxString
& Face
= wxEmptyString
);
64 virtual bool RealizeResource(void);
65 virtual WXHANDLE
GetResourceHandle(void) ;
66 virtual bool FreeResource(bool force
= FALSE
);
68 virtual bool UseResource(void);
69 virtual bool ReleaseResource(void);
72 virtual bool IsFree(void);
73 virtual bool Ok(void) const { return (m_refData
!= NULL
) ; }
75 inline int GetPointSize(void) const { return M_FONTDATA
->m_pointSize
; }
76 inline int GetFamily(void) const { return M_FONTDATA
->m_family
; }
77 inline int GetFontId(void) const { return M_FONTDATA
->m_fontId
; } /* New font system */
78 inline int GetStyle(void) const { return M_FONTDATA
->m_style
; }
79 inline int GetWeight(void) const { return M_FONTDATA
->m_weight
; }
80 wxString
GetFamilyString(void) const ;
81 wxString
GetFaceName(void) const ;
82 wxString
GetStyleString(void) const ;
83 wxString
GetWeightString(void) const ;
84 inline bool GetUnderlined(void) const { return M_FONTDATA
->m_underlined
; }
86 void SetPointSize(int pointSize
);
87 void SetFamily(int family
);
88 void SetStyle(int style
);
89 void SetWeight(int weight
);
90 void SetFaceName(const wxString
& faceName
);
91 void SetUnderlined(bool underlined
);
93 inline wxFont
& operator = (const wxFont
& font
) { if (*this == font
) return (*this); Ref(font
); return *this; }
94 inline bool operator == (const wxFont
& font
) { return m_refData
== font
.m_refData
; }
95 inline bool operator != (const wxFont
& font
) { return m_refData
!= font
.m_refData
; }