]>
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 WXDLLEXPORT wxFont
: public wxFontBase
31 bool underlined
= false,
32 const wxString
& face
= wxEmptyString
,
33 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
35 (void)Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
38 wxFont(const wxSize
& pixelSize
,
42 bool underlined
= false,
43 const wxString
& face
= wxEmptyString
,
44 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
46 (void)Create(pixelSize
, family
, style
, weight
,
47 underlined
, face
, encoding
);
50 wxFont(const wxNativeFontInfo
& info
, WXHFONT hFont
= 0)
55 wxFont(const wxString
& fontDesc
);
61 bool underlined
= false,
62 const wxString
& face
= wxEmptyString
,
63 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
65 return DoCreate(size
, wxDefaultSize
, false, family
, style
,
66 weight
, underlined
, face
, encoding
);
69 bool Create(const wxSize
& pixelSize
,
73 bool underlined
= false,
74 const wxString
& face
= wxEmptyString
,
75 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
77 return DoCreate(-1, pixelSize
, true, family
, style
,
78 weight
, underlined
, face
, encoding
);
81 bool Create(const wxNativeFontInfo
& info
, WXHFONT hFont
= 0);
85 // implement base class pure virtuals
86 virtual int GetPointSize() const;
87 virtual wxSize
GetPixelSize() const;
88 virtual bool IsUsingSizeInPixels() const;
89 virtual int GetFamily() const;
90 virtual int GetStyle() const;
91 virtual int GetWeight() const;
92 virtual bool GetUnderlined() const;
93 virtual wxString
GetFaceName() const;
94 virtual wxFontEncoding
GetEncoding() const;
95 virtual const wxNativeFontInfo
*GetNativeFontInfo() const;
97 virtual void SetPointSize(int pointSize
);
98 virtual void SetPixelSize(const wxSize
& pixelSize
);
99 virtual void SetFamily(int family
);
100 virtual void SetStyle(int style
);
101 virtual void SetWeight(int weight
);
102 virtual void SetFaceName(const wxString
& faceName
);
103 virtual void SetUnderlined(bool underlined
);
104 virtual void SetEncoding(wxFontEncoding encoding
);
106 virtual bool IsFixedWidth() const;
108 // implementation only from now on
109 // -------------------------------
111 virtual bool IsFree() const;
112 virtual bool RealizeResource();
113 virtual WXHANDLE
GetResourceHandle() const;
114 virtual bool FreeResource(bool force
= false);
116 // for consistency with other wxMSW classes
117 WXHFONT
GetHFONT() const;
120 virtual bool UseResource();
121 virtual bool ReleaseResource();
125 // real font creation function, used in all cases
126 bool DoCreate(int size
,
127 const wxSize
& pixelSize
,
128 bool sizeUsingPixels
,
132 bool underlined
= false,
133 const wxString
& face
= wxEmptyString
,
134 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
136 virtual void DoSetNativeFontInfo(const wxNativeFontInfo
& info
);
141 DECLARE_DYNAMIC_CLASS(wxFont
)
144 #endif // _WX_FONT_H_