]>
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 | #include "wx/fontutil.h" | |
18 | ||
19 | WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; | |
20 | ||
21 | // ---------------------------------------------------------------------------- | |
22 | // wxFont | |
23 | // ---------------------------------------------------------------------------- | |
24 | ||
25 | class WXDLLEXPORT wxFont : public wxFontBase | |
26 | { | |
27 | public: | |
28 | // ctors and such | |
29 | wxFont() { Init(); } | |
30 | wxFont(const wxFont& rFont) { Init(); Ref(rFont); } | |
31 | ||
32 | wxFont( int nSize | |
33 | ,int nFamily | |
34 | ,int nStyle | |
35 | ,int nWeight | |
36 | ,bool bUnderlined = FALSE | |
37 | ,const wxString& rsFace = wxEmptyString | |
38 | ,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT | |
39 | ) | |
40 | { | |
41 | Init(); | |
42 | ||
43 | (void)Create( nSize | |
44 | ,nFamily | |
45 | ,nStyle | |
46 | ,nWeight | |
47 | ,bUnderlined | |
48 | ,rsFace | |
49 | ,vEncoding | |
50 | ); | |
51 | } | |
52 | ||
53 | wxFont( const wxNativeFontInfo& rInfo | |
54 | ,WXHFONT hFont = 0 | |
55 | ) | |
56 | ||
57 | { | |
58 | Init(); | |
59 | ||
60 | (void)Create( rInfo | |
61 | ,hFont | |
62 | ); | |
63 | } | |
64 | ||
65 | wxFont(const wxString& rsFontDesc); | |
66 | ||
67 | bool Create( int nSize | |
68 | ,int nFamily | |
69 | ,int nStyle | |
70 | ,int nWeight | |
71 | ,bool bUnderlined = FALSE | |
72 | ,const wxString& rsFace = wxEmptyString | |
73 | ,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT | |
74 | ); | |
75 | bool Create( const wxNativeFontInfo& rInfo | |
76 | ,WXHFONT hFont = 0 | |
77 | ); | |
78 | ||
79 | virtual ~wxFont(); | |
80 | ||
81 | // | |
82 | // Assignment | |
83 | // | |
84 | wxFont& operator=(const wxFont& rFont); | |
85 | ||
86 | // | |
87 | // Implement base class pure virtuals | |
88 | // | |
89 | virtual int GetPointSize(void) const; | |
90 | virtual int GetFamily(void) const; | |
91 | virtual int GetStyle(void) const; | |
92 | virtual int GetWeight(void) const; | |
93 | virtual bool GetUnderlined(void) const; | |
94 | virtual wxString GetFaceName(void) const; | |
95 | virtual wxFontEncoding GetEncoding(void) const; | |
96 | virtual wxNativeFontInfo* GetNativeFontInfo() const; | |
97 | ||
98 | virtual void SetPointSize(int nPointSize); | |
99 | virtual void SetFamily(int nFamily); | |
100 | virtual void SetStyle(int nStyle); | |
101 | virtual void SetWeight(int nWeight); | |
102 | virtual void SetFaceName(const wxString& rsFaceName); | |
103 | virtual void SetUnderlined(bool bUnderlined); | |
104 | virtual void SetEncoding(wxFontEncoding vEncoding); | |
105 | virtual void SetNativeFontInfo(const wxNativeFontInfo& rInfo); | |
106 | ||
107 | // | |
108 | // For internal use only! | |
109 | // | |
110 | void SetPS(HPS hPS); | |
111 | void SetFM( PFONTMETRICS pFM | |
112 | ,int nNumFonts | |
113 | ); | |
114 | // | |
115 | // Implementation only from now on | |
116 | // ------------------------------- | |
117 | // | |
118 | virtual bool IsFree(void) const; | |
119 | virtual bool RealizeResource(void); | |
120 | virtual WXHANDLE GetResourceHandle(void); | |
121 | virtual bool FreeResource(bool bForce = FALSE); | |
122 | ||
123 | WXHFONT GetHFONT(void) const; | |
124 | protected: | |
125 | // | |
126 | // Common part of all ctors | |
127 | // | |
128 | void Init(void); | |
129 | void Unshare(void); | |
130 | ||
131 | private: | |
132 | DECLARE_DYNAMIC_CLASS(wxFont) | |
133 | }; // end of wxFont | |
134 | ||
135 | #endif // _WX_FONT_H_ |