]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/cocoa/font.h
Digital Mars doesn't like the identifiers being declared later
[wxWidgets.git] / include / wx / cocoa / font.h
... / ...
CommitLineData
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
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_FONT_H_
13#define _WX_FONT_H_
14
15class WXDLLEXPORT wxFontRefData: public wxGDIRefData
16{
17 friend class WXDLLEXPORT wxFont;
18public:
19 wxFontRefData()
20 : m_fontId(0)
21 , m_pointSize(10)
22 , m_family(wxDEFAULT)
23 , m_style(wxNORMAL)
24 , m_weight(wxNORMAL)
25 , m_underlined(FALSE)
26 , m_faceName(wxT("Geneva"))
27 , m_encoding(wxFONTENCODING_DEFAULT)
28 {
29 Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE,
30 wxT("Geneva"), wxFONTENCODING_DEFAULT);
31 }
32
33 wxFontRefData(const wxFontRefData& data)
34 : wxGDIRefData()
35 , m_fontId(data.m_fontId)
36 , m_pointSize(data.m_pointSize)
37 , m_family(data.m_family)
38 , m_style(data.m_style)
39 , m_weight(data.m_weight)
40 , m_underlined(data.m_underlined)
41 , m_faceName(data.m_faceName)
42 , m_encoding(data.m_encoding)
43 {
44 Init(data.m_pointSize, data.m_family, data.m_style, data.m_weight,
45 data.m_underlined, data.m_faceName, data.m_encoding);
46 }
47
48 wxFontRefData(int size,
49 int family,
50 int style,
51 int weight,
52 bool underlined,
53 const wxString& faceName,
54 wxFontEncoding encoding)
55 : m_fontId(0)
56 , m_pointSize(size)
57 , m_family(family)
58 , m_style(style)
59 , m_weight(weight)
60 , m_underlined(underlined)
61 , m_faceName(faceName)
62 , m_encoding(encoding)
63 {
64 Init(size, family, style, weight, underlined, faceName, encoding);
65 }
66
67 virtual ~wxFontRefData();
68protected:
69 // common part of all ctors
70 void Init(int size,
71 int family,
72 int style,
73 int weight,
74 bool underlined,
75 const wxString& faceName,
76 wxFontEncoding encoding);
77
78 // font characterstics
79 int m_fontId;
80 int m_pointSize;
81 int m_family;
82 int m_style;
83 int m_weight;
84 bool m_underlined;
85 wxString m_faceName;
86 wxFontEncoding m_encoding;
87
88public:
89};
90// ----------------------------------------------------------------------------
91// wxFont
92// ----------------------------------------------------------------------------
93
94class WXDLLEXPORT wxFont : public wxFontBase
95{
96public:
97 // ctors and such
98 wxFont() { }
99
100 wxFont(int size,
101 int family,
102 int style,
103 int weight,
104 bool underlined = FALSE,
105 const wxString& face = wxEmptyString,
106 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
107 {
108 (void)Create(size, family, style, weight, underlined, face, encoding);
109 }
110
111 wxFont(const wxNativeFontInfo& info)
112 {
113 (void)Create(info);
114 }
115
116 wxFont(const wxString& fontDesc);
117
118 bool Create(int size,
119 int family,
120 int style,
121 int weight,
122 bool underlined = FALSE,
123 const wxString& face = wxEmptyString,
124 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
125
126 bool Create(const wxNativeFontInfo& info);
127
128 virtual ~wxFont();
129
130 // implement base class pure virtuals
131 virtual int GetPointSize() const;
132 virtual int GetFamily() const;
133 virtual int GetStyle() const;
134 virtual int GetWeight() const;
135 virtual bool GetUnderlined() const;
136 virtual wxString GetFaceName() const;
137 virtual wxFontEncoding GetEncoding() const;
138 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
139
140 virtual void SetPointSize(int pointSize);
141 virtual void SetFamily(int family);
142 virtual void SetStyle(int style);
143 virtual void SetWeight(int weight);
144 virtual bool SetFaceName(const wxString& faceName);
145 virtual void SetUnderlined(bool underlined);
146 virtual void SetEncoding(wxFontEncoding encoding);
147
148 // implementation only from now on
149 // -------------------------------
150
151 virtual bool RealizeResource();
152
153protected:
154 void Unshare();
155
156private:
157 DECLARE_DYNAMIC_CLASS(wxFont)
158};
159
160#endif
161 // _WX_FONT_H_