]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/font.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFont class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/gdicmn.h"
17 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
21 class WXDLLIMPEXP_CORE wxFont
: public wxFontBase
27 #if FUTURE_WXWIN_COMPATIBILITY_3_0
32 bool underlined
= false,
33 const wxString
& face
= wxEmptyString
,
34 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
36 (void)Create(size
, (wxFontFamily
)family
, (wxFontStyle
)style
, (wxFontWeight
)weight
, underlined
, face
, encoding
);
44 bool underlined
= false,
45 const wxString
& face
= wxEmptyString
,
46 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
48 Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
55 bool underlined
= false,
56 const wxString
& face
= wxEmptyString
,
57 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
59 return DoCreate(size
, wxDefaultSize
, false, family
, style
,
60 weight
, underlined
, face
, encoding
);
63 #if FUTURE_WXWIN_COMPATIBILITY_3_0
64 wxFont(const wxSize
& pixelSize
,
68 bool underlined
= false,
69 const wxString
& face
= wxEmptyString
,
70 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
72 (void)Create(pixelSize
, (wxFontFamily
)family
, (wxFontStyle
)style
, (wxFontWeight
)weight
,
73 underlined
, face
, encoding
);
77 wxFont(const wxSize
& pixelSize
,
81 bool underlined
= false,
82 const wxString
& face
= wxEmptyString
,
83 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
85 (void)Create(pixelSize
, family
, style
, weight
,
86 underlined
, face
, encoding
);
89 wxFont(const wxNativeFontInfo
& info
, WXHFONT hFont
= 0)
96 int flags
= wxFONTFLAG_DEFAULT
,
97 const wxString
& face
= wxEmptyString
,
98 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
100 wxFont(const wxString
& fontDesc
);
103 bool Create(const wxSize
& pixelSize
,
107 bool underlined
= false,
108 const wxString
& face
= wxEmptyString
,
109 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
111 return DoCreate(-1, pixelSize
, true, family
, style
,
112 weight
, underlined
, face
, encoding
);
115 bool Create(const wxNativeFontInfo
& info
, WXHFONT hFont
= 0);
119 // implement base class pure virtuals
120 virtual int GetPointSize() const;
121 virtual wxSize
GetPixelSize() const;
122 virtual bool IsUsingSizeInPixels() const;
123 virtual wxFontStyle
GetStyle() const;
124 virtual wxFontWeight
GetWeight() const;
125 virtual bool GetUnderlined() const;
126 virtual bool GetStrikethrough() const;
127 virtual wxString
GetFaceName() const;
128 virtual wxFontEncoding
GetEncoding() const;
129 virtual const wxNativeFontInfo
*GetNativeFontInfo() const;
131 virtual void SetPointSize(int pointSize
);
132 virtual void SetPixelSize(const wxSize
& pixelSize
);
133 virtual void SetFamily(wxFontFamily family
);
134 virtual void SetStyle(wxFontStyle style
);
135 virtual void SetWeight(wxFontWeight weight
);
136 virtual bool SetFaceName(const wxString
& faceName
);
137 virtual void SetUnderlined(bool underlined
);
138 virtual void SetStrikethrough(bool strikethrough
);
139 virtual void SetEncoding(wxFontEncoding encoding
);
141 wxDECLARE_COMMON_FONT_METHODS();
143 virtual bool IsFixedWidth() const;
145 // implementation only from now on
146 // -------------------------------
148 virtual bool IsFree() const;
149 virtual bool RealizeResource();
150 virtual WXHANDLE
GetResourceHandle() const;
151 virtual bool FreeResource(bool force
= false);
153 // for consistency with other wxMSW classes
154 WXHFONT
GetHFONT() const;
157 // real font creation function, used in all cases
158 bool DoCreate(int size
,
159 const wxSize
& pixelSize
,
160 bool sizeUsingPixels
,
164 bool underlined
= false,
165 const wxString
& face
= wxEmptyString
,
166 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
168 virtual void DoSetNativeFontInfo(const wxNativeFontInfo
& info
);
169 virtual wxFontFamily
DoGetFamily() const;
171 // implement wxObject virtuals which are used by AllocExclusive()
172 virtual wxGDIRefData
*CreateGDIRefData() const;
173 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
176 DECLARE_DYNAMIC_CLASS(wxFont
)
179 #endif // _WX_FONT_H_