]>
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); | |
e99762c0 | 105 | |
cc95f4f9 DW |
106 | // |
107 | // For internal use only! | |
108 | // | |
511ac294 | 109 | void SetPS(HPS hPS); |
cc95f4f9 DW |
110 | void SetFM( PFONTMETRICS pFM |
111 | ,int nNumFonts | |
112 | ); | |
e99762c0 DW |
113 | // |
114 | // Implementation only from now on | |
21802234 | 115 | // ------------------------------- |
e99762c0 | 116 | // |
e99762c0 DW |
117 | virtual bool IsFree(void) const; |
118 | virtual bool RealizeResource(void); | |
119 | virtual WXHANDLE GetResourceHandle(void); | |
120 | virtual bool FreeResource(bool bForce = FALSE); | |
0e320a79 | 121 | |
08399e45 | 122 | WXHFONT GetHFONT(void) const; |
9045ad9d | 123 | |
21802234 | 124 | protected: |
9045ad9d VZ |
125 | virtual void DoSetNativeFontInfo(const wxNativeFontInfo& rInfo); |
126 | ||
e99762c0 DW |
127 | // |
128 | // Common part of all ctors | |
129 | // | |
130 | void Init(void); | |
131 | void Unshare(void); | |
0e320a79 | 132 | |
21802234 DW |
133 | private: |
134 | DECLARE_DYNAMIC_CLASS(wxFont) | |
e99762c0 | 135 | }; // end of wxFont |
0e320a79 | 136 | |
e99762c0 | 137 | #endif // _WX_FONT_H_ |