]> git.saurik.com Git - wxWidgets.git/blame - src/os2/fontdlg.cpp
Don't close arcs drawn in wxPostScriptDC.
[wxWidgets.git] / src / os2 / fontdlg.cpp
CommitLineData
0e320a79 1/////////////////////////////////////////////////////////////////////////////
7520f3da 2// Name: src/os2/fontdlg.cpp
0e320a79
DW
3// Purpose: wxFontDialog class. NOTE: you can use the generic class
4// if you wish, instead of implementing this.
21802234 5// Author: David Webster
0e320a79 6// Modified by:
21802234 7// Created: 10/06/99
0e320a79 8// RCS-ID: $Id$
21802234 9// Copyright: (c) David Webster
65571936 10// Licence: wxWindows licence
0e320a79
DW
11/////////////////////////////////////////////////////////////////////////////
12
21802234
DW
13// For compilers that support precompilation, includes "wx.h".
14#include "wx/wxprec.h"
15
ce5d92e1
WS
16#include "wx/fontdlg.h"
17
21802234 18#ifndef WX_PRECOMP
7520f3da
WS
19 #include <stdio.h>
20 #include "wx/utils.h"
21 #include "wx/dialog.h"
22 #include "wx/math.h"
0e320a79
DW
23#endif
24
bd76e17e 25#include "wx/fontutil.h"
21802234
DW
26
27#define INCL_PM
28#include <os2.h>
29
30#include "wx/os2/private.h"
0e320a79 31
21802234
DW
32#include <stdlib.h>
33#include <string.h>
34
0e320a79 35IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
0e320a79 36
07df68c8 37int wxFontDialog::ShowModal()
0e320a79 38{
ce5d92e1
WS
39 FONTDLG vFontDlg;
40 char zCurrentFont[FACESIZE];
41 HWND hWndFontDlg;
42 FACENAMEDESC vFn;
0e320a79 43
07df68c8
DW
44 memset(&vFontDlg, '\0', sizeof(FONTDLG));
45 zCurrentFont[0] = '\0';
0e320a79 46
07df68c8
DW
47 //
48 // Set the fontdlg fields
49 //
50 vFontDlg.cbSize = sizeof(FONTDLG);
51 vFontDlg.hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
52 vFontDlg.hpsPrinter = NULL;
53 vFontDlg.pszFamilyname = zCurrentFont;
54 vFontDlg.fxPointSize = MAKEFIXED(12,0);
55 vFontDlg.usFamilyBufLen = FACESIZE;
56 vFontDlg.fl = FNTS_CENTER;
57 vFontDlg.clrFore = CLR_BLACK;
58 vFontDlg.clrBack = CLR_WHITE;
0e320a79 59
07df68c8
DW
60 hWndFontDlg = WinFontDlg( HWND_DESKTOP
61 ,GetParent()->GetHWND()
62 ,&vFontDlg
63 );
64 if (hWndFontDlg && vFontDlg.lReturn == DID_OK)
65 {
66 wxColour vColour((unsigned long)0x00000000);
67 wxNativeFontInfo vInfo;
0e320a79 68
ae500232 69 m_fontData.m_fontColour = vColour;
07df68c8
DW
70
71 memset(&vFn, '\0', sizeof(FACENAMEDESC));
72 vFn.usSize = sizeof(FACENAMEDESC);
73 vFn.usWeightClass = vFontDlg.usWeight;
74 vFn.usWidthClass = vFontDlg.usWidth;
75
a4353f07 76 memset(&vInfo.fa, '\0', sizeof(FATTRS));
07df68c8
DW
77 memcpy(&vInfo.fn, &vFn, sizeof(FACENAMEDESC));
78
a4353f07
DW
79 vInfo.fa.usRecordLength = vFontDlg.fAttrs.usRecordLength;
80 strcpy(vInfo.fa.szFacename, vFontDlg.fAttrs.szFacename);
81 vInfo.fa.lMatch = vFontDlg.fAttrs.lMatch;
82
07df68c8
DW
83 //
84 // Debugging
85 //
86 wxFont vChosenFont(vInfo);
a23692f0 87
a4353f07 88 int nPointSize = vFontDlg.fxPointSize >> 16;
07df68c8 89
a23692f0 90 vChosenFont.SetPointSize(nPointSize);
ae500232 91 m_fontData.m_chosenFont = vChosenFont;
07df68c8 92
0fba44b4 93 m_fontData.EncodingInfo().facename = (wxChar*)vFontDlg.fAttrs.szFacename;
07df68c8
DW
94 m_fontData.EncodingInfo().charset = vFontDlg.fAttrs.usCodePage;
95
96 return wxID_OK;
97 }
0e320a79 98 return wxID_CANCEL;
07df68c8 99} // end of wxFontDialg::ShowModal