]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: font.h | |
3 | // Purpose: wxFont class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_FONT_H_ | |
13 | #define _WX_FONT_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "font.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/gdiobj.h" | |
20 | ||
21 | WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; | |
22 | ||
23 | // ---------------------------------------------------------------------------- | |
24 | // wxFont | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
27 | class WXDLLEXPORT wxFont : public wxFontBase | |
28 | { | |
29 | public: | |
30 | // ctors and such | |
31 | wxFont() { Init(); } | |
32 | wxFont(const wxFont& font) { Init(); Ref(font); } | |
33 | ||
34 | wxFont(int size, | |
35 | int family, | |
36 | int style, | |
37 | int weight, | |
38 | bool underlined = FALSE, | |
39 | const wxString& face = wxEmptyString, | |
40 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
41 | { | |
42 | Init(); | |
43 | ||
44 | (void)Create(size, family, style, weight, underlined, face, encoding); | |
45 | } | |
46 | ||
47 | bool Create(int size, | |
48 | int family, | |
49 | int style, | |
50 | int weight, | |
51 | bool underlined = FALSE, | |
52 | const wxString& face = wxEmptyString, | |
53 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
54 | ||
55 | virtual ~wxFont(); | |
56 | ||
57 | // assignment | |
58 | wxFont& operator=(const wxFont& font); | |
59 | ||
60 | // implement base class pure virtuals | |
61 | virtual int GetPointSize() const; | |
62 | virtual int GetFamily() const; | |
63 | virtual int GetStyle() const; | |
64 | virtual int GetWeight() const; | |
65 | virtual bool GetUnderlined() const; | |
66 | virtual wxString GetFaceName() const; | |
67 | virtual wxFontEncoding GetEncoding() const; | |
68 | ||
69 | virtual void SetPointSize(int pointSize); | |
70 | virtual void SetFamily(int family); | |
71 | virtual void SetStyle(int style); | |
72 | virtual void SetWeight(int weight); | |
73 | virtual void SetFaceName(const wxString& faceName); | |
74 | virtual void SetUnderlined(bool underlined); | |
75 | virtual void SetEncoding(wxFontEncoding encoding); | |
76 | ||
77 | // implementation only from now on | |
78 | // ------------------------------- | |
79 | ||
80 | int GetFontId() const; | |
81 | virtual bool IsFree() const; | |
82 | virtual bool RealizeResource(); | |
83 | virtual WXHANDLE GetResourceHandle(); | |
84 | virtual bool FreeResource(bool force = FALSE); | |
85 | /* | |
86 | virtual bool UseResource(); | |
87 | virtual bool ReleaseResource(); | |
88 | */ | |
89 | ||
90 | protected: | |
91 | // common part of all ctors | |
92 | void Init(); | |
93 | ||
94 | void Unshare(); | |
95 | ||
96 | private: | |
97 | DECLARE_DYNAMIC_CLASS(wxFont) | |
98 | }; | |
99 | ||
100 | #endif | |
101 | // _WX_FONT_H_ |