OpenCPN Partial API docs
Loading...
Searching...
No Matches
ocpn_fontdlg.h
Go to the documentation of this file.
1
2// Author: Julian Smart
3// Modified by: David S Register
4// Created: 04/01/98
5// Copyright: (c) Julian Smart, David S Register
6// Licence: wxWindows licence
7
14#ifndef _OCPN_GENERIC_FONTDLGG_H
15#define _OCPN_GENERIC_FONTDLGG_H
16
17#include <wx/gdicmn.h>
18#include <wx/font.h>
19#include <wx/choice.h>
20#include <wx/textctrl.h>
21#include <wx/checkbox.h>
22
23#define USE_SPINCTRL_FOR_POINT_SIZE 0
24
25/*
26 * FONT DIALOG
27 */
28class OCPNFontPreviewer; // forward in .cpp file
29
30enum {
31 wxID_FONT_UNDERLINE = 3000,
32 wxID_FONT_STYLE,
33 wxID_FONT_WEIGHT,
34 wxID_FONT_FAMILY,
35 wxID_FONT_COLOUR,
36 wxID_FONT_SIZE
37};
38
39class WXDLLIMPEXP_CORE ocpnGenericFontDialog : public wxFontDialogBase {
40public:
41 ocpnGenericFontDialog() { Init(); }
42 ocpnGenericFontDialog(wxWindow *parent) : wxFontDialogBase(parent) { Init(); }
43 ocpnGenericFontDialog(wxWindow *parent, const wxFontData &data)
44 : wxFontDialogBase(parent, data) {
45 Init();
46 }
47 virtual ~ocpnGenericFontDialog();
48
49 virtual int ShowModal() override;
50
51 // Internal functions
52 void OnCloseWindow(wxCloseEvent &event);
53
54 virtual void CreateWidgets();
55 virtual void InitializeFont();
56
57 void OnChangeFont(wxCommandEvent &event);
58
59#if USE_SPINCTRL_FOR_POINT_SIZE
60 void OnChangeSize(wxSpinEvent &event);
61#endif
62
63protected:
64 virtual bool DoCreate(wxWindow *parent) override;
65
66private:
67 // common part of all ctors
68 void Init();
69
70 void DoChangeFont();
71
72 wxFont m_dialogFont;
73
74 wxChoice *m_familyChoice;
75 wxChoice *m_styleChoice;
76 wxChoice *m_weightChoice;
77 wxChoice *m_colourChoice;
78 wxCheckBox *m_underLineCheckBox;
79
80#if USE_SPINCTRL_FOR_POINT_SIZE
81 wxSpinCtrl *m_pointSizeSpin;
82#else
83 wxChoice *m_pointSizeChoice;
84#endif
85
86 OCPNFontPreviewer *m_previewer;
87 bool m_useEvents;
88
89 // static bool fontDialogCancelled;
90 wxDECLARE_EVENT_TABLE();
91};
92
93#endif // _OCPN_GENERIC_FONTDLGG_H