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