]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: font.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Created: 01/02/97 | |
6 | // Id: | |
7 | // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | ||
12 | #ifndef __GTKFONTH__ | |
13 | #define __GTKFONTH__ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface | |
17 | #endif | |
18 | ||
19 | #include "wx/defs.h" | |
20 | #include "wx/object.h" | |
21 | #include "wx/string.h" | |
22 | #include "wx/hash.h" | |
23 | #include "wx/gdiobj.h" | |
24 | ||
25 | //----------------------------------------------------------------------------- | |
26 | // classes | |
27 | //----------------------------------------------------------------------------- | |
28 | ||
29 | class wxDC; | |
30 | class wxPaintDC; | |
31 | class wxWindow; | |
32 | ||
33 | class wxFont; | |
34 | class wxFontNameDirectory; | |
35 | ||
36 | //----------------------------------------------------------------------------- | |
37 | // global variables | |
38 | //----------------------------------------------------------------------------- | |
39 | ||
40 | // extern wxFontNameDirectory wxTheFontNameDirectory; // defined below | |
41 | ||
42 | //----------------------------------------------------------------------------- | |
43 | // wxFont | |
44 | //----------------------------------------------------------------------------- | |
45 | ||
46 | class wxFont: public wxGDIObject | |
47 | { | |
48 | DECLARE_DYNAMIC_CLASS(wxFont) | |
49 | ||
50 | public: | |
51 | wxFont(void); | |
52 | wxFont( int PointSize, int FontIdOrFamily, int Style, int Weight, | |
53 | bool underlined = FALSE, const char *Face=NULL ); | |
54 | wxFont( int PointSize, const char *Face, int Family, int Style, int Weight, | |
55 | bool underlined = FALSE ); | |
56 | wxFont( const wxFont& font ); | |
57 | wxFont( const wxFont* font ); | |
58 | ~wxFont(void); | |
59 | wxFont& operator = ( const wxFont& font ); | |
60 | bool operator == ( const wxFont& font ); | |
61 | bool operator != ( const wxFont& font ); | |
62 | bool Ok(); | |
63 | ||
64 | int GetPointSize(void) const; | |
65 | wxString GetFaceName(void) const; | |
66 | int GetFamily(void) const; | |
67 | wxString GetFamilyString(void) const; | |
68 | int GetFontId(void) const; | |
69 | wxString GetFaceString(void) const; | |
70 | int GetStyle(void) const; | |
71 | wxString GetStyleString(void) const; | |
72 | int GetWeight(void) const; | |
73 | wxString GetWeightString(void) const; | |
74 | bool GetUnderlined(void) const; | |
75 | ||
76 | wxFont( char *xFontName ); | |
77 | ||
78 | private: | |
79 | ||
80 | friend wxDC; | |
81 | friend wxPaintDC; | |
82 | friend wxWindow; | |
83 | ||
84 | GdkFont* GetInternalFont(float scale = 1.0); | |
85 | ||
86 | // no data :-) | |
87 | }; | |
88 | ||
89 | //----------------------------------------------------------------------------- | |
90 | // wxFontDirectory | |
91 | //----------------------------------------------------------------------------- | |
92 | ||
93 | class wxFontNameDirectory: public wxObject | |
94 | { | |
95 | DECLARE_DYNAMIC_CLASS(wxFontNameDirectory) | |
96 | ||
97 | public: | |
98 | wxFontNameDirectory(void); | |
99 | ~wxFontNameDirectory(); | |
100 | ||
101 | void Initialize(void); | |
102 | void Initialize(int fontid, int family, const char *name); | |
103 | ||
104 | int FindOrCreateFontId(const char *name, int family); | |
105 | char* GetAFMName(int fontid, int weight, int style); | |
106 | int GetFamily(int fontid); | |
107 | int GetFontId(const char *name); | |
108 | char* GetFontName(int fontid); | |
109 | int GetNewFontId(void); | |
110 | char* GetPostScriptName(int fontid, int weight, int style); | |
111 | char* GetScreenName(int fontid, int weight, int style); | |
112 | ||
113 | ||
114 | class wxHashTable *table; | |
115 | int nextFontId; | |
116 | }; | |
117 | ||
118 | extern wxFontNameDirectory wxTheFontNameDirectory; | |
119 | ||
120 | #endif // __GTKFONTH__ |