]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/font.h
filter out duplicate date changed events sent by the native control (part of bug...
[wxWidgets.git] / include / wx / msw / font.h
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
c0089c96 2// Name: wx/msw/font.h
2bda0e17
KB
3// Purpose: wxFont class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc 8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_FONT_H_
13#define _WX_FONT_H_
2bda0e17 14
c0089c96 15#include "wx/gdicmn.h"
88899f6b 16
0c5d3e1c
VZ
17// ----------------------------------------------------------------------------
18// wxFont
19// ----------------------------------------------------------------------------
20
21class WXDLLEXPORT wxFont : public wxFontBase
2bda0e17 22{
2bda0e17 23public:
0c5d3e1c 24 // ctors and such
f8855e47 25 wxFont() { }
0c5d3e1c
VZ
26
27 wxFont(int size,
28 int family,
29 int style,
30 int weight,
dabbc6a5 31 bool underlined = false,
0c5d3e1c
VZ
32 const wxString& face = wxEmptyString,
33 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
34 {
df455719 35 (void)Create(size, family, style, weight, underlined, face, encoding);
544229d1
VZ
36 }
37
38 wxFont(const wxSize& pixelSize,
39 int family,
40 int style,
41 int weight,
42 bool underlined = false,
43 const wxString& face = wxEmptyString,
44 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
45 {
df455719
VZ
46 (void)Create(pixelSize, family, style, weight,
47 underlined, face, encoding);
0c5d3e1c
VZ
48 }
49
04ef50df 50 wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0)
30764ab5 51 {
04ef50df 52 Create(info, hFont);
30764ab5
VZ
53 }
54
76e23cdb
VZ
55 wxFont(const wxString& fontDesc);
56
0c5d3e1c
VZ
57 bool Create(int size,
58 int family,
59 int style,
60 int weight,
dabbc6a5 61 bool underlined = false,
0c5d3e1c 62 const wxString& face = wxEmptyString,
df455719
VZ
63 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
64 {
65 return DoCreate(size, wxDefaultSize, false, family, style,
66 weight, underlined, face, encoding);
67 }
68
69 bool Create(const wxSize& pixelSize,
70 int family,
71 int style,
72 int weight,
73 bool underlined = false,
74 const wxString& face = wxEmptyString,
75 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
76 {
77 return DoCreate(-1, pixelSize, true, family, style,
78 weight, underlined, face, encoding);
79 }
0c5d3e1c 80
04ef50df 81 bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0);
76e23cdb 82
0c5d3e1c
VZ
83 virtual ~wxFont();
84
85ab460e
VZ
85 // wxFontBase overridden functions
86 virtual wxString GetNativeFontInfoDesc() const;
87 virtual wxString GetNativeFontInfoUserDesc() const;
88
0c5d3e1c
VZ
89 // implement base class pure virtuals
90 virtual int GetPointSize() const;
544229d1
VZ
91 virtual wxSize GetPixelSize() const;
92 virtual bool IsUsingSizeInPixels() const;
0c5d3e1c
VZ
93 virtual int GetFamily() const;
94 virtual int GetStyle() const;
95 virtual int GetWeight() const;
96 virtual bool GetUnderlined() const;
97 virtual wxString GetFaceName() const;
98 virtual wxFontEncoding GetEncoding() const;
3bf5a59b 99 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
0c5d3e1c
VZ
100
101 virtual void SetPointSize(int pointSize);
544229d1 102 virtual void SetPixelSize(const wxSize& pixelSize);
0c5d3e1c
VZ
103 virtual void SetFamily(int family);
104 virtual void SetStyle(int style);
105 virtual void SetWeight(int weight);
85ab460e 106 virtual bool SetFaceName(const wxString& faceName);
0c5d3e1c
VZ
107 virtual void SetUnderlined(bool underlined);
108 virtual void SetEncoding(wxFontEncoding encoding);
109
9cf8de4c
VZ
110 virtual bool IsFixedWidth() const;
111
0c5d3e1c
VZ
112 // implementation only from now on
113 // -------------------------------
114
0c5d3e1c
VZ
115 virtual bool IsFree() const;
116 virtual bool RealizeResource();
2b5f62a0 117 virtual WXHANDLE GetResourceHandle() const;
dabbc6a5 118 virtual bool FreeResource(bool force = false);
f6bcfd97 119
2b5f62a0 120 // for consistency with other wxMSW classes
f6bcfd97
BP
121 WXHFONT GetHFONT() const;
122
0c5d3e1c
VZ
123 /*
124 virtual bool UseResource();
125 virtual bool ReleaseResource();
126 */
b823f5a1
JS
127
128protected:
df455719
VZ
129 // real font creation function, used in all cases
130 bool DoCreate(int size,
131 const wxSize& pixelSize,
132 bool sizeUsingPixels,
133 int family,
134 int style,
135 int weight,
136 bool underlined = false,
137 const wxString& face = wxEmptyString,
138 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
139
9045ad9d
VZ
140 virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info);
141
0c5d3e1c
VZ
142 void Unshare();
143
144private:
145 DECLARE_DYNAMIC_CLASS(wxFont)
2bda0e17
KB
146};
147
c0089c96 148#endif // _WX_FONT_H_