]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/font.h
Added Win95 implementation of OutputDebugString; added to wxVariant class
[wxWidgets.git] / include / wx / msw / font.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: font.h
3// Purpose: wxFont class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc
JS
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_FONT_H_
13#define _WX_FONT_H_
2bda0e17
KB
14
15#ifdef __GNUG__
16#pragma interface "font.h"
17#endif
18
19#include "wx/gdiobj.h"
20
21class WXDLLEXPORT wxFont;
22
23class WXDLLEXPORT wxFontRefData: public wxGDIRefData
24{
25 friend class WXDLLEXPORT wxFont;
26public:
27 wxFontRefData(void);
b823f5a1 28 wxFontRefData(const wxFontRefData& data);
2bda0e17
KB
29 ~wxFontRefData(void);
30protected:
31 bool m_temporary; // If TRUE, the pointer to the actual font
32 // is temporary and SHOULD NOT BE DELETED by
33 // destructor
34 int m_pointSize;
35 int m_family;
36 int m_fontId;
37 int m_style;
38 int m_weight;
39 bool m_underlined;
40 wxString m_faceName;
41 WXHFONT m_hFont;
42
43};
44
45#define M_FONTDATA ((wxFontRefData *)m_refData)
46
47WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
48
49// Font
50class WXDLLEXPORT wxFont: public wxGDIObject
51{
52 DECLARE_DYNAMIC_CLASS(wxFont)
53public:
54 wxFont(void);
55 wxFont(int PointSize, int Family, int Style, int Weight, bool underlined = FALSE, const wxString& Face = wxEmptyString);
56 inline wxFont(const wxFont& font) { Ref(font); }
b823f5a1 57 inline wxFont(const wxFont* font) { if (font) Ref(*font); }
2bda0e17
KB
58
59 ~wxFont(void);
60
61 bool Create(int PointSize, int Family, int Style, int Weight, bool underlined = FALSE, const wxString& Face = wxEmptyString);
62
63 // Internal
64 virtual bool RealizeResource(void);
65 virtual WXHANDLE GetResourceHandle(void) ;
66 virtual bool FreeResource(bool force = FALSE);
67/*
68 virtual bool UseResource(void);
69 virtual bool ReleaseResource(void);
70*/
71
72 virtual bool IsFree(void);
73 virtual bool Ok(void) const { return (m_refData != NULL) ; }
74
75 inline int GetPointSize(void) const { return M_FONTDATA->m_pointSize; }
76 inline int GetFamily(void) const { return M_FONTDATA->m_family; }
77 inline int GetFontId(void) const { return M_FONTDATA->m_fontId; } /* New font system */
78 inline int GetStyle(void) const { return M_FONTDATA->m_style; }
79 inline int GetWeight(void) const { return M_FONTDATA->m_weight; }
80 wxString GetFamilyString(void) const ;
81 wxString GetFaceName(void) const ;
82 wxString GetStyleString(void) const ;
83 wxString GetWeightString(void) const ;
84 inline bool GetUnderlined(void) const { return M_FONTDATA->m_underlined; }
85
debe6624
JS
86 void SetPointSize(int pointSize);
87 void SetFamily(int family);
88 void SetStyle(int style);
89 void SetWeight(int weight);
2bda0e17 90 void SetFaceName(const wxString& faceName);
debe6624 91 void SetUnderlined(bool underlined);
2bda0e17
KB
92
93 inline wxFont& operator = (const wxFont& font) { if (*this == font) return (*this); Ref(font); return *this; }
94 inline bool operator == (const wxFont& font) { return m_refData == font.m_refData; }
95 inline bool operator != (const wxFont& font) { return m_refData != font.m_refData; }
b823f5a1
JS
96
97protected:
98 void Unshare();
2bda0e17
KB
99};
100
101#endif
bbcdf8bc 102 // _WX_FONT_H_