| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: 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 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
| 14 | #pragma interface |
| 15 | #endif |
| 16 | |
| 17 | #include "wx/hash.h" |
| 18 | |
| 19 | // ---------------------------------------------------------------------------- |
| 20 | // classes |
| 21 | // ---------------------------------------------------------------------------- |
| 22 | |
| 23 | class wxDC; |
| 24 | class wxPaintDC; |
| 25 | class wxWindow; |
| 26 | |
| 27 | class wxFont; |
| 28 | |
| 29 | // ---------------------------------------------------------------------------- |
| 30 | // wxFont |
| 31 | // ---------------------------------------------------------------------------- |
| 32 | |
| 33 | class wxFont : public wxFontBase |
| 34 | { |
| 35 | public: |
| 36 | // ctors and such |
| 37 | wxFont() { Init(); } |
| 38 | wxFont(const wxFont& font) : wxFontBase() { Init(); Ref(font); } |
| 39 | |
| 40 | // wxGTK-specific |
| 41 | wxFont(const wxString& fontname) |
| 42 | { |
| 43 | Init(); |
| 44 | |
| 45 | Create(fontname); |
| 46 | } |
| 47 | |
| 48 | wxFont(const wxNativeFontInfo& info); |
| 49 | |
| 50 | wxFont(int size, |
| 51 | int family, |
| 52 | int style, |
| 53 | int weight, |
| 54 | bool underlined = false, |
| 55 | const wxString& face = wxEmptyString, |
| 56 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) |
| 57 | { |
| 58 | Init(); |
| 59 | |
| 60 | (void)Create(size, family, style, weight, underlined, face, encoding); |
| 61 | } |
| 62 | |
| 63 | bool Create(int size, |
| 64 | int family, |
| 65 | int style, |
| 66 | int weight, |
| 67 | bool underlined = false, |
| 68 | const wxString& face = wxEmptyString, |
| 69 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); |
| 70 | |
| 71 | // wxGTK-specific |
| 72 | bool Create(const wxString& fontname); |
| 73 | |
| 74 | ~wxFont(); |
| 75 | |
| 76 | // assignment |
| 77 | wxFont& operator=(const wxFont& font); |
| 78 | |
| 79 | // implement base class pure virtuals |
| 80 | virtual int GetPointSize() const; |
| 81 | virtual int GetFamily() const; |
| 82 | virtual int GetStyle() const; |
| 83 | virtual int GetWeight() const; |
| 84 | virtual wxString GetFaceName() const; |
| 85 | virtual bool GetUnderlined() 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( int family ); |
| 92 | virtual void SetStyle( int style ); |
| 93 | virtual void SetWeight( int weight ); |
| 94 | virtual void SetFaceName( const wxString& faceName ); |
| 95 | virtual void SetUnderlined( bool underlined ); |
| 96 | virtual void SetEncoding(wxFontEncoding encoding); |
| 97 | |
| 98 | virtual void SetNoAntiAliasing( bool no = true ); |
| 99 | virtual bool GetNoAntiAliasing() const ; |
| 100 | |
| 101 | // implementation from now on |
| 102 | void Unshare(); |
| 103 | |
| 104 | #ifndef __WXGTK20__ |
| 105 | GdkFont* GetInternalFont(float scale = 1.0) const; |
| 106 | #endif |
| 107 | |
| 108 | // no data :-) |
| 109 | |
| 110 | protected: |
| 111 | virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); |
| 112 | |
| 113 | // common part of all ctors |
| 114 | void Init(); |
| 115 | |
| 116 | private: |
| 117 | DECLARE_DYNAMIC_CLASS(wxFont) |
| 118 | }; |
| 119 | |
| 120 | #endif // __GTKFONTH__ |