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