]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/font.h
Make wxComboCtrlBase::Set*groundColour() methods public.
[wxWidgets.git] / include / wx / msw / font.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/font.h
3 // Purpose: wxFont class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_FONT_H_
12 #define _WX_FONT_H_
13
14 #include "wx/gdicmn.h"
15
16 // ----------------------------------------------------------------------------
17 // wxFont
18 // ----------------------------------------------------------------------------
19
20 class WXDLLIMPEXP_CORE wxFont : public wxFontBase
21 {
22 public:
23 // ctors and such
24 wxFont() { }
25
26 wxFont(const wxFontInfo& info);
27
28 #if FUTURE_WXWIN_COMPATIBILITY_3_0
29 wxFont(int size,
30 int family,
31 int style,
32 int weight,
33 bool underlined = false,
34 const wxString& face = wxEmptyString,
35 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
36 {
37 (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
38 }
39 #endif
40
41 wxFont(int size,
42 wxFontFamily family,
43 wxFontStyle style,
44 wxFontWeight weight,
45 bool underlined = false,
46 const wxString& face = wxEmptyString,
47 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
48 {
49 Create(size, family, style, weight, underlined, face, encoding);
50 }
51
52 bool Create(int size,
53 wxFontFamily family,
54 wxFontStyle style,
55 wxFontWeight weight,
56 bool underlined = false,
57 const wxString& face = wxEmptyString,
58 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
59 {
60 return DoCreate(size, wxDefaultSize, false, family, style,
61 weight, underlined, face, encoding);
62 }
63
64 #if FUTURE_WXWIN_COMPATIBILITY_3_0
65 wxFont(const wxSize& pixelSize,
66 int family,
67 int style,
68 int weight,
69 bool underlined = false,
70 const wxString& face = wxEmptyString,
71 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
72 {
73 (void)Create(pixelSize, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight,
74 underlined, face, encoding);
75 }
76 #endif
77
78 wxFont(const wxSize& pixelSize,
79 wxFontFamily family,
80 wxFontStyle style,
81 wxFontWeight weight,
82 bool underlined = false,
83 const wxString& face = wxEmptyString,
84 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
85 {
86 (void)Create(pixelSize, family, style, weight,
87 underlined, face, encoding);
88 }
89
90 wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0)
91 {
92 Create(info, hFont);
93 }
94
95 wxFont(const wxString& fontDesc);
96
97
98 bool Create(const wxSize& pixelSize,
99 wxFontFamily family,
100 wxFontStyle style,
101 wxFontWeight weight,
102 bool underlined = false,
103 const wxString& face = wxEmptyString,
104 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
105 {
106 return DoCreate(-1, pixelSize, true, family, style,
107 weight, underlined, face, encoding);
108 }
109
110 bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0);
111
112 virtual ~wxFont();
113
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;
125
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);
135
136 wxDECLARE_COMMON_FONT_METHODS();
137
138 virtual bool IsFixedWidth() const;
139
140 // implementation only from now on
141 // -------------------------------
142
143 virtual bool IsFree() const;
144 virtual bool RealizeResource();
145 virtual WXHANDLE GetResourceHandle() const;
146 virtual bool FreeResource(bool force = false);
147
148 // for consistency with other wxMSW classes
149 WXHFONT GetHFONT() const;
150
151 protected:
152 // real font creation function, used in all cases
153 bool DoCreate(int size,
154 const wxSize& pixelSize,
155 bool sizeUsingPixels,
156 wxFontFamily family,
157 wxFontStyle style,
158 wxFontWeight weight,
159 bool underlined = false,
160 const wxString& face = wxEmptyString,
161 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
162
163 virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info);
164 virtual wxFontFamily DoGetFamily() const;
165
166 // implement wxObject virtuals which are used by AllocExclusive()
167 virtual wxGDIRefData *CreateGDIRefData() const;
168 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
169
170 private:
171 DECLARE_DYNAMIC_CLASS(wxFont)
172 };
173
174 #endif // _WX_FONT_H_