]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/font.h
No real changes, just inline wxDIB::Create().
[wxWidgets.git] / include / wx / x11 / font.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/x11/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 #if FUTURE_WXWIN_COMPATIBILITY_3_0
25 wxFont(int size,
26 int family,
27 int style,
28 int weight,
29 bool underlined = false,
30 const wxString& face = wxEmptyString,
31 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
32 {
33 (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
34 }
35 #endif
36
37 wxFont(int size,
38 wxFontFamily family,
39 wxFontStyle style,
40 wxFontWeight weight,
41 bool underlined = false,
42 const wxString& face = wxEmptyString,
43 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
44 {
45 Create(size, family, style, weight, underlined, face, encoding);
46 }
47
48 wxFont(const wxSize& pixelSize,
49 wxFontFamily family,
50 wxFontStyle style,
51 wxFontWeight weight,
52 bool underlined = false,
53 const wxString& face = wxEmptyString,
54 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
55 {
56 Create(10, family, style, weight, underlined, face, encoding);
57 SetPixelSize(pixelSize);
58 }
59
60 bool Create(int size,
61 wxFontFamily family,
62 wxFontStyle style,
63 wxFontWeight weight,
64 bool underlined = false,
65 const wxString& face = wxEmptyString,
66 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
67
68 wxFont(const wxNativeFontInfo& info);
69
70 // FIXME: I added the ! to make it compile;
71 // is this right? - JACS
72 #if !wxUSE_UNICODE
73 bool Create(const wxString& fontname,
74 wxFontEncoding fontenc = wxFONTENCODING_DEFAULT);
75 #endif
76 // DELETEME: no longer seems to be implemented.
77 // bool Create(const wxNativeFontInfo& fontinfo);
78
79 virtual ~wxFont();
80
81 // implement base class pure virtuals
82 virtual int GetPointSize() const;
83 virtual wxFontStyle GetStyle() const;
84 virtual wxFontWeight GetWeight() const;
85 virtual bool GetUnderlined() const;
86 virtual wxString GetFaceName() const;
87 virtual wxFontEncoding GetEncoding() const;
88 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
89
90 virtual bool IsFixedWidth() const;
91
92 virtual void SetPointSize(int pointSize);
93 virtual void SetFamily(wxFontFamily family);
94 virtual void SetStyle(wxFontStyle style);
95 virtual void SetWeight(wxFontWeight weight);
96 virtual bool SetFaceName(const wxString& faceName);
97 virtual void SetUnderlined(bool underlined);
98 virtual void SetEncoding(wxFontEncoding encoding);
99
100 wxDECLARE_COMMON_FONT_METHODS();
101
102 // Implementation
103
104 #if wxUSE_PANGO
105 #else
106 // Find an existing, or create a new, XFontStruct
107 // based on this wxFont and the given scale. Append the
108 // font to list in the private data for future reference.
109
110 // TODO This is a fairly basic implementation, that doesn't
111 // allow for different facenames, and also doesn't do a mapping
112 // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.)
113 // and the fonts that are available on a particular system.
114 // Maybe we need to scan the user's machine to build up a profile
115 // of the fonts and a mapping file.
116
117 // Return font struct, and optionally the Motif font list
118 wxXFont *GetInternalFont(double scale = 1.0,
119 WXDisplay* display = NULL) const;
120
121 // Helper function for convenient access of the above.
122 WXFontStructPtr GetFontStruct(double scale = 1.0,
123 WXDisplay* display = NULL) const;
124 #endif
125
126 protected:
127 virtual wxGDIRefData *CreateGDIRefData() const;
128 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
129
130 virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
131 virtual wxFontFamily DoGetFamily() const;
132
133 void Unshare();
134
135 private:
136 DECLARE_DYNAMIC_CLASS(wxFont)
137 };
138
139 #endif
140 // _WX_FONT_H_