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