]>
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
26 wxFont(const wxFont
& font
) : wxFontBase(font
) { Init(); Ref(font
); }
32 bool underlined
= false,
33 const wxString
& face
= wxEmptyString
,
34 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
38 (void)Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
41 wxFont(const wxSize
& pixelSize
,
45 bool underlined
= false,
46 const wxString
& face
= wxEmptyString
,
47 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
51 (void)Create(pixelSize
, family
, style
, weight
,
52 underlined
, face
, encoding
);
55 wxFont(const wxNativeFontInfo
& info
, WXHFONT hFont
= 0)
62 wxFont(const wxString
& fontDesc
);
68 bool underlined
= false,
69 const wxString
& face
= wxEmptyString
,
70 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
72 return DoCreate(size
, wxDefaultSize
, false, family
, style
,
73 weight
, underlined
, face
, encoding
);
76 bool Create(const wxSize
& pixelSize
,
80 bool underlined
= false,
81 const wxString
& face
= wxEmptyString
,
82 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
84 return DoCreate(-1, pixelSize
, true, family
, style
,
85 weight
, underlined
, face
, encoding
);
88 bool Create(const wxNativeFontInfo
& info
, WXHFONT hFont
= 0);
93 wxFont
& operator=(const wxFont
& font
);
95 // implement base class pure virtuals
96 virtual int GetPointSize() const;
97 virtual wxSize
GetPixelSize() const;
98 virtual bool IsUsingSizeInPixels() const;
99 virtual int GetFamily() const;
100 virtual int GetStyle() const;
101 virtual int GetWeight() const;
102 virtual bool GetUnderlined() const;
103 virtual wxString
GetFaceName() const;
104 virtual wxFontEncoding
GetEncoding() const;
105 virtual const wxNativeFontInfo
*GetNativeFontInfo() const;
107 virtual void SetPointSize(int pointSize
);
108 virtual void SetPixelSize(const wxSize
& pixelSize
);
109 virtual void SetFamily(int family
);
110 virtual void SetStyle(int style
);
111 virtual void SetWeight(int weight
);
112 virtual void SetFaceName(const wxString
& faceName
);
113 virtual void SetUnderlined(bool underlined
);
114 virtual void SetEncoding(wxFontEncoding encoding
);
116 virtual bool IsFixedWidth() const;
118 // implementation only from now on
119 // -------------------------------
121 virtual bool IsFree() const;
122 virtual bool RealizeResource();
123 virtual WXHANDLE
GetResourceHandle() const;
124 virtual bool FreeResource(bool force
= false);
126 // for consistency with other wxMSW classes
127 WXHFONT
GetHFONT() const;
130 virtual bool UseResource();
131 virtual bool ReleaseResource();
135 // real font creation function, used in all cases
136 bool DoCreate(int size
,
137 const wxSize
& pixelSize
,
138 bool sizeUsingPixels
,
142 bool underlined
= false,
143 const wxString
& face
= wxEmptyString
,
144 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
146 virtual void DoSetNativeFontInfo(const wxNativeFontInfo
& info
);
148 // common part of all ctors
154 DECLARE_DYNAMIC_CLASS(wxFont
)
157 #endif // _WX_FONT_H_