]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/font.h
applied wxNativeFontInfo patch from Derry Bryson (with minor changes)
[wxWidgets.git] / include / wx / gtk / 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) { Init(); Ref(font); }
39 wxFont(const wxString& fontname, const wxFontData& fontdata) { Create(fontname, fontdata); }
40 wxFont(const wxNativeFontInfo& info);
41
42 // assignment
43 wxFont& operator=(const wxFont& font);
44
45 wxFont(int size,
46 int family,
47 int style,
48 int weight,
49 bool underlined = FALSE,
50 const wxString& face = wxEmptyString,
51 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
52 {
53 Init();
54
55 (void)Create(size, family, style, weight, underlined, face, encoding);
56 }
57
58 bool Create(int size,
59 int family,
60 int style,
61 int weight,
62 bool underlined = FALSE,
63 const wxString& face = wxEmptyString,
64 wxFontEncoding encoding = wxFONTENCODING_DEFAULT,
65 const wxNativeFontInfo& info = wxNullNativeFontInfo);
66
67 bool Create(const wxString& fontname, const wxFontData& fontdata);
68
69 ~wxFont();
70
71 // implement base class pure virtuals
72 virtual int GetPointSize() const;
73 virtual int GetFamily() const;
74 virtual int GetStyle() const;
75 virtual int GetWeight() const;
76 virtual wxString GetFaceName() const;
77 virtual bool GetUnderlined() const;
78 virtual wxFontEncoding GetEncoding() const;
79 virtual wxNativeFontInfo GetNativeFontInfo() const;
80
81 virtual void SetPointSize( int pointSize );
82 virtual void SetFamily( int family );
83 virtual void SetStyle( int style );
84 virtual void SetWeight( int weight );
85 virtual void SetFaceName( const wxString& faceName );
86 virtual void SetUnderlined( bool underlined );
87 virtual void SetEncoding(wxFontEncoding encoding);
88 virtual void SetNativeFontInfo( const wxNativeFontInfo& info );
89
90 // implementation from now on
91 void Unshare();
92
93 GdkFont* GetInternalFont(float scale = 1.0) const;
94
95 // no data :-)
96
97 protected:
98 // common part of all ctors
99 void Init();
100
101 private:
102 DECLARE_DYNAMIC_CLASS(wxFont)
103 };
104
105 #endif // __GTKFONTH__