]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/fontdlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/os2/fontdlg.cpp
3 // Purpose: wxFontDialog class. NOTE: you can use the generic class
4 // if you wish, instead of implementing this.
5 // Author: David Webster
9 // Copyright: (c) David Webster
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 // For compilers that support precompilation, includes "wx.h".
14 #include "wx/wxprec.h"
19 #include "wx/dialog.h"
23 #include "wx/fontdlg.h"
24 #include "wx/fontutil.h"
29 #include "wx/os2/private.h"
30 #include "wx/cmndata.h"
35 IMPLEMENT_DYNAMIC_CLASS(wxFontDialog
, wxDialog
)
37 int wxFontDialog::ShowModal()
40 char zCurrentFont
[FACESIZE
];
44 memset(&vFontDlg
, '\0', sizeof(FONTDLG
));
45 zCurrentFont
[0] = '\0';
48 // Set the fontdlg fields
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
;
60 hWndFontDlg
= WinFontDlg( HWND_DESKTOP
61 ,GetParent()->GetHWND()
64 if (hWndFontDlg
&& vFontDlg
.lReturn
== DID_OK
)
66 wxColour
vColour((unsigned long)0x00000000);
67 wxNativeFontInfo vInfo
;
69 m_fontData
.m_fontColour
= vColour
;
71 memset(&vFn
, '\0', sizeof(FACENAMEDESC
));
72 vFn
.usSize
= sizeof(FACENAMEDESC
);
73 vFn
.usWeightClass
= vFontDlg
.usWeight
;
74 vFn
.usWidthClass
= vFontDlg
.usWidth
;
76 memset(&vInfo
.fa
, '\0', sizeof(FATTRS
));
77 memcpy(&vInfo
.fn
, &vFn
, sizeof(FACENAMEDESC
));
79 vInfo
.fa
.usRecordLength
= vFontDlg
.fAttrs
.usRecordLength
;
80 strcpy(vInfo
.fa
.szFacename
, vFontDlg
.fAttrs
.szFacename
);
81 vInfo
.fa
.lMatch
= vFontDlg
.fAttrs
.lMatch
;
86 wxFont
vChosenFont(vInfo
);
88 int nPointSize
= vFontDlg
.fxPointSize
>> 16;
90 vChosenFont
.SetPointSize(nPointSize
);
91 m_fontData
.m_chosenFont
= vChosenFont
;
93 m_fontData
.EncodingInfo().facename
= (wxChar
*)vFontDlg
.fAttrs
.szFacename
;
94 m_fontData
.EncodingInfo().charset
= vFontDlg
.fAttrs
.usCodePage
;
99 } // end of wxFontDialg::ShowModal