]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
8ef94bfc | 2 | // Name: wx/gtk1/font.h |
c801d85f KB |
3 | // Purpose: |
4 | // Author: Robert Roebling | |
371a5b4e | 5 | // Copyright: (c) 1998 Robert Roebling |
65571936 | 6 | // Licence: wxWindows licence |
c801d85f KB |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
c801d85f KB |
9 | #ifndef __GTKFONTH__ |
10 | #define __GTKFONTH__ | |
11 | ||
c801d85f | 12 | #include "wx/hash.h" |
c801d85f | 13 | |
0c5d3e1c | 14 | // ---------------------------------------------------------------------------- |
c801d85f | 15 | // classes |
0c5d3e1c | 16 | // ---------------------------------------------------------------------------- |
c801d85f | 17 | |
b5dbe15d VS |
18 | class WXDLLIMPEXP_FWD_CORE wxDC; |
19 | class WXDLLIMPEXP_FWD_CORE wxPaintDC; | |
20 | class WXDLLIMPEXP_FWD_CORE wxWindow; | |
c801d85f | 21 | |
b5dbe15d | 22 | class WXDLLIMPEXP_FWD_CORE wxFont; |
c801d85f | 23 | |
0c5d3e1c | 24 | // ---------------------------------------------------------------------------- |
c801d85f | 25 | // wxFont |
0c5d3e1c | 26 | // ---------------------------------------------------------------------------- |
c801d85f | 27 | |
20123d49 | 28 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase |
c801d85f | 29 | { |
358fc25c | 30 | public: |
0c5d3e1c | 31 | // ctors and such |
8628b7d4 | 32 | wxFont() { } |
409d5a58 | 33 | |
b960795e VZ |
34 | wxFont(const wxFontInfo& info) |
35 | { | |
36 | Create(info.GetPointSize(), | |
37 | info.GetFamily(), | |
38 | info.GetStyle(), | |
39 | info.GetWeight(), | |
40 | info.IsUnderlined(), | |
41 | info.GetFaceName(), | |
42 | info.GetEncoding()); | |
43 | ||
44 | if ( info.IsUsingSizeInPixels() ) | |
45 | SetPixelSize(info.GetPixelSize()); | |
46 | } | |
47 | ||
409d5a58 | 48 | wxFont(const wxString& fontname) |
7826e2dd | 49 | { |
409d5a58 | 50 | Create(fontname); |
7826e2dd VZ |
51 | } |
52 | ||
53 | wxFont(const wxNativeFontInfo& info); | |
0c5d3e1c | 54 | |
0c14b6c3 | 55 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 |
0c5d3e1c VZ |
56 | wxFont(int size, |
57 | int family, | |
58 | int style, | |
59 | int weight, | |
dabbc6a5 | 60 | bool underlined = false, |
0c5d3e1c VZ |
61 | const wxString& face = wxEmptyString, |
62 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
63 | { | |
0c14b6c3 FM |
64 | (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); |
65 | } | |
66 | #endif | |
67 | ||
68 | wxFont(int size, | |
69 | wxFontFamily family, | |
70 | wxFontStyle style, | |
71 | wxFontWeight weight, | |
72 | bool underlined = false, | |
73 | const wxString& face = wxEmptyString, | |
74 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
75 | { | |
76 | Create(size, family, style, weight, underlined, face, encoding); | |
0c5d3e1c | 77 | } |
03647350 | 78 | |
b5791cc7 FM |
79 | wxFont(const wxSize& pixelSize, |
80 | wxFontFamily family, | |
81 | wxFontStyle style, | |
82 | wxFontWeight weight, | |
83 | bool underlined = false, | |
84 | const wxString& face = wxEmptyString, | |
85 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
86 | { | |
87 | Create(10, family, style, weight, underlined, face, encoding); | |
88 | SetPixelSize(pixelSize); | |
89 | } | |
03647350 | 90 | |
0c5d3e1c | 91 | bool Create(int size, |
0c14b6c3 FM |
92 | wxFontFamily family, |
93 | wxFontStyle style, | |
94 | wxFontWeight weight, | |
dabbc6a5 | 95 | bool underlined = false, |
0c5d3e1c | 96 | const wxString& face = wxEmptyString, |
7826e2dd | 97 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); |
30764ab5 | 98 | |
0c14b6c3 | 99 | |
7826e2dd | 100 | // wxGTK-specific |
409d5a58 | 101 | bool Create(const wxString& fontname); |
0c5d3e1c | 102 | |
d3c7fc99 | 103 | virtual ~wxFont(); |
0c5d3e1c VZ |
104 | |
105 | // implement base class pure virtuals | |
106 | virtual int GetPointSize() const; | |
0c14b6c3 FM |
107 | virtual wxFontStyle GetStyle() const; |
108 | virtual wxFontWeight GetWeight() const; | |
0c5d3e1c VZ |
109 | virtual wxString GetFaceName() const; |
110 | virtual bool GetUnderlined() const; | |
111 | virtual wxFontEncoding GetEncoding() const; | |
3bf5a59b | 112 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; |
53f6aab7 | 113 | virtual bool IsFixedWidth() const; |
0c5d3e1c VZ |
114 | |
115 | virtual void SetPointSize( int pointSize ); | |
0c14b6c3 FM |
116 | virtual void SetFamily(wxFontFamily family); |
117 | virtual void SetStyle(wxFontStyle style); | |
118 | virtual void SetWeight(wxFontWeight weight); | |
85ab460e | 119 | virtual bool SetFaceName( const wxString& faceName ); |
0c5d3e1c VZ |
120 | virtual void SetUnderlined( bool underlined ); |
121 | virtual void SetEncoding(wxFontEncoding encoding); | |
122 | ||
f76c0758 | 123 | wxDECLARE_COMMON_FONT_METHODS(); |
0c14b6c3 | 124 | |
0c5d3e1c | 125 | // implementation from now on |
0c5d3e1c VZ |
126 | void Unshare(); |
127 | ||
128 | GdkFont* GetInternalFont(float scale = 1.0) const; | |
129 | ||
0c5d3e1c | 130 | protected: |
8f884a0d VZ |
131 | virtual wxGDIRefData *CreateGDIRefData() const; |
132 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
133 | ||
9045ad9d | 134 | virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); |
59b7da02 | 135 | virtual wxFontFamily DoGetFamily() const; |
9045ad9d | 136 | |
0c5d3e1c VZ |
137 | private: |
138 | DECLARE_DYNAMIC_CLASS(wxFont) | |
c801d85f KB |
139 | }; |
140 | ||
c801d85f | 141 | #endif // __GTKFONTH__ |