]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: 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_CORE wxDC; | |
20 | class WXDLLIMPEXP_CORE wxPaintDC; | |
21 | class WXDLLIMPEXP_CORE wxWindow; | |
22 | ||
23 | class WXDLLIMPEXP_CORE wxFont; | |
24 | ||
25 | // ---------------------------------------------------------------------------- | |
26 | // wxFont | |
27 | // ---------------------------------------------------------------------------- | |
28 | ||
29 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase | |
30 | { | |
31 | public: | |
32 | // ctors and such | |
33 | wxFont() { Init(); } | |
34 | wxFont(const wxFont& font) : wxFontBase() { Init(); Ref(font); } | |
35 | ||
36 | // wxGTK-specific | |
37 | wxFont(const wxString& fontname) | |
38 | { | |
39 | Init(); | |
40 | ||
41 | Create(fontname); | |
42 | } | |
43 | ||
44 | wxFont(const wxNativeFontInfo& info); | |
45 | ||
46 | wxFont(int size, | |
47 | int family, | |
48 | int style, | |
49 | int weight, | |
50 | bool underlined = false, | |
51 | const wxString& face = wxEmptyString, | |
52 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
53 | { | |
54 | Init(); | |
55 | ||
56 | (void)Create(size, family, style, weight, underlined, face, encoding); | |
57 | } | |
58 | ||
59 | bool Create(int size, | |
60 | int family, | |
61 | int style, | |
62 | int weight, | |
63 | bool underlined = false, | |
64 | const wxString& face = wxEmptyString, | |
65 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
66 | ||
67 | // wxGTK-specific | |
68 | bool Create(const wxString& fontname); | |
69 | ||
70 | ~wxFont(); | |
71 | ||
72 | // assignment | |
73 | wxFont& operator=(const wxFont& font); | |
74 | ||
75 | // implement base class pure virtuals | |
76 | virtual int GetPointSize() const; | |
77 | virtual int GetFamily() const; | |
78 | virtual int GetStyle() const; | |
79 | virtual int GetWeight() const; | |
80 | virtual wxString GetFaceName() const; | |
81 | virtual bool GetUnderlined() const; | |
82 | virtual wxFontEncoding GetEncoding() const; | |
83 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; | |
84 | virtual bool IsFixedWidth() const; | |
85 | ||
86 | virtual void SetPointSize( int pointSize ); | |
87 | virtual void SetFamily( int family ); | |
88 | virtual void SetStyle( int style ); | |
89 | virtual void SetWeight( int weight ); | |
90 | virtual void SetFaceName( const wxString& faceName ); | |
91 | virtual void SetUnderlined( bool underlined ); | |
92 | virtual void SetEncoding(wxFontEncoding encoding); | |
93 | ||
94 | virtual void SetNoAntiAliasing( bool no = true ); | |
95 | virtual bool GetNoAntiAliasing() const ; | |
96 | ||
97 | // implementation from now on | |
98 | void Unshare(); | |
99 | ||
100 | #ifndef __WXGTK20__ | |
101 | GdkFont* GetInternalFont(float scale = 1.0) const; | |
102 | #endif | |
103 | ||
104 | // no data :-) | |
105 | ||
106 | protected: | |
107 | virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); | |
108 | ||
109 | // common part of all ctors | |
110 | void Init(); | |
111 | ||
112 | private: | |
113 | DECLARE_DYNAMIC_CLASS(wxFont) | |
114 | }; | |
115 | ||
116 | #endif // __GTKFONTH__ |