]>
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" |
0e320a79 | 17 | |
21802234 DW |
18 | WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; |
19 | ||
20 | // ---------------------------------------------------------------------------- | |
21 | // wxFont | |
22 | // ---------------------------------------------------------------------------- | |
0e320a79 | 23 | |
21802234 | 24 | class WXDLLEXPORT wxFont : public wxFontBase |
0e320a79 | 25 | { |
0e320a79 | 26 | public: |
21802234 DW |
27 | // ctors and such |
28 | wxFont() { Init(); } | |
e99762c0 DW |
29 | wxFont(const wxFont& rFont) { Init(); Ref(rFont); } |
30 | ||
31 | wxFont( int nSize | |
32 | ,int nFamily | |
33 | ,int nStyle | |
34 | ,int nWeight | |
35 | ,bool bUnderlined = FALSE | |
36 | ,const wxString& rsFace = wxEmptyString | |
37 | ,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT | |
38 | ) | |
21802234 DW |
39 | { |
40 | Init(); | |
41 | ||
e99762c0 | 42 | (void)Create(nSize, nFamily, nStyle, nWeight, bUnderlined, rsFace, vEncoding); |
21802234 DW |
43 | } |
44 | ||
377771d9 DW |
45 | wxFont(const wxNativeFontInfo& rInfo) |
46 | { | |
47 | Init(); | |
48 | ||
49 | (void)Create( rInfo.pointSize | |
50 | ,rInfo.family | |
51 | ,rInfo.style | |
52 | ,rInfo.weight | |
53 | ,rInfo.underlined | |
54 | ,rInfo.faceName | |
55 | ,rInfo.encoding | |
56 | ); | |
57 | } | |
58 | ||
e99762c0 DW |
59 | bool Create( int nSize |
60 | ,int nFamily | |
61 | ,int nStyle | |
62 | ,int nWeight | |
63 | ,bool bUnderlined = FALSE | |
64 | ,const wxString& rsFace = wxEmptyString | |
65 | ,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT | |
66 | ); | |
21802234 DW |
67 | |
68 | virtual ~wxFont(); | |
69 | ||
e99762c0 DW |
70 | // |
71 | // Assignment | |
72 | // | |
73 | wxFont& operator=(const wxFont& rFont); | |
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 HPS GetPS(void) 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 void SetFaceName(const wxString& rsFaceName); | |
92 | virtual void SetUnderlined(bool bUnderlined); | |
93 | virtual void SetEncoding(wxFontEncoding vEncoding); | |
94 | virtual void SetPS(HPS hPS); | |
95 | virtual void SetFM( PFONTMETRICS pFM | |
96 | ,int nNumFonts | |
97 | ); | |
98 | ||
99 | // | |
100 | // Implementation only from now on | |
21802234 | 101 | // ------------------------------- |
e99762c0 DW |
102 | // |
103 | int GetFontId(void) const; | |
104 | virtual bool IsFree(void) const; | |
105 | virtual bool RealizeResource(void); | |
106 | virtual WXHANDLE GetResourceHandle(void); | |
107 | virtual bool FreeResource(bool bForce = FALSE); | |
0e320a79 | 108 | |
21802234 | 109 | protected: |
e99762c0 DW |
110 | // |
111 | // Common part of all ctors | |
112 | // | |
113 | void Init(void); | |
114 | void Unshare(void); | |
0e320a79 | 115 | |
21802234 | 116 | private: |
e99762c0 DW |
117 | void OS2SelectMatchingFontByName(void); |
118 | ||
21802234 | 119 | DECLARE_DYNAMIC_CLASS(wxFont) |
e99762c0 | 120 | }; // end of wxFont |
0e320a79 | 121 | |
e99762c0 | 122 | #endif // _WX_FONT_H_ |