]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/font.h
Fixed nasty bug wxFont
[wxWidgets.git] / include / wx / gtk1 / font.h
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
11 #ifndef __GTKFONTH__
12 #define __GTKFONTH__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "wx/defs.h"
19 #include "wx/object.h"
20 #include "wx/string.h"
21 #include "wx/hash.h"
22 #include "wx/gdiobj.h"
23
24 //-----------------------------------------------------------------------------
25 // classes
26 //-----------------------------------------------------------------------------
27
28 class wxDC;
29 class wxPaintDC;
30 class wxWindow;
31
32 class wxFont;
33 class wxFontNameDirectory;
34
35 //-----------------------------------------------------------------------------
36 // global variables
37 //-----------------------------------------------------------------------------
38
39 extern wxFontNameDirectory *wxTheFontNameDirectory;
40 extern const char* wxEmptyString;
41
42 //-----------------------------------------------------------------------------
43 // wxFont
44 //-----------------------------------------------------------------------------
45
46 class wxFont: public wxGDIObject
47 {
48 DECLARE_DYNAMIC_CLASS(wxFont)
49
50 public:
51 wxFont();
52 wxFont( int pointSize, int family, int style, int weight, bool underlined = FALSE,
53 const wxString& face = wxEmptyString );
54 wxFont( const wxFont& font );
55 ~wxFont();
56 wxFont& operator = ( const wxFont& font );
57 bool operator == ( const wxFont& font );
58 bool operator != ( const wxFont& font );
59 bool Ok() const;
60
61 int GetPointSize() const;
62 int GetFamily() const;
63 int GetFontId() const;
64 int GetStyle() const;
65 int GetWeight() const;
66 bool GetUnderlined() const;
67
68 void SetPointSize( int pointSize );
69 void SetFamily( int family );
70 void SetStyle( int style );
71 void SetWeight( int weight );
72 void SetFaceName( const wxString& faceName );
73 void SetUnderlined( bool underlined );
74
75 wxString GetFaceName() const;
76 wxString GetFamilyString() const;
77 wxString GetStyleString() const;
78 wxString GetWeightString() const;
79
80 // implementation
81
82 wxFont( char *xFontName );
83 void Unshare();
84
85 GdkFont* GetInternalFont(float scale = 1.0) const;
86
87 // no data :-)
88 };
89
90 //-----------------------------------------------------------------------------
91 // wxFontDirectory
92 //-----------------------------------------------------------------------------
93
94 class wxFontNameDirectory: public wxObject
95 {
96 DECLARE_DYNAMIC_CLASS(wxFontNameDirectory)
97
98 public:
99 wxFontNameDirectory();
100 ~wxFontNameDirectory();
101
102 void Initialize();
103 void Initialize(int fontid, int family, const char *name);
104
105 int FindOrCreateFontId(const char *name, int family);
106 char* GetAFMName(int fontid, int weight, int style);
107 int GetFamily(int fontid);
108 int GetFontId(const char *name);
109 char* GetFontName(int fontid);
110 int GetNewFontId();
111 char* GetPostScriptName(int fontid, int weight, int style);
112 char* GetScreenName(int fontid, int weight, int style);
113
114 class wxHashTable *table;
115 int nextFontId;
116 };
117
118 #endif // __GTKFONTH__