]> git.saurik.com Git - wxWidgets.git/blame - src/common/fontdata.cpp
Fix horizontal mouse wheel scrolling in wxGTK.
[wxWidgets.git] / src / common / fontdata.cpp
CommitLineData
081d8d96
PC
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/common/fontdata.cpp
3// Author: Julian Smart
081d8d96
PC
4// Copyright: (c) Julian Smart
5// Licence: wxWindows licence
6/////////////////////////////////////////////////////////////////////////////
7
8#include "wx/wxprec.h"
9
10#ifdef __BORLANDC__
11 #pragma hdrstop
12#endif
13
14#if wxUSE_FONTDLG || wxUSE_FONTPICKERCTRL
15
16#include "wx/fontdata.h"
17
18IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject)
19
20wxFontData::wxFontData()
21{
22 m_showHelp = false;
23 m_allowSymbols = true;
24 m_enableEffects = true;
25 m_minSize = 0;
26 m_maxSize = 0;
27
28 m_encoding = wxFONTENCODING_SYSTEM;
29}
30
31wxFontData::~wxFontData()
32{
33}
34
35wxFontData::wxFontData(const wxFontData& data)
36 : wxObject(),
37 m_fontColour(data.m_fontColour),
38 m_showHelp(data.m_showHelp),
39 m_allowSymbols(data.m_allowSymbols),
40 m_enableEffects(data.m_enableEffects),
41 m_initialFont(data.m_initialFont),
42 m_chosenFont(data.m_chosenFont),
43 m_minSize(data.m_minSize),
44 m_maxSize(data.m_maxSize),
45 m_encoding(data.m_encoding),
46 m_encodingInfo(data.m_encodingInfo)
47{
48}
49
50wxFontData& wxFontData::operator=(const wxFontData& data)
51{
52 if (&data != this)
53 {
54 wxObject::operator=(data);
55 m_fontColour = data.m_fontColour;
56 m_showHelp = data.m_showHelp;
57 m_allowSymbols = data.m_allowSymbols;
58 m_enableEffects = data.m_enableEffects;
59 m_initialFont = data.m_initialFont;
60 m_chosenFont = data.m_chosenFont;
61 m_minSize = data.m_minSize;
62 m_maxSize = data.m_maxSize;
63 m_encoding = data.m_encoding;
64 m_encodingInfo = data.m_encodingInfo;
65 }
66 return *this;
67}
68#endif // wxUSE_FONTDLG || wxUSE_FONTPICKERCTRL
f81bc2ba
PC
69
70#if wxUSE_FONTDLG
71
72#include "wx/fontdlg.h"
73
74wxFont wxGetFontFromUser(wxWindow *parent, const wxFont& fontInit, const wxString& caption)
75{
76 wxFontData data;
77 if ( fontInit.IsOk() )
78 {
79 data.SetInitialFont(fontInit);
80 }
81
82 wxFont fontRet;
83 wxFontDialog dialog(parent, data);
84 if (!caption.empty())
85 dialog.SetTitle(caption);
86 if ( dialog.ShowModal() == wxID_OK )
87 {
88 fontRet = dialog.GetFontData().GetChosenFont();
89 }
90 //else: leave it invalid
91
92 return fontRet;
93}
94#endif // wxUSE_FONTDLG