]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/font.h
de17523e9f6191c5b7d7f3fb091d54a69e1dfaa8
[wxWidgets.git] / include / wx / gtk1 / font.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: font.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __GTKFONTH__
11 #define __GTKFONTH__
12
13 #ifdef __GNUG__
14 #pragma interface
15 #endif
16
17 #include "wx/hash.h"
18
19 // ----------------------------------------------------------------------------
20 // classes
21 // ----------------------------------------------------------------------------
22
23 class wxDC;
24 class wxPaintDC;
25 class wxWindow;
26
27 class wxFont;
28
29 // ----------------------------------------------------------------------------
30 // wxFont
31 // ----------------------------------------------------------------------------
32
33 class wxFont : public wxFontBase
34 {
35 public:
36 // ctors and such
37 wxFont() { Init(); }
38 wxFont(const wxFont& font) : wxFontBase() { Init(); Ref(font); }
39 wxFont(const wxString& fontname,
40 wxFontEncoding fontenc = wxFONTENCODING_DEFAULT)
41 {
42 Init();
43
44 Create(fontname, fontenc);
45 }
46
47 wxFont(const wxNativeFontInfo& info);
48
49 wxFont(int size,
50 int family,
51 int style,
52 int weight,
53 bool underlined = FALSE,
54 const wxString& face = wxEmptyString,
55 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
56 {
57 Init();
58
59 (void)Create(size, family, style, weight, underlined, face, encoding);
60 }
61
62 bool Create(int size,
63 int family,
64 int style,
65 int weight,
66 bool underlined = FALSE,
67 const wxString& face = wxEmptyString,
68 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
69
70 // wxGTK-specific
71 bool Create(const wxString& fontname,
72 wxFontEncoding fontenc = wxFONTENCODING_DEFAULT);
73 bool Create(const wxNativeFontInfo& fontinfo);
74
75 ~wxFont();
76
77 // assignment
78 wxFont& operator=(const wxFont& font);
79
80 // implement base class pure virtuals
81 virtual int GetPointSize() const;
82 virtual int GetFamily() const;
83 virtual int GetStyle() const;
84 virtual int GetWeight() const;
85 virtual wxString GetFaceName() const;
86 virtual bool GetUnderlined() const;
87 virtual wxFontEncoding GetEncoding() const;
88 virtual wxNativeFontInfo *GetNativeFontInfo() const;
89 virtual bool IsFixedWidth() const;
90
91 virtual void SetPointSize( int pointSize );
92 virtual void SetFamily( int family );
93 virtual void SetStyle( int style );
94 virtual void SetWeight( int weight );
95 virtual void SetFaceName( const wxString& faceName );
96 virtual void SetUnderlined( bool underlined );
97 virtual void SetEncoding(wxFontEncoding encoding);
98 virtual void SetNativeFontInfo( const wxNativeFontInfo& info );
99
100 // implementation from now on
101 void Unshare();
102
103 GdkFont* GetInternalFont(float scale = 1.0) const;
104
105 // no data :-)
106
107 protected:
108 // common part of all ctors
109 void Init();
110
111 // do we have the XFLD for this font (or just wxWin description)?
112 inline bool HasNativeFont() const;
113
114 private:
115 DECLARE_DYNAMIC_CLASS(wxFont)
116 };
117
118 #endif // __GTKFONTH__