]>
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 | 8 | // Copyright: (c) David Webster |
65571936 | 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 | |
dabbc6a5 | 35 | ,bool bUnderlined = false |
e99762c0 DW |
36 | ,const wxString& rsFace = wxEmptyString |
37 | ,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT | |
38 | ) | |
21802234 DW |
39 | { |
40 | Init(); | |
41 | ||
cc95f4f9 DW |
42 | (void)Create( nSize |
43 | ,nFamily | |
44 | ,nStyle | |
45 | ,nWeight | |
46 | ,bUnderlined | |
47 | ,rsFace | |
48 | ,vEncoding | |
49 | ); | |
21802234 DW |
50 | } |
51 | ||
cc95f4f9 DW |
52 | wxFont( const wxNativeFontInfo& rInfo |
53 | ,WXHFONT hFont = 0 | |
54 | ) | |
55 | ||
56 | { | |
57 | Init(); | |
58 | ||
59 | (void)Create( rInfo | |
60 | ,hFont | |
61 | ); | |
62 | } | |
63 | ||
64 | wxFont(const wxString& rsFontDesc); | |
377771d9 | 65 | |
e99762c0 DW |
66 | bool Create( int nSize |
67 | ,int nFamily | |
68 | ,int nStyle | |
69 | ,int nWeight | |
dabbc6a5 | 70 | ,bool bUnderlined = false |
e99762c0 DW |
71 | ,const wxString& rsFace = wxEmptyString |
72 | ,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT | |
73 | ); | |
cc95f4f9 DW |
74 | bool Create( const wxNativeFontInfo& rInfo |
75 | ,WXHFONT hFont = 0 | |
76 | ); | |
21802234 DW |
77 | |
78 | virtual ~wxFont(); | |
79 | ||
e99762c0 DW |
80 | // |
81 | // Assignment | |
82 | // | |
83 | wxFont& operator=(const wxFont& rFont); | |
84 | ||
85 | // | |
86 | // Implement base class pure virtuals | |
87 | // | |
cc95f4f9 DW |
88 | virtual int GetPointSize(void) const; |
89 | virtual int GetFamily(void) const; | |
90 | virtual int GetStyle(void) const; | |
91 | virtual int GetWeight(void) const; | |
92 | virtual bool GetUnderlined(void) const; | |
93 | virtual wxString GetFaceName(void) const; | |
94 | virtual wxFontEncoding GetEncoding(void) const; | |
3bf5a59b | 95 | virtual const wxNativeFontInfo* GetNativeFontInfo() const; |
e99762c0 DW |
96 | |
97 | virtual void SetPointSize(int nPointSize); | |
98 | virtual void SetFamily(int nFamily); | |
99 | virtual void SetStyle(int nStyle); | |
100 | virtual void SetWeight(int nWeight); | |
101 | virtual void SetFaceName(const wxString& rsFaceName); | |
102 | virtual void SetUnderlined(bool bUnderlined); | |
103 | virtual void SetEncoding(wxFontEncoding vEncoding); | |
e99762c0 | 104 | |
cc95f4f9 DW |
105 | // |
106 | // For internal use only! | |
107 | // | |
511ac294 | 108 | void SetPS(HPS hPS); |
cc95f4f9 DW |
109 | void SetFM( PFONTMETRICS pFM |
110 | ,int nNumFonts | |
111 | ); | |
e99762c0 DW |
112 | // |
113 | // Implementation only from now on | |
21802234 | 114 | // ------------------------------- |
e99762c0 | 115 | // |
e99762c0 DW |
116 | virtual bool IsFree(void) const; |
117 | virtual bool RealizeResource(void); | |
118 | virtual WXHANDLE GetResourceHandle(void); | |
dabbc6a5 | 119 | virtual bool FreeResource(bool bForce = false); |
0e320a79 | 120 | |
08399e45 | 121 | WXHFONT GetHFONT(void) const; |
9045ad9d | 122 | |
21802234 | 123 | protected: |
9045ad9d VZ |
124 | virtual void DoSetNativeFontInfo(const wxNativeFontInfo& rInfo); |
125 | ||
e99762c0 DW |
126 | // |
127 | // Common part of all ctors | |
128 | // | |
129 | void Init(void); | |
130 | void Unshare(void); | |
0e320a79 | 131 | |
21802234 DW |
132 | private: |
133 | DECLARE_DYNAMIC_CLASS(wxFont) | |
e99762c0 | 134 | }; // end of wxFont |
0e320a79 | 135 | |
e99762c0 | 136 | #endif // _WX_FONT_H_ |