]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mgl/font.h
It was not acceptable to call the class method from the static initializer
[wxWidgets.git] / include / wx / mgl / font.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: font.h
3 // Author: Vaclav Slavik
4 // Id: $Id$
5 // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 #ifndef __WX_FONT_H__
10 #define __WX_FONT_H__
11
12 #ifdef __GNUG__
13 #pragma interface "font.h"
14 #endif
15
16 #include "wx/hash.h"
17
18 // ----------------------------------------------------------------------------
19 // classes
20 // ----------------------------------------------------------------------------
21
22 class WXDLLEXPORT wxDC;
23 class WXDLLEXPORT wxPaintDC;
24 class WXDLLEXPORT wxWindow;
25 class WXDLLEXPORT wxFont;
26
27 struct font_t;
28
29 // ----------------------------------------------------------------------------
30 // wxFont
31 // ----------------------------------------------------------------------------
32
33 class WXDLLEXPORT wxFont : public wxFontBase
34 {
35 public:
36 // ctors and such
37 wxFont() { Init(); }
38 wxFont(const wxFont& font) { Init(); Ref(font); }
39
40 wxFont(const wxNativeFontInfo& info)
41 {
42 Init();
43
44 (void)Create(info);
45 }
46
47 wxFont(int size,
48 int family,
49 int style,
50 int weight,
51 bool underlined = FALSE,
52 const wxString& face = wxEmptyString,
53 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
54 {
55 Init();
56
57 (void)Create(size, family, style, weight, underlined, face, encoding);
58 }
59
60 bool Create(int size,
61 int family,
62 int style,
63 int weight,
64 bool underlined = FALSE,
65 const wxString& face = wxEmptyString,
66 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
67
68 bool Create(const wxNativeFontInfo& fontinfo);
69
70 ~wxFont() {}
71
72 // assignment
73 wxFont& operator=(const wxFont& font);
74
75 // implement base class pure virtuals
76 virtual int GetPointSize() const;
77 virtual int GetFamily() const;
78 virtual int GetStyle() const;
79 virtual int GetWeight() const;
80 virtual wxString GetFaceName() const;
81 virtual bool GetUnderlined() const;
82 virtual wxFontEncoding GetEncoding() const;
83 virtual bool IsFixedWidth() const;
84
85 virtual void SetPointSize(int pointSize);
86 virtual void SetFamily(int family);
87 virtual void SetStyle(int style);
88 virtual void SetWeight(int weight);
89 virtual void SetFaceName(const wxString& faceName);
90 virtual void SetUnderlined(bool underlined);
91 virtual void SetEncoding(wxFontEncoding encoding);
92
93 struct font_t *GetMGLfont_t(float scale, bool antialiased);
94
95 protected:
96 // common part of all ctors
97 void Init() {}
98
99 // ref counting code
100 virtual wxObjectRefData *CreateRefData() const;
101 virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
102
103 private:
104 DECLARE_DYNAMIC_CLASS(wxFont)
105 };
106
107 #endif // __WX_FONT_H__