]> git.saurik.com Git - wxWidgets.git/blame - src/os2/fontdlg.cpp
removed unused variable
[wxWidgets.git] / src / os2 / fontdlg.cpp
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: fontdlg.cpp
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
DW
9// Copyright: (c) David Webster
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
16#ifndef WX_PRECOMP
17#include <stdio.h>
18#include "wx/defs.h"
19#include "wx/utils.h"
20#include "wx/dialog.h"
0e320a79
DW
21#endif
22
21802234 23#include "wx/fontdlg.h"
bd76e17e 24#include "wx/fontutil.h"
21802234
DW
25
26#define INCL_PM
27#include <os2.h>
28
29#include "wx/os2/private.h"
0e320a79
DW
30#include "wx/cmndata.h"
31
21802234
DW
32#include <math.h>
33#include <stdlib.h>
34#include <string.h>
35
0e320a79 36IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
0e320a79 37
07df68c8 38int wxFontDialog::ShowModal()
0e320a79 39{
07df68c8
DW
40 FONTDLG vFontDlg;
41 char zCurrentFont[FACESIZE];
42 HWND hWndFontDlg;
43 FONTMETRICS vFm;
44 FACENAMEDESC vFn;
0e320a79 45
07df68c8
DW
46 memset(&vFontDlg, '\0', sizeof(FONTDLG));
47 zCurrentFont[0] = '\0';
0e320a79 48
07df68c8
DW
49 //
50 // Set the fontdlg fields
51 //
52 vFontDlg.cbSize = sizeof(FONTDLG);
53 vFontDlg.hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
54 vFontDlg.hpsPrinter = NULL;
55 vFontDlg.pszFamilyname = zCurrentFont;
56 vFontDlg.fxPointSize = MAKEFIXED(12,0);
57 vFontDlg.usFamilyBufLen = FACESIZE;
58 vFontDlg.fl = FNTS_CENTER;
59 vFontDlg.clrFore = CLR_BLACK;
60 vFontDlg.clrBack = CLR_WHITE;
0e320a79 61
07df68c8
DW
62 hWndFontDlg = WinFontDlg( HWND_DESKTOP
63 ,GetParent()->GetHWND()
64 ,&vFontDlg
65 );
66 if (hWndFontDlg && vFontDlg.lReturn == DID_OK)
67 {
68 wxColour vColour((unsigned long)0x00000000);
69 wxNativeFontInfo vInfo;
0e320a79 70
ae500232 71 m_fontData.m_fontColour = vColour;
07df68c8
DW
72
73 memset(&vFn, '\0', sizeof(FACENAMEDESC));
74 vFn.usSize = sizeof(FACENAMEDESC);
75 vFn.usWeightClass = vFontDlg.usWeight;
76 vFn.usWidthClass = vFontDlg.usWidth;
77
a4353f07 78 memset(&vInfo.fa, '\0', sizeof(FATTRS));
07df68c8
DW
79 memcpy(&vInfo.fn, &vFn, sizeof(FACENAMEDESC));
80
a4353f07
DW
81 vInfo.fa.usRecordLength = vFontDlg.fAttrs.usRecordLength;
82 strcpy(vInfo.fa.szFacename, vFontDlg.fAttrs.szFacename);
83 vInfo.fa.lMatch = vFontDlg.fAttrs.lMatch;
84
07df68c8
DW
85 //
86 // Debugging
87 //
88 wxFont vChosenFont(vInfo);
a23692f0 89
a4353f07 90 int nPointSize = vFontDlg.fxPointSize >> 16;
07df68c8 91
a23692f0 92 vChosenFont.SetPointSize(nPointSize);
ae500232 93 m_fontData.m_chosenFont = vChosenFont;
07df68c8 94
07df68c8
DW
95 m_fontData.EncodingInfo().facename = vFontDlg.fAttrs.szFacename;
96 m_fontData.EncodingInfo().charset = vFontDlg.fAttrs.usCodePage;
97
98 return wxID_OK;
99 }
0e320a79 100 return wxID_CANCEL;
07df68c8 101} // end of wxFontDialg::ShowModal
0e320a79 102