]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/font.h
Try to avoid accidental use of wxXmlNode in XRC handlers.
[wxWidgets.git] / include / wx / gtk1 / font.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
8ef94bfc 2// Name: wx/gtk1/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
c801d85f
KB
10#ifndef __GTKFONTH__
11#define __GTKFONTH__
12
c801d85f 13#include "wx/hash.h"
c801d85f 14
0c5d3e1c 15// ----------------------------------------------------------------------------
c801d85f 16// classes
0c5d3e1c 17// ----------------------------------------------------------------------------
c801d85f 18
b5dbe15d
VS
19class WXDLLIMPEXP_FWD_CORE wxDC;
20class WXDLLIMPEXP_FWD_CORE wxPaintDC;
21class WXDLLIMPEXP_FWD_CORE wxWindow;
c801d85f 22
b5dbe15d 23class WXDLLIMPEXP_FWD_CORE wxFont;
c801d85f 24
0c5d3e1c 25// ----------------------------------------------------------------------------
c801d85f 26// wxFont
0c5d3e1c 27// ----------------------------------------------------------------------------
c801d85f 28
20123d49 29class WXDLLIMPEXP_CORE wxFont : public wxFontBase
c801d85f 30{
358fc25c 31public:
0c5d3e1c 32 // ctors and such
8628b7d4 33 wxFont() { }
409d5a58
VZ
34
35 // wxGTK-specific
36 wxFont(const wxString& fontname)
7826e2dd 37 {
409d5a58 38 Create(fontname);
7826e2dd
VZ
39 }
40
41 wxFont(const wxNativeFontInfo& info);
0c5d3e1c 42
0c14b6c3 43#if FUTURE_WXWIN_COMPATIBILITY_3_0
0c5d3e1c
VZ
44 wxFont(int size,
45 int family,
46 int style,
47 int weight,
dabbc6a5 48 bool underlined = false,
0c5d3e1c
VZ
49 const wxString& face = wxEmptyString,
50 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
51 {
0c14b6c3
FM
52 (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
53 }
54#endif
55
56 wxFont(int size,
57 wxFontFamily family,
58 wxFontStyle style,
59 wxFontWeight weight,
60 bool underlined = false,
61 const wxString& face = wxEmptyString,
62 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
63 {
64 Create(size, family, style, weight, underlined, face, encoding);
0c5d3e1c 65 }
03647350 66
b5791cc7
FM
67 wxFont(const wxSize& pixelSize,
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 Create(10, family, style, weight, underlined, face, encoding);
76 SetPixelSize(pixelSize);
77 }
03647350 78
0634700a
VZ
79 wxFont(int pointSize,
80 wxFontFamily family,
81 int flags = wxFONTFLAG_DEFAULT,
82 const wxString& face = wxEmptyString,
83 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
84 {
85 Create(pointSize, family,
86 GetStyleFromFlags(flags),
87 GetWeightFromFlags(flags),
88 GetUnderlinedFromFlags(flags),
89 face, encoding);
90 }
91
0c5d3e1c 92 bool Create(int size,
0c14b6c3
FM
93 wxFontFamily family,
94 wxFontStyle style,
95 wxFontWeight weight,
dabbc6a5 96 bool underlined = false,
0c5d3e1c 97 const wxString& face = wxEmptyString,
7826e2dd 98 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
30764ab5 99
0c14b6c3 100
7826e2dd 101 // wxGTK-specific
409d5a58 102 bool Create(const wxString& fontname);
0c5d3e1c 103
d3c7fc99 104 virtual ~wxFont();
0c5d3e1c
VZ
105
106 // implement base class pure virtuals
107 virtual int GetPointSize() const;
0c14b6c3
FM
108 virtual wxFontStyle GetStyle() const;
109 virtual wxFontWeight GetWeight() const;
0c5d3e1c
VZ
110 virtual wxString GetFaceName() const;
111 virtual bool GetUnderlined() const;
112 virtual wxFontEncoding GetEncoding() const;
3bf5a59b 113 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
53f6aab7 114 virtual bool IsFixedWidth() const;
0c5d3e1c
VZ
115
116 virtual void SetPointSize( int pointSize );
0c14b6c3
FM
117 virtual void SetFamily(wxFontFamily family);
118 virtual void SetStyle(wxFontStyle style);
119 virtual void SetWeight(wxFontWeight weight);
85ab460e 120 virtual bool SetFaceName( const wxString& faceName );
0c5d3e1c
VZ
121 virtual void SetUnderlined( bool underlined );
122 virtual void SetEncoding(wxFontEncoding encoding);
123
f76c0758 124 wxDECLARE_COMMON_FONT_METHODS();
0c14b6c3 125
0c5d3e1c 126 // implementation from now on
0c5d3e1c
VZ
127 void Unshare();
128
129 GdkFont* GetInternalFont(float scale = 1.0) const;
130
0c5d3e1c 131protected:
8f884a0d
VZ
132 virtual wxGDIRefData *CreateGDIRefData() const;
133 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
134
9045ad9d 135 virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
59b7da02 136 virtual wxFontFamily DoGetFamily() const;
9045ad9d 137
0c5d3e1c
VZ
138private:
139 DECLARE_DYNAMIC_CLASS(wxFont)
c801d85f
KB
140};
141
c801d85f 142#endif // __GTKFONTH__