]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: font.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Id: $Id$ | |
6 | // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef __GTKFONTH__ | |
11 | #define __GTKFONTH__ | |
12 | ||
13 | #if defined(__GNUG__) && !defined(__APPLE__) | |
14 | #pragma interface | |
15 | #endif | |
16 | ||
17 | #include "wx/hash.h" | |
18 | ||
19 | // ---------------------------------------------------------------------------- | |
20 | // classes | |
21 | // ---------------------------------------------------------------------------- | |
22 | ||
23 | class wxDC; | |
24 | class wxPaintDC; | |
25 | class wxWindow; | |
26 | ||
27 | class wxFont; | |
28 | ||
29 | // ---------------------------------------------------------------------------- | |
30 | // wxFont | |
31 | // ---------------------------------------------------------------------------- | |
32 | ||
33 | class wxFont : public wxFontBase | |
34 | { | |
35 | public: | |
36 | // ctors and such | |
37 | wxFont() { Init(); } | |
38 | wxFont(const wxFont& font) : wxFontBase() { Init(); Ref(font); } | |
39 | ||
40 | // wxGTK-specific | |
41 | wxFont(const wxString& fontname) | |
42 | { | |
43 | Init(); | |
44 | ||
45 | Create(fontname); | |
46 | } | |
47 | ||
48 | wxFont(const wxNativeFontInfo& info); | |
49 | ||
50 | wxFont(int size, | |
51 | int family, | |
52 | int style, | |
53 | int weight, | |
54 | bool underlined = FALSE, | |
55 | const wxString& face = wxEmptyString, | |
56 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
57 | { | |
58 | Init(); | |
59 | ||
60 | (void)Create(size, family, style, weight, underlined, face, encoding); | |
61 | } | |
62 | ||
63 | bool Create(int size, | |
64 | int family, | |
65 | int style, | |
66 | int weight, | |
67 | bool underlined = FALSE, | |
68 | const wxString& face = wxEmptyString, | |
69 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
70 | ||
71 | // wxGTK-specific | |
72 | bool Create(const wxString& fontname); | |
73 | ||
74 | ~wxFont(); | |
75 | ||
76 | // assignment | |
77 | wxFont& operator=(const wxFont& font); | |
78 | ||
79 | // implement base class pure virtuals | |
80 | virtual int GetPointSize() const; | |
81 | virtual int GetFamily() const; | |
82 | virtual int GetStyle() const; | |
83 | virtual int GetWeight() const; | |
84 | virtual wxString GetFaceName() const; | |
85 | virtual bool GetUnderlined() const; | |
86 | virtual wxFontEncoding GetEncoding() const; | |
87 | virtual wxNativeFontInfo *GetNativeFontInfo() const; | |
88 | virtual bool IsFixedWidth() const; | |
89 | ||
90 | virtual void SetPointSize( int pointSize ); | |
91 | virtual void SetFamily( int family ); | |
92 | virtual void SetStyle( int style ); | |
93 | virtual void SetWeight( int weight ); | |
94 | virtual void SetFaceName( const wxString& faceName ); | |
95 | virtual void SetUnderlined( bool underlined ); | |
96 | virtual void SetEncoding(wxFontEncoding encoding); | |
97 | virtual void SetNativeFontInfo( const wxNativeFontInfo& info ); | |
98 | ||
99 | // implementation from now on | |
100 | void Unshare(); | |
101 | ||
102 | GdkFont* GetInternalFont(float scale = 1.0) const; | |
103 | ||
104 | // no data :-) | |
105 | ||
106 | protected: | |
107 | // common part of all ctors | |
108 | void Init(); | |
109 | ||
110 | private: | |
111 | DECLARE_DYNAMIC_CLASS(wxFont) | |
112 | }; | |
113 | ||
114 | #endif // __GTKFONTH__ |