]> git.saurik.com Git - wxWidgets.git/blame - include/wx/fontutil.h
use wxBusyCursor in wxHtmlWindow instead of SetCursor (the next step is figuring...
[wxWidgets.git] / include / wx / fontutil.h
CommitLineData
7beba2fc
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/fontutil.h
3// Purpose: font-related helper functions
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 05.11.99
7// RCS-ID: $Id$
8// Copyright: (c) wxWindows team
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12// General note: this header is private to wxWindows and is not supposed to be
13// included by user code. The functions declared here are implemented in
14// msw/fontutil.cpp for Windows, unix/fontutil.cpp for GTK/Motif &c.
15
16#ifndef _WX_FONTUTIL_H_
17#define _WX_FONTUTIL_H_
18
19#ifdef __GNUG__
20 #pragma interface "fontutil.h"
21#endif
22
23// ----------------------------------------------------------------------------
24// headers
25// ----------------------------------------------------------------------------
26
27#include "wx/font.h" // for wxFont and wxFontEncoding
28
09fcd889 29#if defined(__WXMSW__)
ab5fe833
VZ
30 #include <windows.h>
31 #include "wx/msw/winundef.h"
09fcd889
VZ
32#endif
33
7beba2fc
VZ
34// ----------------------------------------------------------------------------
35// types
36// ----------------------------------------------------------------------------
37
7826e2dd
VZ
38// wxNativeFontInfo is platform-specific font representation: this struct
39// should be considered as opaque font description only used by the native
40// functions, the user code can only get the objects of this type from
41// somewhere and pass it somewhere else (possibly save them somewhere using
42// ToString() and restore them using FromString())
ab5fe833
VZ
43//
44// NB: it is a POD currently for max efficiency but if it continues to grow
45// further it might make sense to make it a real class with virtual methods
7826e2dd 46struct WXDLLEXPORT wxNativeFontInfo
7beba2fc 47{
ab5fe833
VZ
48#if defined(__WXGTK__) || defined(__WXMOTIF__)
49 // the components of the XLFD
50 wxString fontElements[14];
51
52 // the full XLFD
7826e2dd 53 wxString xFontName;
ab5fe833
VZ
54
55 // init the elements from an XLFD, return TRUE if ok
56 bool FromXFontName(const wxString& xFontName);
57
58 // generate an XLFD using the fontElements
59 wxString GetXFontName() const;
09fcd889
VZ
60#elif defined(__WXMSW__)
61 LOGFONT lf;
7826e2dd
VZ
62#else // other platforms
63 //
64 // This is a generic implementation that should work on all ports
65 // without specific support by the port.
66 //
ab5fe833
VZ
67 #define wNO_NATIVE_FONTINFO
68
7826e2dd
VZ
69 int pointSize;
70 int family;
ab5fe833
VZ
71 wxFontStyle style;
72 wxFontWeight weight;
7826e2dd
VZ
73 bool underlined;
74 wxString faceName;
75 wxFontEncoding encoding;
76#endif // platforms
77
ab5fe833
VZ
78 // default ctor (default copy ctor is ok)
79 wxNativeFontInfo() { Init(); }
80
81 // reset to the default state
82 void Init();
83
84 // accessors and modifiers for the font elements: note that there is no
85 // GetFamily() because in general it is impossible to get the family for an
86 // arbitrary native font
87 int GetPointSize() const;
88 wxFontStyle GetStyle() const;
89 wxFontWeight GetWeight() const;
90 bool GetUnderlined() const;
91 wxString GetFaceName() const;
92 wxFontEncoding GetEncoding() const;
93
94 void SetPointSize(int pointsize);
95 void SetStyle(wxFontStyle style);
96 void SetWeight(wxFontWeight weight);
97 void SetUnderlined(bool underlined);
98 void SetFaceName(wxString facename);
99 void SetEncoding(wxFontEncoding encoding);
100
7826e2dd
VZ
101 // it is important to be able to serialize wxNativeFontInfo objects to be
102 // able to store them (in config file, for example)
7beba2fc
VZ
103 bool FromString(const wxString& s);
104 wxString ToString() const;
ab5fe833
VZ
105
106 // we also want to present the native font descriptions to the user in some
107 // human-readable form (it is not platform independent neither, but can
108 // hopefully be understood by the user)
109 bool FromUserString(const wxString& s);
110 wxString ToUserString() const;
7beba2fc
VZ
111};
112
113// ----------------------------------------------------------------------------
114// font-related functions (common)
115// ----------------------------------------------------------------------------
116
117// translate a wxFontEncoding into native encoding parameter (defined above),
118// returning TRUE if an (exact) macth could be found, FALSE otherwise (without
119// attempting any substitutions)
120extern bool wxGetNativeFontEncoding(wxFontEncoding encoding,
121 wxNativeEncodingInfo *info);
122
123// test for the existence of the font described by this facename/encoding,
124// return TRUE if such font(s) exist, FALSE otherwise
125extern bool wxTestFontEncoding(const wxNativeEncodingInfo& info);
126
127// ----------------------------------------------------------------------------
128// font-related functions (X and GTK)
129// ----------------------------------------------------------------------------
130
131#ifdef _WX_X_FONTLIKE
132 #include "wx/unix/fontutil.h"
133#endif // X || GDK
134
1e6feb95
VZ
135// ----------------------------------------------------------------------------
136// font-related functions (MGL)
137// ----------------------------------------------------------------------------
138
139#ifdef __WXMGL__
140 #include "wx/mgl/fontutil.h"
141#endif // __WXMGL__
142
7beba2fc 143#endif // _WX_FONTUTIL_H_