]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/font.h
moved OnExceptionInMainLoop() from wxAppConsole to wxAppBase because
[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
VZ
24 // ctors and such
25 wxFont() { Init(); }
4dddb8a2 26 wxFont(const wxFont& font) : wxFontBase(font) { Init(); Ref(font); }
0c5d3e1c
VZ
27
28 wxFont(int size,
29 int family,
30 int style,
31 int weight,
dabbc6a5 32 bool underlined = false,
0c5d3e1c
VZ
33 const wxString& face = wxEmptyString,
34 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
35 {
36 Init();
37
df455719 38 (void)Create(size, family, style, weight, underlined, face, encoding);
544229d1
VZ
39 }
40
41 wxFont(const wxSize& pixelSize,
42 int family,
43 int style,
44 int weight,
45 bool underlined = false,
46 const wxString& face = wxEmptyString,
47 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
48 {
49 Init();
50
df455719
VZ
51 (void)Create(pixelSize, family, style, weight,
52 underlined, face, encoding);
0c5d3e1c
VZ
53 }
54
04ef50df 55 wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0)
30764ab5
VZ
56 {
57 Init();
58
04ef50df 59 Create(info, hFont);
30764ab5
VZ
60 }
61
76e23cdb
VZ
62 wxFont(const wxString& fontDesc);
63
0c5d3e1c
VZ
64 bool Create(int size,
65 int family,
66 int style,
67 int weight,
dabbc6a5 68 bool underlined = false,
0c5d3e1c 69 const wxString& face = wxEmptyString,
df455719
VZ
70 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
71 {
72 return DoCreate(size, wxDefaultSize, false, family, style,
73 weight, underlined, face, encoding);
74 }
75
76 bool Create(const wxSize& pixelSize,
77 int family,
78 int style,
79 int weight,
80 bool underlined = false,
81 const wxString& face = wxEmptyString,
82 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
83 {
84 return DoCreate(-1, pixelSize, true, family, style,
85 weight, underlined, face, encoding);
86 }
0c5d3e1c 87
04ef50df 88 bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0);
76e23cdb 89
0c5d3e1c
VZ
90 virtual ~wxFont();
91
74b31181
VZ
92 // assignment
93 wxFont& operator=(const wxFont& font);
94
0c5d3e1c
VZ
95 // implement base class pure virtuals
96 virtual int GetPointSize() const;
544229d1
VZ
97 virtual wxSize GetPixelSize() const;
98 virtual bool IsUsingSizeInPixels() const;
0c5d3e1c
VZ
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;
3bf5a59b 105 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
0c5d3e1c
VZ
106
107 virtual void SetPointSize(int pointSize);
544229d1 108 virtual void SetPixelSize(const wxSize& pixelSize);
0c5d3e1c
VZ
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);
115
9cf8de4c
VZ
116 virtual bool IsFixedWidth() const;
117
0c5d3e1c
VZ
118 // implementation only from now on
119 // -------------------------------
120
0c5d3e1c
VZ
121 virtual bool IsFree() const;
122 virtual bool RealizeResource();
2b5f62a0 123 virtual WXHANDLE GetResourceHandle() const;
dabbc6a5 124 virtual bool FreeResource(bool force = false);
f6bcfd97 125
2b5f62a0 126 // for consistency with other wxMSW classes
f6bcfd97
BP
127 WXHFONT GetHFONT() const;
128
0c5d3e1c
VZ
129 /*
130 virtual bool UseResource();
131 virtual bool ReleaseResource();
132 */
b823f5a1
JS
133
134protected:
df455719
VZ
135 // real font creation function, used in all cases
136 bool DoCreate(int size,
137 const wxSize& pixelSize,
138 bool sizeUsingPixels,
139 int family,
140 int style,
141 int weight,
142 bool underlined = false,
143 const wxString& face = wxEmptyString,
144 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
145
9045ad9d
VZ
146 virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info);
147
0c5d3e1c
VZ
148 // common part of all ctors
149 void Init();
150
151 void Unshare();
152
153private:
154 DECLARE_DYNAMIC_CLASS(wxFont)
2bda0e17
KB
155};
156
c0089c96 157#endif // _WX_FONT_H_