]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/font.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[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 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_FONT_H_
12 #define _WX_FONT_H_
13
14 #include "wx/gdiobj.h"
15 #include "wx/os2/private.h"
16
17 WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxEmptyString;
18
19 // ----------------------------------------------------------------------------
20 // wxFont
21 // ----------------------------------------------------------------------------
22
23 class WXDLLIMPEXP_CORE wxFont : public wxFontBase
24 {
25 public:
26 // ctors and such
27 wxFont() { }
28
29 wxFont(const wxFontInfo& info)
30 {
31 Create(info.GetPointSize(),
32 info.GetFamily(),
33 info.GetStyle(),
34 info.GetWeight(),
35 info.IsUnderlined(),
36 info.GetFaceName(),
37 info.GetEncoding());
38
39 if ( info.IsUsingSizeInPixels() )
40 SetPixelSize(info.GetPixelSize());
41 }
42
43 #if FUTURE_WXWIN_COMPATIBILITY_3_0
44 wxFont(int size,
45 int family,
46 int style,
47 int weight,
48 bool underlined = false,
49 const wxString& face = wxEmptyString,
50 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
51 {
52 (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
53 }
54 #endif
55
56 wxFont(int size,
57 wxFontFamily family,
58 wxFontStyle style,
59 wxFontWeight weight,
60 bool underlined = false,
61 const wxString& face = wxEmptyString,
62 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
63 {
64 Create(size, family, style, weight, underlined, face, encoding);
65 }
66
67 wxFont(const wxSize& pixelSize,
68 wxFontFamily family,
69 wxFontStyle style,
70 wxFontWeight weight,
71 bool underlined = false,
72 const wxString& face = wxEmptyString,
73 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
74 {
75 Create(10, family, style, weight, underlined, face, encoding);
76 SetPixelSize(pixelSize);
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_