]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/font.h
tree control and dc::drawlines bug
[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$
8// Copyright: (c) Julian Smart and Markus Holzem
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __FONTH__
13#define __FONTH__
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);
28 ~wxFontRefData(void);
29protected:
30 bool m_temporary; // If TRUE, the pointer to the actual font
31 // is temporary and SHOULD NOT BE DELETED by
32 // destructor
33 int m_pointSize;
34 int m_family;
35 int m_fontId;
36 int m_style;
37 int m_weight;
38 bool m_underlined;
39 wxString m_faceName;
40 WXHFONT m_hFont;
41
42};
43
44#define M_FONTDATA ((wxFontRefData *)m_refData)
45
46WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
47
48// Font
49class WXDLLEXPORT wxFont: public wxGDIObject
50{
51 DECLARE_DYNAMIC_CLASS(wxFont)
52public:
53 wxFont(void);
54 wxFont(int PointSize, int Family, int Style, int Weight, bool underlined = FALSE, const wxString& Face = wxEmptyString);
55 inline wxFont(const wxFont& font) { Ref(font); }
56 inline wxFont(const wxFont* font) { /* UnRef(); */ if (font) Ref(*font); }
57
58 ~wxFont(void);
59
60 bool Create(int PointSize, int Family, int Style, int Weight, bool underlined = FALSE, const wxString& Face = wxEmptyString);
61
62 // Internal
63 virtual bool RealizeResource(void);
64 virtual WXHANDLE GetResourceHandle(void) ;
65 virtual bool FreeResource(bool force = FALSE);
66/*
67 virtual bool UseResource(void);
68 virtual bool ReleaseResource(void);
69*/
70
71 virtual bool IsFree(void);
72 virtual bool Ok(void) const { return (m_refData != NULL) ; }
73
74 inline int GetPointSize(void) const { return M_FONTDATA->m_pointSize; }
75 inline int GetFamily(void) const { return M_FONTDATA->m_family; }
76 inline int GetFontId(void) const { return M_FONTDATA->m_fontId; } /* New font system */
77 inline int GetStyle(void) const { return M_FONTDATA->m_style; }
78 inline int GetWeight(void) const { return M_FONTDATA->m_weight; }
79 wxString GetFamilyString(void) const ;
80 wxString GetFaceName(void) const ;
81 wxString GetStyleString(void) const ;
82 wxString GetWeightString(void) const ;
83 inline bool GetUnderlined(void) const { return M_FONTDATA->m_underlined; }
84
debe6624
JS
85 void SetPointSize(int pointSize);
86 void SetFamily(int family);
87 void SetStyle(int style);
88 void SetWeight(int weight);
2bda0e17 89 void SetFaceName(const wxString& faceName);
debe6624 90 void SetUnderlined(bool underlined);
2bda0e17
KB
91
92 inline wxFont& operator = (const wxFont& font) { if (*this == font) return (*this); Ref(font); return *this; }
93 inline bool operator == (const wxFont& font) { return m_refData == font.m_refData; }
94 inline bool operator != (const wxFont& font) { return m_refData != font.m_refData; }
95};
96
97#endif
98 // __FONTH__