]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/font.h
5b05caf5d5cd1d790421a0b1b071b3051899eec7
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFont class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "font.h"
19 #include <wx/gdicmn.h>
21 // ----------------------------------------------------------------------------
23 // ----------------------------------------------------------------------------
25 class WXDLLEXPORT wxFont
: public wxFontBase
30 wxFont(const wxFont
& font
) : wxFontBase(font
) { Init(); Ref(font
); }
36 bool underlined
= false,
37 const wxString
& face
= wxEmptyString
,
38 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
42 (void)Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
45 wxFont(const wxSize
& pixelSize
,
49 bool underlined
= false,
50 const wxString
& face
= wxEmptyString
,
51 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
55 (void)Create(pixelSize
, family
, style
, weight
,
56 underlined
, face
, encoding
);
59 wxFont(const wxNativeFontInfo
& info
, WXHFONT hFont
= 0)
66 wxFont(const wxString
& fontDesc
);
72 bool underlined
= false,
73 const wxString
& face
= wxEmptyString
,
74 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
76 return DoCreate(size
, wxDefaultSize
, false, family
, style
,
77 weight
, underlined
, face
, encoding
);
80 bool Create(const wxSize
& pixelSize
,
84 bool underlined
= false,
85 const wxString
& face
= wxEmptyString
,
86 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
88 return DoCreate(-1, pixelSize
, true, family
, style
,
89 weight
, underlined
, face
, encoding
);
92 bool Create(const wxNativeFontInfo
& info
, WXHFONT hFont
= 0);
97 wxFont
& operator=(const wxFont
& font
);
99 // implement base class pure virtuals
100 virtual int GetPointSize() const;
101 virtual wxSize
GetPixelSize() const;
102 virtual bool IsUsingSizeInPixels() const;
103 virtual int GetFamily() const;
104 virtual int GetStyle() const;
105 virtual int GetWeight() const;
106 virtual bool GetUnderlined() const;
107 virtual wxString
GetFaceName() const;
108 virtual wxFontEncoding
GetEncoding() const;
109 virtual const wxNativeFontInfo
*GetNativeFontInfo() const;
111 virtual void SetPointSize(int pointSize
);
112 virtual void SetPixelSize(const wxSize
& pixelSize
);
113 virtual void SetFamily(int family
);
114 virtual void SetStyle(int style
);
115 virtual void SetWeight(int weight
);
116 virtual void SetFaceName(const wxString
& faceName
);
117 virtual void SetUnderlined(bool underlined
);
118 virtual void SetEncoding(wxFontEncoding encoding
);
120 virtual bool IsFixedWidth() const;
122 // implementation only from now on
123 // -------------------------------
125 virtual bool IsFree() const;
126 virtual bool RealizeResource();
127 virtual WXHANDLE
GetResourceHandle() const;
128 virtual bool FreeResource(bool force
= false);
130 // for consistency with other wxMSW classes
131 WXHFONT
GetHFONT() const;
134 virtual bool UseResource();
135 virtual bool ReleaseResource();
139 // real font creation function, used in all cases
140 bool DoCreate(int size
,
141 const wxSize
& pixelSize
,
142 bool sizeUsingPixels
,
146 bool underlined
= false,
147 const wxString
& face
= wxEmptyString
,
148 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
150 virtual void DoSetNativeFontInfo(const wxNativeFontInfo
& info
);
152 // common part of all ctors
158 DECLARE_DYNAMIC_CLASS(wxFont
)