]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/font.h
fixed off by one error in wxXPMDecoder::ReadFile
[wxWidgets.git] / include / wx / motif / font.h
CommitLineData
9b6dbb09
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: font.h
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
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_FONT_H_
13#define _WX_FONT_H_
14
15#ifdef __GNUG__
93ccaed8 16 #pragma interface "font.h"
9b6dbb09
JS
17#endif
18
a2e91a93
VZ
19class wxXFont;
20
93ccaed8
VZ
21// Font
22class wxFont : public wxFontBase
f97c9854
JS
23{
24public:
93ccaed8
VZ
25 // ctors and such
26 wxFont() { Init(); }
27 wxFont(const wxFont& font) { Init(); Ref(font); }
28
29 wxFont(int size,
30 int family,
31 int style,
32 int weight,
33 bool underlined = FALSE,
34 const wxString& face = wxEmptyString,
35 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
36 {
37 Init();
38
39 (void)Create(size, family, style, weight, underlined, face, encoding);
40 }
41
98c9fc2d 42 wxFont(const wxNativeFontInfo& info);
30764ab5 43
93ccaed8
VZ
44 bool Create(int size,
45 int family,
46 int style,
47 int weight,
48 bool underlined = FALSE,
49 const wxString& face = wxEmptyString,
50 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
51
52 virtual ~wxFont();
53
54 // assignment
55 wxFont& operator=(const wxFont& font);
56
57 // implement base class pure virtuals
58 virtual int GetPointSize() const;
59 virtual int GetFamily() const;
60 virtual int GetStyle() const;
61 virtual int GetWeight() const;
62 virtual bool GetUnderlined() const;
63 virtual wxString GetFaceName() const;
64 virtual wxFontEncoding GetEncoding() const;
65
66 virtual void SetPointSize(int pointSize);
67 virtual void SetFamily(int family);
68 virtual void SetStyle(int style);
69 virtual void SetWeight(int weight);
70 virtual void SetFaceName(const wxString& faceName);
71 virtual void SetUnderlined(bool underlined);
72 virtual void SetEncoding(wxFontEncoding encoding);
73
74 // Implementation
75
76 // Find an existing, or create a new, XFontStruct
77 // based on this wxFont and the given scale. Append the
78 // font to list in the private data for future reference.
79
80 // TODO This is a fairly basic implementation, that doesn't
81 // allow for different facenames, and also doesn't do a mapping
82 // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.)
83 // and the fonts that are available on a particular system.
84 // Maybe we need to scan the user's machine to build up a profile
85 // of the fonts and a mapping file.
86
87 // Return font struct, and optionally the Motif font list
a2e91a93
VZ
88 wxXFont *GetInternalFont(double scale = 1.0,
89 WXDisplay* display = NULL) const;
93ccaed8
VZ
90
91 // These two are helper functions for convenient access of the above.
92 WXFontStructPtr GetFontStruct(double scale = 1.0,
93 WXDisplay* display = NULL) const;
94 WXFontList GetFontList(double scale = 1.0,
95 WXDisplay* display = NULL) const;
f97c9854 96
9b6dbb09 97protected:
93ccaed8
VZ
98 // common part of all ctors
99 void Init();
9b6dbb09 100
93ccaed8
VZ
101 // VZ: IMHO, we don't need it at all...
102 bool RealizeResource() { return TRUE; }
103 void Unshare();
9b6dbb09 104
93ccaed8
VZ
105private:
106 DECLARE_DYNAMIC_CLASS(wxFont)
9b6dbb09
JS
107};
108
109#endif
110 // _WX_FONT_H_