| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: font.h |
| 3 | // Purpose: |
| 4 | // Author: Robert Roebling |
| 5 | // Id: $Id$ |
| 6 | // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem |
| 7 | // Licence: wxWindows licence |
| 8 | ///////////////////////////////////////////////////////////////////////////// |
| 9 | |
| 10 | #ifndef __GTKFONTH__ |
| 11 | #define __GTKFONTH__ |
| 12 | |
| 13 | #ifdef __GNUG__ |
| 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) { Init(); Ref(font); } |
| 39 | wxFont(const wxString& fontname, const wxFontData& fontdata); |
| 40 | |
| 41 | // assignment |
| 42 | wxFont& operator=(const wxFont& font); |
| 43 | |
| 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 | Init(); |
| 53 | |
| 54 | (void)Create(size, family, style, weight, underlined, face, encoding); |
| 55 | } |
| 56 | |
| 57 | bool Create(int size, |
| 58 | int family, |
| 59 | int style, |
| 60 | int weight, |
| 61 | bool underlined = FALSE, |
| 62 | const wxString& face = wxEmptyString, |
| 63 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); |
| 64 | |
| 65 | ~wxFont(); |
| 66 | |
| 67 | // implement base class pure virtuals |
| 68 | virtual int GetPointSize() const; |
| 69 | virtual int GetFamily() const; |
| 70 | virtual int GetStyle() const; |
| 71 | virtual int GetWeight() const; |
| 72 | virtual wxString GetFaceName() const; |
| 73 | virtual bool GetUnderlined() const; |
| 74 | virtual wxFontEncoding GetEncoding() const; |
| 75 | |
| 76 | virtual void SetPointSize( int pointSize ); |
| 77 | virtual void SetFamily( int family ); |
| 78 | virtual void SetStyle( int style ); |
| 79 | virtual void SetWeight( int weight ); |
| 80 | virtual void SetFaceName( const wxString& faceName ); |
| 81 | virtual void SetUnderlined( bool underlined ); |
| 82 | virtual void SetEncoding(wxFontEncoding encoding); |
| 83 | |
| 84 | // implementation from now on |
| 85 | void Unshare(); |
| 86 | |
| 87 | GdkFont* GetInternalFont(float scale = 1.0) const; |
| 88 | |
| 89 | // no data :-) |
| 90 | |
| 91 | protected: |
| 92 | // common part of all ctors |
| 93 | void Init(); |
| 94 | |
| 95 | private: |
| 96 | DECLARE_DYNAMIC_CLASS(wxFont) |
| 97 | }; |
| 98 | |
| 99 | #endif // __GTKFONTH__ |