]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/gtk1/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_FWD_CORE wxDC; | |
20 | class WXDLLIMPEXP_FWD_CORE wxPaintDC; | |
21 | class WXDLLIMPEXP_FWD_CORE wxWindow; | |
22 | ||
23 | class WXDLLIMPEXP_FWD_CORE wxFont; | |
24 | ||
25 | // ---------------------------------------------------------------------------- | |
26 | // wxFont | |
27 | // ---------------------------------------------------------------------------- | |
28 | ||
29 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase | |
30 | { | |
31 | public: | |
32 | // ctors and such | |
33 | wxFont() { } | |
34 | ||
35 | wxFont(const wxFontInfo& info) | |
36 | { | |
37 | Create(info.GetPointSize(), | |
38 | info.GetFamily(), | |
39 | info.GetStyle(), | |
40 | info.GetWeight(), | |
41 | info.IsUnderlined(), | |
42 | info.GetFaceName(), | |
43 | info.GetEncoding()); | |
44 | ||
45 | if ( info.IsUsingSizeInPixels() ) | |
46 | SetPixelSize(info.GetPixelSize()); | |
47 | } | |
48 | ||
49 | wxFont(const wxString& fontname) | |
50 | { | |
51 | Create(fontname); | |
52 | } | |
53 | ||
54 | wxFont(const wxNativeFontInfo& info); | |
55 | ||
56 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 | |
57 | wxFont(int size, | |
58 | int family, | |
59 | int style, | |
60 | int weight, | |
61 | bool underlined = false, | |
62 | const wxString& face = wxEmptyString, | |
63 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
64 | { | |
65 | (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); | |
66 | } | |
67 | #endif | |
68 | ||
69 | wxFont(int size, | |
70 | wxFontFamily family, | |
71 | wxFontStyle style, | |
72 | wxFontWeight weight, | |
73 | bool underlined = false, | |
74 | const wxString& face = wxEmptyString, | |
75 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
76 | { | |
77 | Create(size, family, style, weight, underlined, face, encoding); | |
78 | } | |
79 | ||
80 | wxFont(const wxSize& pixelSize, | |
81 | wxFontFamily family, | |
82 | wxFontStyle style, | |
83 | wxFontWeight weight, | |
84 | bool underlined = false, | |
85 | const wxString& face = wxEmptyString, | |
86 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
87 | { | |
88 | Create(10, family, style, weight, underlined, face, encoding); | |
89 | SetPixelSize(pixelSize); | |
90 | } | |
91 | ||
92 | bool Create(int size, | |
93 | wxFontFamily family, | |
94 | wxFontStyle style, | |
95 | wxFontWeight weight, | |
96 | bool underlined = false, | |
97 | const wxString& face = wxEmptyString, | |
98 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
99 | ||
100 | ||
101 | // wxGTK-specific | |
102 | bool Create(const wxString& fontname); | |
103 | ||
104 | virtual ~wxFont(); | |
105 | ||
106 | // implement base class pure virtuals | |
107 | virtual int GetPointSize() const; | |
108 | virtual wxFontStyle GetStyle() const; | |
109 | virtual wxFontWeight GetWeight() const; | |
110 | virtual wxString GetFaceName() const; | |
111 | virtual bool GetUnderlined() const; | |
112 | virtual wxFontEncoding GetEncoding() const; | |
113 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; | |
114 | virtual bool IsFixedWidth() const; | |
115 | ||
116 | virtual void SetPointSize( int pointSize ); | |
117 | virtual void SetFamily(wxFontFamily family); | |
118 | virtual void SetStyle(wxFontStyle style); | |
119 | virtual void SetWeight(wxFontWeight weight); | |
120 | virtual bool SetFaceName( const wxString& faceName ); | |
121 | virtual void SetUnderlined( bool underlined ); | |
122 | virtual void SetEncoding(wxFontEncoding encoding); | |
123 | ||
124 | wxDECLARE_COMMON_FONT_METHODS(); | |
125 | ||
126 | // implementation from now on | |
127 | void Unshare(); | |
128 | ||
129 | GdkFont* GetInternalFont(float scale = 1.0) const; | |
130 | ||
131 | protected: | |
132 | virtual wxGDIRefData *CreateGDIRefData() const; | |
133 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
134 | ||
135 | virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); | |
136 | virtual wxFontFamily DoGetFamily() const; | |
137 | ||
138 | private: | |
139 | DECLARE_DYNAMIC_CLASS(wxFont) | |
140 | }; | |
141 | ||
142 | #endif // __GTKFONTH__ |