]>
Commit | Line | Data |
---|---|---|
0e320a79 | 1 | ///////////////////////////////////////////////////////////////////////////// |
17b1d76b | 2 | // Name: wx/os2/font.h |
0e320a79 | 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 | |
53a2db12 | 18 | WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxEmptyString; |
21802234 DW |
19 | |
20 | // ---------------------------------------------------------------------------- | |
21 | // wxFont | |
22 | // ---------------------------------------------------------------------------- | |
0e320a79 | 23 | |
53a2db12 | 24 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase |
0e320a79 | 25 | { |
0e320a79 | 26 | public: |
21802234 | 27 | // ctors and such |
f8855e47 | 28 | wxFont() { } |
e99762c0 | 29 | |
0c14b6c3 FM |
30 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 |
31 | wxFont(int size, | |
32 | int family, | |
33 | int style, | |
34 | int weight, | |
35 | bool underlined = false, | |
36 | const wxString& face = wxEmptyString, | |
37 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
21802234 | 38 | { |
0c14b6c3 FM |
39 | (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); |
40 | } | |
41 | #endif | |
42 | ||
43 | wxFont(int size, | |
44 | wxFontFamily family, | |
45 | wxFontStyle style, | |
46 | wxFontWeight weight, | |
47 | bool underlined = false, | |
48 | const wxString& face = wxEmptyString, | |
49 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
50 | { | |
51 | Create(size, family, style, weight, underlined, face, encoding); | |
21802234 | 52 | } |
03647350 | 53 | |
b5791cc7 FM |
54 | wxFont(const wxSize& pixelSize, |
55 | wxFontFamily family, | |
56 | wxFontStyle style, | |
57 | wxFontWeight weight, | |
58 | bool underlined = false, | |
59 | const wxString& face = wxEmptyString, | |
60 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
61 | { | |
62 | Create(10, family, style, weight, underlined, face, encoding); | |
63 | SetPixelSize(pixelSize); | |
64 | } | |
03647350 | 65 | |
0c14b6c3 FM |
66 | bool Create(int size, |
67 | wxFontFamily family, | |
68 | wxFontStyle style, | |
69 | wxFontWeight weight, | |
70 | bool underlined = false, | |
71 | const wxString& face = wxEmptyString, | |
72 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
73 | ||
cc95f4f9 DW |
74 | wxFont( const wxNativeFontInfo& rInfo |
75 | ,WXHFONT hFont = 0 | |
76 | ) | |
77 | ||
78 | { | |
cc95f4f9 DW |
79 | (void)Create( rInfo |
80 | ,hFont | |
81 | ); | |
82 | } | |
83 | ||
84 | wxFont(const wxString& rsFontDesc); | |
377771d9 | 85 | |
cc95f4f9 DW |
86 | bool Create( const wxNativeFontInfo& rInfo |
87 | ,WXHFONT hFont = 0 | |
88 | ); | |
21802234 DW |
89 | |
90 | virtual ~wxFont(); | |
91 | ||
e99762c0 DW |
92 | // |
93 | // Implement base class pure virtuals | |
94 | // | |
cc95f4f9 | 95 | virtual int GetPointSize(void) const; |
0c14b6c3 FM |
96 | virtual wxFontFamily GetFamily() const; |
97 | virtual wxFontStyle GetStyle() const; | |
98 | virtual wxFontWeight GetWeight() const; | |
cc95f4f9 DW |
99 | virtual bool GetUnderlined(void) const; |
100 | virtual wxString GetFaceName(void) const; | |
101 | virtual wxFontEncoding GetEncoding(void) const; | |
3bf5a59b | 102 | virtual const wxNativeFontInfo* GetNativeFontInfo() const; |
e99762c0 DW |
103 | |
104 | virtual void SetPointSize(int nPointSize); | |
0c14b6c3 FM |
105 | virtual void SetFamily(wxFontFamily family); |
106 | virtual void SetStyle(wxFontStyle style); | |
107 | virtual void SetWeight(wxFontWeight weight); | |
85ab460e | 108 | virtual bool SetFaceName(const wxString& rsFaceName); |
e99762c0 DW |
109 | virtual void SetUnderlined(bool bUnderlined); |
110 | virtual void SetEncoding(wxFontEncoding vEncoding); | |
e99762c0 | 111 | |
f76c0758 | 112 | wxDECLARE_COMMON_FONT_METHODS(); |
0c14b6c3 | 113 | |
cc95f4f9 DW |
114 | // |
115 | // For internal use only! | |
116 | // | |
511ac294 | 117 | void SetPS(HPS hPS); |
cc95f4f9 DW |
118 | void SetFM( PFONTMETRICS pFM |
119 | ,int nNumFonts | |
120 | ); | |
e99762c0 DW |
121 | // |
122 | // Implementation only from now on | |
21802234 | 123 | // ------------------------------- |
e99762c0 | 124 | // |
e99762c0 DW |
125 | virtual bool IsFree(void) const; |
126 | virtual bool RealizeResource(void); | |
17b1d76b | 127 | virtual WXHANDLE GetResourceHandle(void) const; |
dabbc6a5 | 128 | virtual bool FreeResource(bool bForce = false); |
0e320a79 | 129 | |
08399e45 | 130 | WXHFONT GetHFONT(void) const; |
9045ad9d | 131 | |
21802234 | 132 | protected: |
9045ad9d VZ |
133 | virtual void DoSetNativeFontInfo(const wxNativeFontInfo& rInfo); |
134 | ||
4b3f61d1 SN |
135 | // implement wxObject virtuals which are used by AllocExclusive() |
136 | virtual wxGDIRefData *CreateGDIRefData() const; | |
137 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
0e320a79 | 138 | |
21802234 DW |
139 | private: |
140 | DECLARE_DYNAMIC_CLASS(wxFont) | |
e99762c0 | 141 | }; // end of wxFont |
0e320a79 | 142 | |
e99762c0 | 143 | #endif // _WX_FONT_H_ |