]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/gtk/font.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Copyright: (c) 1998 Robert Roebling | |
6 | // Licence: wxWindows licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | #ifndef _WX_GTK_FONT_H_ | |
10 | #define _WX_GTK_FONT_H_ | |
11 | ||
12 | // ---------------------------------------------------------------------------- | |
13 | // wxFont | |
14 | // ---------------------------------------------------------------------------- | |
15 | ||
16 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase | |
17 | { | |
18 | public: | |
19 | wxFont() { } | |
20 | ||
21 | wxFont(const wxFontInfo& info); | |
22 | ||
23 | wxFont(const wxString& nativeFontInfoString) | |
24 | { | |
25 | Create(nativeFontInfoString); | |
26 | } | |
27 | ||
28 | wxFont(const wxNativeFontInfo& info); | |
29 | ||
30 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 | |
31 | wxFont(int size, | |
32 | int family, | |
33 | int style, | |
34 | int weight, | |
35 | bool underlined = false, | |
36 | const wxString& face = wxEmptyString, | |
37 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
38 | { | |
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); | |
52 | } | |
53 | ||
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 | } | |
65 | ||
66 | bool Create(int size, | |
67 | wxFontFamily family, | |
68 | wxFontStyle style, | |
69 | wxFontWeight weight, | |
70 | bool underlined = false, | |
71 | const wxString& face = wxEmptyString, | |
72 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
73 | ||
74 | // wxGTK-specific | |
75 | bool Create(const wxString& fontname); | |
76 | ||
77 | virtual ~wxFont(); | |
78 | ||
79 | // implement base class pure virtuals | |
80 | virtual int GetPointSize() const; | |
81 | virtual wxFontStyle GetStyle() const; | |
82 | virtual wxFontWeight GetWeight() const; | |
83 | virtual wxString GetFaceName() const; | |
84 | virtual bool GetUnderlined() const; | |
85 | virtual bool GetStrikethrough() const; | |
86 | virtual wxFontEncoding GetEncoding() const; | |
87 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; | |
88 | virtual bool IsFixedWidth() const; | |
89 | ||
90 | virtual void SetPointSize( int pointSize ); | |
91 | virtual void SetFamily(wxFontFamily family); | |
92 | virtual void SetStyle(wxFontStyle style); | |
93 | virtual void SetWeight(wxFontWeight weight); | |
94 | virtual bool SetFaceName( const wxString& faceName ); | |
95 | virtual void SetUnderlined( bool underlined ); | |
96 | virtual void SetStrikethrough(bool strikethrough); | |
97 | virtual void SetEncoding(wxFontEncoding encoding); | |
98 | ||
99 | wxDECLARE_COMMON_FONT_METHODS(); | |
100 | ||
101 | // Set Pango attributes in the specified layout. Currently only | |
102 | // underlined and strike-through attributes are handled by this function. | |
103 | // | |
104 | // If neither of them is specified, returns false, otherwise sets up the | |
105 | // attributes and returns true. | |
106 | bool GTKSetPangoAttrs(PangoLayout* layout) const; | |
107 | ||
108 | // implementation from now on | |
109 | void Unshare(); | |
110 | ||
111 | // no data :-) | |
112 | ||
113 | protected: | |
114 | virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); | |
115 | ||
116 | virtual wxGDIRefData* CreateGDIRefData() const; | |
117 | virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const; | |
118 | ||
119 | virtual wxFontFamily DoGetFamily() const; | |
120 | ||
121 | private: | |
122 | void Init(); | |
123 | ||
124 | DECLARE_DYNAMIC_CLASS(wxFont) | |
125 | }; | |
126 | ||
127 | #endif // _WX_GTK_FONT_H_ |