]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/font.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/font.h
3 // Purpose: wxFont class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 DECLARE_WXCOCOA_OBJC_CLASS(NSFont
);
21 // Internal class that bridges us with code like wxSystemSettings
22 class wxCocoaFontFactory
;
23 // We have c-tors/methods taking pointers of these
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.
31 See the documentation in src/cocoa/font.mm for more implementatoin details.
33 class WXDLLIMPEXP_CORE wxFont
: public wxFontBase
35 friend class wxCocoaFontFactory
;
37 /*! @abstract Default construction of invalid font for 2-step construct then Create process.
41 /*! @abstract Platform-independent construction with individual properties
43 #if FUTURE_WXWIN_COMPATIBILITY_3_0
48 bool underlined
= FALSE
,
49 const wxString
& face
= wxEmptyString
,
50 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
52 (void)Create(size
, (wxFontFamily
)family
, (wxFontStyle
)style
, (wxFontWeight
)weight
, underlined
, face
, encoding
);
59 bool underlined
= FALSE
,
60 const wxString
& face
= wxEmptyString
,
61 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
63 (void)Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
66 wxFont(const wxSize
& pixelSize
,
70 bool underlined
= false,
71 const wxString
& face
= wxEmptyString
,
72 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
74 Create(10, family
, style
, weight
, underlined
, face
, encoding
);
75 SetPixelSize(pixelSize
);
78 /*! @abstract Construction with opaque wxNativeFontInfo
80 wxFont(const wxNativeFontInfo
& info
)
85 /*! @abstract Construction with platform-dependent font descriptor string.
86 @param fontDesc Usually the result of wxNativeFontInfo::ToUserString()
88 wxFont(const wxString
& fontDesc
);
90 // NOTE: Copy c-tor and assignment from wxObject is fine
96 bool underlined
= FALSE
,
97 const wxString
& face
= wxEmptyString
,
98 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
100 bool Create(const wxNativeFontInfo
& info
);
104 // implement base class pure virtuals
105 virtual int GetPointSize() const;
106 virtual wxFontStyle
GetStyle() const;
107 virtual wxFontWeight
GetWeight() const;
108 virtual bool GetUnderlined() const;
109 virtual wxString
GetFaceName() const;
110 virtual wxFontEncoding
GetEncoding() const;
111 virtual const wxNativeFontInfo
*GetNativeFontInfo() const;
113 virtual void SetPointSize(int pointSize
);
114 virtual void SetFamily(wxFontFamily family
);
115 virtual void SetStyle(wxFontStyle style
);
116 virtual void SetWeight(wxFontWeight weight
);
117 virtual bool SetFaceName(const wxString
& faceName
);
118 virtual void SetUnderlined(bool underlined
);
119 virtual void SetEncoding(wxFontEncoding encoding
);
121 wxDECLARE_COMMON_FONT_METHODS();
123 // implementation only from now on
124 // -------------------------------
126 /*! @abstract Defined on some ports (not including this one) in wxGDIObject
128 The intention here I suppose is to allow one to create a wxFont without yet
129 creating the underlying native object. There's no point not to create the
130 NSFont immediately in wxCocoa so this is useless.
131 This method came from the stub code copied in the early days of wxCocoa.
132 FIXME(1): Remove this in trunk. FIXME(2): Is it really a good idea for this to
133 be part of the public API for wxGDIObject?
135 virtual bool RealizeResource();
138 /*! @abstract Internal constructor with ref data
140 Takes ownership of @a refData. That is, it is assumed that refData has either just been
141 created using new (which initializes its m_refCount to 1) or if you are sharing a ref that
142 you have called IncRef on it before passing it to this method.
144 explicit wxFont(wxFontRefData
*refData
)
146 bool Create(wxFontRefData
*refData
);
148 virtual wxGDIRefData
*CreateGDIRefData() const;
149 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
151 virtual wxFontFamily
DoGetFamily() const;
154 DECLARE_DYNAMIC_CLASS(wxFont
)