| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/gtk1/font.h |
| 3 | // Purpose: |
| 4 | // Author: Robert Roebling |
| 5 | // Id: $Id$ |
| 6 | // Copyright: (c) 1998 Robert Roebling |
| 7 | // Licence: wxWindows licence |
| 8 | ///////////////////////////////////////////////////////////////////////////// |
| 9 | |
| 10 | #ifndef __GTKFONTH__ |
| 11 | #define __GTKFONTH__ |
| 12 | |
| 13 | #include "wx/hash.h" |
| 14 | |
| 15 | // ---------------------------------------------------------------------------- |
| 16 | // classes |
| 17 | // ---------------------------------------------------------------------------- |
| 18 | |
| 19 | class WXDLLIMPEXP_FWD_CORE wxDC; |
| 20 | class WXDLLIMPEXP_FWD_CORE wxPaintDC; |
| 21 | class WXDLLIMPEXP_FWD_CORE wxWindow; |
| 22 | |
| 23 | class WXDLLIMPEXP_FWD_CORE wxFont; |
| 24 | |
| 25 | // ---------------------------------------------------------------------------- |
| 26 | // wxFont |
| 27 | // ---------------------------------------------------------------------------- |
| 28 | |
| 29 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase |
| 30 | { |
| 31 | public: |
| 32 | // ctors and such |
| 33 | wxFont() { } |
| 34 | |
| 35 | // wxGTK-specific |
| 36 | wxFont(const wxString& fontname) |
| 37 | { |
| 38 | Create(fontname); |
| 39 | } |
| 40 | |
| 41 | wxFont(const wxNativeFontInfo& info); |
| 42 | |
| 43 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 |
| 44 | wxFont(int size, |
| 45 | int family, |
| 46 | int style, |
| 47 | int weight, |
| 48 | bool underlined = false, |
| 49 | const wxString& face = wxEmptyString, |
| 50 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) |
| 51 | { |
| 52 | (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); |
| 53 | } |
| 54 | #endif |
| 55 | |
| 56 | wxFont(int size, |
| 57 | wxFontFamily family, |
| 58 | wxFontStyle style, |
| 59 | wxFontWeight weight, |
| 60 | bool underlined = false, |
| 61 | const wxString& face = wxEmptyString, |
| 62 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) |
| 63 | { |
| 64 | Create(size, family, style, weight, underlined, face, encoding); |
| 65 | } |
| 66 | |
| 67 | bool Create(int size, |
| 68 | wxFontFamily family, |
| 69 | wxFontStyle style, |
| 70 | wxFontWeight weight, |
| 71 | bool underlined = false, |
| 72 | const wxString& face = wxEmptyString, |
| 73 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); |
| 74 | |
| 75 | |
| 76 | // wxGTK-specific |
| 77 | bool Create(const wxString& fontname); |
| 78 | |
| 79 | virtual ~wxFont(); |
| 80 | |
| 81 | // implement base class pure virtuals |
| 82 | virtual int GetPointSize() const; |
| 83 | virtual wxFontFamily GetFamily() const; |
| 84 | virtual wxFontStyle GetStyle() const; |
| 85 | virtual wxFontWeight GetWeight() const; |
| 86 | virtual wxString GetFaceName() const; |
| 87 | virtual bool GetUnderlined() const; |
| 88 | virtual wxFontEncoding GetEncoding() const; |
| 89 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; |
| 90 | virtual bool IsFixedWidth() const; |
| 91 | |
| 92 | virtual void SetPointSize( int pointSize ); |
| 93 | virtual void SetFamily(wxFontFamily family); |
| 94 | virtual void SetStyle(wxFontStyle style); |
| 95 | virtual void SetWeight(wxFontWeight weight); |
| 96 | virtual bool SetFaceName( const wxString& faceName ); |
| 97 | virtual void SetUnderlined( bool underlined ); |
| 98 | virtual void SetEncoding(wxFontEncoding encoding); |
| 99 | |
| 100 | WXDECLARE_COMPAT_SETTERS |
| 101 | |
| 102 | virtual void SetNoAntiAliasing( bool no = true ); |
| 103 | virtual bool GetNoAntiAliasing() const ; |
| 104 | |
| 105 | // implementation from now on |
| 106 | void Unshare(); |
| 107 | |
| 108 | GdkFont* GetInternalFont(float scale = 1.0) const; |
| 109 | |
| 110 | protected: |
| 111 | virtual wxGDIRefData *CreateGDIRefData() const; |
| 112 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; |
| 113 | |
| 114 | virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); |
| 115 | |
| 116 | private: |
| 117 | DECLARE_DYNAMIC_CLASS(wxFont) |
| 118 | }; |
| 119 | |
| 120 | #endif // __GTKFONTH__ |