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