]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/font.h
Cleaned up paint DC cache in ~wxPaintDC to avoid spurious memory warning
[wxWidgets.git] / include / wx / mac / font.h
CommitLineData
0dbd6262
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: font.h
3// Purpose: wxFont class
519cb848 4// Author: Julian Smart
0dbd6262 5// Modified by:
519cb848 6// Created: 01/02/97
0dbd6262 7// RCS-ID: $Id$
519cb848
SC
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
0dbd6262
SC
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_FONT_H_
13#define _WX_FONT_H_
14
15#ifdef __GNUG__
519cb848 16 #pragma interface "font.h"
0dbd6262
SC
17#endif
18
519cb848
SC
19// ----------------------------------------------------------------------------
20// public functions
21// ----------------------------------------------------------------------------
0dbd6262 22
519cb848
SC
23// convert wxFontEncoding into one of Windows XXX_CHARSET constants (fill exact
24// parameter if it's not NULL with TRUE if encoding is realyl supported under
25// Windows and FALSE if not and we just chose something close to it)
26extern int wxCharsetFromEncoding(wxFontEncoding encoding, bool *exact = NULL);
0dbd6262 27
519cb848
SC
28// ----------------------------------------------------------------------------
29// wxFont
30// ----------------------------------------------------------------------------
31
32class WXDLLEXPORT wxFont : public wxFontBase
0dbd6262 33{
0dbd6262 34public:
519cb848
SC
35 // ctors and such
36 wxFont() { Init(); }
37 wxFont(const wxFont& font) { Init(); Ref(font); }
38
39 wxFont(int size,
40 int family,
41 int style,
42 int weight,
43 bool underlined = FALSE,
44 const wxString& face = wxEmptyString,
45 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
46 {
47 Init();
48
49 (void)Create(size, family, style, weight, underlined, face, encoding);
50 }
51
52 bool Create(int size,
53 int family,
54 int style,
55 int weight,
56 bool underlined = FALSE,
57 const wxString& face = wxEmptyString,
58 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
59
60 virtual ~wxFont();
61
62 // assignment
63 wxFont& operator=(const wxFont& font);
64
65 // implement base class pure virtuals
66 virtual int GetPointSize() const;
67 virtual int GetFamily() const;
68 virtual int GetStyle() const;
69 virtual int GetWeight() const;
70 virtual bool GetUnderlined() const;
71 virtual wxString GetFaceName() const;
72 virtual wxFontEncoding GetEncoding() const;
73
74 virtual void SetPointSize(int pointSize);
75 virtual void SetFamily(int family);
76 virtual void SetStyle(int style);
77 virtual void SetWeight(int weight);
78 virtual void SetFaceName(const wxString& faceName);
79 virtual void SetUnderlined(bool underlined);
80 virtual void SetEncoding(wxFontEncoding encoding);
81
82 // implementation only from now on
83 // -------------------------------
84
85 int GetFontId() const;
86 virtual bool IsFree() const;
87 virtual bool RealizeResource();
88 virtual WXHANDLE GetResourceHandle();
89 virtual bool FreeResource(bool force = FALSE);
90 /*
91 virtual bool UseResource();
92 virtual bool ReleaseResource();
93 */
0dbd6262 94
519cb848
SC
95protected:
96 // common part of all ctors
97 void Init();
0dbd6262 98
519cb848 99 void Unshare();
0dbd6262 100
519cb848
SC
101private:
102 DECLARE_DYNAMIC_CLASS(wxFont)
0dbd6262
SC
103};
104
105#endif
106 // _WX_FONT_H_