OpenCPN Partial API docs
ocpn_fontdlg.h
1 // 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 
22 class WXDLLIMPEXP_FWD_CORE wxChoice;
23 class WXDLLIMPEXP_FWD_CORE wxText;
24 class WXDLLIMPEXP_FWD_CORE wxCheckBox;
25 class WXDLLIMPEXP_FWD_CORE OCPNFontPreviewer;
26 
27 enum
28 {
29  wxID_FONT_UNDERLINE = 3000,
30  wxID_FONT_STYLE,
31  wxID_FONT_WEIGHT,
32  wxID_FONT_FAMILY,
33  wxID_FONT_COLOUR,
34  wxID_FONT_SIZE
35 };
36 
37 class WXDLLIMPEXP_CORE ocpnGenericFontDialog : public wxFontDialogBase
38 {
39 public:
40  ocpnGenericFontDialog() { Init(); }
41  ocpnGenericFontDialog(wxWindow *parent)
42  : wxFontDialogBase(parent) { Init(); }
43  ocpnGenericFontDialog(wxWindow *parent, const wxFontData& data)
44  : wxFontDialogBase(parent, data) { Init(); }
45  virtual ~ocpnGenericFontDialog();
46 
47  virtual int ShowModal() override;
48 
49  // Internal functions
50  void OnCloseWindow(wxCloseEvent& event);
51 
52  virtual void CreateWidgets();
53  virtual void InitializeFont();
54 
55  void OnChangeFont(wxCommandEvent& event);
56 
57 #if USE_SPINCTRL_FOR_POINT_SIZE
58  void OnChangeSize(wxSpinEvent& event);
59 #endif
60 
61 protected:
62 
63  virtual bool DoCreate(wxWindow *parent) override;
64 
65 private:
66 
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  wxDECLARE_DYNAMIC_CLASS(ocpnGenericFontDialog);
92 };
93 
94 #endif // _OCPN_GENERIC_FONTDLGG_H