]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/font.h
d95b0da260d09c57c69983567f1bf0b75e350425
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 wxFont(const wxFontInfo
& info
);
29 #if FUTURE_WXWIN_COMPATIBILITY_3_0
34 bool underlined
= false,
35 const wxString
& face
= wxEmptyString
,
36 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
38 (void)Create(size
, (wxFontFamily
)family
, (wxFontStyle
)style
, (wxFontWeight
)weight
, underlined
, face
, encoding
);
46 bool underlined
= false,
47 const wxString
& face
= wxEmptyString
,
48 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
50 Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
57 bool underlined
= false,
58 const wxString
& face
= wxEmptyString
,
59 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
61 return DoCreate(size
, wxDefaultSize
, false, family
, style
,
62 weight
, underlined
, face
, encoding
);
65 #if FUTURE_WXWIN_COMPATIBILITY_3_0
66 wxFont(const wxSize
& pixelSize
,
70 bool underlined
= false,
71 const wxString
& face
= wxEmptyString
,
72 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
74 (void)Create(pixelSize
, (wxFontFamily
)family
, (wxFontStyle
)style
, (wxFontWeight
)weight
,
75 underlined
, face
, encoding
);
79 wxFont(const wxSize
& pixelSize
,
83 bool underlined
= false,
84 const wxString
& face
= wxEmptyString
,
85 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
87 (void)Create(pixelSize
, family
, style
, weight
,
88 underlined
, face
, encoding
);
91 wxFont(const wxNativeFontInfo
& info
, WXHFONT hFont
= 0)
96 wxFont(const wxString
& fontDesc
);
99 bool Create(const wxSize
& pixelSize
,
103 bool underlined
= false,
104 const wxString
& face
= wxEmptyString
,
105 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
107 return DoCreate(-1, pixelSize
, true, family
, style
,
108 weight
, underlined
, face
, encoding
);
111 bool Create(const wxNativeFontInfo
& info
, WXHFONT hFont
= 0);
115 // implement base class pure virtuals
116 virtual int GetPointSize() const;
117 virtual wxSize
GetPixelSize() const;
118 virtual bool IsUsingSizeInPixels() const;
119 virtual wxFontStyle
GetStyle() const;
120 virtual wxFontWeight
GetWeight() const;
121 virtual bool GetUnderlined() const;
122 virtual bool GetStrikethrough() const;
123 virtual wxString
GetFaceName() const;
124 virtual wxFontEncoding
GetEncoding() const;
125 virtual const wxNativeFontInfo
*GetNativeFontInfo() const;
127 virtual void SetPointSize(int pointSize
);
128 virtual void SetPixelSize(const wxSize
& pixelSize
);
129 virtual void SetFamily(wxFontFamily family
);
130 virtual void SetStyle(wxFontStyle style
);
131 virtual void SetWeight(wxFontWeight weight
);
132 virtual bool SetFaceName(const wxString
& faceName
);
133 virtual void SetUnderlined(bool underlined
);
134 virtual void SetStrikethrough(bool strikethrough
);
135 virtual void SetEncoding(wxFontEncoding encoding
);
137 wxDECLARE_COMMON_FONT_METHODS();
139 virtual bool IsFixedWidth() const;
141 // implementation only from now on
142 // -------------------------------
144 virtual bool IsFree() const;
145 virtual bool RealizeResource();
146 virtual WXHANDLE
GetResourceHandle() const;
147 virtual bool FreeResource(bool force
= false);
149 // for consistency with other wxMSW classes
150 WXHFONT
GetHFONT() const;
153 // real font creation function, used in all cases
154 bool DoCreate(int size
,
155 const wxSize
& pixelSize
,
156 bool sizeUsingPixels
,
160 bool underlined
= false,
161 const wxString
& face
= wxEmptyString
,
162 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
164 virtual void DoSetNativeFontInfo(const wxNativeFontInfo
& info
);
165 virtual wxFontFamily
DoGetFamily() const;
167 // implement wxObject virtuals which are used by AllocExclusive()
168 virtual wxGDIRefData
*CreateGDIRefData() const;
169 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
172 DECLARE_DYNAMIC_CLASS(wxFont
)
175 #endif // _WX_FONT_H_