--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: fontenum.h
+// Purpose: wxFontEnumerator class for Windows
+// Author: Julian Smart
+// Modified by:
+// Created: 04/01/98
+// RCS-ID: $Id$
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FONTENUM_H_
+#define _WX_FONTENUM_H_
+
+#ifdef __GNUG__
+#pragma interface "fontenum.h"
+#endif
+
+/*
+ * wxFontEnumerator: for gathering font information
+ */
+
+class wxFontEnumerator: public wxObject
+{
+DECLARE_CLASS(wxFontEnumerator)
+public:
+ wxFontEnumerator() {};
+
+ // Enumerate the fonts.
+ bool Enumerate();
+
+ // Stop enumeration if FALSE is returned.
+ // By default, the enumerator stores the facenames in a list for
+ // retrieval via GetFacenames().
+ virtual bool OnFont(const wxFont& font);
+
+ // Return the list of facenames.
+ wxStringList& GetFacenames() { return (wxStringList&) m_faceNames; }
+protected:
+ wxStringList m_faceNames;
+};
+
+#endif
+ // _WX_FONTENUM_H_
+
((m_validatorStyle & wxFILTER_ALPHA) && !isalpha(keyCode)) ||
((m_validatorStyle & wxFILTER_ALPHANUMERIC) && !isalnum(keyCode)) ||
((m_validatorStyle & wxFILTER_NUMERIC) && !isdigit(keyCode)
- && keyCode != '.' && keyCode != '-')
+ && keyCode != '.' && keyCode != ',' && keyCode != '-')
)
)
{
int i;
for ( i = 0; i < (int)val.Length(); i++)
{
- if ((!isdigit(val[i])) && (val[i] != '.'))
+ // Allow for "," (French) as well as "." -- in future we should
+ // use wxSystemSettings or other to do better localisation
+ if ((!isdigit(val[i])) && (val[i] != '.') && (val[i] != ','))
if(!((i == 0) && (val[i] == '-')))
return FALSE;
}
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: fontenum.cpp
+// Purpose: wxFontEnumerator class for Windows
+// Author: Julian Smart
+// Modified by:
+// Created: 04/01/98
+// RCS-ID: $Id$
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/font.h"
+#endif
+
+#include <wx/msw/private.h>
+
+int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm,
+ DWORD dwStyle, LONG lParam)
+{
+ // Get rid of any fonts that we don't want...
+ if (dwStyle != TRUETYPE_FONTTYPE)
+ return 1;
+
+ wxFontEnumerator *fontEnum = (wxFontEnumerator *)lParam;
+
+ wxFont font = wxCreateFontFromLogFont(lplf);
+
+ if (fontEnum->OnFont(font))
+ return 1 ;
+ else
+ return 0 ;
+}
+
+IMPLEMENT_CLASS(wxFontEnumerator, wxObject)
+
+bool wxFontEnumerator::Enumerate()
+{
+ m_faceNames.Clear();
+
+ HDC hDC = ::GetDC(NULL);
+#ifdef __WIN32__
+ ::EnumFontFamilies(hDC, (LPTSTR) NULL, (FONTENUMPROC) wxFontEnumeratorProc, (LPARAM) (void*) this) ;
+#else
+ ::EnumFonts(hDC, (LPTSTR) NULL, (FONTENUMPROC) wxFontEnumeratorProc, (LPARAM) (void*) this) ;
+#endif
+ ::ReleaseDC(NULL, hDC);
+ return TRUE;
+}
+
+bool wxFontEnumerator::OnFont(const wxFont& font)
+{
+ m_faceNames.Add(font.GetFaceName());
+ return TRUE;
+}
+