projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wxMSW: return correct value from wxMessageDialog::GetReturnCode().
[wxWidgets.git]
/
src
/
msw
/
fontenum.cpp
diff --git
a/src/msw/fontenum.cpp
b/src/msw/fontenum.cpp
index dda6ca6185402ee203259660768831990ba19271..9b505cb4f12f4230a10ef260e361c89e0d9268a1 100644
(file)
--- a/
src/msw/fontenum.cpp
+++ b/
src/msw/fontenum.cpp
@@
-1,10
+1,9
@@
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
-// Name: msw/fontenum.cpp
+// Name:
src/
msw/fontenum.cpp
// Purpose: wxFontEnumerator class for Windows
// Author: Julian Smart
// Modified by: Vadim Zeitlin to add support for font encodings
// Created: 04/01/98
// Purpose: wxFontEnumerator class for Windows
// Author: Julian Smart
// Modified by: Vadim Zeitlin to add support for font encodings
// Created: 04/01/98
-// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@@
-24,18
+23,19
@@
#pragma hdrstop
#endif
#pragma hdrstop
#endif
-#if wxUSE_FONTMAP
+#if wxUSE_FONTENUM
+
+#include "wx/fontenum.h"
#ifndef WX_PRECOMP
#include "wx/gdicmn.h"
#include "wx/font.h"
#ifndef WX_PRECOMP
#include "wx/gdicmn.h"
#include "wx/font.h"
- #include "wx/encinfo.h"
+ #include "wx/dynarray.h"
+ #include "wx/msw/private.h"
#endif
#endif
-#include "wx/msw/private.h"
-
+#include "wx/encinfo.h"
#include "wx/fontutil.h"
#include "wx/fontutil.h"
-#include "wx/fontenum.h"
#include "wx/fontmap.h"
// ----------------------------------------------------------------------------
#include "wx/fontmap.h"
// ----------------------------------------------------------------------------
@@
-89,7
+89,7
@@
private:
// the list of facenames we already found while enumerating facenames
wxArrayString m_facenames;
// the list of facenames we already found while enumerating facenames
wxArrayString m_facenames;
- DECLARE_NO_COPY_CLASS(wxFontEnumeratorHelper)
+ wxDECLARE_NO_COPY_CLASS(wxFontEnumeratorHelper);
};
// ----------------------------------------------------------------------------
};
// ----------------------------------------------------------------------------
@@
-98,7
+98,7
@@
private:
#ifndef __WXMICROWIN__
int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm,
#ifndef __WXMICROWIN__
int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm,
- DWORD dwStyle, L
ONG
lParam);
+ DWORD dwStyle, L
PARAM
lParam);
#endif
// ============================================================================
#endif
// ============================================================================
@@
-158,12
+158,14
@@
void wxFontEnumeratorHelper::DoEnumerate()
HDC hDC = ::GetDC(NULL);
#ifdef __WXWINCE__
HDC hDC = ::GetDC(NULL);
#ifdef __WXWINCE__
- ::EnumFontFamilies(hDC, m_facename, (wxFONTENUMPROC)wxFontEnumeratorProc,
- (LPARAM)this) ;
+ ::EnumFontFamilies(hDC,
+ m_facename.empty() ? NULL : wxMSW_CONV_LPCTSTR(m_facename),
+ (wxFONTENUMPROC)wxFontEnumeratorProc,
+ (LPARAM)this) ;
#else // __WIN32__
LOGFONT lf;
lf.lfCharSet = (BYTE)m_charset;
#else // __WIN32__
LOGFONT lf;
lf.lfCharSet = (BYTE)m_charset;
- wxStr
ncpy(lf.lfFaceName, m_facename
, WXSIZEOF(lf.lfFaceName));
+ wxStr
lcpy(lf.lfFaceName, m_facename.c_str()
, WXSIZEOF(lf.lfFaceName));
lf.lfPitchAndFamily = 0;
::EnumFontFamiliesEx(hDC, &lf, (wxFONTENUMPROC)wxFontEnumeratorProc,
(LPARAM)this, 0 /* reserved */) ;
lf.lfPitchAndFamily = 0;
::EnumFontFamiliesEx(hDC, &lf, (wxFONTENUMPROC)wxFontEnumeratorProc,
(LPARAM)this, 0 /* reserved */) ;
@@
-184,9
+186,18
@@
bool wxFontEnumeratorHelper::OnFont(const LPLOGFONT lf,
{
wxConstCast(this, wxFontEnumeratorHelper)->m_charsets.Add(cs);
{
wxConstCast(this, wxFontEnumeratorHelper)->m_charsets.Add(cs);
+#if wxUSE_FONTMAP
wxFontEncoding enc = wxGetFontEncFromCharSet(cs);
return m_fontEnum->OnFontEncoding(lf->lfFaceName,
wxFontMapper::GetEncodingName(enc));
wxFontEncoding enc = wxGetFontEncFromCharSet(cs);
return m_fontEnum->OnFontEncoding(lf->lfFaceName,
wxFontMapper::GetEncodingName(enc));
+#else // !wxUSE_FONTMAP
+ // Just use some unique and, hopefully, understandable, name.
+ return m_fontEnum->OnFontEncoding
+ (
+ lf->lfFaceName,
+ wxString::Format(wxS("Code page %d"), cs)
+ );
+#endif // wxUSE_FONTMAP/!wxUSE_FONTMAP
}
else
{
}
else
{
@@
-266,7
+277,7
@@
bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
#ifndef __WXMICROWIN__
int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm,
#ifndef __WXMICROWIN__
int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm,
- DWORD WXUNUSED(dwStyle), L
ONG
lParam)
+ DWORD WXUNUSED(dwStyle), L
PARAM
lParam)
{
// we used to process TrueType fonts only, but there doesn't seem to be any
{
// we used to process TrueType fonts only, but there doesn't seem to be any
@@
-286,4
+297,4
@@
int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm,
}
#endif
}
#endif
-#endif // wxUSE_FONT
MAP
+#endif // wxUSE_FONT
ENUM