]> git.saurik.com Git - wxWidgets.git/blob - src/mgl/fontenum.cpp
Made all bitmaps 16x16
[wxWidgets.git] / src / mgl / fontenum.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mgl/fontenum.cpp
3 // Purpose: wxFontEnumerator class for MGL
4 // Author: Vaclav Slavik
5 // RCS-ID: $Id$
6 // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #ifdef __BORLANDC__
14 #pragma hdrstop
15 #endif
16
17 // ============================================================================
18 // declarations
19 // ============================================================================
20
21 // ----------------------------------------------------------------------------
22 // headers
23 // ----------------------------------------------------------------------------
24
25 #include "wx/fontenum.h"
26
27 #ifndef WX_PRECOMP
28 #include "wx/dynarray.h"
29 #include "wx/string.h"
30 #include "wx/utils.h"
31 #endif
32
33 #include "wx/encinfo.h"
34 #include "wx/fontutil.h"
35
36 #include <mgraph.h>
37
38 // ============================================================================
39 // implementation
40 // ============================================================================
41
42
43 // ----------------------------------------------------------------------------
44 // wxFontEnumerator
45 // ----------------------------------------------------------------------------
46
47 bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
48 bool fixedWidthOnly)
49 {
50 bool found = false;
51 wxMGLFontFamilyList *list = wxTheFontsManager->GetFamilyList();
52 wxMGLFontFamilyList::Node *node;
53 wxMGLFontFamily *f = NULL;
54 wxNativeEncodingInfo info;
55
56 if ( encoding != wxFONTENCODING_SYSTEM )
57 wxGetNativeFontEncoding(encoding, &info);
58
59 for (node = list->GetFirst(); node; node = node->GetNext())
60 {
61 f = node->GetData();
62 info.facename = f->GetName();
63 if ( (!fixedWidthOnly || f->GetInfo()->isFixed) &&
64 (encoding == wxFONTENCODING_SYSTEM || wxTestFontEncoding(info)) )
65 {
66 found = true;
67 if ( !OnFacename(f->GetName()) )
68 return true;
69 }
70 }
71
72 return found;
73 }
74
75 bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
76 {
77 static wxFontEncoding encodings[] =
78 {
79 wxFONTENCODING_ISO8859_1,
80 wxFONTENCODING_ISO8859_2,
81 wxFONTENCODING_ISO8859_3,
82 wxFONTENCODING_ISO8859_4,
83 wxFONTENCODING_ISO8859_5,
84 wxFONTENCODING_ISO8859_6,
85 wxFONTENCODING_ISO8859_7,
86 wxFONTENCODING_ISO8859_8,
87 wxFONTENCODING_ISO8859_9,
88 wxFONTENCODING_ISO8859_10,
89 //wxFONTENCODING_ISO8859_11,
90 //wxFONTENCODING_ISO8859_12,
91 wxFONTENCODING_ISO8859_13,
92 wxFONTENCODING_ISO8859_14,
93 wxFONTENCODING_ISO8859_15,
94 wxFONTENCODING_CP1250,
95 wxFONTENCODING_CP1251,
96 wxFONTENCODING_CP1252,
97 wxFONTENCODING_CP1253,
98 wxFONTENCODING_CP1254,
99 wxFONTENCODING_CP1255,
100 wxFONTENCODING_CP1256,
101 wxFONTENCODING_CP1257,
102 wxFONTENCODING_KOI8,
103
104 wxFONTENCODING_SYSTEM
105 };
106
107 static const char *encodingNames[] =
108 {
109 "iso88590-1",
110 "iso88590-2",
111 "iso88590-3",
112 "iso88590-4",
113 "iso88590-5",
114 "iso88590-6",
115 "iso88590-7",
116 "iso88590-8",
117 "iso88590-9",
118 "iso88590-10",
119 "iso88590-13",
120 "iso88590-14",
121 "iso88590-15",
122 "windows-1250",
123 "windows-1251",
124 "windows-1252",
125 "windows-1253",
126 "windows-1254",
127 "windows-1255",
128 "windows-1256",
129 "windows-1257",
130 "koi-8",
131 NULL
132 };
133
134 wxNativeEncodingInfo info;
135 info.facename = family;
136
137 for (size_t i = 0; encodings[i] != wxFONTENCODING_SYSTEM; i++)
138 {
139 if ( !wxGetNativeFontEncoding(encodings[i], &info) ||
140 !wxTestFontEncoding(info) )
141 continue;
142 if ( !OnFontEncoding(family, encodingNames[i]) )
143 break;
144 }
145
146 return true;
147 }