-// Font
-class WXDLLEXPORT wxFont: public wxGDIObject
-{
- DECLARE_DYNAMIC_CLASS(wxFont)
-public:
- wxFont(void);
- wxFont(int PointSize, int Family, int Style, int Weight, bool underlined = FALSE, const wxString& Face = wxEmptyString);
- inline wxFont(const wxFont& font) { Ref(font); }
- inline wxFont(const wxFont* font) { if (font) Ref(*font); }
-
- ~wxFont(void);
-
- bool Create(int PointSize, int Family, int Style, int Weight, bool underlined = FALSE, const wxString& Face = wxEmptyString);
-
- // Internal
- virtual bool RealizeResource(void);
- virtual WXHANDLE GetResourceHandle(void) ;
- virtual bool FreeResource(bool force = FALSE);
-/*
- virtual bool UseResource(void);
- virtual bool ReleaseResource(void);
-*/
-
- virtual bool IsFree(void);
- virtual bool Ok(void) const { return (m_refData != NULL) ; }
-
- inline int GetPointSize(void) const { return M_FONTDATA->m_pointSize; }
- inline int GetFamily(void) const { return M_FONTDATA->m_family; }
- inline int GetFontId(void) const { return M_FONTDATA->m_fontId; } /* New font system */
- inline int GetStyle(void) const { return M_FONTDATA->m_style; }
- inline int GetWeight(void) const { return M_FONTDATA->m_weight; }
- wxString GetFamilyString(void) const ;
- wxString GetFaceName(void) const ;
- wxString GetStyleString(void) const ;
- wxString GetWeightString(void) const ;
- inline bool GetUnderlined(void) const { return M_FONTDATA->m_underlined; }
-
- void SetPointSize(int pointSize);
- void SetFamily(int family);
- void SetStyle(int style);
- void SetWeight(int weight);
- void SetFaceName(const wxString& faceName);
- void SetUnderlined(bool underlined);
-
- inline wxFont& operator = (const wxFont& font) { if (*this == font) return (*this); Ref(font); return *this; }
- inline bool operator == (const wxFont& font) { return m_refData == font.m_refData; }
- inline bool operator != (const wxFont& font) { return m_refData != font.m_refData; }
+ wxFont(const wxSize& pixelSize,
+ wxFontFamily family,
+ wxFontStyle style,
+ wxFontWeight weight,
+ bool underlined = false,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
+ {
+ (void)Create(pixelSize, family, style, weight,
+ underlined, face, encoding);
+ }
+
+ wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0)
+ {
+ Create(info, hFont);
+ }
+
+ wxFont(int pointSize,
+ wxFontFamily family,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
+
+ wxFont(const wxString& fontDesc);
+
+
+ bool Create(const wxSize& pixelSize,
+ wxFontFamily family,
+ wxFontStyle style,
+ wxFontWeight weight,
+ bool underlined = false,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
+ {
+ return DoCreate(-1, pixelSize, true, family, style,
+ weight, underlined, face, encoding);
+ }
+
+ bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0);
+
+ virtual ~wxFont();
+
+ // implement base class pure virtuals
+ virtual int GetPointSize() const;
+ virtual wxSize GetPixelSize() const;
+ virtual bool IsUsingSizeInPixels() const;
+ virtual wxFontStyle GetStyle() const;
+ virtual wxFontWeight GetWeight() const;
+ virtual bool GetUnderlined() const;
+ virtual bool GetStrikethrough() const;
+ virtual wxString GetFaceName() const;
+ virtual wxFontEncoding GetEncoding() const;
+ virtual const wxNativeFontInfo *GetNativeFontInfo() const;
+
+ virtual void SetPointSize(int pointSize);
+ virtual void SetPixelSize(const wxSize& pixelSize);
+ virtual void SetFamily(wxFontFamily family);
+ virtual void SetStyle(wxFontStyle style);
+ virtual void SetWeight(wxFontWeight weight);
+ virtual bool SetFaceName(const wxString& faceName);
+ virtual void SetUnderlined(bool underlined);
+ virtual void SetStrikethrough(bool strikethrough);
+ virtual void SetEncoding(wxFontEncoding encoding);
+
+ wxDECLARE_COMMON_FONT_METHODS();
+
+ virtual bool IsFixedWidth() const;
+
+ // implementation only from now on
+ // -------------------------------
+
+ virtual bool IsFree() const;
+ virtual bool RealizeResource();
+ virtual WXHANDLE GetResourceHandle() const;
+ virtual bool FreeResource(bool force = false);
+
+ // for consistency with other wxMSW classes
+ WXHFONT GetHFONT() const;