]> git.saurik.com Git - wxWidgets.git/blob - src/generic/fontdlgg.cpp
Added Cocoa_acceptsFirstMouse.
[wxWidgets.git] / src / generic / fontdlgg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/fontdlgg.cpp
3 // Purpose: Generic font dialog
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #ifdef __BORLANDC__
16 #pragma hdrstop
17 #endif
18
19 #if wxUSE_FONTDLG && (!defined(__WXGTK__) || defined(__WXGPE__) || defined(__WXUNIVERSAL__))
20
21 #ifndef WX_PRECOMP
22 #include <stdio.h>
23 #include "wx/utils.h"
24 #include "wx/dialog.h"
25 #include "wx/listbox.h"
26 #include "wx/button.h"
27 #include "wx/stattext.h"
28 #include "wx/layout.h"
29 #include "wx/dcclient.h"
30 #include "wx/choice.h"
31 #include "wx/checkbox.h"
32 #include "wx/intl.h"
33 #endif
34
35 #include <string.h>
36 #include <stdlib.h>
37
38 #include "wx/cmndata.h"
39 #include "wx/sizer.h"
40 #include "wx/fontdlg.h"
41 #include "wx/generic/fontdlgg.h"
42 #include "wx/settings.h"
43
44 //-----------------------------------------------------------------------------
45 // helper class - wxFontPreviewer
46 //-----------------------------------------------------------------------------
47
48 class WXDLLEXPORT wxFontPreviewer : public wxWindow
49 {
50 public:
51 wxFontPreviewer(wxWindow *parent, const wxSize& sz = wxDefaultSize) : wxWindow(parent, wxID_ANY, wxDefaultPosition, sz)
52 {
53 }
54
55 private:
56 void OnPaint(wxPaintEvent& event);
57 DECLARE_EVENT_TABLE()
58 };
59
60 BEGIN_EVENT_TABLE(wxFontPreviewer, wxWindow)
61 EVT_PAINT(wxFontPreviewer::OnPaint)
62 END_EVENT_TABLE()
63
64 void wxFontPreviewer::OnPaint(wxPaintEvent& WXUNUSED(event))
65 {
66 wxPaintDC dc(this);
67
68 wxSize size = GetSize();
69 wxFont font = GetFont();
70
71 dc.SetPen(*wxBLACK_PEN);
72 dc.SetBrush(*wxWHITE_BRUSH);
73 dc.DrawRectangle(0, 0, size.x, size.y);
74
75 if ( font.Ok() )
76 {
77 dc.SetFont(font);
78 // Calculate vertical centre
79 long w, h;
80 dc.GetTextExtent( wxT("X"), &w, &h);
81 dc.SetTextForeground(GetForegroundColour());
82 dc.SetClippingRegion(2, 2, size.x-4, size.y-4);
83 dc.DrawText(_("ABCDEFGabcdefg12345"),
84 10, size.y/2 - h/2);
85 dc.DestroyClippingRegion();
86 }
87 }
88
89 //-----------------------------------------------------------------------------
90 // wxGenericFontDialog
91 //-----------------------------------------------------------------------------
92
93 IMPLEMENT_DYNAMIC_CLASS(wxGenericFontDialog, wxDialog)
94
95 BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog)
96 EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont)
97 EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont)
98 EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont)
99 EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont)
100 EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont)
101 EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont)
102 EVT_CLOSE(wxGenericFontDialog::OnCloseWindow)
103 END_EVENT_TABLE()
104
105
106 #define NUM_COLS 48
107 static wxString wxColourDialogNames[NUM_COLS]={wxT("ORANGE"),
108 wxT("GOLDENROD"),
109 wxT("WHEAT"),
110 wxT("SPRING GREEN"),
111 wxT("SKY BLUE"),
112 wxT("SLATE BLUE"),
113 wxT("MEDIUM VIOLET RED"),
114 wxT("PURPLE"),
115
116 wxT("RED"),
117 wxT("YELLOW"),
118 wxT("MEDIUM SPRING GREEN"),
119 wxT("PALE GREEN"),
120 wxT("CYAN"),
121 wxT("LIGHT STEEL BLUE"),
122 wxT("ORCHID"),
123 wxT("LIGHT MAGENTA"),
124
125 wxT("BROWN"),
126 wxT("YELLOW"),
127 wxT("GREEN"),
128 wxT("CADET BLUE"),
129 wxT("MEDIUM BLUE"),
130 wxT("MAGENTA"),
131 wxT("MAROON"),
132 wxT("ORANGE RED"),
133
134 wxT("FIREBRICK"),
135 wxT("CORAL"),
136 wxT("FOREST GREEN"),
137 wxT("AQUARAMINE"),
138 wxT("BLUE"),
139 wxT("NAVY"),
140 wxT("THISTLE"),
141 wxT("MEDIUM VIOLET RED"),
142
143 wxT("INDIAN RED"),
144 wxT("GOLD"),
145 wxT("MEDIUM SEA GREEN"),
146 wxT("MEDIUM BLUE"),
147 wxT("MIDNIGHT BLUE"),
148 wxT("GREY"),
149 wxT("PURPLE"),
150 wxT("KHAKI"),
151
152 wxT("BLACK"),
153 wxT("MEDIUM FOREST GREEN"),
154 wxT("KHAKI"),
155 wxT("DARK GREY"),
156 wxT("SEA GREEN"),
157 wxT("LIGHT GREY"),
158 wxT("MEDIUM SLATE BLUE"),
159 wxT("WHITE")
160 };
161
162 /*
163 * Generic wxFontDialog
164 */
165
166 void wxGenericFontDialog::Init()
167 {
168 m_useEvents = false;
169 m_previewer = NULL;
170 Create( m_parent ) ;
171 }
172
173 wxGenericFontDialog::~wxGenericFontDialog()
174 {
175 }
176
177 void wxGenericFontDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
178 {
179 EndModal(wxID_CANCEL);
180 }
181
182 bool wxGenericFontDialog::DoCreate(wxWindow *parent)
183 {
184 if ( !wxDialog::Create( parent , wxID_ANY , _T("Choose Font") , wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE,
185 _T("fontdialog") ) )
186 {
187 wxFAIL_MSG( wxT("wxFontDialog creation failed") );
188 return false;
189 }
190
191 InitializeFont();
192 CreateWidgets();
193
194 // sets initial font in preview area
195 wxCommandEvent dummy;
196 OnChangeFont(dummy);
197
198 return true;
199 }
200
201 int wxGenericFontDialog::ShowModal()
202 {
203 int ret = wxDialog::ShowModal();
204
205 if (ret != wxID_CANCEL)
206 {
207 m_fontData.m_chosenFont = dialogFont;
208 }
209
210 return ret;
211 }
212
213 // This should be application-settable
214 static bool ShowToolTips() { return false; }
215
216 void wxGenericFontDialog::CreateWidgets()
217 {
218 wxString
219 *families = new wxString[6],
220 *styles = new wxString[3],
221 *weights = new wxString[3];
222 families[0] = _("Roman");
223 families[1] = _("Decorative");
224 families[2] = _("Modern");
225 families[3] = _("Script");
226 families[4] = _("Swiss" );
227 families[5] = _("Teletype" );
228 styles[0] = _("Normal");
229 styles[1] = _("Italic");
230 styles[2] = _("Slant");
231 weights[0] = _("Normal");
232 weights[1] = _("Light");
233 weights[2] = _("Bold");
234
235 wxString *pointSizes = new wxString[40];
236 int i;
237 for ( i = 0; i < 40; i++)
238 {
239 wxChar buf[5];
240 wxSprintf(buf, wxT("%d"), i + 1);
241 pointSizes[i] = buf;
242 }
243
244 // layout
245
246 bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
247 int noCols, noRows;
248 if (is_pda)
249 {
250 noCols = 2; noRows = 3;
251 }
252 else
253 {
254 noCols = 3; noRows = 2;
255 }
256
257 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
258 this->SetSizer(itemBoxSizer2);
259 this->SetAutoLayout(TRUE);
260
261 wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
262 itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5);
263
264 wxFlexGridSizer* itemGridSizer4 = new wxFlexGridSizer(noRows, noCols, 0, 0);
265 itemBoxSizer3->Add(itemGridSizer4, 0, wxGROW, 5);
266
267 wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
268 itemGridSizer4->Add(itemBoxSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW, 5);
269 wxStaticText* itemStaticText6 = new wxStaticText( this, wxID_STATIC, _("&Font family:"), wxDefaultPosition, wxDefaultSize, 0 );
270 itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
271
272 wxChoice* itemChoice7 = new wxChoice( this, wxID_FONT_FAMILY, wxDefaultPosition, wxDefaultSize, 5, families, 0 );
273 itemChoice7->SetHelpText(_("The font family."));
274 if (ShowToolTips())
275 itemChoice7->SetToolTip(_("The font family."));
276 itemBoxSizer5->Add(itemChoice7, 0, wxALIGN_LEFT|wxALL, 5);
277
278 wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL);
279 itemGridSizer4->Add(itemBoxSizer8, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW, 5);
280 wxStaticText* itemStaticText9 = new wxStaticText( this, wxID_STATIC, _("&Style:"), wxDefaultPosition, wxDefaultSize, 0 );
281 itemBoxSizer8->Add(itemStaticText9, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
282
283 wxChoice* itemChoice10 = new wxChoice( this, wxID_FONT_STYLE, wxDefaultPosition, wxDefaultSize, 3, styles, 0 );
284 itemChoice10->SetHelpText(_("The font style."));
285 if (ShowToolTips())
286 itemChoice10->SetToolTip(_("The font style."));
287 itemBoxSizer8->Add(itemChoice10, 0, wxALIGN_LEFT|wxALL, 5);
288
289 wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
290 itemGridSizer4->Add(itemBoxSizer11, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW, 5);
291 wxStaticText* itemStaticText12 = new wxStaticText( this, wxID_STATIC, _("&Weight:"), wxDefaultPosition, wxDefaultSize, 0 );
292 itemBoxSizer11->Add(itemStaticText12, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
293
294 wxChoice* itemChoice13 = new wxChoice( this, wxID_FONT_WEIGHT, wxDefaultPosition, wxDefaultSize, 3, weights, 0 );
295 itemChoice13->SetHelpText(_("The font weight."));
296 if (ShowToolTips())
297 itemChoice13->SetToolTip(_("The font weight."));
298 itemBoxSizer11->Add(itemChoice13, 0, wxALIGN_LEFT|wxALL, 5);
299
300 wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxVERTICAL);
301 itemGridSizer4->Add(itemBoxSizer14, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW, 5);
302 if (m_fontData.GetEnableEffects())
303 {
304 wxStaticText* itemStaticText15 = new wxStaticText( this, wxID_STATIC, _("C&olour:"), wxDefaultPosition, wxDefaultSize, 0 );
305 itemBoxSizer14->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
306
307 wxSize colourSize = wxDefaultSize;
308 if (is_pda)
309 colourSize.x = 100;
310
311 wxChoice* itemChoice16 = new wxChoice( this, wxID_FONT_COLOUR, wxDefaultPosition, colourSize, NUM_COLS, wxColourDialogNames, 0 );
312 itemChoice16->SetHelpText(_("The font colour."));
313 if (ShowToolTips())
314 itemChoice16->SetToolTip(_("The font colour."));
315 itemBoxSizer14->Add(itemChoice16, 0, wxALIGN_LEFT|wxALL, 5);
316 }
317
318 wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxVERTICAL);
319 itemGridSizer4->Add(itemBoxSizer17, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW, 5);
320 wxStaticText* itemStaticText18 = new wxStaticText( this, wxID_STATIC, _("&Point size:"), wxDefaultPosition, wxDefaultSize, 0 );
321 itemBoxSizer17->Add(itemStaticText18, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
322
323 wxChoice* itemChoice19 = new wxChoice( this, wxID_FONT_SIZE, wxDefaultPosition, wxDefaultSize, 40, pointSizes, 0 );
324 itemChoice19->SetHelpText(_("The font point size."));
325 if (ShowToolTips())
326 itemChoice19->SetToolTip(_("The font point size."));
327 itemBoxSizer17->Add(itemChoice19, 0, wxALIGN_LEFT|wxALL, 5);
328
329 if (m_fontData.GetEnableEffects())
330 {
331 wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxVERTICAL);
332 itemGridSizer4->Add(itemBoxSizer20, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
333 wxCheckBox* itemCheckBox21 = new wxCheckBox( this, wxID_FONT_UNDERLINE, _("&Underline"), wxDefaultPosition, wxDefaultSize, 0 );
334 itemCheckBox21->SetValue(FALSE);
335 itemCheckBox21->SetHelpText(_("Whether the font is underlined."));
336 if (ShowToolTips())
337 itemCheckBox21->SetToolTip(_("Whether the font is underlined."));
338 itemBoxSizer20->Add(itemCheckBox21, 0, wxALIGN_LEFT|wxALL, 5);
339 }
340
341 if (!is_pda)
342 itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
343
344 wxStaticText* itemStaticText23 = new wxStaticText( this, wxID_STATIC, _("Preview:"), wxDefaultPosition, wxDefaultSize, 0 );
345 itemBoxSizer3->Add(itemStaticText23, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
346
347 wxFontPreviewer* itemWindow24 = new wxFontPreviewer( this );
348 m_previewer = itemWindow24;
349 itemWindow24->SetHelpText(_("Shows the font preview."));
350 if (ShowToolTips())
351 itemWindow24->SetToolTip(_("Shows the font preview."));
352 itemBoxSizer3->Add(itemWindow24, 0, wxGROW|wxALL, 5);
353
354 wxBoxSizer* itemBoxSizer25 = new wxBoxSizer(wxHORIZONTAL);
355 itemBoxSizer3->Add(itemBoxSizer25, 0, wxGROW, 5);
356 itemBoxSizer25->Add(5, 5, 1, wxGROW|wxALL, 5);
357
358 #ifdef __WXMAC__
359 wxButton* itemButton28 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
360 if (ShowToolTips())
361 itemButton28->SetToolTip(_("Click to cancel the font selection."));
362 itemBoxSizer25->Add(itemButton28, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
363
364 wxButton* itemButton27 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
365 itemButton27->SetDefault();
366 itemButton27->SetHelpText(_("Click to confirm the font selection."));
367 if (ShowToolTips())
368 itemButton27->SetToolTip(_("Click to confirm the font selection."));
369 itemBoxSizer25->Add(itemButton27, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
370 #else
371 wxButton* itemButton27 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
372 itemButton27->SetDefault();
373 itemButton27->SetHelpText(_("Click to confirm the font selection."));
374 if (ShowToolTips())
375 itemButton27->SetToolTip(_("Click to confirm the font selection."));
376 itemBoxSizer25->Add(itemButton27, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
377
378 wxButton* itemButton28 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
379 if (ShowToolTips())
380 itemButton28->SetToolTip(_("Click to cancel the font selection."));
381 itemBoxSizer25->Add(itemButton28, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
382 #endif
383
384 familyChoice = (wxChoice*) FindWindow(wxID_FONT_FAMILY);
385 styleChoice = (wxChoice*) FindWindow(wxID_FONT_STYLE);
386 weightChoice = (wxChoice*) FindWindow(wxID_FONT_WEIGHT);
387 colourChoice = (wxChoice*) FindWindow(wxID_FONT_COLOUR);
388 pointSizeChoice = (wxChoice*) FindWindow(wxID_FONT_SIZE);
389 underLineCheckBox = (wxCheckBox*) FindWindow(wxID_FONT_UNDERLINE);
390
391 familyChoice->SetStringSelection( wxFontFamilyIntToString(dialogFont.GetFamily()) );
392 styleChoice->SetStringSelection(wxFontStyleIntToString(dialogFont.GetStyle()));
393 weightChoice->SetStringSelection(wxFontWeightIntToString(dialogFont.GetWeight()));
394
395 if (colourChoice)
396 {
397 wxString name(wxTheColourDatabase->FindName(m_fontData.GetColour()));
398 if (name.length())
399 colourChoice->SetStringSelection(name);
400 else
401 colourChoice->SetStringSelection(wxT("BLACK"));
402 }
403
404 if (underLineCheckBox)
405 {
406 underLineCheckBox->SetValue(dialogFont.GetUnderlined());
407 }
408
409 pointSizeChoice->SetSelection(dialogFont.GetPointSize()-1);
410
411 #if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
412 GetSizer()->SetItemMinSize(m_previewer, is_pda ? 100 : 430, is_pda ? 40 : 100);
413 GetSizer()->SetSizeHints(this);
414 GetSizer()->Fit(this);
415
416 Centre(wxBOTH);
417 #endif
418
419 delete[] families;
420 delete[] styles;
421 delete[] weights;
422 delete[] pointSizes;
423
424 // Don't block events any more
425 m_useEvents = true;
426
427 }
428
429 void wxGenericFontDialog::InitializeFont()
430 {
431 int fontFamily = wxSWISS;
432 int fontWeight = wxNORMAL;
433 int fontStyle = wxNORMAL;
434 int fontSize = 12;
435 bool fontUnderline = false;
436
437 if (m_fontData.m_initialFont.Ok())
438 {
439 fontFamily = m_fontData.m_initialFont.GetFamily();
440 fontWeight = m_fontData.m_initialFont.GetWeight();
441 fontStyle = m_fontData.m_initialFont.GetStyle();
442 fontSize = m_fontData.m_initialFont.GetPointSize();
443 fontUnderline = m_fontData.m_initialFont.GetUnderlined();
444 }
445
446 dialogFont = wxFont(fontSize, fontFamily, fontStyle,
447 fontWeight, fontUnderline);
448
449 if (m_previewer)
450 m_previewer->SetFont(dialogFont);
451 }
452
453 void wxGenericFontDialog::OnChangeFont(wxCommandEvent& WXUNUSED(event))
454 {
455 if (!m_useEvents) return;
456
457 int fontFamily = wxFontFamilyStringToInt(WXSTRINGCAST familyChoice->GetStringSelection());
458 int fontWeight = wxFontWeightStringToInt(WXSTRINGCAST weightChoice->GetStringSelection());
459 int fontStyle = wxFontStyleStringToInt(WXSTRINGCAST styleChoice->GetStringSelection());
460 int fontSize = wxAtoi(pointSizeChoice->GetStringSelection());
461 // Start with previous underline setting, we want to retain it even if we can't edit it
462 // dialogFont is always initialized because of the call to InitializeFont
463 int fontUnderline = dialogFont.GetUnderlined();
464
465 if (underLineCheckBox)
466 {
467 fontUnderline = underLineCheckBox->GetValue();
468 }
469
470 dialogFont = wxFont(fontSize, fontFamily, fontStyle, fontWeight, (fontUnderline != 0));
471 m_previewer->SetFont(dialogFont);
472
473 if ( colourChoice )
474 {
475 if ( !colourChoice->GetStringSelection().empty() )
476 {
477 wxColour col = wxTheColourDatabase->Find(colourChoice->GetStringSelection());
478 if (col.Ok())
479 {
480 m_fontData.m_fontColour = col;
481 }
482 }
483 }
484 // Update color here so that we can also use the color originally passed in
485 // (EnableEffects may be false)
486 if (m_fontData.m_fontColour.Ok())
487 m_previewer->SetForegroundColour(m_fontData.m_fontColour);
488
489 m_previewer->Refresh();
490 }
491
492 const wxChar *wxFontWeightIntToString(int weight)
493 {
494 switch (weight)
495 {
496 case wxLIGHT:
497 return wxT("Light");
498 case wxBOLD:
499 return wxT("Bold");
500 case wxNORMAL:
501 default:
502 return wxT("Normal");
503 }
504 }
505
506 const wxChar *wxFontStyleIntToString(int style)
507 {
508 switch (style)
509 {
510 case wxITALIC:
511 return wxT("Italic");
512 case wxSLANT:
513 return wxT("Slant");
514 case wxNORMAL:
515 default:
516 return wxT("Normal");
517 }
518 }
519
520 const wxChar *wxFontFamilyIntToString(int family)
521 {
522 switch (family)
523 {
524 case wxROMAN:
525 return wxT("Roman");
526 case wxDECORATIVE:
527 return wxT("Decorative");
528 case wxMODERN:
529 return wxT("Modern");
530 case wxSCRIPT:
531 return wxT("Script");
532 case wxTELETYPE:
533 return wxT("Teletype");
534 case wxSWISS:
535 default:
536 return wxT("Swiss");
537 }
538 }
539
540 int wxFontFamilyStringToInt(wxChar *family)
541 {
542 if (!family)
543 return wxSWISS;
544
545 if (wxStrcmp(family, wxT("Roman")) == 0)
546 return wxROMAN;
547 else if (wxStrcmp(family, wxT("Decorative")) == 0)
548 return wxDECORATIVE;
549 else if (wxStrcmp(family, wxT("Modern")) == 0)
550 return wxMODERN;
551 else if (wxStrcmp(family, wxT("Script")) == 0)
552 return wxSCRIPT;
553 else if (wxStrcmp(family, wxT("Teletype")) == 0)
554 return wxTELETYPE;
555 else return wxSWISS;
556 }
557
558 int wxFontStyleStringToInt(wxChar *style)
559 {
560 if (!style)
561 return wxNORMAL;
562 if (wxStrcmp(style, wxT("Italic")) == 0)
563 return wxITALIC;
564 else if (wxStrcmp(style, wxT("Slant")) == 0)
565 return wxSLANT;
566 else
567 return wxNORMAL;
568 }
569
570 int wxFontWeightStringToInt(wxChar *weight)
571 {
572 if (!weight)
573 return wxNORMAL;
574 if (wxStrcmp(weight, wxT("Bold")) == 0)
575 return wxBOLD;
576 else if (wxStrcmp(weight, wxT("Light")) == 0)
577 return wxLIGHT;
578 else
579 return wxNORMAL;
580 }
581
582 #endif
583 // wxUSE_FONTDLG
584