]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/fontenum.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFontEnumerator class for Windows
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
23 #include <wx/msw/private.h>
25 int CALLBACK
wxFontEnumeratorProc(LPLOGFONT lplf
, LPTEXTMETRIC lptm
,
26 DWORD dwStyle
, LONG lParam
)
28 // Get rid of any fonts that we don't want...
29 if (dwStyle
!= TRUETYPE_FONTTYPE
)
32 wxFontEnumerator
*fontEnum
= (wxFontEnumerator
*)lParam
;
34 wxFont font
= wxCreateFontFromLogFont(lplf
);
36 if (fontEnum
->OnFont(font
))
42 IMPLEMENT_CLASS(wxFontEnumerator
, wxObject
)
44 bool wxFontEnumerator::Enumerate()
48 HDC hDC
= ::GetDC(NULL
);
50 ::EnumFontFamilies(hDC
, (LPTSTR
) NULL
, (FONTENUMPROC
) wxFontEnumeratorProc
, (LPARAM
) (void*) this) ;
52 ::EnumFonts(hDC
, (LPTSTR
) NULL
, (FONTENUMPROC
) wxFontEnumeratorProc
, (LPARAM
) (void*) this) ;
54 ::ReleaseDC(NULL
, hDC
);
58 bool wxFontEnumerator::OnFont(const wxFont
& font
)
60 m_faceNames
.Add(font
.GetFaceName());