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