]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/font.h
Define WXBUILDING in Xcode projects.
[wxWidgets.git] / include / wx / os2 / font.h
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 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
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)
52 {
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);
66 }
67
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 }
79
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
88 wxFont( const wxNativeFontInfo& rInfo
89 ,WXHFONT hFont = 0
90 )
91
92 {
93 (void)Create( rInfo
94 ,hFont
95 );
96 }
97
98 wxFont(const wxString& rsFontDesc);
99
100 bool Create( const wxNativeFontInfo& rInfo
101 ,WXHFONT hFont = 0
102 );
103
104 virtual ~wxFont();
105
106 //
107 // Implement base class pure virtuals
108 //
109 virtual int GetPointSize(void) const;
110 virtual wxFontStyle GetStyle() const;
111 virtual wxFontWeight GetWeight() const;
112 virtual bool GetUnderlined(void) const;
113 virtual wxString GetFaceName(void) const;
114 virtual wxFontEncoding GetEncoding(void) const;
115 virtual const wxNativeFontInfo* GetNativeFontInfo() const;
116
117 virtual void SetPointSize(int nPointSize);
118 virtual void SetFamily(wxFontFamily family);
119 virtual void SetStyle(wxFontStyle style);
120 virtual void SetWeight(wxFontWeight weight);
121 virtual bool SetFaceName(const wxString& rsFaceName);
122 virtual void SetUnderlined(bool bUnderlined);
123 virtual void SetEncoding(wxFontEncoding vEncoding);
124
125 wxDECLARE_COMMON_FONT_METHODS();
126
127 //
128 // For internal use only!
129 //
130 void SetPS(HPS hPS);
131 void SetFM( PFONTMETRICS pFM
132 ,int nNumFonts
133 );
134 //
135 // Implementation only from now on
136 // -------------------------------
137 //
138 virtual bool IsFree(void) const;
139 virtual bool RealizeResource(void);
140 virtual WXHANDLE GetResourceHandle(void) const;
141 virtual bool FreeResource(bool bForce = false);
142
143 WXHFONT GetHFONT(void) const;
144
145 protected:
146 virtual void DoSetNativeFontInfo(const wxNativeFontInfo& rInfo);
147 virtual wxFontFamily DoGetFamily() const;
148
149 // implement wxObject virtuals which are used by AllocExclusive()
150 virtual wxGDIRefData *CreateGDIRefData() const;
151 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
152
153 private:
154 DECLARE_DYNAMIC_CLASS(wxFont)
155 }; // end of wxFont
156
157 #endif // _WX_FONT_H_