OpenCPN Partial API docs
rest_server_gui.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 __RESTSERVERGUI_H__
26 #define __RESTSERVERGUI_H__
27 
28 #include <functional>
29 #include <string>
30 
31 #include <wx/button.h>
32 #include <wx/dialog.h>
33 #include <wx/stattext.h>
34 #include <wx/checkbox.h>
35 
36 #include "ocpn_frame.h"
37 #include "model/rest_server.h"
38 
39 // Constants for Dialog
40 #define ID_STGDIALOG 10005
41 #define SYMBOL_STG_STYLE \
42  wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCLOSE_BOX
43 
44 #define SYMBOL_STG_TITLE _("Send to GPS")
45 #define SYMBOL_STG_IDNAME ID_STGDIALOG
46 #define SYMBOL_STG_SIZE wxSize(500, 500)
47 #define SYMBOL_STG_POSITION wxDefaultPosition
48 
52 class AcceptObjectDialog : public wxDialog {
53  DECLARE_DYNAMIC_CLASS(AcceptObjectDialog)
54  DECLARE_EVENT_TABLE()
55 
56 public:
58  AcceptObjectDialog(wxWindow* parent, const wxString& caption,
59  const wxString& msg1, const wxString msg2);
60  AcceptObjectDialog(wxWindow* parent, wxWindowID id, const wxString& caption,
61  const wxString& hint, const wxPoint& pos, const wxSize& size,
62  long style, const wxString& msg1, const wxString& msg2);
64 
65  bool Create(wxWindow* parent, wxWindowID id,
66  const wxString& caption,
67  const wxString& hint,
68  const wxPoint& pos,
69  const wxSize& size,
70  long style,
71  const wxString& msg1, const wxString& msg2);
72 
73  void SetMessage(const wxString &message);
74  void SetCheck1Message(const wxString &message);
75 
76  bool GetCheck1Value(){ return m_pCheck1->GetValue(); }
77 
78 private:
79  void CreateControls(const wxString& hint,
80  const wxString& msg1, const wxString& msg);
81 
82  void OnCancelClick(wxCommandEvent& event);
83  void OnOKClick(wxCommandEvent& event);
84 
85  wxButton* m_CancelButton;
86  wxButton* m_OKButton;
87  wxStaticText* premtext;
88  wxCheckBox *m_pCheck1;
89  wxString m_checkbox1_msg;
90 };
91 
92 
93 class PINCreateDialog : public wxDialog {
94  DECLARE_DYNAMIC_CLASS(PINCreateDialog)
95  DECLARE_EVENT_TABLE()
96 
97 public:
99 
100  PINCreateDialog(wxWindow* parent, wxWindowID id, const wxString& caption,
101  const wxString& hint, const wxPoint& pos, const wxSize& size,
102  long style);
103  ~PINCreateDialog();
104 
105  static RestServerDlgCtx GetDlgCtx();
106 
107 
108  wxDialog* Initiate(const std::string& msg, const std::string& text1);
109  void DeInit();
110 
111  bool Create(wxWindow* parent, wxWindowID id = SYMBOL_STG_IDNAME,
112  const wxString& caption = SYMBOL_STG_TITLE,
113  const wxString& hint = SYMBOL_STG_TITLE,
114  const wxPoint& pos = SYMBOL_STG_POSITION,
115  const wxSize& size = SYMBOL_STG_SIZE,
116  long style = SYMBOL_STG_STYLE);
117  void SetMessage(const wxString &message);
118  void SetText1Message(const wxString &message);
119 
120  wxString GetText1Value(){ return m_pText1->GetValue(); }
121 
122 private:
123  void CreateControls(const wxString& hint);
124 
125  void OnCancelClick(wxCommandEvent& event);
126  void OnOKClick(wxCommandEvent& event);
127 
128  wxButton* m_CancelButton;
129  wxButton* m_OKButton;
130  wxStaticText* premtext;
131  wxTextCtrl *m_pText1;
132  wxString m_checkbox1_msg;
133 };
134 
135 #endif
"Accept Object" Dialog Definition
Callbacks for handling dialogs and RouteManager updates.
Definition: rest_server.h:95