OpenCPN Partial API docs
AISTargetAlertDialog.h
1 /***************************************************************************
2  *
3  * Project: OpenCPN
4  *
5  ***************************************************************************
6  * Copyright (C) 2010 by David S. Register *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22  ***************************************************************************
23  */
24 
25 #ifndef __AISTARGETALERTDIALOG_H__
26 #define __AISTARGETALERTDIALOG_H__
27 
28 #include <wx/dialog.h>
29 
30 #define ID_ACKNOWLEDGE 10001
31 #define ID_SILENCE 10002
32 #define ID_JUMPTO 10004
33 #define ID_WPT_CREATE 10005
34 
35 class AisDecoder;
36 class wxHtmlWindow;
37 
38 class OCPN_AlertDialog : public wxDialog {
39  DECLARE_CLASS(OCPN_AlertDialog)
40  DECLARE_EVENT_TABLE()
41 public:
43 
44  virtual ~OCPN_AlertDialog();
45  virtual void Init();
46 
47  virtual bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
48  const wxString& caption = _("OpenCPN Alert"),
49  const wxPoint& pos = wxDefaultPosition,
50  const wxSize& size = wxDefaultSize,
51  long style = wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU);
52 
53 private:
54  wxWindow* m_pparent;
55 };
56 
58  DECLARE_CLASS(AISTargetAlertDialog)
59  DECLARE_EVENT_TABLE()
60 public:
62 
64  bool Create(int target_mmsi, wxWindow* parent, AisDecoder* pdecoder,
65  bool b_jumpto, bool b_createWP, bool b_ack,
66  wxWindowID id = wxID_ANY,
67  const wxString& caption = _("OpenCPN AIS Alert"),
68  const wxPoint& pos = wxDefaultPosition,
69  const wxSize& size = wxDefaultSize,
70  long style = wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU);
71  void Init();
72 
73  int Get_Dialog_MMSI(void) { return m_target_mmsi; }
74  void UpdateText();
75  void RecalculateSize(void);
76 
77  wxDateTime dtAlertExpireTime;
78 
79 private:
80  void CreateControls();
81  bool GetAlertText(void);
82  void SetColorScheme(void);
83  void OnClose(wxCloseEvent& event);
84  void OnIdAckClick(wxCommandEvent& event);
85  void OnMove(wxMoveEvent& event);
86  void OnSize(wxSizeEvent& event);
87  void OnIdSilenceClick(wxCommandEvent& event);
88  void OnIdJumptoClick(wxCommandEvent& event);
89  void OnIdCreateWPClick(wxCommandEvent& event);
90 
91  wxWindow *m_pParent;
92  wxHtmlWindow* m_pAlertTextCtl;
93  int m_target_mmsi;
94  AisDecoder* m_pdecoder;
95  wxFont* m_pFont;
96  wxString m_alert_text;
97  bool m_bjumpto;
98  bool m_back;
99  bool m_bcreateWP;
100  int m_max_nline;
101  int m_adj_height;
102  bool m_bsizeSet;
103 };
104 
105 #endif