OpenCPN Partial API docs
Loading...
Searching...
No Matches
SendToPeerDlg.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 __SENDTOPEERDLG_H__
26#define __SENDTOPEERDLG_H__
27
28#include <vector>
29
30#include <wx/wxprec.h>
31#ifndef WX_PRECOMP
32#include <wx/wx.h>
33#endif // precompiled headers
34
35#include <vector>
36
37#include <wx/button.h>
38#include <wx/checkbox.h>
39#include <wx/combobox.h>
40#include <wx/dialog.h>
41#include <wx/event.h>
42#include <wx/gauge.h>
43#include <wx/gdicmn.h>
44#include <wx/stattext.h>
45#include <wx/string.h>
46#include <wx/timer.h>
47#include <wx/window.h>
48
49#include "model/route.h"
50#include "model/route_point.h"
51#include "model/track.h"
52
53#include "observable_evtvar.h"
54
55// Constants for SendToPeer... Dialog
56#define ID_STPDIALOG 10006
57#define SYMBOL_STP_STYLE \
58 wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCLOSE_BOX | \
59 wxFRAME_FLOAT_ON_PARENT
60#define SYMBOL_STP_TITLE _("Send to Peer")
61#define SYMBOL_STP_IDNAME ID_STPDIALOG
62#define SYMBOL_STP_SIZE wxSize(500, 500)
63#define SYMBOL_STP_POSITION wxDefaultPosition
64
65enum { ID_STP_CANCEL = 10000, ID_STP_OK, ID_STP_CHOICE_PEER, ID_STP_SCAN };
66
73class SendToPeerDlg : public wxDialog {
74 DECLARE_EVENT_TABLE()
75
76public:
79
80 bool Create(wxWindow* parent, wxWindowID id = SYMBOL_STP_IDNAME,
81 const wxString& caption = SYMBOL_STP_TITLE,
82 const wxString& hint = SYMBOL_STP_TITLE,
83 const wxPoint& pos = SYMBOL_STP_POSITION,
84 const wxSize& size = SYMBOL_STP_SIZE,
85 long style = SYMBOL_STP_STYLE);
86 void SetRoute(Route* pRoute) { m_RouteList.push_back(pRoute); }
87 void SetWaypoint(RoutePoint* pRoutePoint) {
88 m_RoutePointList.push_back(pRoutePoint);
89 }
90 void SetTrack(Track* pTrack) { m_TrackList.push_back(pTrack); }
91 void SetMessage(wxString message);
92 void SetScanOnCreate(bool s) { m_bScanOnCreate = s; }
93 void SetScanTime(int t) { m_scanTime = t * 2; }
94
95private:
96 void CreateControls([[maybe_unused]] const wxString& hint);
97
98 void OnCancelClick(wxCommandEvent& event);
99 void OnSendClick([[maybe_unused]] wxCommandEvent& event);
100 void OnScanClick(wxCommandEvent& event);
101 void OnTimerAutoscan(wxTimerEvent& event);
102 void OnTimerScanTick(wxTimerEvent& event);
103 void DoScan();
104 bool EnableActivateChkbox();
105
106 std::vector<Route*> m_RouteList;
107 std::vector<RoutePoint*> m_RoutePointList;
108 std::vector<Track*> m_TrackList;
109 wxComboBox* m_PeerListBox;
110 wxGauge* m_pgauge;
111 wxButton* m_CancelButton;
112 wxButton* m_SendButton;
113 wxStaticText* premtext;
114 wxButton* m_RescanButton;
115 wxCheckBox* m_activate_chkbox;
116 EventVar progress;
117 ObsListener progress_listener;
118 std::string m_ownipAddr;
119
120 wxTimer m_autoScanTimer;
121 wxTimer m_ScanTickTimer;
122 int m_tick;
123 int m_scanTime;
124 bool m_bScanOnCreate;
125};
126
127#endif
Generic event handling between MVC Model and Controller based on a shared EventVar variable.
Define an action to be performed when a KeyProvider is notified.
Definition observable.h:228
Definition route.h:75
Dialog for sending navigation objects to peer devices.
Represents a track, which is a series of connected track points.
Definition track.h:78