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