OpenCPN Partial API docs
concanv.h
1 /******************************************************************************
2  *
3  * Project: OpenCPN
4  * Purpose: Console Canvas
5  * Author: David Register
6  *
7  ***************************************************************************
8  * Copyright (C) 2010 by David S. Register *
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  * This program is distributed in the hope that it will be useful, *
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18  * GNU General Public License for more details. *
19  * *
20  * You should have received a copy of the GNU General Public License *
21  * along with this program; if not, write to the *
22  * Free Software Foundation, Inc., *
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
24  ***************************************************************************
25  *
26  */
27 
28 #ifndef __concanv_H__
29 #define __concanv_H__
30 
31 //----------------------------------------------------------------------------
32 // constants
33 //----------------------------------------------------------------------------
34 
35 #include "ocpn_frame.h" //FIXME (dave) Only needed for colorscheme stuff
36 
37 #define SPEED_VMG 0
38 #define SPEED_SOG 1
39 
40 #define ID_LEGROUTE 1000
41 #define SECONDS_PER_DAY 86400
42 
43 // Class declarations
44 class Routeman;
45 
46 //----------------------------------------------------------------------------
47 // CDI
48 //----------------------------------------------------------------------------
49 
50 class CDI : public wxWindow {
51 public:
52  CDI(wxWindow *parent, wxWindowID id, long style, const wxString &name);
53 
54  void OnPaint(wxPaintEvent &event);
55  void SetColorScheme(ColorScheme cs);
56  void MouseEvent(wxMouseEvent &event);
57 
58  wxBrush *m_pbackBrush;
59  wxBrush *m_proadBrush;
60  wxPen *m_proadPen;
61 
62  DECLARE_EVENT_TABLE()
63 };
64 
65 //----------------------------------------------------------------------------
66 // AnnunText
67 //----------------------------------------------------------------------------
68 class AnnunText : public wxWindow {
69 public:
70  AnnunText(wxWindow *parent, wxWindowID id, const wxString &LegendElement,
71  const wxString &ValueElement);
72 
73  ~AnnunText();
74 
75  void SetALabel(const wxString &l);
76  void SetAValue(const wxString &v);
77  void OnPaint(wxPaintEvent &event);
78  void RefreshFonts(void);
79  void SetLegendElement(const wxString &element);
80  void SetValueElement(const wxString &element);
81  void SetColorScheme(ColorScheme cs);
82  void MouseEvent(wxMouseEvent &event);
83 
84 private:
85  void CalculateMinSize(void);
86 
87  wxBrush m_backBrush;
88  wxColour m_default_text_color;
89 
90  wxString m_label;
91  wxString m_value;
92  wxFont *m_plabelFont;
93  wxFont *m_pvalueFont;
94 
95  wxString m_LegendTextElement;
96  wxString m_ValueTextElement;
97  wxColour m_legend_color;
98  wxColour m_val_color;
99 
100  DECLARE_EVENT_TABLE()
101 };
102 
103 //----------------------------------------------------------------------------
104 // ConsoleCanvas
105 //----------------------------------------------------------------------------
106 class ConsoleCanvas : public wxFrame {
107 public:
108  ConsoleCanvas(wxWindow *frame);
109  ~ConsoleCanvas();
110  void UpdateRouteData();
111  void ShowWithFreshFonts(void);
112  void UpdateFonts(void);
113  void SetColorScheme(ColorScheme cs);
114  void LegRoute();
115  void OnContextMenu(wxContextMenuEvent &event);
116  void OnContextMenuSelection(wxCommandEvent &event);
117  void RefreshConsoleData(void);
118  void ToggleRouteTotalDisplay();
119 
120  wxWindow *m_pParent;
121  wxStaticText *pThisLegText;
122  wxBoxSizer *m_pitemBoxSizerLeg;
123 
124  AnnunText *pXTE;
125  AnnunText *pBRG;
126  AnnunText *pRNG;
127  AnnunText *pTTG;
128  AnnunText *pVMG;
129  CDI *pCDI;
130 
131  wxFont *pThisLegFont;
132  bool m_bNeedClear;
133  wxBrush *pbackBrush;
134 
135 private:
136  void OnPaint(wxPaintEvent &event);
137  void OnShow(wxShowEvent &event);
138  char m_speedUsed;
139 
140  DECLARE_EVENT_TABLE()
141 };
142 
143 #endif
Definition: concanv.h:50
void OnPaint(wxPaintEvent &event)
Definition: concanv.cpp:684