]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/font.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFont class
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
14 #include "wx/gdicmn.h"
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 class WXDLLIMPEXP_CORE wxFont
: public wxFontBase
26 wxFont(const wxFontInfo
& info
);
28 #if FUTURE_WXWIN_COMPATIBILITY_3_0
33 bool underlined
= false,
34 const wxString
& face
= wxEmptyString
,
35 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
37 (void)Create(size
, (wxFontFamily
)family
, (wxFontStyle
)style
, (wxFontWeight
)weight
, underlined
, face
, encoding
);
45 bool underlined
= false,
46 const wxString
& face
= wxEmptyString
,
47 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
49 Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
56 bool underlined
= false,
57 const wxString
& face
= wxEmptyString
,
58 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
60 return DoCreate(size
, wxDefaultSize
, false, family
, style
,
61 weight
, underlined
, face
, encoding
);
64 #if FUTURE_WXWIN_COMPATIBILITY_3_0
65 wxFont(const wxSize
& pixelSize
,
69 bool underlined
= false,
70 const wxString
& face
= wxEmptyString
,
71 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
73 (void)Create(pixelSize
, (wxFontFamily
)family
, (wxFontStyle
)style
, (wxFontWeight
)weight
,
74 underlined
, face
, encoding
);
78 wxFont(const wxSize
& pixelSize
,
82 bool underlined
= false,
83 const wxString
& face
= wxEmptyString
,
84 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
86 (void)Create(pixelSize
, family
, style
, weight
,
87 underlined
, face
, encoding
);
90 wxFont(const wxNativeFontInfo
& info
, WXHFONT hFont
= 0)
95 wxFont(const wxString
& fontDesc
);
98 bool Create(const wxSize
& pixelSize
,
102 bool underlined
= false,
103 const wxString
& face
= wxEmptyString
,
104 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
106 return DoCreate(-1, pixelSize
, true, family
, style
,
107 weight
, underlined
, face
, encoding
);
110 bool Create(const wxNativeFontInfo
& info
, WXHFONT hFont
= 0);
114 // implement base class pure virtuals
115 virtual int GetPointSize() const;
116 virtual wxSize
GetPixelSize() const;
117 virtual bool IsUsingSizeInPixels() const;
118 virtual wxFontStyle
GetStyle() const;
119 virtual wxFontWeight
GetWeight() const;
120 virtual bool GetUnderlined() const;
121 virtual bool GetStrikethrough() const;
122 virtual wxString
GetFaceName() const;
123 virtual wxFontEncoding
GetEncoding() const;
124 virtual const wxNativeFontInfo
*GetNativeFontInfo() const;
126 virtual void SetPointSize(int pointSize
);
127 virtual void SetPixelSize(const wxSize
& pixelSize
);
128 virtual void SetFamily(wxFontFamily family
);
129 virtual void SetStyle(wxFontStyle style
);
130 virtual void SetWeight(wxFontWeight weight
);
131 virtual bool SetFaceName(const wxString
& faceName
);
132 virtual void SetUnderlined(bool underlined
);
133 virtual void SetStrikethrough(bool strikethrough
);
134 virtual void SetEncoding(wxFontEncoding encoding
);
136 wxDECLARE_COMMON_FONT_METHODS();
138 virtual bool IsFixedWidth() const;
140 // implementation only from now on
141 // -------------------------------
143 virtual bool IsFree() const;
144 virtual bool RealizeResource();
145 virtual WXHANDLE
GetResourceHandle() const;
146 virtual bool FreeResource(bool force
= false);
148 // for consistency with other wxMSW classes
149 WXHFONT
GetHFONT() const;
152 // real font creation function, used in all cases
153 bool DoCreate(int size
,
154 const wxSize
& pixelSize
,
155 bool sizeUsingPixels
,
159 bool underlined
= false,
160 const wxString
& face
= wxEmptyString
,
161 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
163 virtual void DoSetNativeFontInfo(const wxNativeFontInfo
& info
);
164 virtual wxFontFamily
DoGetFamily() const;
166 // implement wxObject virtuals which are used by AllocExclusive()
167 virtual wxGDIRefData
*CreateGDIRefData() const;
168 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
171 DECLARE_DYNAMIC_CLASS(wxFont
)
174 #endif // _WX_FONT_H_