OpenCPN Partial API docs
Loading...
Searching...
No Matches
connection_edit.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2026 Alec Leamas *
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
23
24#ifndef COnn_EDIT_H
25#define COnn_EDIT_H
26
27#include <memory>
28#include <functional>
29
30#include <wx/panel.h>
31#include <wx/window.h>
32
33#include "model/conn_params.h"
34
37 std::function<void(std::unique_ptr<ConnectionParams>, bool editing)>;
38
40class AbstractConnectionEditDlg : public wxPanel {
41public:
47 virtual void SetParams(std::unique_ptr<ConnectionParams> params) = 0;
48
51
52 virtual void Scroll(int hscroll, int vscroll) {}
53
54 static AbstractConnectionEditDlg* Create(wxWindow* parent,
55 std::function<void()> on_cancel,
56 ConnEditCallback on_ok);
57
58protected:
59 explicit AbstractConnectionEditDlg(wxWindow* parent) : wxPanel(parent) {}
60};
61
62#endif // COnn_EDIT_H
Dialog editing existing or new connection parameters.
virtual ConnectionParams GetEditedParams()=0
Return edited parameters.
virtual void SetParams(std::unique_ptr< ConnectionParams > params)=0
Set parameters to use and reset dialog.
Connection data container close to a POD struct.
Definition conn_params.h:76
Connection parameters.
std::function< void(std::unique_ptr< ConnectionParams >, bool editing)> ConnEditCallback
Callback invoked when user clicks OK button in dialog.