]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/font.h
The rounded corners look really dumb at this size.
[wxWidgets.git] / include / wx / gtk1 / font.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/font.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 #ifndef __GTKFONTH__
10 #define __GTKFONTH__
11
12 #include "wx/hash.h"
13
14 // ----------------------------------------------------------------------------
15 // classes
16 // ----------------------------------------------------------------------------
17
18 class WXDLLIMPEXP_FWD_CORE wxDC;
19 class WXDLLIMPEXP_FWD_CORE wxPaintDC;
20 class WXDLLIMPEXP_FWD_CORE wxWindow;
21
22 class WXDLLIMPEXP_FWD_CORE wxFont;
23
24 // ----------------------------------------------------------------------------
25 // wxFont
26 // ----------------------------------------------------------------------------
27
28 class WXDLLIMPEXP_CORE wxFont : public wxFontBase
29 {
30 public:
31 // ctors and such
32 wxFont() { }
33
34 wxFont(const wxFontInfo& info)
35 {
36 Create(info.GetPointSize(),
37 info.GetFamily(),
38 info.GetStyle(),
39 info.GetWeight(),
40 info.IsUnderlined(),
41 info.GetFaceName(),
42 info.GetEncoding());
43
44 if ( info.IsUsingSizeInPixels() )
45 SetPixelSize(info.GetPixelSize());
46 }
47
48 wxFont(const wxString& fontname)
49 {
50 Create(fontname);
51 }
52
53 wxFont(const wxNativeFontInfo& info);
54
55 #if FUTURE_WXWIN_COMPATIBILITY_3_0
56 wxFont(int size,
57 int family,
58 int style,
59 int weight,
60 bool underlined = false,
61 const wxString& face = wxEmptyString,
62 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
63 {
64 (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
65 }
66 #endif
67
68 wxFont(int size,
69 wxFontFamily family,
70 wxFontStyle style,
71 wxFontWeight weight,
72 bool underlined = false,
73 const wxString& face = wxEmptyString,
74 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
75 {
76 Create(size, family, style, weight, underlined, face, encoding);
77 }
78
79 wxFont(const wxSize& pixelSize,
80 wxFontFamily family,
81 wxFontStyle style,
82 wxFontWeight weight,
83 bool underlined = false,
84 const wxString& face = wxEmptyString,
85 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
86 {
87 Create(10, family, style, weight, underlined, face, encoding);
88 SetPixelSize(pixelSize);
89 }
90
91 bool Create(int size,
92 wxFontFamily family,
93 wxFontStyle style,
94 wxFontWeight weight,
95 bool underlined = false,
96 const wxString& face = wxEmptyString,
97 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
98
99
100 // wxGTK-specific
101 bool Create(const wxString& fontname);
102
103 virtual ~wxFont();
104
105 // implement base class pure virtuals
106 virtual int GetPointSize() const;
107 virtual wxFontStyle GetStyle() const;
108 virtual wxFontWeight GetWeight() const;
109 virtual wxString GetFaceName() const;
110 virtual bool GetUnderlined() const;
111 virtual wxFontEncoding GetEncoding() const;
112 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
113 virtual bool IsFixedWidth() const;
114
115 virtual void SetPointSize( int pointSize );
116 virtual void SetFamily(wxFontFamily family);
117 virtual void SetStyle(wxFontStyle style);
118 virtual void SetWeight(wxFontWeight weight);
119 virtual bool SetFaceName( const wxString& faceName );
120 virtual void SetUnderlined( bool underlined );
121 virtual void SetEncoding(wxFontEncoding encoding);
122
123 wxDECLARE_COMMON_FONT_METHODS();
124
125 // implementation from now on
126 void Unshare();
127
128 GdkFont* GetInternalFont(float scale = 1.0) const;
129
130 protected:
131 virtual wxGDIRefData *CreateGDIRefData() const;
132 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
133
134 virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
135 virtual wxFontFamily DoGetFamily() const;
136
137 private:
138 DECLARE_DYNAMIC_CLASS(wxFont)
139 };
140
141 #endif // __GTKFONTH__