]>
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 | ||
cc95f4f9 DW |
43 | (void)Create( nSize |
44 | ,nFamily | |
45 | ,nStyle | |
46 | ,nWeight | |
47 | ,bUnderlined | |
48 | ,rsFace | |
49 | ,vEncoding | |
50 | ); | |
21802234 DW |
51 | } |
52 | ||
cc95f4f9 DW |
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); | |
377771d9 | 66 | |
e99762c0 DW |
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 | ); | |
cc95f4f9 DW |
75 | bool Create( const wxNativeFontInfo& rInfo |
76 | ,WXHFONT hFont = 0 | |
77 | ); | |
21802234 DW |
78 | |
79 | virtual ~wxFont(); | |
80 | ||
e99762c0 DW |
81 | // |
82 | // Assignment | |
83 | // | |
84 | wxFont& operator=(const wxFont& rFont); | |
85 | ||
86 | // | |
87 | // Implement base class pure virtuals | |
88 | // | |
cc95f4f9 DW |
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; | |
e99762c0 DW |
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); | |
cc95f4f9 | 105 | virtual void SetNativeFontInfo(const wxNativeFontInfo& rInfo); |
e99762c0 | 106 | |
cc95f4f9 DW |
107 | // |
108 | // For internal use only! | |
109 | // | |
511ac294 | 110 | void SetPS(HPS hPS); |
cc95f4f9 DW |
111 | void SetFM( PFONTMETRICS pFM |
112 | ,int nNumFonts | |
113 | ); | |
e99762c0 DW |
114 | // |
115 | // Implementation only from now on | |
21802234 | 116 | // ------------------------------- |
e99762c0 | 117 | // |
e99762c0 DW |
118 | virtual bool IsFree(void) const; |
119 | virtual bool RealizeResource(void); | |
120 | virtual WXHANDLE GetResourceHandle(void); | |
121 | virtual bool FreeResource(bool bForce = FALSE); | |
0e320a79 | 122 | |
08399e45 | 123 | WXHFONT GetHFONT(void) const; |
21802234 | 124 | protected: |
e99762c0 DW |
125 | // |
126 | // Common part of all ctors | |
127 | // | |
128 | void Init(void); | |
129 | void Unshare(void); | |
0e320a79 | 130 | |
21802234 DW |
131 | private: |
132 | DECLARE_DYNAMIC_CLASS(wxFont) | |
e99762c0 | 133 | }; // end of wxFont |
0e320a79 | 134 | |
e99762c0 | 135 | #endif // _WX_FONT_H_ |