]>
Commit | Line | Data |
---|---|---|
9b6dbb09 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: font.h | |
3 | // Purpose: wxFont class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_FONT_H_ | |
13 | #define _WX_FONT_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
93ccaed8 | 16 | #pragma interface "font.h" |
9b6dbb09 JS |
17 | #endif |
18 | ||
93ccaed8 VZ |
19 | // Font |
20 | class wxFont : public wxFontBase | |
f97c9854 JS |
21 | { |
22 | public: | |
93ccaed8 VZ |
23 | // ctors and such |
24 | wxFont() { Init(); } | |
25 | wxFont(const wxFont& font) { Init(); Ref(font); } | |
26 | ||
27 | wxFont(int size, | |
28 | int family, | |
29 | int style, | |
30 | int weight, | |
31 | bool underlined = FALSE, | |
32 | const wxString& face = wxEmptyString, | |
33 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
34 | { | |
35 | Init(); | |
36 | ||
37 | (void)Create(size, family, style, weight, underlined, face, encoding); | |
38 | } | |
39 | ||
40 | bool Create(int size, | |
41 | int family, | |
42 | int style, | |
43 | int weight, | |
44 | bool underlined = FALSE, | |
45 | const wxString& face = wxEmptyString, | |
46 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
47 | ||
48 | virtual ~wxFont(); | |
49 | ||
50 | // assignment | |
51 | wxFont& operator=(const wxFont& font); | |
52 | ||
53 | // implement base class pure virtuals | |
54 | virtual int GetPointSize() const; | |
55 | virtual int GetFamily() const; | |
56 | virtual int GetStyle() const; | |
57 | virtual int GetWeight() const; | |
58 | virtual bool GetUnderlined() const; | |
59 | virtual wxString GetFaceName() const; | |
60 | virtual wxFontEncoding GetEncoding() const; | |
61 | ||
62 | virtual void SetPointSize(int pointSize); | |
63 | virtual void SetFamily(int family); | |
64 | virtual void SetStyle(int style); | |
65 | virtual void SetWeight(int weight); | |
66 | virtual void SetFaceName(const wxString& faceName); | |
67 | virtual void SetUnderlined(bool underlined); | |
68 | virtual void SetEncoding(wxFontEncoding encoding); | |
69 | ||
70 | // Implementation | |
71 | ||
72 | // Find an existing, or create a new, XFontStruct | |
73 | // based on this wxFont and the given scale. Append the | |
74 | // font to list in the private data for future reference. | |
75 | ||
76 | // TODO This is a fairly basic implementation, that doesn't | |
77 | // allow for different facenames, and also doesn't do a mapping | |
78 | // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.) | |
79 | // and the fonts that are available on a particular system. | |
80 | // Maybe we need to scan the user's machine to build up a profile | |
81 | // of the fonts and a mapping file. | |
82 | ||
83 | // Return font struct, and optionally the Motif font list | |
84 | class wxXFont* GetInternalFont(double scale = 1.0, | |
85 | WXDisplay* display = NULL) const; | |
86 | ||
87 | // These two are helper functions for convenient access of the above. | |
88 | WXFontStructPtr GetFontStruct(double scale = 1.0, | |
89 | WXDisplay* display = NULL) const; | |
90 | WXFontList GetFontList(double scale = 1.0, | |
91 | WXDisplay* display = NULL) const; | |
f97c9854 | 92 | |
9b6dbb09 | 93 | protected: |
93ccaed8 VZ |
94 | // common part of all ctors |
95 | void Init(); | |
9b6dbb09 | 96 | |
93ccaed8 VZ |
97 | // VZ: IMHO, we don't need it at all... |
98 | bool RealizeResource() { return TRUE; } | |
99 | void Unshare(); | |
9b6dbb09 | 100 | |
93ccaed8 VZ |
101 | private: |
102 | DECLARE_DYNAMIC_CLASS(wxFont) | |
9b6dbb09 JS |
103 | }; |
104 | ||
105 | #endif | |
106 | // _WX_FONT_H_ |