| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: font.h |
| 3 | // Author: Vaclav Slavik |
| 4 | // Id: $Id$ |
| 5 | // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) |
| 6 | // Licence: wxWindows licence |
| 7 | ///////////////////////////////////////////////////////////////////////////// |
| 8 | |
| 9 | #ifndef __WX_FONT_H__ |
| 10 | #define __WX_FONT_H__ |
| 11 | |
| 12 | #ifdef __GNUG__ |
| 13 | #pragma interface "font.h" |
| 14 | #endif |
| 15 | |
| 16 | #include "wx/hash.h" |
| 17 | |
| 18 | // ---------------------------------------------------------------------------- |
| 19 | // classes |
| 20 | // ---------------------------------------------------------------------------- |
| 21 | |
| 22 | class WXDLLEXPORT wxDC; |
| 23 | class WXDLLEXPORT wxPaintDC; |
| 24 | class WXDLLEXPORT wxWindow; |
| 25 | class WXDLLEXPORT wxFont; |
| 26 | |
| 27 | struct font_t; |
| 28 | |
| 29 | // ---------------------------------------------------------------------------- |
| 30 | // wxFont |
| 31 | // ---------------------------------------------------------------------------- |
| 32 | |
| 33 | class WXDLLEXPORT wxFont : public wxFontBase |
| 34 | { |
| 35 | public: |
| 36 | // ctors and such |
| 37 | wxFont() { Init(); } |
| 38 | wxFont(const wxFont& font) { Init(); Ref(font); } |
| 39 | |
| 40 | wxFont(const wxNativeFontInfo& info) |
| 41 | { |
| 42 | Init(); |
| 43 | |
| 44 | (void)Create(info); |
| 45 | } |
| 46 | |
| 47 | wxFont(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 | Init(); |
| 56 | |
| 57 | (void)Create(size, family, style, weight, underlined, face, encoding); |
| 58 | } |
| 59 | |
| 60 | bool Create(int size, |
| 61 | int family, |
| 62 | int style, |
| 63 | int weight, |
| 64 | bool underlined = FALSE, |
| 65 | const wxString& face = wxEmptyString, |
| 66 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); |
| 67 | |
| 68 | bool Create(const wxNativeFontInfo& fontinfo); |
| 69 | |
| 70 | ~wxFont(); |
| 71 | |
| 72 | // assignment |
| 73 | wxFont& operator=(const wxFont& font); |
| 74 | |
| 75 | // implement base class pure virtuals |
| 76 | virtual int GetPointSize() const; |
| 77 | virtual int GetFamily() const; |
| 78 | virtual int GetStyle() const; |
| 79 | virtual int GetWeight() const; |
| 80 | virtual wxString GetFaceName() const; |
| 81 | virtual bool GetUnderlined() const; |
| 82 | virtual wxFontEncoding GetEncoding() const; |
| 83 | |
| 84 | virtual void SetPointSize(int pointSize); |
| 85 | virtual void SetFamily(int family); |
| 86 | virtual void SetStyle(int style); |
| 87 | virtual void SetWeight(int weight); |
| 88 | virtual void SetFaceName(const wxString& faceName); |
| 89 | virtual void SetUnderlined(bool underlined); |
| 90 | virtual void SetEncoding(wxFontEncoding encoding); |
| 91 | |
| 92 | // implementation from now on |
| 93 | void Unshare(); |
| 94 | |
| 95 | struct font_t *GetMGLfont_t(float scale, bool antialiased); |
| 96 | |
| 97 | // no data :-) |
| 98 | |
| 99 | protected: |
| 100 | // common part of all ctors |
| 101 | void Init(); |
| 102 | |
| 103 | private: |
| 104 | DECLARE_DYNAMIC_CLASS(wxFont) |
| 105 | }; |
| 106 | |
| 107 | #endif // __WX_FONT_H__ |