]>
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 | ||
19193a2c | 46 | wxFont(const wxNativeFontInfo& rInfo); |
377771d9 | 47 | |
e99762c0 DW |
48 | bool Create( int nSize |
49 | ,int nFamily | |
50 | ,int nStyle | |
51 | ,int nWeight | |
52 | ,bool bUnderlined = FALSE | |
53 | ,const wxString& rsFace = wxEmptyString | |
54 | ,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT | |
55 | ); | |
21802234 DW |
56 | |
57 | virtual ~wxFont(); | |
58 | ||
e99762c0 DW |
59 | // |
60 | // Assignment | |
61 | // | |
62 | wxFont& operator=(const wxFont& rFont); | |
63 | ||
64 | // | |
65 | // Implement base class pure virtuals | |
66 | // | |
67 | virtual int GetPointSize(void) const; | |
68 | virtual int GetFamily(void) const; | |
69 | virtual int GetStyle(void) const; | |
70 | virtual int GetWeight(void) const; | |
71 | virtual bool GetUnderlined(void) const; | |
72 | virtual wxString GetFaceName(void) const; | |
73 | virtual wxFontEncoding GetEncoding(void) const; | |
74 | virtual HPS GetPS(void) const; | |
75 | ||
76 | virtual void SetPointSize(int nPointSize); | |
77 | virtual void SetFamily(int nFamily); | |
78 | virtual void SetStyle(int nStyle); | |
79 | virtual void SetWeight(int nWeight); | |
80 | virtual void SetFaceName(const wxString& rsFaceName); | |
81 | virtual void SetUnderlined(bool bUnderlined); | |
82 | virtual void SetEncoding(wxFontEncoding vEncoding); | |
83 | virtual void SetPS(HPS hPS); | |
84 | virtual void SetFM( PFONTMETRICS pFM | |
85 | ,int nNumFonts | |
86 | ); | |
87 | ||
88 | // | |
89 | // Implementation only from now on | |
21802234 | 90 | // ------------------------------- |
e99762c0 DW |
91 | // |
92 | int GetFontId(void) const; | |
93 | virtual bool IsFree(void) const; | |
94 | virtual bool RealizeResource(void); | |
95 | virtual WXHANDLE GetResourceHandle(void); | |
96 | virtual bool FreeResource(bool bForce = FALSE); | |
0e320a79 | 97 | |
08399e45 | 98 | WXHFONT GetHFONT(void) const; |
21802234 | 99 | protected: |
e99762c0 DW |
100 | // |
101 | // Common part of all ctors | |
102 | // | |
103 | void Init(void); | |
104 | void Unshare(void); | |
0e320a79 | 105 | |
21802234 | 106 | private: |
e99762c0 DW |
107 | void OS2SelectMatchingFontByName(void); |
108 | ||
21802234 | 109 | DECLARE_DYNAMIC_CLASS(wxFont) |
e99762c0 | 110 | }; // end of wxFont |
0e320a79 | 111 | |
e99762c0 | 112 | #endif // _WX_FONT_H_ |