]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/font.h
added assignment operators from int for disambiguation of expressions such as ll=0
[wxWidgets.git] / include / wx / x11 / font.h
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 class wxXFont;
16
17 // Font
18 class WXDLLIMPEXP_CORE wxFont : public wxFontBase
19 {
20 public:
21 // ctors and such
22 wxFont() { }
23
24 wxFont(int size,
25 int family,
26 int style,
27 int weight,
28 bool underlined = FALSE,
29 const wxString& face = wxEmptyString,
30 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
31 {
32 (void)Create(size, family, style, weight, underlined, face, encoding);
33 }
34
35 wxFont(const wxNativeFontInfo& info);
36
37 bool Create(int size,
38 int family,
39 int style,
40 int weight,
41 bool underlined = FALSE,
42 const wxString& face = wxEmptyString,
43 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
44
45 // FIXME: I added the ! to make it compile;
46 // is this right? - JACS
47 #if !wxUSE_UNICODE
48 bool Create(const wxString& fontname,
49 wxFontEncoding fontenc = wxFONTENCODING_DEFAULT);
50 #endif
51 // DELETEME: no longer seems to be implemented.
52 // bool Create(const wxNativeFontInfo& fontinfo);
53
54 virtual ~wxFont();
55
56 // implement base class pure virtuals
57 virtual int GetPointSize() const;
58 virtual int GetFamily() const;
59 virtual int GetStyle() const;
60 virtual int GetWeight() const;
61 virtual bool GetUnderlined() const;
62 virtual wxString GetFaceName() const;
63 virtual wxFontEncoding GetEncoding() const;
64 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
65
66 virtual bool IsFixedWidth() const;
67
68 virtual void SetPointSize(int pointSize);
69 virtual void SetFamily(int family);
70 virtual void SetStyle(int style);
71 virtual void SetWeight(int weight);
72 virtual void SetFaceName(const wxString& faceName);
73 virtual void SetUnderlined(bool underlined);
74 virtual void SetEncoding(wxFontEncoding encoding);
75
76 virtual void SetNoAntiAliasing( bool no = TRUE );
77 virtual bool GetNoAntiAliasing() const ;
78
79 // Implementation
80
81 #if wxUSE_PANGO
82 #else
83 // Find an existing, or create a new, XFontStruct
84 // based on this wxFont and the given scale. Append the
85 // font to list in the private data for future reference.
86
87 // TODO This is a fairly basic implementation, that doesn't
88 // allow for different facenames, and also doesn't do a mapping
89 // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.)
90 // and the fonts that are available on a particular system.
91 // Maybe we need to scan the user's machine to build up a profile
92 // of the fonts and a mapping file.
93
94 // Return font struct, and optionally the Motif font list
95 wxXFont *GetInternalFont(double scale = 1.0,
96 WXDisplay* display = NULL) const;
97
98 // Helper function for convenient access of the above.
99 WXFontStructPtr GetFontStruct(double scale = 1.0,
100 WXDisplay* display = NULL) const;
101 #endif
102
103 protected:
104 virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
105
106 void Unshare();
107
108 private:
109 DECLARE_DYNAMIC_CLASS(wxFont)
110 };
111
112 #endif
113 // _WX_FONT_H_