]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/font.h
Correct form of mnemonics returned by wxGTK wxMenu::GetTitle().
[wxWidgets.git] / include / wx / gtk1 / font.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/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 __GTKFONTH__
11 #define __GTKFONTH__
12
13 #include "wx/hash.h"
14
15 // ----------------------------------------------------------------------------
16 // classes
17 // ----------------------------------------------------------------------------
18
19 class WXDLLIMPEXP_FWD_CORE wxDC;
20 class WXDLLIMPEXP_FWD_CORE wxPaintDC;
21 class WXDLLIMPEXP_FWD_CORE wxWindow;
22
23 class WXDLLIMPEXP_FWD_CORE wxFont;
24
25 // ----------------------------------------------------------------------------
26 // wxFont
27 // ----------------------------------------------------------------------------
28
29 class WXDLLIMPEXP_CORE wxFont : public wxFontBase
30 {
31 public:
32 // ctors and such
33 wxFont() { }
34
35 // wxGTK-specific
36 wxFont(const wxString& fontname)
37 {
38 Create(fontname);
39 }
40
41 wxFont(const wxNativeFontInfo& info);
42
43 #if FUTURE_WXWIN_COMPATIBILITY_3_0
44 wxFont(int size,
45 int family,
46 int style,
47 int weight,
48 bool underlined = false,
49 const wxString& face = wxEmptyString,
50 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
51 {
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);
65 }
66
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 }
78
79 bool Create(int size,
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
88 // wxGTK-specific
89 bool Create(const wxString& fontname);
90
91 virtual ~wxFont();
92
93 // implement base class pure virtuals
94 virtual int GetPointSize() const;
95 virtual wxFontStyle GetStyle() const;
96 virtual wxFontWeight GetWeight() const;
97 virtual wxString GetFaceName() const;
98 virtual bool GetUnderlined() const;
99 virtual wxFontEncoding GetEncoding() const;
100 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
101 virtual bool IsFixedWidth() const;
102
103 virtual void SetPointSize( int pointSize );
104 virtual void SetFamily(wxFontFamily family);
105 virtual void SetStyle(wxFontStyle style);
106 virtual void SetWeight(wxFontWeight weight);
107 virtual bool SetFaceName( const wxString& faceName );
108 virtual void SetUnderlined( bool underlined );
109 virtual void SetEncoding(wxFontEncoding encoding);
110
111 wxDECLARE_COMMON_FONT_METHODS();
112
113 // implementation from now on
114 void Unshare();
115
116 GdkFont* GetInternalFont(float scale = 1.0) const;
117
118 protected:
119 virtual wxGDIRefData *CreateGDIRefData() const;
120 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
121
122 virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
123 virtual wxFontFamily DoGetFamily() const;
124
125 private:
126 DECLARE_DYNAMIC_CLASS(wxFont)
127 };
128
129 #endif // __GTKFONTH__