]> git.saurik.com Git - wxWidgets.git/blame - src/os2/fontdlg.cpp
Document wxTreeCtrl::GetItemFont() behaviour for items without font.
[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
21802234 8// Copyright: (c) David Webster
65571936 9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
21802234
DW
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
ce5d92e1
WS
15#include "wx/fontdlg.h"
16
21802234 17#ifndef WX_PRECOMP
7520f3da
WS
18 #include <stdio.h>
19 #include "wx/utils.h"
20 #include "wx/dialog.h"
21 #include "wx/math.h"
0e320a79
DW
22#endif
23
bd76e17e 24#include "wx/fontutil.h"
691745ab 25#include "wx/modalhook.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{
691745ab 39 WX_HOOK_MODAL_DIALOG();
643e9cf9 40
ce5d92e1
WS
41 FONTDLG vFontDlg;
42 char zCurrentFont[FACESIZE];
43 HWND hWndFontDlg;
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
0fba44b4 95 m_fontData.EncodingInfo().facename = (wxChar*)vFontDlg.fAttrs.szFacename;
07df68c8
DW
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