]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/font.h
SWIGged updates for wxGTK
[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 #ifdef __GNUG__
16 #pragma interface "font.h"
17 #endif
18
19 class wxXFont;
20
21 // Font
22 class wxFont : public wxFontBase
23 {
24 public:
25 // ctors and such
26 wxFont() { Init(); }
27 wxFont(const wxFont& font) { Init(); Ref(font); }
28
29 wxFont(int size,
30 int family,
31 int style,
32 int weight,
33 bool underlined = FALSE,
34 const wxString& face = wxEmptyString,
35 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
36 {
37 Init();
38
39 (void)Create(size, family, style, weight, underlined, face, encoding);
40 }
41
42 wxFont(const wxNativeFontInfo& info);
43
44 bool Create(int size,
45 int family,
46 int style,
47 int weight,
48 bool underlined = FALSE,
49 const wxString& face = wxEmptyString,
50 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
51
52 // wxMOTIF-specific
53 bool Create(const wxString& fontname,
54 wxFontEncoding fontenc = wxFONTENCODING_DEFAULT);
55 bool Create(const wxNativeFontInfo& fontinfo);
56
57 virtual ~wxFont();
58
59 // assignment
60 wxFont& operator=(const wxFont& font);
61
62 // implement base class pure virtuals
63 virtual int GetPointSize() const;
64 virtual int GetFamily() const;
65 virtual int GetStyle() const;
66 virtual int GetWeight() const;
67 virtual bool GetUnderlined() const;
68 virtual wxString GetFaceName() const;
69 virtual wxFontEncoding GetEncoding() const;
70 virtual wxNativeFontInfo *GetNativeFontInfo() const;
71
72 virtual void SetPointSize(int pointSize);
73 virtual void SetFamily(int family);
74 virtual void SetStyle(int style);
75 virtual void SetWeight(int weight);
76 virtual void SetFaceName(const wxString& faceName);
77 virtual void SetUnderlined(bool underlined);
78 virtual void SetEncoding(wxFontEncoding encoding);
79 virtual void SetNativeFontInfo( const wxNativeFontInfo& info );
80
81 // Implementation
82
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
102 protected:
103 // common part of all ctors
104 void Init();
105
106 // VZ: IMHO, we don't need it at all...
107 bool RealizeResource() { return TRUE; }
108 void Unshare();
109
110 private:
111 DECLARE_DYNAMIC_CLASS(wxFont)
112 };
113
114 #endif
115 // _WX_FONT_H_