]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/font.h
set listview extended styles after switching to report view and not only when creatin...
[wxWidgets.git] / include / wx / motif / font.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/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 #if __WXMOTIF20__ && !__WXLESSTIF__
16 #define wxMOTIF_USE_RENDER_TABLE 1
17 #else
18 #define wxMOTIF_USE_RENDER_TABLE 0
19 #endif
20 #define wxMOTIF_NEW_FONT_HANDLING wxMOTIF_USE_RENDER_TABLE
21
22 class wxXFont;
23
24 // Font
25 class WXDLLIMPEXP_CORE wxFont : public wxFontBase
26 {
27 public:
28 // ctors and such
29 wxFont() { }
30
31 wxFont(int size,
32 int family,
33 int style,
34 int weight,
35 bool underlined = false,
36 const wxString& face = wxEmptyString,
37 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
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 // implement base class pure virtuals
60 virtual int GetPointSize() const;
61 virtual int GetFamily() const;
62 virtual int GetStyle() const;
63 virtual int GetWeight() const;
64 virtual bool GetUnderlined() const;
65 virtual wxString GetFaceName() const;
66 virtual wxFontEncoding GetEncoding() const;
67 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
68
69 virtual void SetPointSize(int pointSize);
70 virtual void SetFamily(int family);
71 virtual void SetStyle(int style);
72 virtual void SetWeight(int weight);
73 virtual bool SetFaceName(const wxString& faceName);
74 virtual void SetUnderlined(bool underlined);
75 virtual void SetEncoding(wxFontEncoding encoding);
76
77 // Implementation
78
79 // Find an existing, or create a new, XFontStruct
80 // based on this wxFont and the given scale. Append the
81 // font to list in the private data for future reference.
82
83 // TODO This is a fairly basic implementation, that doesn't
84 // allow for different facenames, and also doesn't do a mapping
85 // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.)
86 // and the fonts that are available on a particular system.
87 // Maybe we need to scan the user's machine to build up a profile
88 // of the fonts and a mapping file.
89
90 // Return font struct, and optionally the Motif font list
91 wxXFont *GetInternalFont(double scale = 1.0,
92 WXDisplay* display = NULL) const;
93
94 // These two are helper functions for convenient access of the above.
95 #if wxMOTIF_USE_RENDER_TABLE
96 WXFontSet GetFontSet(double scale, WXDisplay* display = NULL) const;
97 WXRenderTable GetRenderTable(WXDisplay* display) const;
98 #else // if !wxMOTIF_USE_RENDER_TABLE
99 WXFontStructPtr GetFontStruct(double scale = 1.0,
100 WXDisplay* display = NULL) const;
101 WXFontList GetFontList(double scale = 1.0,
102 WXDisplay* display = NULL) const;
103 #endif // !wxMOTIF_USE_RENDER_TABLE
104 // returns either a XmFontList or XmRenderTable, depending
105 // on Motif version
106 WXFontType GetFontType(WXDisplay* display) const;
107 // like the function above but does a copy for XmFontList
108 WXFontType GetFontTypeC(WXDisplay* display) const;
109 static WXString GetFontTag();
110
111 protected:
112 virtual wxGDIRefData *CreateGDIRefData() const;
113 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
114
115 virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
116
117 void Unshare();
118
119 private:
120 DECLARE_DYNAMIC_CLASS(wxFont)
121 };
122
123 #endif // _WX_FONT_H_