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