]>
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 | #ifdef __GNUG__ | |
14 | #pragma interface | |
15 | #endif | |
16 | ||
17 | #include "wx/defs.h" | |
18 | #include "wx/object.h" | |
19 | #include "wx/string.h" | |
20 | #include "wx/hash.h" | |
21 | #include "wx/gdiobj.h" | |
22 | ||
23 | // ---------------------------------------------------------------------------- | |
24 | // classes | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
27 | class wxDC; | |
28 | class wxPaintDC; | |
29 | class wxWindow; | |
30 | ||
31 | class wxFont; | |
32 | ||
33 | // ---------------------------------------------------------------------------- | |
34 | // global variables | |
35 | // ---------------------------------------------------------------------------- | |
36 | ||
37 | extern const wxChar* wxEmptyString; | |
38 | ||
39 | // ---------------------------------------------------------------------------- | |
40 | // wxFont | |
41 | // ---------------------------------------------------------------------------- | |
42 | ||
43 | class wxFont : public wxFontBase | |
44 | { | |
45 | public: | |
46 | // ctors and such | |
47 | wxFont() { Init(); } | |
48 | wxFont(const wxFont& font) { Init(); Ref(font); } | |
49 | ||
50 | // assignment | |
51 | wxFont& operator=(const wxFont& font); | |
52 | ||
53 | wxFont(int size, | |
54 | int family, | |
55 | int style, | |
56 | int weight, | |
57 | bool underlined = FALSE, | |
58 | const wxString& face = wxEmptyString, | |
59 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
60 | { | |
61 | Init(); | |
62 | ||
63 | (void)Create(size, family, style, weight, underlined, face, encoding); | |
64 | } | |
65 | ||
66 | bool Create(int size, | |
67 | int family, | |
68 | int style, | |
69 | int weight, | |
70 | bool underlined = FALSE, | |
71 | const wxString& face = wxEmptyString, | |
72 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
73 | ||
74 | ~wxFont(); | |
75 | ||
76 | // implement base class pure virtuals | |
77 | virtual int GetPointSize() const; | |
78 | virtual int GetFamily() const; | |
79 | virtual int GetStyle() const; | |
80 | virtual int GetWeight() const; | |
81 | virtual wxString GetFaceName() const; | |
82 | virtual bool GetUnderlined() const; | |
83 | virtual wxFontEncoding GetEncoding() const; | |
84 | ||
85 | virtual void SetPointSize( int pointSize ); | |
86 | virtual void SetFamily( int family ); | |
87 | virtual void SetStyle( int style ); | |
88 | virtual void SetWeight( int weight ); | |
89 | virtual void SetFaceName( const wxString& faceName ); | |
90 | virtual void SetUnderlined( bool underlined ); | |
91 | virtual void SetEncoding(wxFontEncoding encoding); | |
92 | ||
93 | // implementation from now on | |
94 | wxFont( GdkFont* font, char *xFontName ); | |
95 | void Unshare(); | |
96 | ||
97 | GdkFont* GetInternalFont(float scale = 1.0) const; | |
98 | ||
99 | // no data :-) | |
100 | ||
101 | protected: | |
102 | // common part of all ctors | |
103 | void Init(); | |
104 | ||
105 | private: | |
106 | DECLARE_DYNAMIC_CLASS(wxFont) | |
107 | }; | |
108 | ||
109 | #endif // __GTKFONTH__ |