]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/font.h
400e37285187cd2eec96feec3e6260f26568ba86
[wxWidgets.git] / include / wx / gtk / font.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/font.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_GTK_FONT_H_
11 #define _WX_GTK_FONT_H_
12
13 // ----------------------------------------------------------------------------
14 // wxFont
15 // ----------------------------------------------------------------------------
16
17 class WXDLLIMPEXP_CORE wxFont : public wxFontBase
18 {
19 public:
20 wxFont() { }
21
22 wxFont(const wxFontInfo& info);
23
24 wxFont(const wxString& nativeFontInfoString)
25 {
26 Create(nativeFontInfoString);
27 }
28
29 wxFont(const wxNativeFontInfo& info);
30
31 #if FUTURE_WXWIN_COMPATIBILITY_3_0
32 wxFont(int size,
33 int family,
34 int style,
35 int weight,
36 bool underlined = false,
37 const wxString& face = wxEmptyString,
38 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
39 {
40 (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
41 }
42 #endif
43
44 wxFont(int size,
45 wxFontFamily family,
46 wxFontStyle style,
47 wxFontWeight weight,
48 bool underlined = false,
49 const wxString& face = wxEmptyString,
50 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
51 {
52 Create(size, family, style, weight, underlined, face, encoding);
53 }
54
55 wxFont(const wxSize& pixelSize,
56 wxFontFamily family,
57 wxFontStyle style,
58 wxFontWeight weight,
59 bool underlined = false,
60 const wxString& face = wxEmptyString,
61 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
62 {
63 Create(10, family, style, weight, underlined, face, encoding);
64 SetPixelSize(pixelSize);
65 }
66
67 bool Create(int size,
68 wxFontFamily family,
69 wxFontStyle style,
70 wxFontWeight weight,
71 bool underlined = false,
72 const wxString& face = wxEmptyString,
73 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
74
75 // wxGTK-specific
76 bool Create(const wxString& fontname);
77
78 virtual ~wxFont();
79
80 // implement base class pure virtuals
81 virtual int GetPointSize() const;
82 virtual wxFontStyle GetStyle() const;
83 virtual wxFontWeight GetWeight() const;
84 virtual wxString GetFaceName() const;
85 virtual bool GetUnderlined() const;
86 virtual bool GetStrikethrough() const;
87 virtual wxFontEncoding GetEncoding() const;
88 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
89 virtual bool IsFixedWidth() const;
90
91 virtual void SetPointSize( int pointSize );
92 virtual void SetFamily(wxFontFamily family);
93 virtual void SetStyle(wxFontStyle style);
94 virtual void SetWeight(wxFontWeight weight);
95 virtual bool SetFaceName( const wxString& faceName );
96 virtual void SetUnderlined( bool underlined );
97 virtual void SetStrikethrough(bool strikethrough);
98 virtual void SetEncoding(wxFontEncoding encoding);
99
100 wxDECLARE_COMMON_FONT_METHODS();
101
102 // Set Pango attributes in the specified layout. Currently only
103 // underlined and strike-through attributes are handled by this function.
104 //
105 // If neither of them is specified, returns false, otherwise sets up the
106 // attributes and returns true.
107 bool GTKSetPangoAttrs(PangoLayout* layout) const;
108
109 // implementation from now on
110 void Unshare();
111
112 // no data :-)
113
114 protected:
115 virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
116
117 virtual wxGDIRefData* CreateGDIRefData() const;
118 virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const;
119
120 virtual wxFontFamily DoGetFamily() const;
121
122 private:
123 void Init();
124
125 DECLARE_DYNAMIC_CLASS(wxFont)
126 };
127
128 #endif // _WX_GTK_FONT_H_