]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/font.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / msw / font.h
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
c0089c96 2// Name: wx/msw/font.h
2bda0e17
KB
3// Purpose: wxFont class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
bbcdf8bc 7// Copyright: (c) Julian Smart
65571936 8// Licence: wxWindows licence
2bda0e17
KB
9/////////////////////////////////////////////////////////////////////////////
10
bbcdf8bc
JS
11#ifndef _WX_FONT_H_
12#define _WX_FONT_H_
2bda0e17 13
c0089c96 14#include "wx/gdicmn.h"
88899f6b 15
0c5d3e1c
VZ
16// ----------------------------------------------------------------------------
17// wxFont
18// ----------------------------------------------------------------------------
19
53a2db12 20class WXDLLIMPEXP_CORE wxFont : public wxFontBase
2bda0e17 21{
2bda0e17 22public:
0c5d3e1c 23 // ctors and such
f8855e47 24 wxFont() { }
0c5d3e1c 25
b960795e
VZ
26 wxFont(const wxFontInfo& info);
27
0c14b6c3 28#if FUTURE_WXWIN_COMPATIBILITY_3_0
0c5d3e1c
VZ
29 wxFont(int size,
30 int family,
31 int style,
32 int weight,
dabbc6a5 33 bool underlined = false,
0c5d3e1c
VZ
34 const wxString& face = wxEmptyString,
35 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
36 {
0c14b6c3 37 (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
544229d1 38 }
0c14b6c3 39#endif
544229d1 40
0c14b6c3
FM
41 wxFont(int size,
42 wxFontFamily family,
43 wxFontStyle style,
44 wxFontWeight weight,
45 bool underlined = false,
46 const wxString& face = wxEmptyString,
47 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
48 {
49 Create(size, family, style, weight, underlined, face, encoding);
50 }
03647350 51
0c14b6c3
FM
52 bool Create(int size,
53 wxFontFamily family,
54 wxFontStyle style,
55 wxFontWeight weight,
56 bool underlined = false,
57 const wxString& face = wxEmptyString,
58 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
59 {
60 return DoCreate(size, wxDefaultSize, false, family, style,
61 weight, underlined, face, encoding);
62 }
63
64#if FUTURE_WXWIN_COMPATIBILITY_3_0
544229d1
VZ
65 wxFont(const wxSize& pixelSize,
66 int family,
67 int style,
68 int weight,
69 bool underlined = false,
70 const wxString& face = wxEmptyString,
71 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
0c14b6c3
FM
72 {
73 (void)Create(pixelSize, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight,
74 underlined, face, encoding);
75 }
76#endif
77
78 wxFont(const wxSize& pixelSize,
79 wxFontFamily family,
80 wxFontStyle style,
81 wxFontWeight weight,
82 bool underlined = false,
83 const wxString& face = wxEmptyString,
84 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
544229d1 85 {
df455719
VZ
86 (void)Create(pixelSize, family, style, weight,
87 underlined, face, encoding);
0c5d3e1c
VZ
88 }
89
04ef50df 90 wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0)
30764ab5 91 {
04ef50df 92 Create(info, hFont);
30764ab5
VZ
93 }
94
76e23cdb
VZ
95 wxFont(const wxString& fontDesc);
96
df455719
VZ
97
98 bool Create(const wxSize& pixelSize,
0c14b6c3
FM
99 wxFontFamily family,
100 wxFontStyle style,
101 wxFontWeight weight,
df455719
VZ
102 bool underlined = false,
103 const wxString& face = wxEmptyString,
104 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
105 {
106 return DoCreate(-1, pixelSize, true, family, style,
107 weight, underlined, face, encoding);
108 }
0c5d3e1c 109
04ef50df 110 bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0);
76e23cdb 111
0c5d3e1c
VZ
112 virtual ~wxFont();
113
114 // implement base class pure virtuals
115 virtual int GetPointSize() const;
544229d1
VZ
116 virtual wxSize GetPixelSize() const;
117 virtual bool IsUsingSizeInPixels() const;
0c14b6c3
FM
118 virtual wxFontStyle GetStyle() const;
119 virtual wxFontWeight GetWeight() const;
0c5d3e1c 120 virtual bool GetUnderlined() const;
c7a49742 121 virtual bool GetStrikethrough() const;
0c5d3e1c
VZ
122 virtual wxString GetFaceName() const;
123 virtual wxFontEncoding GetEncoding() const;
3bf5a59b 124 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
0c5d3e1c
VZ
125
126 virtual void SetPointSize(int pointSize);
544229d1 127 virtual void SetPixelSize(const wxSize& pixelSize);
0c14b6c3
FM
128 virtual void SetFamily(wxFontFamily family);
129 virtual void SetStyle(wxFontStyle style);
130 virtual void SetWeight(wxFontWeight weight);
85ab460e 131 virtual bool SetFaceName(const wxString& faceName);
0c5d3e1c 132 virtual void SetUnderlined(bool underlined);
c7a49742 133 virtual void SetStrikethrough(bool strikethrough);
0c5d3e1c
VZ
134 virtual void SetEncoding(wxFontEncoding encoding);
135
f76c0758 136 wxDECLARE_COMMON_FONT_METHODS();
0c14b6c3 137
9cf8de4c
VZ
138 virtual bool IsFixedWidth() const;
139
0c5d3e1c
VZ
140 // implementation only from now on
141 // -------------------------------
142
0c5d3e1c
VZ
143 virtual bool IsFree() const;
144 virtual bool RealizeResource();
2b5f62a0 145 virtual WXHANDLE GetResourceHandle() const;
dabbc6a5 146 virtual bool FreeResource(bool force = false);
f6bcfd97 147
2b5f62a0 148 // for consistency with other wxMSW classes
f6bcfd97
BP
149 WXHFONT GetHFONT() const;
150
b823f5a1 151protected:
df455719
VZ
152 // real font creation function, used in all cases
153 bool DoCreate(int size,
154 const wxSize& pixelSize,
155 bool sizeUsingPixels,
9817be8a
FM
156 wxFontFamily family,
157 wxFontStyle style,
158 wxFontWeight weight,
df455719
VZ
159 bool underlined = false,
160 const wxString& face = wxEmptyString,
161 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
162
9045ad9d 163 virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info);
59b7da02 164 virtual wxFontFamily DoGetFamily() const;
9045ad9d 165
f030b28c 166 // implement wxObject virtuals which are used by AllocExclusive()
8f884a0d
VZ
167 virtual wxGDIRefData *CreateGDIRefData() const;
168 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
0c5d3e1c
VZ
169
170private:
171 DECLARE_DYNAMIC_CLASS(wxFont)
2bda0e17
KB
172};
173
c0089c96 174#endif // _WX_FONT_H_