]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/os2/font.h | |
3 | // Purpose: wxFont class | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/06/99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) David Webster | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_FONT_H_ | |
13 | #define _WX_FONT_H_ | |
14 | ||
15 | #include "wx/gdiobj.h" | |
16 | #include "wx/os2/private.h" | |
17 | ||
18 | WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxEmptyString; | |
19 | ||
20 | // ---------------------------------------------------------------------------- | |
21 | // wxFont | |
22 | // ---------------------------------------------------------------------------- | |
23 | ||
24 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase | |
25 | { | |
26 | public: | |
27 | // ctors and such | |
28 | wxFont() { } | |
29 | ||
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) | |
38 | { | |
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); | |
52 | } | |
53 | ||
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 | } | |
65 | ||
66 | wxFont(int pointSize, | |
67 | wxFontFamily family, | |
68 | int flags = wxFONTFLAG_DEFAULT, | |
69 | const wxString& face = wxEmptyString, | |
70 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
71 | { | |
72 | Create(pointSize, family, | |
73 | GetStyleFromFlags(flags), | |
74 | GetWeightFromFlags(flags), | |
75 | GetUnderlinedFromFlags(flags), | |
76 | face, encoding); | |
77 | } | |
78 | ||
79 | bool Create(int size, | |
80 | wxFontFamily family, | |
81 | wxFontStyle style, | |
82 | wxFontWeight weight, | |
83 | bool underlined = false, | |
84 | const wxString& face = wxEmptyString, | |
85 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
86 | ||
87 | wxFont( const wxNativeFontInfo& rInfo | |
88 | ,WXHFONT hFont = 0 | |
89 | ) | |
90 | ||
91 | { | |
92 | (void)Create( rInfo | |
93 | ,hFont | |
94 | ); | |
95 | } | |
96 | ||
97 | wxFont(const wxString& rsFontDesc); | |
98 | ||
99 | bool Create( const wxNativeFontInfo& rInfo | |
100 | ,WXHFONT hFont = 0 | |
101 | ); | |
102 | ||
103 | virtual ~wxFont(); | |
104 | ||
105 | // | |
106 | // Implement base class pure virtuals | |
107 | // | |
108 | virtual int GetPointSize(void) const; | |
109 | virtual wxFontStyle GetStyle() const; | |
110 | virtual wxFontWeight GetWeight() const; | |
111 | virtual bool GetUnderlined(void) const; | |
112 | virtual wxString GetFaceName(void) const; | |
113 | virtual wxFontEncoding GetEncoding(void) const; | |
114 | virtual const wxNativeFontInfo* GetNativeFontInfo() const; | |
115 | ||
116 | virtual void SetPointSize(int nPointSize); | |
117 | virtual void SetFamily(wxFontFamily family); | |
118 | virtual void SetStyle(wxFontStyle style); | |
119 | virtual void SetWeight(wxFontWeight weight); | |
120 | virtual bool SetFaceName(const wxString& rsFaceName); | |
121 | virtual void SetUnderlined(bool bUnderlined); | |
122 | virtual void SetEncoding(wxFontEncoding vEncoding); | |
123 | ||
124 | wxDECLARE_COMMON_FONT_METHODS(); | |
125 | ||
126 | // | |
127 | // For internal use only! | |
128 | // | |
129 | void SetPS(HPS hPS); | |
130 | void SetFM( PFONTMETRICS pFM | |
131 | ,int nNumFonts | |
132 | ); | |
133 | // | |
134 | // Implementation only from now on | |
135 | // ------------------------------- | |
136 | // | |
137 | virtual bool IsFree(void) const; | |
138 | virtual bool RealizeResource(void); | |
139 | virtual WXHANDLE GetResourceHandle(void) const; | |
140 | virtual bool FreeResource(bool bForce = false); | |
141 | ||
142 | WXHFONT GetHFONT(void) const; | |
143 | ||
144 | protected: | |
145 | virtual void DoSetNativeFontInfo(const wxNativeFontInfo& rInfo); | |
146 | virtual wxFontFamily DoGetFamily() const; | |
147 | ||
148 | // implement wxObject virtuals which are used by AllocExclusive() | |
149 | virtual wxGDIRefData *CreateGDIRefData() const; | |
150 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
151 | ||
152 | private: | |
153 | DECLARE_DYNAMIC_CLASS(wxFont) | |
154 | }; // end of wxFont | |
155 | ||
156 | #endif // _WX_FONT_H_ |