]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/font.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFont class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "font.h"
19 #if __WXMOTIF20__ && !__WXLESSTIF__
20 #define wxMOTIF_NEW_FONT_HANDLING 0 // safe default, change to 1 to enable
22 #define wxMOTIF_NEW_FONT_HANDLING 0
28 class WXDLLIMPEXP_CORE wxFont
: public wxFontBase
33 wxFont(const wxFont
& font
) { Init(); Ref(font
); }
39 bool underlined
= false,
40 const wxString
& face
= wxEmptyString
,
41 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
45 (void)Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
48 wxFont(const wxNativeFontInfo
& info
);
54 bool underlined
= false,
55 const wxString
& face
= wxEmptyString
,
56 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
59 bool Create(const wxString
& fontname
,
60 wxFontEncoding fontenc
= wxFONTENCODING_DEFAULT
);
61 bool Create(const wxNativeFontInfo
& fontinfo
);
66 wxFont
& operator=(const wxFont
& font
);
68 // implement base class pure virtuals
69 virtual int GetPointSize() const;
70 virtual int GetFamily() const;
71 virtual int GetStyle() const;
72 virtual int GetWeight() const;
73 virtual bool GetUnderlined() const;
74 virtual wxString
GetFaceName() const;
75 virtual wxFontEncoding
GetEncoding() const;
76 virtual const wxNativeFontInfo
*GetNativeFontInfo() const;
78 virtual void SetPointSize(int pointSize
);
79 virtual void SetFamily(int family
);
80 virtual void SetStyle(int style
);
81 virtual void SetWeight(int weight
);
82 virtual void SetFaceName(const wxString
& faceName
);
83 virtual void SetUnderlined(bool underlined
);
84 virtual void SetEncoding(wxFontEncoding encoding
);
88 // Find an existing, or create a new, XFontStruct
89 // based on this wxFont and the given scale. Append the
90 // font to list in the private data for future reference.
92 // TODO This is a fairly basic implementation, that doesn't
93 // allow for different facenames, and also doesn't do a mapping
94 // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.)
95 // and the fonts that are available on a particular system.
96 // Maybe we need to scan the user's machine to build up a profile
97 // of the fonts and a mapping file.
99 // Return font struct, and optionally the Motif font list
100 wxXFont
*GetInternalFont(double scale
= 1.0,
101 WXDisplay
* display
= NULL
) const;
103 // These two are helper functions for convenient access of the above.
104 #if !wxMOTIF_NEW_FONT_HANDLING
105 WXFontStructPtr
GetFontStruct(double scale
= 1.0,
106 WXDisplay
* display
= NULL
) const;
107 WXFontList
GetFontList(double scale
= 1.0,
108 WXDisplay
* display
= NULL
) const;
110 WXFontSet
GetFontSet(double scale
, WXDisplay
* display
= NULL
) const;
112 #if __WXMOTIF20__ // && !__WXLESSTIF__ for 2.7
113 WXRenderTable
GetRenderTable(WXDisplay
* display
) const;
115 // returns either a XmFontList or XmRenderTable, depending
117 WXFontType
GetFontType(WXDisplay
* display
) const;
118 // like the function above but does a copy for XmFontList
119 WXFontType
GetFontTypeC(WXDisplay
* display
) const;
120 static WXString
GetFontTag();
122 virtual void DoSetNativeFontInfo( const wxNativeFontInfo
& info
);
124 // common part of all ctors
127 // VZ: IMHO, we don't need it at all...
128 bool RealizeResource() { return true; }
132 DECLARE_DYNAMIC_CLASS(wxFont
)