]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: font.h | |
3 | // Purpose: wxFont class | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/06/99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) David Webster | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_FONT_H_ | |
13 | #define _WX_FONT_H_ | |
14 | ||
15 | #include "wx/gdiobj.h" | |
16 | #include "wx/os2/private.h" | |
17 | ||
18 | WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; | |
19 | ||
20 | // ---------------------------------------------------------------------------- | |
21 | // wxFont | |
22 | // ---------------------------------------------------------------------------- | |
23 | ||
24 | class WXDLLEXPORT wxFont : public wxFontBase | |
25 | { | |
26 | public: | |
27 | // ctors and such | |
28 | wxFont() { } | |
29 | ||
30 | wxFont( int nSize | |
31 | ,int nFamily | |
32 | ,int nStyle | |
33 | ,int nWeight | |
34 | ,bool bUnderlined = false | |
35 | ,const wxString& rsFace = wxEmptyString | |
36 | ,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT | |
37 | ) | |
38 | { | |
39 | (void)Create( nSize | |
40 | ,nFamily | |
41 | ,nStyle | |
42 | ,nWeight | |
43 | ,bUnderlined | |
44 | ,rsFace | |
45 | ,vEncoding | |
46 | ); | |
47 | } | |
48 | ||
49 | wxFont( const wxNativeFontInfo& rInfo | |
50 | ,WXHFONT hFont = 0 | |
51 | ) | |
52 | ||
53 | { | |
54 | (void)Create( rInfo | |
55 | ,hFont | |
56 | ); | |
57 | } | |
58 | ||
59 | wxFont(const wxString& rsFontDesc); | |
60 | ||
61 | bool Create( int nSize | |
62 | ,int nFamily | |
63 | ,int nStyle | |
64 | ,int nWeight | |
65 | ,bool bUnderlined = false | |
66 | ,const wxString& rsFace = wxEmptyString | |
67 | ,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT | |
68 | ); | |
69 | bool Create( const wxNativeFontInfo& rInfo | |
70 | ,WXHFONT hFont = 0 | |
71 | ); | |
72 | ||
73 | virtual ~wxFont(); | |
74 | ||
75 | // | |
76 | // Implement base class pure virtuals | |
77 | // | |
78 | virtual int GetPointSize(void) const; | |
79 | virtual int GetFamily(void) const; | |
80 | virtual int GetStyle(void) const; | |
81 | virtual int GetWeight(void) const; | |
82 | virtual bool GetUnderlined(void) const; | |
83 | virtual wxString GetFaceName(void) const; | |
84 | virtual wxFontEncoding GetEncoding(void) const; | |
85 | virtual const wxNativeFontInfo* GetNativeFontInfo() const; | |
86 | ||
87 | virtual void SetPointSize(int nPointSize); | |
88 | virtual void SetFamily(int nFamily); | |
89 | virtual void SetStyle(int nStyle); | |
90 | virtual void SetWeight(int nWeight); | |
91 | virtual bool SetFaceName(const wxString& rsFaceName); | |
92 | virtual void SetUnderlined(bool bUnderlined); | |
93 | virtual void SetEncoding(wxFontEncoding vEncoding); | |
94 | ||
95 | // | |
96 | // For internal use only! | |
97 | // | |
98 | void SetPS(HPS hPS); | |
99 | void SetFM( PFONTMETRICS pFM | |
100 | ,int nNumFonts | |
101 | ); | |
102 | // | |
103 | // Implementation only from now on | |
104 | // ------------------------------- | |
105 | // | |
106 | virtual bool IsFree(void) const; | |
107 | virtual bool RealizeResource(void); | |
108 | virtual WXHANDLE GetResourceHandle(void); | |
109 | virtual bool FreeResource(bool bForce = false); | |
110 | ||
111 | WXHFONT GetHFONT(void) const; | |
112 | ||
113 | protected: | |
114 | virtual void DoSetNativeFontInfo(const wxNativeFontInfo& rInfo); | |
115 | ||
116 | void Unshare(void); | |
117 | ||
118 | private: | |
119 | DECLARE_DYNAMIC_CLASS(wxFont) | |
120 | }; // end of wxFont | |
121 | ||
122 | #endif // _WX_FONT_H_ |