]>
Commit | Line | Data |
---|---|---|
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 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
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 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; | |
85 | ||
86 | virtual void SetPointSize(int pointSize); | |
87 | virtual void SetFamily(int family); | |
88 | virtual void SetStyle(int style); | |
89 | virtual void SetWeight(int weight); | |
90 | virtual void SetFaceName(const wxString& faceName); | |
91 | virtual void SetUnderlined(bool underlined); | |
92 | virtual void SetEncoding(wxFontEncoding encoding); | |
93 | ||
94 | struct font_t *GetMGLfont_t(float scale, bool antialiased); | |
95 | ||
96 | protected: | |
97 | // common part of all ctors | |
98 | void Init() {} | |
99 | ||
100 | // ref counting code | |
101 | virtual wxObjectRefData *CreateRefData() const; | |
102 | virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; | |
103 | ||
104 | private: | |
105 | DECLARE_DYNAMIC_CLASS(wxFont) | |
106 | }; | |
107 | ||
108 | #endif // __WX_FONT_H__ |