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