]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/font.h
Make storing non-trivial data in wxThreadSpecificInfo possible.
[wxWidgets.git] / include / wx / os2 / font.h
CommitLineData
0e320a79 1/////////////////////////////////////////////////////////////////////////////
17b1d76b 2// Name: wx/os2/font.h
0e320a79 3// Purpose: wxFont class
21802234 4// Author: David Webster
0e320a79 5// Modified by:
21802234 6// Created: 10/06/99
21802234 7// Copyright: (c) David Webster
65571936 8// Licence: wxWindows licence
0e320a79
DW
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_FONT_H_
12#define _WX_FONT_H_
13
0e320a79 14#include "wx/gdiobj.h"
e99762c0 15#include "wx/os2/private.h"
0e320a79 16
53a2db12 17WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxEmptyString;
21802234
DW
18
19// ----------------------------------------------------------------------------
20// wxFont
21// ----------------------------------------------------------------------------
0e320a79 22
53a2db12 23class WXDLLIMPEXP_CORE wxFont : public wxFontBase
0e320a79 24{
0e320a79 25public:
21802234 26 // ctors and such
f8855e47 27 wxFont() { }
e99762c0 28
b960795e
VZ
29 wxFont(const wxFontInfo& info)
30 {
31 Create(info.GetPointSize(),
32 info.GetFamily(),
33 info.GetStyle(),
34 info.GetWeight(),
35 info.IsUnderlined(),
36 info.GetFaceName(),
37 info.GetEncoding());
38
39 if ( info.IsUsingSizeInPixels() )
40 SetPixelSize(info.GetPixelSize());
41 }
42
0c14b6c3
FM
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)
21802234 51 {
0c14b6c3
FM
52 (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
53 }
54#endif
55
56 wxFont(int size,
57 wxFontFamily family,
58 wxFontStyle style,
59 wxFontWeight weight,
60 bool underlined = false,
61 const wxString& face = wxEmptyString,
62 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
63 {
64 Create(size, family, style, weight, underlined, face, encoding);
21802234 65 }
03647350 66
b5791cc7
FM
67 wxFont(const wxSize& pixelSize,
68 wxFontFamily family,
69 wxFontStyle style,
70 wxFontWeight weight,
71 bool underlined = false,
72 const wxString& face = wxEmptyString,
73 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
74 {
75 Create(10, family, style, weight, underlined, face, encoding);
76 SetPixelSize(pixelSize);
77 }
03647350 78
0c14b6c3
FM
79 bool Create(int size,
80 wxFontFamily family,
81 wxFontStyle style,
82 wxFontWeight weight,
83 bool underlined = false,
84 const wxString& face = wxEmptyString,
85 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
86
cc95f4f9
DW
87 wxFont( const wxNativeFontInfo& rInfo
88 ,WXHFONT hFont = 0
89 )
90
91 {
cc95f4f9
DW
92 (void)Create( rInfo
93 ,hFont
94 );
95 }
96
97 wxFont(const wxString& rsFontDesc);
377771d9 98
cc95f4f9
DW
99 bool Create( const wxNativeFontInfo& rInfo
100 ,WXHFONT hFont = 0
101 );
21802234
DW
102
103 virtual ~wxFont();
104
e99762c0
DW
105 //
106 // Implement base class pure virtuals
107 //
cc95f4f9 108 virtual int GetPointSize(void) const;
0c14b6c3
FM
109 virtual wxFontStyle GetStyle() const;
110 virtual wxFontWeight GetWeight() const;
cc95f4f9
DW
111 virtual bool GetUnderlined(void) const;
112 virtual wxString GetFaceName(void) const;
113 virtual wxFontEncoding GetEncoding(void) const;
3bf5a59b 114 virtual const wxNativeFontInfo* GetNativeFontInfo() const;
e99762c0
DW
115
116 virtual void SetPointSize(int nPointSize);
0c14b6c3
FM
117 virtual void SetFamily(wxFontFamily family);
118 virtual void SetStyle(wxFontStyle style);
119 virtual void SetWeight(wxFontWeight weight);
85ab460e 120 virtual bool SetFaceName(const wxString& rsFaceName);
e99762c0
DW
121 virtual void SetUnderlined(bool bUnderlined);
122 virtual void SetEncoding(wxFontEncoding vEncoding);
e99762c0 123
f76c0758 124 wxDECLARE_COMMON_FONT_METHODS();
0c14b6c3 125
cc95f4f9
DW
126 //
127 // For internal use only!
128 //
511ac294 129 void SetPS(HPS hPS);
cc95f4f9
DW
130 void SetFM( PFONTMETRICS pFM
131 ,int nNumFonts
132 );
e99762c0
DW
133 //
134 // Implementation only from now on
21802234 135 // -------------------------------
e99762c0 136 //
e99762c0
DW
137 virtual bool IsFree(void) const;
138 virtual bool RealizeResource(void);
17b1d76b 139 virtual WXHANDLE GetResourceHandle(void) const;
dabbc6a5 140 virtual bool FreeResource(bool bForce = false);
0e320a79 141
08399e45 142 WXHFONT GetHFONT(void) const;
9045ad9d 143
21802234 144protected:
9045ad9d 145 virtual void DoSetNativeFontInfo(const wxNativeFontInfo& rInfo);
59b7da02 146 virtual wxFontFamily DoGetFamily() const;
9045ad9d 147
4b3f61d1
SN
148 // implement wxObject virtuals which are used by AllocExclusive()
149 virtual wxGDIRefData *CreateGDIRefData() const;
150 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
0e320a79 151
21802234
DW
152private:
153 DECLARE_DYNAMIC_CLASS(wxFont)
e99762c0 154}; // end of wxFont
0e320a79 155
e99762c0 156#endif // _WX_FONT_H_