]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/font.h
wxAuiMDI* patches through images to wxAuiNotebook
[wxWidgets.git] / include / wx / motif / font.h
CommitLineData
9b6dbb09 1/////////////////////////////////////////////////////////////////////////////
53c5fb20 2// Name: wx/motif/font.h
9b6dbb09
JS
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
53c5fb20 9// Licence: wxWindows licence
9b6dbb09
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_FONT_H_
13#define _WX_FONT_H_
14
b0b2263b 15#if __WXMOTIF20__ && !__WXLESSTIF__
53c5fb20 16 #define wxMOTIF_NEW_FONT_HANDLING 1
eb9d223a 17 #define wxMOTIF_USE_RENDER_TABLE 1
b0b2263b
MB
18#else
19 #define wxMOTIF_NEW_FONT_HANDLING 0
eb9d223a 20 #define wxMOTIF_USE_RENDER_TABLE 0
996994c7
MB
21#endif
22
a2e91a93
VZ
23class wxXFont;
24
93ccaed8 25// Font
94c7b088 26class WXDLLIMPEXP_CORE wxFont : public wxFontBase
f97c9854
JS
27{
28public:
93ccaed8 29 // ctors and such
f8855e47 30 wxFont() { }
9045ad9d 31
93ccaed8 32 wxFont(int size,
83df96d6
JS
33 int family,
34 int style,
35 int weight,
96be256b 36 bool underlined = false,
83df96d6
JS
37 const wxString& face = wxEmptyString,
38 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
93ccaed8 39 {
93ccaed8
VZ
40 (void)Create(size, family, style, weight, underlined, face, encoding);
41 }
9045ad9d 42
98c9fc2d 43 wxFont(const wxNativeFontInfo& info);
9045ad9d 44
93ccaed8 45 bool Create(int size,
83df96d6
JS
46 int family,
47 int style,
48 int weight,
96be256b 49 bool underlined = false,
83df96d6
JS
50 const wxString& face = wxEmptyString,
51 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
9045ad9d 52
563f868d
GD
53 // wxMOTIF-specific
54 bool Create(const wxString& fontname,
83df96d6 55 wxFontEncoding fontenc = wxFONTENCODING_DEFAULT);
563f868d 56 bool Create(const wxNativeFontInfo& fontinfo);
9045ad9d 57
93ccaed8 58 virtual ~wxFont();
9045ad9d 59
93ccaed8
VZ
60 // implement base class pure virtuals
61 virtual int GetPointSize() const;
62 virtual int GetFamily() const;
63 virtual int GetStyle() const;
64 virtual int GetWeight() const;
65 virtual bool GetUnderlined() const;
66 virtual wxString GetFaceName() const;
67 virtual wxFontEncoding GetEncoding() const;
3bf5a59b 68 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
9045ad9d 69
93ccaed8
VZ
70 virtual void SetPointSize(int pointSize);
71 virtual void SetFamily(int family);
72 virtual void SetStyle(int style);
73 virtual void SetWeight(int weight);
85ab460e 74 virtual bool SetFaceName(const wxString& faceName);
93ccaed8
VZ
75 virtual void SetUnderlined(bool underlined);
76 virtual void SetEncoding(wxFontEncoding encoding);
9045ad9d 77
93ccaed8 78 // Implementation
9045ad9d 79
93ccaed8
VZ
80 // Find an existing, or create a new, XFontStruct
81 // based on this wxFont and the given scale. Append the
82 // font to list in the private data for future reference.
9045ad9d 83
93ccaed8
VZ
84 // TODO This is a fairly basic implementation, that doesn't
85 // allow for different facenames, and also doesn't do a mapping
86 // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.)
87 // and the fonts that are available on a particular system.
88 // Maybe we need to scan the user's machine to build up a profile
89 // of the fonts and a mapping file.
9045ad9d 90
93ccaed8 91 // Return font struct, and optionally the Motif font list
a2e91a93 92 wxXFont *GetInternalFont(double scale = 1.0,
83df96d6 93 WXDisplay* display = NULL) const;
9045ad9d 94
93ccaed8 95 // These two are helper functions for convenient access of the above.
eb9d223a
MB
96#if wxMOTIF_NEW_FONT_HANDLING
97 WXFontSet GetFontSet(double scale, WXDisplay* display = NULL) const;
98#else // if !wxMOTIF_NEW_FONT_HANDLING
93ccaed8 99 WXFontStructPtr GetFontStruct(double scale = 1.0,
83df96d6 100 WXDisplay* display = NULL) const;
eb9d223a
MB
101#endif // wxMOTIF_NEW_FONT_HANDLING
102#if wxMOTIF_USE_RENDER_TABLE
103 WXRenderTable GetRenderTable(WXDisplay* display) const;
104#else // if !wxMOTIF_USE_RENDER_TABLE
93ccaed8 105 WXFontList GetFontList(double scale = 1.0,
83df96d6 106 WXDisplay* display = NULL) const;
eb9d223a 107#endif // wxMOTIF_USE_RENDER_TABLE
996994c7 108 // returns either a XmFontList or XmRenderTable, depending
da494b40
MB
109 // on Motif version
110 WXFontType GetFontType(WXDisplay* display) const;
73608949
MB
111 // like the function above but does a copy for XmFontList
112 WXFontType GetFontTypeC(WXDisplay* display) const;
da494b40 113 static WXString GetFontTag();
9b6dbb09 114protected:
9045ad9d
VZ
115 virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
116
93ccaed8 117 void Unshare();
9045ad9d 118
93ccaed8
VZ
119private:
120 DECLARE_DYNAMIC_CLASS(wxFont)
9b6dbb09
JS
121};
122
123#endif
83df96d6 124// _WX_FONT_H_