]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/font.h
Really fix the problem with caret in wxGrid text editor under MSW.
[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
0e320a79 7// RCS-ID: $Id$
21802234 8// Copyright: (c) David Webster
65571936 9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_FONT_H_
13#define _WX_FONT_H_
14
0e320a79 15#include "wx/gdiobj.h"
e99762c0 16#include "wx/os2/private.h"
0e320a79 17
53a2db12 18WXDLLIMPEXP_DATA_CORE(extern const wxChar*) wxEmptyString;
21802234
DW
19
20// ----------------------------------------------------------------------------
21// wxFont
22// ----------------------------------------------------------------------------
0e320a79 23
53a2db12 24class WXDLLIMPEXP_CORE wxFont : public wxFontBase
0e320a79 25{
0e320a79 26public:
21802234 27 // ctors and such
f8855e47 28 wxFont() { }
e99762c0 29
0c14b6c3
FM
30#if FUTURE_WXWIN_COMPATIBILITY_3_0
31 wxFont(int size,
32 int family,
33 int style,
34 int weight,
35 bool underlined = false,
36 const wxString& face = wxEmptyString,
37 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
21802234 38 {
0c14b6c3
FM
39 (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
40 }
41#endif
42
43 wxFont(int size,
44 wxFontFamily family,
45 wxFontStyle style,
46 wxFontWeight weight,
47 bool underlined = false,
48 const wxString& face = wxEmptyString,
49 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
50 {
51 Create(size, family, style, weight, underlined, face, encoding);
21802234 52 }
03647350 53
b5791cc7
FM
54 wxFont(const wxSize& pixelSize,
55 wxFontFamily family,
56 wxFontStyle style,
57 wxFontWeight weight,
58 bool underlined = false,
59 const wxString& face = wxEmptyString,
60 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
61 {
62 Create(10, family, style, weight, underlined, face, encoding);
63 SetPixelSize(pixelSize);
64 }
03647350 65
0634700a
VZ
66 wxFont(int pointSize,
67 wxFontFamily family,
68 int flags = wxFONTFLAG_DEFAULT,
69 const wxString& face = wxEmptyString,
70 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
71 {
72 Create(pointSize, family,
73 GetStyleFromFlags(flags),
74 GetWeightFromFlags(flags),
75 GetUnderlinedFromFlags(flags),
76 face, encoding);
77 }
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_