OpenCPN Partial API docs
Loading...
Searching...
No Matches
send_to_peer_dlg.h
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2010 by David S. Register *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, see <https://www.gnu.org/licenses/>. *
16 **************************************************************************/
17
24#ifndef SENDTOPEERDLG_H_
25#define SENDTOPEERDLG_H_
26
27#include <vector>
28
29#include <wx/wxprec.h>
30#ifndef WX_PRECOMP
31#include <wx/wx.h>
32#endif // precompiled headers
33
34#include <wx/button.h>
35#include <wx/checkbox.h>
36#include <wx/combobox.h>
37#include <wx/dialog.h>
38#include <wx/event.h>
39#include <wx/gauge.h>
40#include <wx/gdicmn.h>
41#include <wx/stattext.h>
42#include <wx/string.h>
43#include <wx/timer.h>
44#include <wx/window.h>
45
46#include "model/route.h"
47#include "model/route_point.h"
48#include "model/track.h"
49
50#include "observable_evtvar.h"
51
52// Constants for SendToPeer... Dialog
53#define ID_STPDIALOG 10006
54#define SYMBOL_STP_STYLE \
55 wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCLOSE_BOX | \
56 wxFRAME_FLOAT_ON_PARENT
57#define SYMBOL_STP_TITLE _("Send to Peer")
58#define SYMBOL_STP_IDNAME ID_STPDIALOG
59#define SYMBOL_STP_SIZE wxSize(500, 500)
60#define SYMBOL_STP_POSITION wxDefaultPosition
61
62enum { ID_STP_CANCEL = 10000, ID_STP_OK, ID_STP_CHOICE_PEER, ID_STP_SCAN };
63
70class SendToPeerDlg : public wxDialog {
71 DECLARE_EVENT_TABLE()
72
73public:
76
77 bool Create(wxWindow* parent, wxWindowID id = SYMBOL_STP_IDNAME,
78 const wxString& caption = SYMBOL_STP_TITLE,
79 const wxString& hint = SYMBOL_STP_TITLE,
80 const wxPoint& pos = SYMBOL_STP_POSITION,
81 const wxSize& size = SYMBOL_STP_SIZE,
82 long style = SYMBOL_STP_STYLE);
83 void SetRoute(Route* pRoute) { m_RouteList.push_back(pRoute); }
84 void SetWaypoint(RoutePoint* pRoutePoint) {
85 m_RoutePointList.push_back(pRoutePoint);
86 }
87 void SetTrack(Track* pTrack) { m_TrackList.push_back(pTrack); }
88 void SetMessage(wxString message);
89 void SetScanOnCreate(bool s) { m_bScanOnCreate = s; }
90 void SetScanTime(int t) { m_scanTime = t * 2; }
91
92private:
93 void CreateControls([[maybe_unused]] const wxString& hint);
94
95 void OnCancelClick(wxCommandEvent& event);
96 void OnSendClick([[maybe_unused]] wxCommandEvent& event);
97 void OnScanClick(wxCommandEvent& event);
98 void OnTimerAutoscan(wxTimerEvent& event);
99 void OnTimerScanTick(wxTimerEvent& event);
100 void DoScan();
101 bool EnableActivateChkbox();
102
103 std::vector<Route*> m_RouteList;
104 std::vector<RoutePoint*> m_RoutePointList;
105 std::vector<Track*> m_TrackList;
106 wxComboBox* m_PeerListBox;
107 wxGauge* m_pgauge;
108 wxButton* m_CancelButton;
109 wxButton* m_SendButton;
110 wxStaticText* premtext;
111 wxButton* m_RescanButton;
112 wxCheckBox* m_activate_chkbox;
113 EventVar progress;
114 ObsListener progress_listener;
115 std::string m_ownipAddr;
116
117 wxTimer m_autoScanTimer;
118 wxTimer m_ScanTickTimer;
119 int m_tick;
120 int m_scanTime;
121 bool m_bScanOnCreate;
122};
123
124#endif // SENDTOPEERDLG_H_
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:257
Represents a waypoint or mark within the navigation system.
Definition route_point.h:71
Represents a navigational route in the navigation system.
Definition route.h:99
Dialog for sending navigation objects to peer devices.
Represents a track, which is a series of connected track points.
Definition track.h:117
A common variable shared between producer and consumer which supports Listen() and Notify().
Route abstraction.
Waypoint or mark abstraction.
Recorded track abstraction.