]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/fontdlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
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"
20 #include "wx/dialog.h"
23 #include "wx/fontdlg.h"
28 #include "wx/os2/private.h"
29 #include "wx/cmndata.h"
35 IMPLEMENT_DYNAMIC_CLASS(wxFontDialog
, wxDialog
)
37 int wxFontDialog::ShowModal()
40 char zCurrentFont
[FACESIZE
];
45 memset(&vFontDlg
, '\0', sizeof(FONTDLG
));
46 zCurrentFont
[0] = '\0';
49 // Set the fontdlg fields
51 vFontDlg
.cbSize
= sizeof(FONTDLG
);
52 vFontDlg
.hpsScreen
= ::WinGetScreenPS(HWND_DESKTOP
);
53 vFontDlg
.hpsPrinter
= NULL
;
54 vFontDlg
.pszFamilyname
= zCurrentFont
;
55 vFontDlg
.fxPointSize
= MAKEFIXED(12,0);
56 vFontDlg
.usFamilyBufLen
= FACESIZE
;
57 vFontDlg
.fl
= FNTS_CENTER
;
58 vFontDlg
.clrFore
= CLR_BLACK
;
59 vFontDlg
.clrBack
= CLR_WHITE
;
61 hWndFontDlg
= WinFontDlg( HWND_DESKTOP
62 ,GetParent()->GetHWND()
65 if (hWndFontDlg
&& vFontDlg
.lReturn
== DID_OK
)
67 wxColour
vColour((unsigned long)0x00000000);
68 wxNativeFontInfo vInfo
;
70 m_fontData
.fontColour
= vColour
;
72 memset(&vFn
, '\0', sizeof(FACENAMEDESC
));
73 vFn
.usSize
= sizeof(FACENAMEDESC
);
74 vFn
.usWeightClass
= vFontDlg
.usWeight
;
75 vFn
.usWidthClass
= vFontDlg
.usWidth
;
77 memcpy(&vInfo
.fa
, &vFontDlg
.fAttrs
, sizeof(FATTRS
));
78 memcpy(&vInfo
.fn
, &vFn
, sizeof(FACENAMEDESC
));
83 wxFont
vChosenFont(vInfo
);
86 int nPointSize
= vFontDlg
.lEmHeight
;
91 wxNativeFontInfo
* pInfo
;
93 vChosenFont
.SetPointSize(nPointSize
);
94 nFamily
= vChosenFont
.GetFamily();
95 nPointSize
= vChosenFont
.GetPointSize();
96 nStyle
= vChosenFont
.GetStyle();
97 nWeight
= vChosenFont
.GetWeight();
98 bUnderlined
= vChosenFont
.GetUnderlined();
99 sFaceName
= vChosenFont
.GetFaceName();
100 pInfo
= vChosenFont
.GetNativeFontInfo();
103 m_fontData
.chosenFont
= vChosenFont
;
105 nFamily
= m_fontData
.chosenFont
.GetFamily();
106 nPointSize
= m_fontData
.chosenFont
.GetPointSize();
107 nStyle
= m_fontData
.chosenFont
.GetStyle();
108 nWeight
= m_fontData
.chosenFont
.GetWeight();
109 bUnderlined
= m_fontData
.chosenFont
.GetUnderlined();
110 sFaceName
= m_fontData
.chosenFont
.GetFaceName();
111 pInfo
= m_fontData
.chosenFont
.GetNativeFontInfo();
113 m_fontData
.EncodingInfo().facename
= vFontDlg
.fAttrs
.szFacename
;
114 m_fontData
.EncodingInfo().charset
= vFontDlg
.fAttrs
.usCodePage
;
119 } // end of wxFontDialg::ShowModal