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