]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/font.h
In the object destructor, Disassociate the object from its Cocoa counterpart
[wxWidgets.git] / include / wx / os2 / font.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: font.h
3 // Purpose: wxFont class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/06/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FONT_H_
13 #define _WX_FONT_H_
14
15 #include "wx/gdiobj.h"
16 #include "wx/os2/private.h"
17 #include "wx/fontutil.h"
18
19 WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
20
21 // ----------------------------------------------------------------------------
22 // wxFont
23 // ----------------------------------------------------------------------------
24
25 class WXDLLEXPORT wxFont : public wxFontBase
26 {
27 public:
28 // ctors and such
29 wxFont() { Init(); }
30 wxFont(const wxFont& rFont) { Init(); Ref(rFont); }
31
32 wxFont( int nSize
33 ,int nFamily
34 ,int nStyle
35 ,int nWeight
36 ,bool bUnderlined = FALSE
37 ,const wxString& rsFace = wxEmptyString
38 ,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT
39 )
40 {
41 Init();
42
43 (void)Create( nSize
44 ,nFamily
45 ,nStyle
46 ,nWeight
47 ,bUnderlined
48 ,rsFace
49 ,vEncoding
50 );
51 }
52
53 wxFont( const wxNativeFontInfo& rInfo
54 ,WXHFONT hFont = 0
55 )
56
57 {
58 Init();
59
60 (void)Create( rInfo
61 ,hFont
62 );
63 }
64
65 wxFont(const wxString& rsFontDesc);
66
67 bool Create( int nSize
68 ,int nFamily
69 ,int nStyle
70 ,int nWeight
71 ,bool bUnderlined = FALSE
72 ,const wxString& rsFace = wxEmptyString
73 ,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT
74 );
75 bool Create( const wxNativeFontInfo& rInfo
76 ,WXHFONT hFont = 0
77 );
78
79 virtual ~wxFont();
80
81 //
82 // Assignment
83 //
84 wxFont& operator=(const wxFont& rFont);
85
86 //
87 // Implement base class pure virtuals
88 //
89 virtual int GetPointSize(void) const;
90 virtual int GetFamily(void) const;
91 virtual int GetStyle(void) const;
92 virtual int GetWeight(void) const;
93 virtual bool GetUnderlined(void) const;
94 virtual wxString GetFaceName(void) const;
95 virtual wxFontEncoding GetEncoding(void) const;
96 virtual wxNativeFontInfo* GetNativeFontInfo() const;
97
98 virtual void SetPointSize(int nPointSize);
99 virtual void SetFamily(int nFamily);
100 virtual void SetStyle(int nStyle);
101 virtual void SetWeight(int nWeight);
102 virtual void SetFaceName(const wxString& rsFaceName);
103 virtual void SetUnderlined(bool bUnderlined);
104 virtual void SetEncoding(wxFontEncoding vEncoding);
105
106 //
107 // For internal use only!
108 //
109 void SetPS(HPS hPS);
110 void SetFM( PFONTMETRICS pFM
111 ,int nNumFonts
112 );
113 //
114 // Implementation only from now on
115 // -------------------------------
116 //
117 virtual bool IsFree(void) const;
118 virtual bool RealizeResource(void);
119 virtual WXHANDLE GetResourceHandle(void);
120 virtual bool FreeResource(bool bForce = FALSE);
121
122 WXHFONT GetHFONT(void) const;
123
124 protected:
125 virtual void DoSetNativeFontInfo(const wxNativeFontInfo& rInfo);
126
127 //
128 // Common part of all ctors
129 //
130 void Init(void);
131 void Unshare(void);
132
133 private:
134 DECLARE_DYNAMIC_CLASS(wxFont)
135 }; // end of wxFont
136
137 #endif // _WX_FONT_H_