]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/gtk/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 | ||
0416c418 PC |
9 | #ifndef _WX_GTK_FONT_H_ |
10 | #define _WX_GTK_FONT_H_ | |
c801d85f | 11 | |
0c5d3e1c | 12 | // ---------------------------------------------------------------------------- |
c801d85f | 13 | // wxFont |
0c5d3e1c | 14 | // ---------------------------------------------------------------------------- |
c801d85f | 15 | |
20123d49 | 16 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase |
c801d85f | 17 | { |
358fc25c | 18 | public: |
f8855e47 | 19 | wxFont() { } |
409d5a58 | 20 | |
b960795e VZ |
21 | wxFont(const wxFontInfo& info); |
22 | ||
34be948f | 23 | wxFont(const wxString& nativeFontInfoString) |
7826e2dd | 24 | { |
34be948f | 25 | Create(nativeFontInfoString); |
7826e2dd VZ |
26 | } |
27 | ||
28 | wxFont(const wxNativeFontInfo& info); | |
0c5d3e1c | 29 | |
0c14b6c3 | 30 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 |
0c5d3e1c VZ |
31 | wxFont(int size, |
32 | int family, | |
33 | int style, | |
34 | int weight, | |
dabbc6a5 | 35 | bool underlined = false, |
0c5d3e1c VZ |
36 | const wxString& face = wxEmptyString, |
37 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
38 | { | |
0c14b6c3 FM |
39 | (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); |
40 | } | |
41 | #endif | |
42 | ||
43 | wxFont(int size, | |
44 | wxFontFamily family, | |
45 | wxFontStyle style, | |
46 | wxFontWeight weight, | |
47 | bool underlined = false, | |
48 | const wxString& face = wxEmptyString, | |
49 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
50 | { | |
51 | Create(size, family, style, weight, underlined, face, encoding); | |
0c5d3e1c VZ |
52 | } |
53 | ||
b5791cc7 FM |
54 | wxFont(const wxSize& pixelSize, |
55 | wxFontFamily family, | |
56 | wxFontStyle style, | |
57 | wxFontWeight weight, | |
58 | bool underlined = false, | |
59 | const wxString& face = wxEmptyString, | |
60 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
61 | { | |
62 | Create(10, family, style, weight, underlined, face, encoding); | |
63 | SetPixelSize(pixelSize); | |
64 | } | |
03647350 | 65 | |
0c5d3e1c | 66 | bool Create(int size, |
0c14b6c3 FM |
67 | wxFontFamily family, |
68 | wxFontStyle style, | |
69 | wxFontWeight weight, | |
dabbc6a5 | 70 | bool underlined = false, |
0c5d3e1c | 71 | const wxString& face = wxEmptyString, |
7826e2dd | 72 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); |
30764ab5 | 73 | |
7826e2dd | 74 | // wxGTK-specific |
409d5a58 | 75 | bool Create(const wxString& fontname); |
0c5d3e1c | 76 | |
d3c7fc99 | 77 | virtual ~wxFont(); |
0c5d3e1c VZ |
78 | |
79 | // implement base class pure virtuals | |
80 | virtual int GetPointSize() const; | |
0c14b6c3 FM |
81 | virtual wxFontStyle GetStyle() const; |
82 | virtual wxFontWeight GetWeight() const; | |
0c5d3e1c VZ |
83 | virtual wxString GetFaceName() const; |
84 | virtual bool GetUnderlined() const; | |
c7a49742 | 85 | virtual bool GetStrikethrough() const; |
0c5d3e1c | 86 | virtual wxFontEncoding GetEncoding() const; |
3bf5a59b | 87 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; |
53f6aab7 | 88 | virtual bool IsFixedWidth() const; |
0c5d3e1c VZ |
89 | |
90 | virtual void SetPointSize( int pointSize ); | |
0c14b6c3 FM |
91 | virtual void SetFamily(wxFontFamily family); |
92 | virtual void SetStyle(wxFontStyle style); | |
93 | virtual void SetWeight(wxFontWeight weight); | |
85ab460e | 94 | virtual bool SetFaceName( const wxString& faceName ); |
0c5d3e1c | 95 | virtual void SetUnderlined( bool underlined ); |
c7a49742 | 96 | virtual void SetStrikethrough(bool strikethrough); |
0c5d3e1c VZ |
97 | virtual void SetEncoding(wxFontEncoding encoding); |
98 | ||
f76c0758 | 99 | wxDECLARE_COMMON_FONT_METHODS(); |
0c14b6c3 | 100 | |
99f8cf22 | 101 | // Set Pango attributes in the specified layout. Currently only |
c7e99122 PC |
102 | // underlined and strike-through attributes are handled by this function. |
103 | // | |
c7e99122 PC |
104 | // If neither of them is specified, returns false, otherwise sets up the |
105 | // attributes and returns true. | |
99f8cf22 | 106 | bool GTKSetPangoAttrs(PangoLayout* layout) const; |
c7e99122 | 107 | |
0c5d3e1c | 108 | // implementation from now on |
0c5d3e1c VZ |
109 | void Unshare(); |
110 | ||
0c5d3e1c VZ |
111 | // no data :-) |
112 | ||
113 | protected: | |
9045ad9d VZ |
114 | virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); |
115 | ||
8f884a0d VZ |
116 | virtual wxGDIRefData* CreateGDIRefData() const; |
117 | virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const; | |
fd7a7443 | 118 | |
59b7da02 VZ |
119 | virtual wxFontFamily DoGetFamily() const; |
120 | ||
0c5d3e1c | 121 | private: |
95dc31e0 PC |
122 | void Init(); |
123 | ||
0c5d3e1c | 124 | DECLARE_DYNAMIC_CLASS(wxFont) |
c801d85f KB |
125 | }; |
126 | ||
0416c418 | 127 | #endif // _WX_GTK_FONT_H_ |