]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/cocoa/font.h
added self-assignment check to wxListItem::operator=()
[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
15// ----------------------------------------------------------------------------
16// wxFont
17// ----------------------------------------------------------------------------
18
19DECLARE_WXCOCOA_OBJC_CLASS(NSFont);
20
21// Internal class that bridges us with code like wxSystemSettings
22class wxCocoaFontFactory;
23// We have c-tors/methods taking pointers of these
24class wxFontRefData;
25
26/*! @discussion
27 wxCocoa's implementation of wxFont is very incomplete. In particular,
28 a lot of work needs to be done on wxNativeFontInfo which is currently
29 using the totally generic implementation.
30
31 See the documentation in src/cocoa/font.mm for more implementatoin details.
32 */
33class WXDLLIMPEXP_CORE wxFont : public wxFontBase
34{
35 friend class wxCocoaFontFactory;
36public:
37 /*! @abstract Default construction of invalid font for 2-step construct then Create process.
38 */
39 wxFont() { }
40
41 /*! @abstract Platform-independent construction with individual properties
42 */
43#if FUTURE_WXWIN_COMPATIBILITY_3_0
44 wxFont(int size,
45 int family,
46 int style,
47 int weight,
48 bool underlined = FALSE,
49 const wxString& face = wxEmptyString,
50 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
51 {
52 (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
53 }
54#endif
55 wxFont(int size,
56 wxFontFamily family,
57 wxFontStyle style,
58 wxFontWeight weight,
59 bool underlined = FALSE,
60 const wxString& face = wxEmptyString,
61 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
62 {
63 (void)Create(size, family, style, weight, underlined, face, encoding);
64 }
65
66 /*! @abstract Construction with opaque wxNativeFontInfo
67 */
68 wxFont(const wxNativeFontInfo& info)
69 {
70 (void)Create(info);
71 }
72
73 /*! @abstract Construction with platform-dependent font descriptor string.
74 @param fontDesc Usually the result of wxNativeFontInfo::ToUserString()
75 */
76 wxFont(const wxString& fontDesc);
77
78 // NOTE: Copy c-tor and assignment from wxObject is fine
79
80 bool Create(int size,
81 wxFontFamily family,
82 wxFontStyle style,
83 wxFontWeight weight,
84 bool underlined = FALSE,
85 const wxString& face = wxEmptyString,
86 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
87
88 bool Create(const wxNativeFontInfo& info);
89
90 virtual ~wxFont();
91
92 // implement base class pure virtuals
93 virtual int GetPointSize() const;
94 virtual wxFontFamily GetFamily() const;
95 virtual wxFontStyle GetStyle() const;
96 virtual wxFontWeight GetWeight() const;
97 virtual bool GetUnderlined() const;
98 virtual wxString GetFaceName() const;
99 virtual wxFontEncoding GetEncoding() const;
100 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
101
102 virtual void SetPointSize(int pointSize);
103 virtual void SetFamily(wxFontFamily family);
104 virtual void SetStyle(wxFontStyle style);
105 virtual void SetWeight(wxFontWeight weight);
106 virtual bool SetFaceName(const wxString& faceName);
107 virtual void SetUnderlined(bool underlined);
108 virtual void SetEncoding(wxFontEncoding encoding);
109
110 WXDECLARE_COMPAT_SETTERS
111
112 // implementation only from now on
113 // -------------------------------
114
115 /*! @abstract Defined on some ports (not including this one) in wxGDIObject
116 @discussion
117 The intention here I suppose is to allow one to create a wxFont without yet
118 creating the underlying native object. There's no point not to create the
119 NSFont immediately in wxCocoa so this is useless.
120 This method came from the stub code copied in the early days of wxCocoa.
121 FIXME(1): Remove this in trunk. FIXME(2): Is it really a good idea for this to
122 be part of the public API for wxGDIObject?
123 */
124 virtual bool RealizeResource();
125
126protected:
127 /*! @abstract Internal constructor with ref data
128 @discussion
129 Takes ownership of @a refData. That is, it is assumed that refData has either just been
130 created using new (which initializes its m_refCount to 1) or if you are sharing a ref that
131 you have called IncRef on it before passing it to this method.
132 */
133 explicit wxFont(wxFontRefData *refData)
134 { Create(refData); }
135 bool Create(wxFontRefData *refData);
136
137 virtual wxGDIRefData *CreateGDIRefData() const;
138 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
139
140private:
141 DECLARE_DYNAMIC_CLASS(wxFont)
142};
143
144#endif
145 // _WX_FONT_H_